From 7547e9e0e1ea9a69a29b0193554b31011cfde85d Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Fri, 16 Feb 2024 16:36:27 +0000 Subject: [PATCH] build --- dist/xrfragment.aframe.all.js | 1918 +- dist/xrfragment.aframe.js | 1918 +- dist/xrfragment.js | 848 +- dist/xrfragment.lua | 1312 +- dist/xrfragment.module.js | 42954 +----------------------------- dist/xrfragment.py | 980 +- dist/xrfragment.three.js | 1868 +- dist/xrfragment.three.module.js | 1868 +- 8 files changed, 10233 insertions(+), 43433 deletions(-) diff --git a/dist/xrfragment.aframe.all.js b/dist/xrfragment.aframe.all.js index b925f27..f2fa0af 100644 --- a/dist/xrfragment.aframe.all.js +++ b/dist/xrfragment.aframe.all.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 31 06:46:04 PM UTC 2024 + * v0.5.1 generated at Fri Feb 16 04:36:12 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -8,6 +8,13 @@ //# sourceMappingURL=aframe-blink-controls.min.js.mapvar $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -21,6 +28,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -60,6 +87,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -72,6 +118,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -118,6 +179,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -151,6 +216,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -164,6 +278,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -181,6 +876,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -365,43 +1088,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -424,8 +1154,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -443,7 +1177,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -476,23 +1225,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -505,6 +1269,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -512,19 +1277,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -537,8 +1314,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -546,12 +1324,16 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; // the core project uses #vanillajs #proxies #clean #noframework var $ = typeof $ != 'undefined' ? $ : (s) => document.querySelector(s) // respect jquery @@ -569,7 +1351,14 @@ var xrf = {} xrf.init = function(opts){ opts = opts || {} - xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + + xrf.debug = document.location.hostname.match(/^(localhost|[0-9])/) ? 0 : false + if( !xrf.debug ){ + console.log("add #debug=[0-9] to URL to see XR Fragment debuglog") + xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + } + if( xrf.debug != undefined ) xrf.stats() + xrf.Parser.debug = xrf.debug xrf.detectCameraRig(opts) for ( let i in opts ) xrf[i] = opts[i] @@ -609,6 +1398,16 @@ xrf.roundrobin = (frag, store) => { return store.rr[label].index = 0 } +xrf.stats = () => { + // bookmarklet from https://github.com/zlgenuine/threejs_stats + (function(){ + for( let i = 0; i < 4; i++ ){ + var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.showPanel( i ); + stats.dom.style.marginTop = `${i*48}px`; document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script); + } + })() +} + xrf.hasTag = (tag,tags) => String(tags).match( new RegExp(`(^| )${tag}( |$)`,`g`) ) // map library functions to xrf @@ -640,14 +1439,15 @@ xrf.addEventListener = function(eventName, callback, opts) { this._listeners[eventName].push(callback); // sort this._listeners[eventName] = this._listeners[eventName].sort( (a,b) => a.opts.weight > b.opts.weight ) - return () => { + callback.unlisten = () => { this._listeners[eventName] = this._listeners[eventName].filter( (c) => c != callback ) } + return callback.unlisten }; xrf.emit = function(eventName, data){ if( typeof data != 'object' ) throw 'emit() requires passing objects' - if( xrf.debug && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ + if( xrf.debug && xrf.debug > 1 && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ let label = String(`xrf.emit('${eventName}')`).padEnd(35," "); label += data.mesh && data.mesh.name ? '#'+data.mesh.name : '' console.groupCollapsed(label) @@ -691,9 +1491,10 @@ xrf.emit.promise = function(e, opts){ } xrf.addEventListener('reset', () => { -// *TODO* do this nicely -// xrf._listeners['renderPost'] = [] -// xrf._listeners['render'] = [] + let events = ['renderPost'] + events.map( (e) => { + if( xrf._listeners[e] ) xrf._listeners[e].map( (r) => r.unlisten && r.unlisten() ) + }) }) /*! rasterizeHTML.js - v1.3.1 - 2023-07-06 * http://www.github.com/cburgmer/rasterizeHTML.js @@ -722,6 +1523,7 @@ XRWG.match = (str,types,level) => { return n }) str = str.toLowerCase() + .replace(/[!-\*]/g,'') // remove excludes and wildcards if( level <10 ) res = res.filter( (n) => n.key == str ) if( level >=10 ) res = res.filter( (n) => n.word == str || n.key == str ) if( level >30 ) res = res.filter( (n) => n.word.match(str) || n.key == str ) @@ -740,11 +1542,12 @@ XRWG.generate = (opts) => { if( !key || key.match(/(^#$|name)/) ) return let node = XRWG.get( XRWG.cleankey(key) ) if( node ){ + node.types.push(type) node.nodes.push(spatialNode) }else{ - node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] } + node = { word: XRWG.cleankey(key), key, nodes:[spatialNode], types:[] } if( spatialNode.userData[key] ) node.value = spatialNode.userData[key] - node[type] = true + node.types.push(type) xrf.emit('XRWGnode',node) XRWG.push( node ) } @@ -769,22 +1572,48 @@ XRWG.generate = (opts) => { XRWG = XRWG.reverse() // the cleankey/get functions e.g. will persist xrf.emit('XRWG',XRWG) } + +XRWG.deepApplyMatch = function(match,v,cb){ + match.map( (m) => { + for( let i in m.types ){ + let type = m.types[i] + let node = m.nodes[i] + if (type == 'name' || type == 'tag'){ + cb(match,v,node,type) + if( v.filter.q.deep ) node.traverse( (c) => cb(match,v,c,t) ) + } + } + }) +} + // the hashbus (QueryString eventBus) is mentioned in the spec // // it allows metadata-keys ('foo' e.g.) of 3D scene-nodes (.userData.foo e.g.) to // react by executing code -let pub = function( url, model, flags ){ // evaluate fragments in url +let pub = function( url, node_or_model, flags ){ // evaluate fragments in url if( !url ) return if( !url.match(/#/) ) url = `#${url}` - model = model || xrf.model let { THREE, camera } = xrf - let frag = xrf.URI.parse( url, flags ) - let opts = {frag, mesh:xrf.camera, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE, hashbus: xrf.hashbus } + let frag = xrf.URI.parse( url, flags ) + let fromNode = node_or_model != xrf.model + + let opts = { + frag, + mesh: fromNode ? node_or_model : xrf.camera, + model: xrf.model, + camera: xrf.camera, + scene: xrf.scene, + renderer: xrf.renderer, + THREE: xrf.THREE, + hashbus: xrf.hashbus + } xrf.emit('hashbus',opts) .then( () => { for ( let k in frag ){ - pub.fragment(k,opts) + let nodeAlias = fromNode && opts.mesh && opts.mesh.userData && opts.mesh.userData[k] && opts.mesh.userData[k][0] == '#' + if( nodeAlias ) pub(opts.mesh.userData[k], opts.mesh) // evaluate node alias + else pub.fragment(k,opts) } }) return frag @@ -807,7 +1636,8 @@ pub.mesh = (mesh,model) => { pub.fragment = (k, opts ) => { // evaluate one fragment let frag = opts.frag[k]; - if( !opts.skipXRWG && frag.is( xrf.XRF.PV_EXECUTE ) ) pub.XRWG(opts) + let isPVorMediaFrag = frag.is( xrf.XRF.PV_EXECUTE ) || frag.is( xrf.XRF.T_MEDIAFRAG) + if( !opts.skipXRWG && isPVorMediaFrag ) pub.XRWG(k,opts) // call native function (xrf/env.js e.g.), or pass it to user decorator xrf.emit(k,opts) @@ -818,50 +1648,53 @@ pub.fragment = (k, opts ) => { // evaluate one fragment }) } -pub.XRWG = (opts) => { +pub.XRWG = (word,opts) => { let {frag,scene,model,renderer} = opts // if this query was triggered by an src-value, lets filter it const isSRC = opts.embedded && opts.embedded.fragment == 'src' if( !isSRC ){ // spec : https://xrfragment.org/#src - for ( let i in frag ) { - let v = frag[i] - let id = v.string || v.fragment - if( id == '#' || !id ) return - let match = xrf.XRWG.match(id) - if( v.is( xrf.XRF.PV_EXECUTE ) ){ - scene.XRF_PV_ORIGIN = v.string - // evaluate aliases - match.map( (w) => { - if( w.key == `#${id}` ){ - if( w.value && w.value[0] == '#' ){ - // if value is alias, execute fragment value - xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) - } + let triggeredByMesh = opts.model != opts.mesh + + let v = frag[word] + let id = v.is( xrf.XRF.T_DYNAMICKEY ) ? word : v.string || word + + if( id == '#' || !id ) return + let match = xrf.XRWG.match(id) + + if( !triggeredByMesh && (v.is( xrf.XRF.PV_EXECUTE ) || v.is( xrf.XRF.T_DYNAMIC)) && !v.is( xrf.XRF.T_DYNAMICKEYVALUE ) ){ + // evaluate global aliases or tag/objectnames + match.map( (w) => { + if( w.key == `#${id}` ){ + if( w.value && w.value[0] == '#' ){ + // if value is alias, execute fragment value + xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) } - }) - xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) - }else{ - xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) - } + } + }) + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) + }else if( v.string ){ + // evaluate global aliases + xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) + }else{ + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) } } } xrf.hashbus = { pub } -xrf.frag = {} +xrf.frag = {dynamic:{}} xrf.model = {} xrf.mixers = [] xrf.init = ((init) => function(opts){ - console.log("add #debug to URL to see XR Fragment debuglog") let scene = new opts.THREE.Group() opts.scene.add(scene) opts.scene = scene init(opts) - if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) + //if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) xrf.patchRenderer(opts) xrf.navigator.init() @@ -878,7 +1711,7 @@ xrf.patchRenderer = function(opts){ xrf.clock = new xrf.THREE.Clock() renderer.render = ((render) => function(scene,camera){ // update clock - let time = xrf.clock.getDelta() + let time = xrf.clock.delta = xrf.clock.getDelta() xrf.emit('render',{scene,camera,time,render}) // allow fragments to do something at renderframe render(scene,camera) xrf.emit('renderPost',{scene,camera,time,render,renderer}) // allow fragments to do something after renderframe @@ -886,21 +1719,6 @@ xrf.patchRenderer = function(opts){ } -xrf.patchLoader = function(loader){ - if( loader.prototype.load.xrf_patched ) return // prevent patching aliased loaders twice - loader.prototype.load = ((load) => function(url, onLoad, onProgress, onError){ - load.call( this, - url, - (model) => { - onLoad(model); - xrf.parseModel(model,url) - }, - onProgress, - onError) - })(loader.prototype.load) - loader.prototype.load.xrf_patched = true -} - xrf.getFile = (url) => url.split("/").pop().replace(/#.*/,'') // parseModel event is essential for src.js to hook into embedded loaded models @@ -915,9 +1733,9 @@ xrf.parseModel = function(model,url){ xrf.getLastModel = () => xrf.model.last xrf.reset = () => { - // remove mixers - xrf.mixers.map( (m) => m.stop()) // stop animations *TODO* move to t.js - xrf.mixers = [] + + // allow others to reset certain events + xrf.emit('reset',{}) const disposeObject = (obj) => { if (obj.children.length > 0) obj.children.forEach((child) => disposeObject(child)); @@ -931,17 +1749,11 @@ xrf.reset = () => { return true }; let nodes = [] - xrf.scene.traverse( (n) => n.audio && (n.audio.playXRF({x:0})) && (n.audio.remove()) ) // *TODO* move to src/audio.js xrf.scene.traverse( (child) => child.isXRF && (nodes.push(child)) ) nodes.map( disposeObject ) // leave non-XRF objects intact xrf.interactive = xrf.interactiveGroup( xrf.THREE, xrf.renderer, xrf.camera) xrf.add( xrf.interactive ) xrf.layers = 0 - - // allow others to reset certain events - xrf.emit('reset',{}) - // set the player to position 0,0,0 - xrf.camera.position.set(0,0,0) } xrf.parseUrl = (url) => { @@ -1027,15 +1839,17 @@ xrf.navigator.to = (url,flags,loader,data) => { if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash ) xrf.model = model - if( !model.isXRF ) xrf.emit('parseModel',{model,url,file}) // loader.load() does this automatically (but not loader.parse) + if( !model.isXRF ) xrf.parseModel(model,url) // this marks the model as an XRF model if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) ) + + // spec: 1. generate the XRWG + xrf.XRWG.generate({model,scene:model.scene}) + // spec: 2. init metadata inside model for non-SRC data if( !model.isSRC ){ model.scene.traverse( (mesh) => xrf.hashbus.pub.mesh(mesh,model) ) } - // spec: 1. generate the XRWG - xrf.XRWG.generate({model,scene:model.scene}) // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) xrf.frag.defaultPredefinedViews({model,scene:model.scene}) @@ -1047,10 +1861,17 @@ xrf.navigator.to = (url,flags,loader,data) => { xrf.emit('navigateLoaded',{url,model}) resolve(model) } - + if( data ){ // file upload loader.parse(data, "", onLoad ) - }else loader.load(url, onLoad ) + }else{ + try{ + loader.load(url, onLoad ) + }catch(e){ + console.error(e) + xrf.emit('navigateError',{url}) + } + } }) }) }) @@ -1088,6 +1909,7 @@ xrf.navigator.setupNavigateFallbacks = () => { xrf.addEventListener('navigate', (opts) => { let {url} = opts let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + // handle http links if( url.match(/^http/) && !xrf.loaders[ext] ){ let inIframe @@ -1172,6 +1994,11 @@ xrf.frag.href = function(v, opts){ let click = mesh.userData.XRF.href.exec = (e) => { + if( !mesh.material.visible ) return + + // bubble up! + mesh.traverseAncestors( (n) => n.userData && n.userData.href && n.dispatchEvent({type:e.type,data:{}}) ) + let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}` xrf .emit('href',{click:true,mesh,xrf:v}) // let all listeners agree @@ -1182,24 +2009,21 @@ xrf.frag.href = function(v, opts){ const hasPos = isLocal && v.string.match(/pos=/) const flags = isLocal ? xrf.XRF.PV_OVERRIDE : undefined - let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) - // always commit current location in case of teleport (keep a trail of last positions before we navigate) - //if( isLocal && !hasPos ){ - // xrf.hashbus.pub( v.string, xrf.model ) // publish to hashbus - //}else{ - //if( !e.nocommit && !document.location.hash.match(lastPos) ) xrf.navigator.updateHash(`#${lastPos}`) - xrf.navigator.to(v.string) // let's surf - //} + //let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) + if( v.xrfScheme ){ + xrf.hashbus.pub(v.string) + } else xrf.navigator.to(v.string) // let's surf }) .catch( console.error ) } let selected = mesh.userData.XRF.href.selected = (state) => () => { if( mesh.selected == state ) return // nothing changed + xrf.interactive.objects.map( (o) => { let newState = o.name == mesh.name ? state : false if( o.material ){ - if( o.material.uniforms ) o.material.uniforms.selected.value = newState + if( o.material.uniforms && o.material.uniforms.selected ) o.material.uniforms.selected.value = newState //if( o.material.emissive ) o.material.emissive.r = o.material.emissive.g = o.material.emissive.b = newState ? 2.0 : 1.0 if( o.material.emissive ){ if( !o.material.emissive.original ) o.material.emissive.original = o.material.emissive.clone() @@ -1232,6 +2056,47 @@ xrf.frag.href = function(v, opts){ }, 0, mesh ) } +xrf.addEventListener('audioInited', function(opts){ + let {THREE,listener} = opts + opts.audio = opts.audio || {} + opts.audio.click = opts.audio.click || '/example/assets/audio/click.wav' + opts.audio.hover = opts.audio.hover || '/example/assets/audio/hover.wav' + opts.audio.teleport = opts.audio.teleport || '/example/assets/audio/teleport.wav' + + let audio = xrf.frag.href.audio = {} + + actions = ['click','hover','teleport'] + actions.map( (action) => { + const audioLoader = new THREE.AudioLoader(); + audio[action] = new THREE.Audio( xrf.camera.listener ) + audioLoader.load( opts.audio[action], function( buffer ) { + audio[action].setBuffer( buffer ); + }) + }); + + xrf.addEventListener('href', (opts) => { + let v = opts.xrf + if( opts.selected ){ + xrf.frag.href.audio.hover.stop() + xrf.frag.href.audio.hover.play() + return + } + if( opts.click ){ + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.click.play() + return + } + }) + + xrf.addEventListener('navigateLoading', (e) => { + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.teleport.stop() + xrf.frag.href.audio.teleport.play() + }) + + +}) + /** * > above solutions were abducted from [[this|https://i.imgur.com/E3En0gJ.png]] and [[this|https://i.imgur.com/lpnTz3A.png]] survey result * @@ -1243,6 +2108,33 @@ xrf.frag.href = function(v, opts){ * * > capture of aframe/sandbox */ +// this is called by navigator.js rather than by a URL e.g. + +xrf.frag.defaultPredefinedViews = (opts) => { + let {scene,model} = opts; + scene.traverse( (n) => { + if( n.userData && n.userData['#'] ){ + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + } + }) +} +xrf.frag.loop = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("loop",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + // update loop + mixer.loop.enabled = v.loop + + }) + +} xrf.frag.pos = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1262,13 +2154,20 @@ xrf.frag.pos = function(v, opts){ camera.position.z = pos.z } + if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) + xrf.frag.pos.last = pos // remember camera.updateMatrixWorld() } + +xrf.addEventListener('reset', (opts) => { + // set the player to position 0,0,0 + xrf.camera.position.set(0,0,0) +}) xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts - console.log(" └ setting camera rotation to "+v.string) + if( xrf.debug ) console.log("#rot.js: setting camera rotation to "+v.string) if( !model.isSRC ){ camera.rotation.set( v.x * Math.PI / 180, @@ -1286,21 +2185,52 @@ xrf.frag.rot = function(v, opts){ ) } } +xrf.frag.s = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("s",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + mixer.s = v + + // update speed + mixer.timeScale = v.x || 1.0 + mixer.loop.speed = v.x || 1.0 + mixer.loop.speedAbs = Math.abs( v.x ) + + }) + +} // *TODO* use webgl instancing xrf.frag.src = function(v, opts){ opts.embedded = v // indicate embedded XR fragment let { mesh, model, camera, scene, renderer, THREE, hashbus, frag} = opts - let url = v.string - let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) - opts.isLocal = v.string[0] == '#' + let url = xrf.frag.src.expandURI( mesh, v.string ) + let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) + opts.isLocal = v.string[0] == '#' opts.isPortal = xrf.frag.src.renderAsPortal(mesh) - opts.isSRC = true + opts.isSRC = true + + if(xrf.debug) console.log(`src.js: instancing ${opts.isLocal?'local':'remote'} object ${url}`) if( opts.isLocal ){ - xrf.frag.src.localSRC(url,srcFrag,opts) // local + xrf.frag.src.localSRC(url,srcFrag,opts) // local }else xrf.frag.src.externalSRC(url,srcFrag,opts) // external file + + xrf.hashbus.pub( url.replace(/.*#/,''), mesh) // eval src-url fragments +} + +xrf.frag.src.expandURI = function(mesh,uri){ + if( uri ) mesh.userData.srcTemplate = uri + mesh.userData.src = xrf.URI.template( mesh.userData.srcTemplate, xrf.URI.vars.__object ) + return mesh.userData.src } xrf.frag.src.addModel = (model,url,frag,opts) => { @@ -1310,7 +2240,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { if( mesh.material && mesh.userData.src ) mesh.material.visible = false // hide placeholder object //enableSourcePortation(scene) - if( xrf.frag.src.renderAsPortal(mesh) ){ + if( opts.isPortal ){ // only add remote objects, because // local scene-objects are already added to scene xrf.portalNonEuclidian({...opts,model,scene:model.scene}) @@ -1318,10 +2248,11 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { }else{ xrf.frag.src.scale( scene, opts, url ) // scale scene mesh.add(scene) - xrf.emit('parseModel', {...opts, scene, model}) } // flag everything isSRC & isXRF mesh.traverse( (n) => { n.isSRC = n.isXRF = n[ opts.isLocal ? 'isSRCLocal' : 'isSRCExternal' ] = true }) + + xrf.emit('parseModel', {...opts, isSRC:true, scene, model}) } xrf.frag.src.renderAsPortal = (mesh) => { @@ -1352,7 +2283,9 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { fetch(url, { method: 'HEAD' }) .then( (res) => { let mimetype = res.headers.get('Content-type') - if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(frag|fs|glsl)$/) ) mimetype = 'x-shader/x-fragment' + if( url.replace(/#.*/,'').match(/\.(vert|vs)$/) ) mimetype = 'x-shader/x-fragment' //if( url.match(/\.(fbx|stl|obj)$/) ) mimetype = opts = { ...opts, frag, mimetype } return xrf.frag.src.type[ mimetype ] ? xrf.frag.src.type[ mimetype ](url,opts) : xrf.frag.src.type.unknown(url,opts) @@ -1367,15 +2300,16 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { xrf.frag.src.localSRC = (url,frag,opts) => { let {model,mesh,scene} = opts - setTimeout( () => { + //setTimeout( (mesh,scene) => { if( mesh.material ) mesh.material = mesh.material.clone() // clone, so we can individually highlight meshes let _model = { animations: model.animations, - scene: scene.clone() // *TODO* opts.isPortal ? scene : scene.clone() + scene: scene.clone() + // scene: opts.isPortal ? scene : scene.clone() } _model.scenes = [_model.scene] xrf.frag.src.addModel(_model,url,frag, opts) // current file - },500 ) + //},1000,mesh,scene ) } // scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects @@ -1384,7 +2318,6 @@ xrf.frag.src.scale = function(scene, opts, url){ // remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection let cleanScene = scene.clone() - if( !cleanScene ) debugger let remove = [] const notVisible = (n) => !n.visible || (n.material && !n.material.visible) cleanScene.traverse( (n) => notVisible(n) && n.children.length == 0 && (remove.push(n)) ) @@ -1413,7 +2346,7 @@ xrf.frag.src.scale = function(scene, opts, url){ xrf.frag.src.filterScene = (scene,opts) => { let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts - scene = xrf.filter.scene({scene,frag,reparent:true}) // *TODO* ,copyScene: opts.isPortal}) + scene = xrf.filter.scene({scene,frag,reparent:true,copyScene: opts.isPortal}) if( !opts.isLocal ){ scene.traverse( (m) => { @@ -1439,23 +2372,33 @@ xrf.frag.src.type['unknown'] = function( url, opts ){ reject(`${url} mimetype '${opts.mimetype}' not found or supported (yet)`) }) } +// this ns the global #t mediafragment handler (which affects the 3D animation) + xrf.frag.t = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("t",v) + return + } + + // otherwise handle global 3D animations if( !model.mixer ) return if( !model.animations || model.animations[0] == undefined ){ console.warn('no animations found in model') return xrf.emit( v.x == 0 ? 'stop' : 'play',{isPlaying: v.x != 0 }) } - + xrf.mixers.map ( (mixer) => { mixer.t = v // update speed - mixer.timeScale = mixer.loop.speed = v.x - mixer.loop.speedAbs = Math.abs(v.x) + mixer.timeScale = mixer.loop.speed + mixer.loop.speedAbs = Math.abs( mixer.timeScale ) - if( v.y != undefined || v.z != undefined ) mixer.updateLoop( v ) + mixer.updateLoop( v ) // play animations mixer.play( v ) @@ -1472,7 +2415,7 @@ xrf.addEventListener('parseModel', (opts) => { let {model} = opts let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene) mixer.model = model - mixer.loop = {timeStart:0,timeStop:0} + mixer.loop = {timeStart:0,timeStop:0,speed:1.0} mixer.i = xrf.mixers.length mixer.actions = [] @@ -1482,28 +2425,8 @@ xrf.addEventListener('parseModel', (opts) => { mixer.actions.push( mixer.clipAction( anim, model.scene ) ) }) - - mixer.checkZombies = (animations) => { - if( mixer.zombieCheck ) return // fire only once - animations.map( (anim) => { - // collect zombie animations and warn user - let zombies = anim.tracks.map( (t) => { - let name = t.name.replace(/\..*/,'') - let obj = model.scene.getObjectByName(name) - return !model.scene.getObjectByName(name) ? {anim:anim.name,obj:name} : undefined - }) - if( zombies.length > 0 && mixer.i == 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) - zombies - .filter( (z) => z ) // filter out undefined - .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) - console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) - } - }) - mixer.zombieCheck = true - } - mixer.play = (t) => { - mixer.isPlaying = t.x != 0 + mixer.isPlaying = t.x !== undefined && t.x != t.y mixer.updateLoop(t) xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying}) } @@ -1513,35 +2436,37 @@ xrf.addEventListener('parseModel', (opts) => { } mixer.updateLoop = (t) => { - mixer.loop.timeStart = t.y != undefined ? t.y : mixer.loop.timeStart - mixer.loop.timeStop = t.z != undefined ? t.z : mixer.loop.timeStop + if( t ){ + mixer.loop.timeStart = t.x != undefined ? t.x : mixer.loop.timeStart + mixer.loop.timeStop = t.y != undefined ? t.y : mixer.duration + } mixer.actions.map( (action) => { if( mixer.loop.timeStart != undefined ){ action.time = mixer.loop.timeStart action.setLoop( xrf.THREE.LoopOnce, ) action.timeScale = mixer.timeScale action.enabled = true - if( t.x != 0 ){ - action.play() - } + if( t && t.x != undefined ) action.play() } }) mixer.setTime(mixer.loop.timeStart) mixer.time = Math.abs( mixer.loop.timeStart ) mixer.update(0) - mixer.checkZombies( model.animations) } - // update loop when needed + // monkeypatch: update loop when needed if( !mixer.update.patched ){ + let update = mixer.update mixer.update = function(time){ mixer.time = Math.abs(mixer.time) if( time == 0 ) return update.call(this,time) // loop jump - if( mixer.loop.speed > 0.0 && (mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop) ){ - setTimeout( (time,anims) => mixer.updateLoop(time), 0, mixer.loop.timeStart ) // prevent recursion + if( mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop ){ + if( mixer.loop.enabled ){ + setTimeout( () => mixer.updateLoop(), 0 ) // prevent recursion + }else mixer.stop() } return update.call( this, time ) } @@ -1576,7 +2501,7 @@ xrf.addEventListener('render', (opts) => { xrf.mixers.map( (m) => m.isPlaying && (m.update( time )) ) // update active camera in case selected by dynamicKey in URI - if( xrf.model.camera && model.mixer.isPlaying ){ + if( xrf.model.camera && xrf.model.camera.length && model.mixer.isPlaying ){ let cam = xrf.camera.getCam() // cam.fov = model.cameras[0].fov (why is blender not exporting radians?) @@ -1593,22 +2518,95 @@ xrf.addEventListener('render', (opts) => { } }) -xrf.addEventListener('dynamicKey', (opts) => { - // select active camera if any - let {id,match,v} = opts - match.map( (w) => { - w.nodes.map( (node) => { - if( node.isCamera ){ - console.log("setting camera to "+node.name) - xrf.model.camera = node - } - }) - }) +// remove mixers and stop mixers when loading another scene +xrf.addEventListener('reset', (opts) => { + xrf.mixers.map( (m) => m.stop()) + xrf.mixers = [] }) +xrf.frag.uv = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + if( !mesh.geometry ) return // nothing to do here + if( v.floats.length != 4 ) return console.warn('xrfragment.js: got less than 4 uv values ') + + xrf.frag.uv.init(mesh) + mesh.uv.u = v.floats[0] + mesh.uv.v = v.floats[1] + mesh.uv.uspeed = v.floats[2] || 1.0 + mesh.uv.vspeed = v.floats[3] || 1.0 + mesh.uv.ushift = v.shift[0] || v.floats[0] < 0 // negative u is always relative + mesh.uv.vshift = v.shift[1] || v.floats[1] < 0 // negative v is always relative + mesh.uv.uloop = v.shift[2] || false + mesh.uv.vloop = v.shift[3] || false + + mesh.onBeforeRender = xrf.frag.uv.scroll +} + +xrf.frag.uv.init = function(mesh){ + if( !mesh.uv ) mesh.uv = {u:0, v:0, uspeed:1, vspeed:1, uloop:false, vloop:false, uv:false} + + let uv = mesh.geometry.getAttribute("uv") + if( !uv.old ) uv.old = mesh.geometry.getAttribute("uv").clone() +} + +xrf.frag.uv.scroll = function(){ + + let diffU = 0.0 // distance to end-state (non-looping mode) + let diffV = 0.0 // distance to end-state (non-looping mode) + let uv = this.geometry.getAttribute("uv") + + // translate! + for( let i = 0; i < uv.count; i++ ){ + + if( this.uv.uspeed == 1.0 ) uv.setX(i, this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u ) + if( this.uv.vspeed == 1.0 ) uv.setY(i, this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v ) + + if( this.uv.uspeed != 1.0 || this.uv.vspeed != 1.0 ){ + let u = uv.getX(i) + let v = uv.getY(i) + let uTarget = this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u + let vTarget = this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v + + // scroll U + if( this.uv.uloop ){ + u += this.uv.uspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(u-uTarget) > 10.0 ) u = uv.old.getX(i) + //u = u > uTarget ? u + (this.uv.uspeed * -xrf.clock.delta) + // : u + (this.uv.uspeed * xrf.clock.delta) + //diffU += Math.abs( u - uTarget ) // are we done yet? (non-looping mode) + } + + // scroll V + if( this.uv.vloop ){ + v += this.uv.vspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(v-vTarget) > 10.0 ) v = uv.old.getY(i) + //v = v > vTarget ? v + (this.uv.vspeed * -xrf.clock.delta) + // : v + (this.uv.vspeed * xrf.clock.delta) + //diffV += Math.abs( v - vTarget ) + } + uv.setXY(i,u,v) + } + + } + uv.needsUpdate = true + + if( (!this.uv.uloop && diffU < 0.05) && + (!this.uv.vloop && diffV < 0.05) + ){ // stop animating if done + this.onBeforeRender = function(){} + } +} xrf.getCollisionMeshes = () => { let meshes = [] xrf.scene.traverse( (n) => { - if( !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ + if( n.type == 'Mesh' && !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ meshes.push(n) } }) @@ -1647,7 +2645,6 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ const tempMatrix = new Matrix4(); // Pointer Events - const element = renderer.domElement; function onPointerEvent( event ) { @@ -1677,7 +2674,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ }else{ if( object.selected ) { _event.type = 'mouseleave' - object.dispatchEvent(_event) + object.dispatchEvent( _event) } } @@ -1694,7 +2691,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ // WebXR Controller Events // TODO: Dispatch pointerevents too - const events = { + const eventsMapper = { 'move': 'mousemove', 'select': 'click', 'selectstart': 'mousedown', @@ -1714,12 +2711,14 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ if ( intersections.length > 0 ) { + console.log(object.name) + const intersection = intersections[ 0 ]; object = intersection.object; const uv = intersection.uv; - _event.type = events[ event.type ]; + _event.type = eventsMapper[ event.type ]; _event.data.set( uv.x, 1 - uv.y ); object.dispatchEvent( _event ); @@ -1756,18 +2755,119 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ return new interactive(renderer,camera) } -/* - * TODO: refactor/fix this (queries are being refactored to filters) - */ +xrf.optimize = (opts) => { + opts.animatedObjects = [] + xrf.optimize + .checkAnimations(opts) + .freezeUnAnimatedObjects(opts) + .disableShadows(opts) + .disableEmbeddedLights(opts) + .removeDuplicateLights() +} + + // check unused animations +xrf.optimize.checkAnimations = (opts) => { + if( xrf.debug ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + model.animations.map( (anim) => { + // collect zombie animations and warn user + let zombies = anim.tracks.map( (t) => { + let name = t.name.replace(/\..*/,'') + let obj = model.scene.getObjectByName(name) + if( !model.scene.getObjectByName(name) ) return {anim:anim.name,obj:name} + else opts.animatedObjects.push(name) + return undefined + }) + if( zombies.length > 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) + zombies + .filter( (z) => z ) // filter out undefined + .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) + console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) + } + }) + return xrf.optimize +} + +xrf.optimize.freezeUnAnimatedObjects = (opts) => { + if( xrf.todo ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + let scene = model.scene + // increase performance by freezing all objects + scene.traverse( (n) => n.matrixAutoUpdate = false ) + // except animated objects and children + scene.traverse( (n) => { + if( ~opts.animatedObjects.indexOf(n.name) ){ + n.matrixAutoUpdate = true + n.traverse( (m) => m.matrixAutoUpdate = true ) + } + }) + return xrf.optimize +} + +xrf.optimize.disableShadows = (opts) => { + opts.model.scene.traverse( (n) => { + if( n.castShadow !== undefined ) n.castShadow = false + }) + return xrf.optimize +} + +xrf.optimize.disableEmbeddedLights = (opts) => { + if( !opts.isSRC ) return xrf.optimize + // remove lights from SRC's + opts.model.scene.traverse( (n) => { + if( n.type.match(/light/i) ) n.remove() + }) + return xrf.optimize +} + +xrf.optimize.removeDuplicateLights = () => { + // local/extern src's can cause duplicate lights which tax performance + let lights = {} + xrf.scene.traverse( (n) => { + if( n.type.match(/light/i) ){ + if( !lights[n.name] ) lights[n.name] = true + else n.remove() + } + }) + return xrf.optimize +} + +xrf.addEventListener('parseModel', (opts) => { + xrf.optimize(opts) +}) +// switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { + // select active camera if any + let {id,match,v} = opts + match.map( (w) => { + w.nodes.map( (node) => { + if( node.isCamera ){ + console.log("switching camera to cam: "+node.name) + xrf.model.camera = node + } + }) + }) +}) + +const doFilter = (opts) => { let {scene,id,match,v} = opts if( v.filter ){ let frags = {} frags[ v.filter.key ] = v xrf.filter.scene({frag:frags,scene}) } +} + +xrf.addEventListener('dynamicKey', doFilter ) +xrf.addEventListener('dynamicKeyValue', (opts) => { + if( xrf.debug ) console.log("*TODO* filter integers only") + // doFilter(opts) }) // spec: https://xrfragment.org/#filters @@ -1883,48 +2983,116 @@ xrf.filter.process = function(frag,scene,opts){ return scene } -xrf.frag.defaultPredefinedViews = (opts) => { - let {scene,model} = opts; - scene.traverse( (n) => { - if( n.userData && n.userData['#'] ){ - let frag = xrf.URI.parse( n.userData['#'] ) - if( !n.parent && document.location.hash.length < 2){ - xrf.navigator.to( n.userData['#'] ) // evaluate static XR fragments - }else{ - xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments - } - } +xrf.frag.dynamic.material = function(v,opts){ + let {match} = opts + + // update material in case of [*]= + let material + xrf.scene.traverse( (n) => n.material && (n.material.name == v.string) && (material = n.material) ) + if( !material && !v.reset ) return // nothing to do + + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, material, v.reset ) }) } -xrf.addEventListener('dynamicKeyValue', (opts) => { - let {scene,match,v} = opts - let objname = v.fragment - let autoscroll = v.z > 0 || v.w > 0 -return // DISABLED - scene.traverse( (mesh) => { - if( mesh.name == objname ){ - if( !mesh.geometry ) return console.warn(`mesh '${objname}' has no uvcoordinates to offset`) - let uv = mesh.geometry.getAttribute("uv") - if( !uv.old ) uv.old = uv.clone() - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.old.getX(i) + v.x, uv.old.getY(i) + v.y ) +xrf.frag.dynamic.material.set = function(mesh,material,reset){ + if( !mesh.materialOriginal ) mesh.materialOriginal = mesh.material + let visible = mesh.material.visible //remember + if( reset ){ + mesh.material = mesh.materialOriginal + }else mesh.material = material + mesh.material.visible = visible +} + +// for reset calls like href: xrf://!myobject e.g. +xrf.addEventListener('dynamicKey', (opts) => { + + let {v,match} = opts + + if( v.reset ){ + xrf.XRWG.deepApplyMatch(match,v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, null, v.reset ) + }) + } + +}) + +// this holds all the URI Template variables (https://www.rfc-editor.org/rfc/rfc6570) + +xrf.addEventListener('parseModel', (opts) => { + let {model,url,file} = opts + if( model.isSRC || opts.isSRC ) return // ignore SRC models + + xrf.URI.vars = new Proxy({},{ + set(me,k,v){ + if( k.match(/^(name)$/) ) return + me[k] = v + }, + get(me,k ){ + if( k == '__object' ){ + let obj = {} + for( let i in xrf.URI.vars ) obj[i] = xrf.URI.vars[i]() + return obj } + return me[k] + }, + }) - if( autoscroll ){ - if( mesh.removeUVListener ) mesh.removeUVListener() - mesh.removeUVListener = xrf.addEventListener('render', (opts) => { - let {time} = opts - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.getX(i) + v.z * time, uv.getY(i) + v.w * time) + model.scene.traverse( (n) => { + const variables = /{([a-zA-Z0-9-]+)}/g + + if( n.userData ){ + for( let i in n.userData ){ + if( i[0] == '#' || i.match(/^(href|tag)$/) ) continue // ignore XR Fragment aliases + if( i == 'src' ){ + // lets declare empty variables found in src-values ('https://foo.com/video.mp4#{somevar}') e.g. + if( n.userData[i].match(variables) ){ + let vars = [].concat( n.userData[i].match(variables) ) + const strip = (v) => v.replace(/[{}]/g,'') + vars.map( (v) => xrf.URI.vars[ strip(v) ] = () => '' ) } - uv.needsUpdate = true - }) + }else xrf.URI.vars[i] = () => n.userData[i] // declare variables with values } - - uv.needsUpdate = true } }) + +}) + + +xrf.addEventListener('dynamicKeyValue', (opts) => { + // select active camera if any + let {id,match,v} = opts + + if( !v.is( xrf.XRF.CUSTOMFRAG) ) return // only process custom frags from here + if( v.string.match(/(<|>)/) ) return // ignore filter values + + if( match.length > 0 ){ + xrf.frag.dynamic.material(v,opts) // check if fragment is an objectname + } + + if( !xrf.URI.vars[ v.string ] ) return console.error(`'${v.string}' metadata-key not found in scene`) + //if( xrf.URI.vars[ id ] && !match.length ) return console.error(`'${id}' object/tag/metadata-key not found in scene`) + + if( xrf.debug ) console.log(`URI.vars[${id}]='${v.string}'`) + + if( xrf.URI.vars[id] ){ + xrf.URI.vars[ id ] = xrf.URI.vars[ v.string ] // update var + xrf.scene.traverse( (n) => { + // re-expand src-values which use the updated URI Template var + if( n.userData && n.userData.src && n.userData.srcTemplate && n.userData.srcTemplate.match(`{${id}}`) ){ + let srcNewFragments = xrf.frag.src.expandURI( n ).replace(/.*#/,'') + console.log(`URI.vars[${id}] => updating ${n.name} => ${srcNewFragments}`) + let frag = xrf.hashbus.pub( srcNewFragments, n ) + } + }) + }else{ + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + console.log(v.string) + if( node.geometry ) xrf.hashbus.pub( xrf.URI.vars[ v.string ](), node) // apply fragment mesh(es) + }) + } + }) xrf.addEventListener('dynamicKey', (opts) => { let {scene,id,match,v} = opts @@ -2004,68 +3172,109 @@ let loadAudio = (mimetype) => function(url,opts){ let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) let frag = xrf.URI.parse( url ) - /* WebAudio: setup context via THREEjs */ - if( !camera.listener ){ - camera.listener = new THREE.AudioListener(); - // *FIXME* camera vs camerarig conflict - (camera.getCam ? camera.getCam() : camera).add( camera.listener ); - } - + xrf.init.audio() let isPositionalAudio = !(mesh.position.x == 0 && mesh.position.y == 0 && mesh.position.z == 0) const audioLoader = new THREE.AudioLoader(); let sound = isPositionalAudio ? new THREE.PositionalAudio( camera.listener) : new THREE.Audio( camera.listener ) - mesh.audio = {} + mesh.media = mesh.media || {} + mesh.media.audio = { set: (mediafragment,v) => mesh.media.audio[mediafragment] = v } audioLoader.load( url.replace(/#.*/,''), function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(false); - sound.setVolume(1.0); + sound.setVolume( 1.0 ) if( isPositionalAudio ){ sound.setRefDistance( mesh.scale.x); sound.setRolloffFactor(20.0) //sound.setDirectionalCone( 360, 360, 0.01 ); - } + }else sound.setVolume( mesh.scale.x ) - sound.playXRF = (t) => { - mesh.add(sound) + mesh.add(sound) + + sound.set = (mediafragment,v) => { try{ - if( sound.isPlaying && t.y != undefined ) sound.stop() - if( sound.isPlaying && t.y == undefined ) sound.pause() + sound[mediafragment] = v + + if( mediafragment == 't'){ + + if( sound.isPlaying && v.y != undefined && v.x == v.y ){ + sound.offset = v.x * buffer.sampleRate ; + sound.pause() + return + }else sound.stop() - let hardcodedLoop = frag.t != undefined - t = hardcodedLoop ? { ...frag.t, x: t.x} : t // override with hardcoded metadata except playstate (x) - if( t && t.x != 0 ){ - // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well - t.x = Math.abs(t.x) - sound.setPlaybackRate( t.x ) // WebAudio does not support negative playback - // setting loop - if( t.z ) sound.setLoop( true ) // apply embedded audio/video samplerate/fps or global mixer fps - let loopStart = hardcodedLoop ? t.y : t.y * buffer.sampleRate; - let loopEnd = hardcodedLoop ? t.z : t.z * buffer.sampleRate; - let timeStart = loopStart > 0 ? loopStart : (t.y == undefined ? xrf.model.mixer.time : t.y) + sound.setLoopStart(v.x); + sound.setLoopEnd(v.y || buffer.duration); + sound.offset = v.x; + sound.play() + } - if( t.z > 0 ) sound.setLoopEnd( loopEnd ) - if( t.y != undefined ){ - sound.setLoopStart( loopStart ) - sound.offset = loopStart - } + if( mediafragment == 's'){ + // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well + sound.pause() + sound.setPlaybackRate( Math.abs(v.x) ) // WebAudio does not support negative playback + sound.play() + } + + if( mediafragment == 'loop'){ + sound.pause() + sound.setLoop( v.loop ) sound.play() } }catch(e){ console.warn(e) } } - // autoplay if user already requested play - let autoplay = mesh.audio && mesh.audio.autoplay - mesh.audio = sound - if( autoplay ) xrf.hashbus.pub(mesh.audio.autoplay) + let lazySet = {} + let mediaFragments = ['t','loop','s'] + mediaFragments.map( (f) => mesh.media.audio[f] && (lazySet[f] = mesh.media.audio[f]) ) + mesh.media.audio = sound + + // autoplay if user already requested play (before the sound was loaded) + mediaFragments.map( (f) => { + if( lazySet[f] ) mesh.media.audio.set(f, lazySet[f] ) + }) + }); + + // apply Media fragments from URL + (['t','loop','s']).map( (f) => { + if( frag[f] ){ + mesh.media.audio.set( f, frag[f] ) + } + }) + } +xrf.init.audio = (opts) => { + let camera = xrf.camera + /* WebAudio: setup context via THREEjs */ + if( !camera.listener ){ + camera.listener = new THREE.AudioListener(); + // *FIXME* camera vs camerarig conflict + (camera.getCam ? camera.getCam() : camera).add( camera.listener ); + xrf.emit('audioInited',{listener:camera.listener, ...opts}) + } +} +xrf.addEventListener('init', xrf.init.audio ) + +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => { + if( n.media && n.media.audio ){ + if( n.media.audio.stop ) n.media.audio.stop() + if( n.media.audio.remove ) n.media.audio.remove() + } + }) +}) + + + let audioMimeTypes = [ + 'audio/x-wav', 'audio/wav', 'audio/mpeg', 'audio/mp3', @@ -2074,16 +3283,99 @@ let audioMimeTypes = [ 'application/ogg' ] audioMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadAudio(mimetype) ) +/* + * mimetype: model/gltf+json + */ -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => { - if( !n.audio ) return - if( !n.audio.playXRF ) n.audio.autoplay = t - else n.audio.playXRF(t) +xrf.frag.src.type['fbx'] = function( url, opts ){ + return new Promise( async (resolve,reject) => { + let {mesh,src} = opts + let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + let loader + + //let {THREE} = await import('https://unpkg.com/three@0.161.0/build/three.module.js') + //let { FBXLoader } = await import('three/addons/loaders/FBXLoader.js') + + //const Loader = xrf.loaders[ext] + //if( !Loader ) throw 'xrfragment: no loader passed to xrfragment for extension .'+ext + //if( !dir.match("://") ){ // force relative path + // dir = dir[0] == './' ? dir : `./${dir}` + // loader = new Loader().setPath( dir ) + //}else loader = new Loader() + + //loader.load(url, (model) => { + // model.isSRC = true + // resolve(model) + //}) }) -}) +} + +/* + * extensions: .frag/.fs/.vs/.vert + */ + +xrf.frag.src.type['x-shader/x-fragment'] = function(url,opts){ + let {mesh,THREE} = opts + + let isFragmentShader = /\.(fs|frag|glsl)$/ + let isVertexShader = /\.(vs|vert)$/ + + let shaderReqs = [] + let shaderCode = {} + let shader = { + fragment: { code: '', url: url.match( isFragmentShader ) ? url : '' }, + vertex: { code: '', url: url.match( isVertexShader ) ? url : '' } + } + + var onShaderLoaded = ((args) => (type, status, code) => { + shader[type].status = status + shader[type].code = code + if( shader.fragment.code && shader.vertex.code ){ + + let oldMaterial = mesh.material + mesh.material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2(1.0,1.0) } + }, + // basic shaders include following common vars/funcs: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/common.glsl.js + fragmentShader: shader.fragment.status == 200 ? shader.fragment.code : THREE.ShaderChunk.meshbasic_frag, + vertexShader: shader.vertex.status == 200 ? shader.vertex.code : THREE.ShaderChunk.meshbasic_vert, + + }); + + mesh.material.needsUpdate = true + mesh.needsUpdate = true + + mesh.onBeforeRender = () => { + if( !mesh.material || !mesh.material.uniforms ) return mesh.onBeforeRender = function(){} + mesh.material.uniforms.time.value = xrf.clock.elapsedTime + } + + } + + })({}) + + // sidecar-load vertex shader file + if( shader.fragment.url && !shader.vertex.url ){ + shader.vertex.url = shader.fragment.url.replace(/\.fs$/, '.vs') + .replace(/\.frag$/, '.vert') + } + + if( shader.fragment.url ){ + fetch(shader.fragment.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('fragment',res.status,code) ) ) + } + + if( shader.vertex.url ){ + fetch(shader.vertex.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('vertex',res.status,code) ) ) + } + +} + +xrf.frag.src.type['x-shader/x-vertex'] = xrf.frag.src.type['x-shader/x-fragment'] + /* * mimetype: model/gltf+json */ @@ -2155,6 +3447,14 @@ xrf.frag.src.type['image/png'] = function(url,opts){ mesh.material.map = texture mesh.material.needsUpdate = true mesh.needsUpdate = true + + //// *TODO* update clones in portals or dont clone scene of portals.. + //xrf.scene.traverse( (n) => { + // if( n.userData.src == mesh.userData.src && mesh.uuid != n.uuid ){ + // n.material = mesh.material + // n.material.needsUpdate = true + // } + //}) } let onLoad = (texture) => { @@ -2176,7 +3476,6 @@ xrf.frag.src.type['image/jpeg'] = xrf.frag.src.type['image/png'] xrf.portalNonEuclidian = function(opts){ let { frag, mesh, model, camera, scene, renderer} = opts - mesh.portal = { pos: mesh.position.clone(), posWorld: new xrf.THREE.Vector3(), @@ -2234,7 +3533,7 @@ xrf.portalNonEuclidian = function(opts){ mesh.portal.stencilObjects.children = stencilObjects xrf.portalNonEuclidian.stencilRef += 1 // each portal has unique stencil id - console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) + if( xrf.debug ) console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) return this } @@ -2247,6 +3546,9 @@ xrf.portalNonEuclidian = function(opts){ this.setupListeners = () => { + // below is a somewhat weird tapdance to render the portals **after** the scene + // is rendered (otherwise it messes up occlusion) + mesh.onAfterRender = function(renderer, scene, camera, geometry, material, group ){ mesh.portal.needUpdate = true } @@ -2266,7 +3568,7 @@ xrf.portalNonEuclidian = function(opts){ let cam = xrf.camera.getCam ? xrf.camera.getCam() : camera cam.getWorldPosition(cameraPosition) cam.getWorldDirection(cameraDirection) - if( cameraPosition.distanceTo(newPos) > 10.0 ) return // dont render far portals + if( cameraPosition.distanceTo(newPos) > 15.0 ) return // dont render far portals // init if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = true @@ -2375,7 +3677,9 @@ let loadVideo = (mimetype) => function(url,opts){ const THREE = xrf.THREE let frag = xrf.URI.parse( url ) - let video = mesh.video = document.createElement('video') + mesh.media = mesh.media || {} + + let video = mesh.media.video = document.createElement('video') video.setAttribute("crossOrigin","anonymous") video.setAttribute("playsinline",'') video.addEventListener('loadedmetadata', function(){ @@ -2385,36 +3689,48 @@ let loadVideo = (mimetype) => function(url,opts){ mat.map = texture mesh.material = mat // set range - //video.addEventListener('timeupdate', function timeupdate() { - // if (frag.t && video.currentTime < frag.t.y || video.currentTime >= frag.t.z ) { - // video.currentTime = frag.t.y - // } - //},false) + video.addEventListener('timeupdate', function timeupdate() { + if (video.t && video.t.y !== undefined && video.t.y > video.t.x && Math.abs(video.currentTime) >= video.t.y ){ + if( video.looping ) video.currentTime = video.t.x // speed means loop + else video.pause() + } + },false) }) video.src = url - video.playXRF = (t) => { - video.t = t - if( t.x == 0 ) video.pause() - else{ - video.playbackRate = Math.abs( t.x ) // html5 video does not support reverseplay :/ - video.play() + video.speed = 1.0 + video.looping = false + video.set = (mediafragment,v) => { + video[mediafragment] = v + + if( mediafragment == 't'){ + video.pause() + if( v.x !== undefined && v.x == v.y ) return // stop paused + else{ + video.currentTime = v.x + video.time = v.x + video.play() + } + } + if( mediafragment == 's' ){ + video.playbackRate = Math.abs( v.x ) // html5 video does not support reverseplay :/ + } + if( mediafragment == 'loop' ){ + video.looping = true } - if( t.y != undefined ) video.time = t.y } } +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => n.media && n.media.video && (n.media.video.pause()) && (n.media.video.remove()) ) +}) + let videoMimeTypes = [ 'video/ogg', 'video/mp4' ] videoMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadVideo(mimetype) ) - -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => n.video && (n.video.playXRF(t)) ) -}) window.AFRAME.registerComponent('xrf', { schema: { http: { type:'string'}, @@ -2454,7 +3770,7 @@ window.AFRAME.registerComponent('xrf', { } }) aScene.renderer.toneMapping = THREE.ACESFilmicToneMapping; - aScene.renderer.toneMappingExposure = 1.5; + aScene.renderer.toneMappingExposure = 1.25; if( !XRF.camera ) throw 'xrfragment: no camera detected, please declare ABOVE entities with xrf-attributes' // this is just for convenience (not part of spec): hide/show stuff based on VR/AR tags in 3D model @@ -2493,6 +3809,12 @@ window.AFRAME.registerComponent('xrf', { let com = blinkControls.components['blink-controls'] if( com ) com.update({collisionEntities:true}) else console.warn("xrfragments: blink-controls is not mounted, please run manually: $('[blink-controls]).components['blink-controls'].update({collisionEntities:true})") + + blinkControls.addEventListener('teleported', (e) => { + if( e.detail.newPosition.z < 0){ + console.warn('teleported to negative Z-value: https://github.com/jure/aframe-blink-controls/issues/30') + } + }) } // give headset users way to debug without a cumbersome usb-tapdance @@ -2501,6 +3823,9 @@ window.AFRAME.registerComponent('xrf', { } }) + xrf.addEventListener('navigateError', (opts) => { + AFRAME.fade.out() + }) xrf.addEventListener('navigateLoading', (opts) => { let p = opts.promise() @@ -2508,6 +3833,7 @@ window.AFRAME.registerComponent('xrf', { let isLocal = url.match(/^#/) let hasPos = url.match(/pos=/) let fastFadeMs = 200 + if( !AFRAME.fade ) return p.resolve() if( isLocal ){ if( hasPos ){ @@ -2529,16 +3855,19 @@ window.AFRAME.registerComponent('xrf', { // raycaster can find & execute it AFRAME.XRF.clickableMeshToEntity = (opts) => { let {mesh,clickHandler} = opts; - let el = document.createElement("a-entity") - el.setAttribute("xrf-get",mesh.name ) // turn into AFRAME entity - el.setAttribute("class","ray") // expose to raycaster - el.setAttribute("pressable", '') // detect hand-controller click - // respond to cursor via laser-controls (https://aframe.io/docs/1.4.0/components/laser-controls.html) - el.addEventListener("click", clickHandler ) - el.addEventListener("mouseenter", mesh.userData.XRF.href.selected(true) ) - el.addEventListener("mouseleave", mesh.userData.XRF.href.selected(false) ) - el.addEventListener("pressedstarted", clickHandler ) - $('a-scene').appendChild(el) + let createEl = function(c){ + let el = document.createElement("a-entity") + el.setAttribute("xrf-get",c.name ) // turn into AFRAME entity + el.setAttribute("class","ray") // expose to raycaster + el.setAttribute("pressable", '') // detect hand-controller click + // respond to cursor via laser-controls (https://aframe.io/docs/1.4.0/components/laser-controls.html) + el.addEventListener("click", clickHandler ) + el.addEventListener("mouseenter", mesh.userData.XRF.href.selected(true) ) + el.addEventListener("mouseleave", mesh.userData.XRF.href.selected(false) ) + el.addEventListener("pressedstarted", clickHandler ) + $('a-scene').appendChild(el) + } + createEl(mesh) } xrf.addEventListener('interactionReady', AFRAME.XRF.clickableMeshToEntity ) @@ -2790,6 +4119,13 @@ AFRAME.registerComponent('xrf-gaze',{ schema:{ spawn:{type:'boolean',default:false}, }, + events:{ + "fusing": function(e){ + if( e.detail.mouseEvent ) return // ignore click event + console.dir(e) + + } + }, setGazer: function(state){ let cam = document.querySelector("[camera]") if( state ){ @@ -2801,7 +4137,6 @@ AFRAME.registerComponent('xrf-gaze',{ raycaster="objects: .ray" visible="true" position="0 0 -1" - geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03" material="color: #BBBBBB; shader: flat"> ` }else{ @@ -2811,9 +4146,12 @@ AFRAME.registerComponent('xrf-gaze',{ } }, init:function(data){ - let enabled = () => AFRAME.utils.device.isMobile() let setVisible = (state) => { - if( enabled() ) this.setGazer(state) + if( AFRAME.utils.device.isMobile() ){ + this.setGazer(state) + if( state || xrf.debug ) this.el.setAttribute("geometry","primitive: ring; radiusInner: 0.02; radiusOuter: 0.03") + else this.el.removeAttribute("geometry") + } } setVisible(false); diff --git a/dist/xrfragment.aframe.js b/dist/xrfragment.aframe.js index 351cbd9..a415202 100644 --- a/dist/xrfragment.aframe.js +++ b/dist/xrfragment.aframe.js @@ -1,11 +1,18 @@ /* - * v0.5.1 generated at Wed Jan 31 06:46:04 PM UTC 2024 + * v0.5.1 generated at Fri Feb 16 04:36:12 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -19,6 +26,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -58,6 +85,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -70,6 +116,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -116,6 +177,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -149,6 +214,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -162,6 +276,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -179,6 +874,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -363,43 +1086,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -422,8 +1152,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -441,7 +1175,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -474,23 +1223,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -503,6 +1267,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -510,19 +1275,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -535,8 +1312,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -544,12 +1322,16 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; // the core project uses #vanillajs #proxies #clean #noframework var $ = typeof $ != 'undefined' ? $ : (s) => document.querySelector(s) // respect jquery @@ -567,7 +1349,14 @@ var xrf = {} xrf.init = function(opts){ opts = opts || {} - xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + + xrf.debug = document.location.hostname.match(/^(localhost|[0-9])/) ? 0 : false + if( !xrf.debug ){ + console.log("add #debug=[0-9] to URL to see XR Fragment debuglog") + xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + } + if( xrf.debug != undefined ) xrf.stats() + xrf.Parser.debug = xrf.debug xrf.detectCameraRig(opts) for ( let i in opts ) xrf[i] = opts[i] @@ -607,6 +1396,16 @@ xrf.roundrobin = (frag, store) => { return store.rr[label].index = 0 } +xrf.stats = () => { + // bookmarklet from https://github.com/zlgenuine/threejs_stats + (function(){ + for( let i = 0; i < 4; i++ ){ + var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.showPanel( i ); + stats.dom.style.marginTop = `${i*48}px`; document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script); + } + })() +} + xrf.hasTag = (tag,tags) => String(tags).match( new RegExp(`(^| )${tag}( |$)`,`g`) ) // map library functions to xrf @@ -638,14 +1437,15 @@ xrf.addEventListener = function(eventName, callback, opts) { this._listeners[eventName].push(callback); // sort this._listeners[eventName] = this._listeners[eventName].sort( (a,b) => a.opts.weight > b.opts.weight ) - return () => { + callback.unlisten = () => { this._listeners[eventName] = this._listeners[eventName].filter( (c) => c != callback ) } + return callback.unlisten }; xrf.emit = function(eventName, data){ if( typeof data != 'object' ) throw 'emit() requires passing objects' - if( xrf.debug && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ + if( xrf.debug && xrf.debug > 1 && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ let label = String(`xrf.emit('${eventName}')`).padEnd(35," "); label += data.mesh && data.mesh.name ? '#'+data.mesh.name : '' console.groupCollapsed(label) @@ -689,9 +1489,10 @@ xrf.emit.promise = function(e, opts){ } xrf.addEventListener('reset', () => { -// *TODO* do this nicely -// xrf._listeners['renderPost'] = [] -// xrf._listeners['render'] = [] + let events = ['renderPost'] + events.map( (e) => { + if( xrf._listeners[e] ) xrf._listeners[e].map( (r) => r.unlisten && r.unlisten() ) + }) }) /*! rasterizeHTML.js - v1.3.1 - 2023-07-06 * http://www.github.com/cburgmer/rasterizeHTML.js @@ -720,6 +1521,7 @@ XRWG.match = (str,types,level) => { return n }) str = str.toLowerCase() + .replace(/[!-\*]/g,'') // remove excludes and wildcards if( level <10 ) res = res.filter( (n) => n.key == str ) if( level >=10 ) res = res.filter( (n) => n.word == str || n.key == str ) if( level >30 ) res = res.filter( (n) => n.word.match(str) || n.key == str ) @@ -738,11 +1540,12 @@ XRWG.generate = (opts) => { if( !key || key.match(/(^#$|name)/) ) return let node = XRWG.get( XRWG.cleankey(key) ) if( node ){ + node.types.push(type) node.nodes.push(spatialNode) }else{ - node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] } + node = { word: XRWG.cleankey(key), key, nodes:[spatialNode], types:[] } if( spatialNode.userData[key] ) node.value = spatialNode.userData[key] - node[type] = true + node.types.push(type) xrf.emit('XRWGnode',node) XRWG.push( node ) } @@ -767,22 +1570,48 @@ XRWG.generate = (opts) => { XRWG = XRWG.reverse() // the cleankey/get functions e.g. will persist xrf.emit('XRWG',XRWG) } + +XRWG.deepApplyMatch = function(match,v,cb){ + match.map( (m) => { + for( let i in m.types ){ + let type = m.types[i] + let node = m.nodes[i] + if (type == 'name' || type == 'tag'){ + cb(match,v,node,type) + if( v.filter.q.deep ) node.traverse( (c) => cb(match,v,c,t) ) + } + } + }) +} + // the hashbus (QueryString eventBus) is mentioned in the spec // // it allows metadata-keys ('foo' e.g.) of 3D scene-nodes (.userData.foo e.g.) to // react by executing code -let pub = function( url, model, flags ){ // evaluate fragments in url +let pub = function( url, node_or_model, flags ){ // evaluate fragments in url if( !url ) return if( !url.match(/#/) ) url = `#${url}` - model = model || xrf.model let { THREE, camera } = xrf - let frag = xrf.URI.parse( url, flags ) - let opts = {frag, mesh:xrf.camera, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE, hashbus: xrf.hashbus } + let frag = xrf.URI.parse( url, flags ) + let fromNode = node_or_model != xrf.model + + let opts = { + frag, + mesh: fromNode ? node_or_model : xrf.camera, + model: xrf.model, + camera: xrf.camera, + scene: xrf.scene, + renderer: xrf.renderer, + THREE: xrf.THREE, + hashbus: xrf.hashbus + } xrf.emit('hashbus',opts) .then( () => { for ( let k in frag ){ - pub.fragment(k,opts) + let nodeAlias = fromNode && opts.mesh && opts.mesh.userData && opts.mesh.userData[k] && opts.mesh.userData[k][0] == '#' + if( nodeAlias ) pub(opts.mesh.userData[k], opts.mesh) // evaluate node alias + else pub.fragment(k,opts) } }) return frag @@ -805,7 +1634,8 @@ pub.mesh = (mesh,model) => { pub.fragment = (k, opts ) => { // evaluate one fragment let frag = opts.frag[k]; - if( !opts.skipXRWG && frag.is( xrf.XRF.PV_EXECUTE ) ) pub.XRWG(opts) + let isPVorMediaFrag = frag.is( xrf.XRF.PV_EXECUTE ) || frag.is( xrf.XRF.T_MEDIAFRAG) + if( !opts.skipXRWG && isPVorMediaFrag ) pub.XRWG(k,opts) // call native function (xrf/env.js e.g.), or pass it to user decorator xrf.emit(k,opts) @@ -816,50 +1646,53 @@ pub.fragment = (k, opts ) => { // evaluate one fragment }) } -pub.XRWG = (opts) => { +pub.XRWG = (word,opts) => { let {frag,scene,model,renderer} = opts // if this query was triggered by an src-value, lets filter it const isSRC = opts.embedded && opts.embedded.fragment == 'src' if( !isSRC ){ // spec : https://xrfragment.org/#src - for ( let i in frag ) { - let v = frag[i] - let id = v.string || v.fragment - if( id == '#' || !id ) return - let match = xrf.XRWG.match(id) - if( v.is( xrf.XRF.PV_EXECUTE ) ){ - scene.XRF_PV_ORIGIN = v.string - // evaluate aliases - match.map( (w) => { - if( w.key == `#${id}` ){ - if( w.value && w.value[0] == '#' ){ - // if value is alias, execute fragment value - xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) - } + let triggeredByMesh = opts.model != opts.mesh + + let v = frag[word] + let id = v.is( xrf.XRF.T_DYNAMICKEY ) ? word : v.string || word + + if( id == '#' || !id ) return + let match = xrf.XRWG.match(id) + + if( !triggeredByMesh && (v.is( xrf.XRF.PV_EXECUTE ) || v.is( xrf.XRF.T_DYNAMIC)) && !v.is( xrf.XRF.T_DYNAMICKEYVALUE ) ){ + // evaluate global aliases or tag/objectnames + match.map( (w) => { + if( w.key == `#${id}` ){ + if( w.value && w.value[0] == '#' ){ + // if value is alias, execute fragment value + xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) } - }) - xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) - }else{ - xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) - } + } + }) + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) + }else if( v.string ){ + // evaluate global aliases + xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) + }else{ + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) } } } xrf.hashbus = { pub } -xrf.frag = {} +xrf.frag = {dynamic:{}} xrf.model = {} xrf.mixers = [] xrf.init = ((init) => function(opts){ - console.log("add #debug to URL to see XR Fragment debuglog") let scene = new opts.THREE.Group() opts.scene.add(scene) opts.scene = scene init(opts) - if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) + //if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) xrf.patchRenderer(opts) xrf.navigator.init() @@ -876,7 +1709,7 @@ xrf.patchRenderer = function(opts){ xrf.clock = new xrf.THREE.Clock() renderer.render = ((render) => function(scene,camera){ // update clock - let time = xrf.clock.getDelta() + let time = xrf.clock.delta = xrf.clock.getDelta() xrf.emit('render',{scene,camera,time,render}) // allow fragments to do something at renderframe render(scene,camera) xrf.emit('renderPost',{scene,camera,time,render,renderer}) // allow fragments to do something after renderframe @@ -884,21 +1717,6 @@ xrf.patchRenderer = function(opts){ } -xrf.patchLoader = function(loader){ - if( loader.prototype.load.xrf_patched ) return // prevent patching aliased loaders twice - loader.prototype.load = ((load) => function(url, onLoad, onProgress, onError){ - load.call( this, - url, - (model) => { - onLoad(model); - xrf.parseModel(model,url) - }, - onProgress, - onError) - })(loader.prototype.load) - loader.prototype.load.xrf_patched = true -} - xrf.getFile = (url) => url.split("/").pop().replace(/#.*/,'') // parseModel event is essential for src.js to hook into embedded loaded models @@ -913,9 +1731,9 @@ xrf.parseModel = function(model,url){ xrf.getLastModel = () => xrf.model.last xrf.reset = () => { - // remove mixers - xrf.mixers.map( (m) => m.stop()) // stop animations *TODO* move to t.js - xrf.mixers = [] + + // allow others to reset certain events + xrf.emit('reset',{}) const disposeObject = (obj) => { if (obj.children.length > 0) obj.children.forEach((child) => disposeObject(child)); @@ -929,17 +1747,11 @@ xrf.reset = () => { return true }; let nodes = [] - xrf.scene.traverse( (n) => n.audio && (n.audio.playXRF({x:0})) && (n.audio.remove()) ) // *TODO* move to src/audio.js xrf.scene.traverse( (child) => child.isXRF && (nodes.push(child)) ) nodes.map( disposeObject ) // leave non-XRF objects intact xrf.interactive = xrf.interactiveGroup( xrf.THREE, xrf.renderer, xrf.camera) xrf.add( xrf.interactive ) xrf.layers = 0 - - // allow others to reset certain events - xrf.emit('reset',{}) - // set the player to position 0,0,0 - xrf.camera.position.set(0,0,0) } xrf.parseUrl = (url) => { @@ -1025,15 +1837,17 @@ xrf.navigator.to = (url,flags,loader,data) => { if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash ) xrf.model = model - if( !model.isXRF ) xrf.emit('parseModel',{model,url,file}) // loader.load() does this automatically (but not loader.parse) + if( !model.isXRF ) xrf.parseModel(model,url) // this marks the model as an XRF model if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) ) + + // spec: 1. generate the XRWG + xrf.XRWG.generate({model,scene:model.scene}) + // spec: 2. init metadata inside model for non-SRC data if( !model.isSRC ){ model.scene.traverse( (mesh) => xrf.hashbus.pub.mesh(mesh,model) ) } - // spec: 1. generate the XRWG - xrf.XRWG.generate({model,scene:model.scene}) // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) xrf.frag.defaultPredefinedViews({model,scene:model.scene}) @@ -1045,10 +1859,17 @@ xrf.navigator.to = (url,flags,loader,data) => { xrf.emit('navigateLoaded',{url,model}) resolve(model) } - + if( data ){ // file upload loader.parse(data, "", onLoad ) - }else loader.load(url, onLoad ) + }else{ + try{ + loader.load(url, onLoad ) + }catch(e){ + console.error(e) + xrf.emit('navigateError',{url}) + } + } }) }) }) @@ -1086,6 +1907,7 @@ xrf.navigator.setupNavigateFallbacks = () => { xrf.addEventListener('navigate', (opts) => { let {url} = opts let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + // handle http links if( url.match(/^http/) && !xrf.loaders[ext] ){ let inIframe @@ -1170,6 +1992,11 @@ xrf.frag.href = function(v, opts){ let click = mesh.userData.XRF.href.exec = (e) => { + if( !mesh.material.visible ) return + + // bubble up! + mesh.traverseAncestors( (n) => n.userData && n.userData.href && n.dispatchEvent({type:e.type,data:{}}) ) + let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}` xrf .emit('href',{click:true,mesh,xrf:v}) // let all listeners agree @@ -1180,24 +2007,21 @@ xrf.frag.href = function(v, opts){ const hasPos = isLocal && v.string.match(/pos=/) const flags = isLocal ? xrf.XRF.PV_OVERRIDE : undefined - let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) - // always commit current location in case of teleport (keep a trail of last positions before we navigate) - //if( isLocal && !hasPos ){ - // xrf.hashbus.pub( v.string, xrf.model ) // publish to hashbus - //}else{ - //if( !e.nocommit && !document.location.hash.match(lastPos) ) xrf.navigator.updateHash(`#${lastPos}`) - xrf.navigator.to(v.string) // let's surf - //} + //let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) + if( v.xrfScheme ){ + xrf.hashbus.pub(v.string) + } else xrf.navigator.to(v.string) // let's surf }) .catch( console.error ) } let selected = mesh.userData.XRF.href.selected = (state) => () => { if( mesh.selected == state ) return // nothing changed + xrf.interactive.objects.map( (o) => { let newState = o.name == mesh.name ? state : false if( o.material ){ - if( o.material.uniforms ) o.material.uniforms.selected.value = newState + if( o.material.uniforms && o.material.uniforms.selected ) o.material.uniforms.selected.value = newState //if( o.material.emissive ) o.material.emissive.r = o.material.emissive.g = o.material.emissive.b = newState ? 2.0 : 1.0 if( o.material.emissive ){ if( !o.material.emissive.original ) o.material.emissive.original = o.material.emissive.clone() @@ -1230,6 +2054,47 @@ xrf.frag.href = function(v, opts){ }, 0, mesh ) } +xrf.addEventListener('audioInited', function(opts){ + let {THREE,listener} = opts + opts.audio = opts.audio || {} + opts.audio.click = opts.audio.click || '/example/assets/audio/click.wav' + opts.audio.hover = opts.audio.hover || '/example/assets/audio/hover.wav' + opts.audio.teleport = opts.audio.teleport || '/example/assets/audio/teleport.wav' + + let audio = xrf.frag.href.audio = {} + + actions = ['click','hover','teleport'] + actions.map( (action) => { + const audioLoader = new THREE.AudioLoader(); + audio[action] = new THREE.Audio( xrf.camera.listener ) + audioLoader.load( opts.audio[action], function( buffer ) { + audio[action].setBuffer( buffer ); + }) + }); + + xrf.addEventListener('href', (opts) => { + let v = opts.xrf + if( opts.selected ){ + xrf.frag.href.audio.hover.stop() + xrf.frag.href.audio.hover.play() + return + } + if( opts.click ){ + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.click.play() + return + } + }) + + xrf.addEventListener('navigateLoading', (e) => { + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.teleport.stop() + xrf.frag.href.audio.teleport.play() + }) + + +}) + /** * > above solutions were abducted from [[this|https://i.imgur.com/E3En0gJ.png]] and [[this|https://i.imgur.com/lpnTz3A.png]] survey result * @@ -1241,6 +2106,33 @@ xrf.frag.href = function(v, opts){ * * > capture of aframe/sandbox */ +// this is called by navigator.js rather than by a URL e.g. + +xrf.frag.defaultPredefinedViews = (opts) => { + let {scene,model} = opts; + scene.traverse( (n) => { + if( n.userData && n.userData['#'] ){ + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + } + }) +} +xrf.frag.loop = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("loop",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + // update loop + mixer.loop.enabled = v.loop + + }) + +} xrf.frag.pos = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1260,13 +2152,20 @@ xrf.frag.pos = function(v, opts){ camera.position.z = pos.z } + if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) + xrf.frag.pos.last = pos // remember camera.updateMatrixWorld() } + +xrf.addEventListener('reset', (opts) => { + // set the player to position 0,0,0 + xrf.camera.position.set(0,0,0) +}) xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts - console.log(" └ setting camera rotation to "+v.string) + if( xrf.debug ) console.log("#rot.js: setting camera rotation to "+v.string) if( !model.isSRC ){ camera.rotation.set( v.x * Math.PI / 180, @@ -1284,21 +2183,52 @@ xrf.frag.rot = function(v, opts){ ) } } +xrf.frag.s = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("s",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + mixer.s = v + + // update speed + mixer.timeScale = v.x || 1.0 + mixer.loop.speed = v.x || 1.0 + mixer.loop.speedAbs = Math.abs( v.x ) + + }) + +} // *TODO* use webgl instancing xrf.frag.src = function(v, opts){ opts.embedded = v // indicate embedded XR fragment let { mesh, model, camera, scene, renderer, THREE, hashbus, frag} = opts - let url = v.string - let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) - opts.isLocal = v.string[0] == '#' + let url = xrf.frag.src.expandURI( mesh, v.string ) + let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) + opts.isLocal = v.string[0] == '#' opts.isPortal = xrf.frag.src.renderAsPortal(mesh) - opts.isSRC = true + opts.isSRC = true + + if(xrf.debug) console.log(`src.js: instancing ${opts.isLocal?'local':'remote'} object ${url}`) if( opts.isLocal ){ - xrf.frag.src.localSRC(url,srcFrag,opts) // local + xrf.frag.src.localSRC(url,srcFrag,opts) // local }else xrf.frag.src.externalSRC(url,srcFrag,opts) // external file + + xrf.hashbus.pub( url.replace(/.*#/,''), mesh) // eval src-url fragments +} + +xrf.frag.src.expandURI = function(mesh,uri){ + if( uri ) mesh.userData.srcTemplate = uri + mesh.userData.src = xrf.URI.template( mesh.userData.srcTemplate, xrf.URI.vars.__object ) + return mesh.userData.src } xrf.frag.src.addModel = (model,url,frag,opts) => { @@ -1308,7 +2238,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { if( mesh.material && mesh.userData.src ) mesh.material.visible = false // hide placeholder object //enableSourcePortation(scene) - if( xrf.frag.src.renderAsPortal(mesh) ){ + if( opts.isPortal ){ // only add remote objects, because // local scene-objects are already added to scene xrf.portalNonEuclidian({...opts,model,scene:model.scene}) @@ -1316,10 +2246,11 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { }else{ xrf.frag.src.scale( scene, opts, url ) // scale scene mesh.add(scene) - xrf.emit('parseModel', {...opts, scene, model}) } // flag everything isSRC & isXRF mesh.traverse( (n) => { n.isSRC = n.isXRF = n[ opts.isLocal ? 'isSRCLocal' : 'isSRCExternal' ] = true }) + + xrf.emit('parseModel', {...opts, isSRC:true, scene, model}) } xrf.frag.src.renderAsPortal = (mesh) => { @@ -1350,7 +2281,9 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { fetch(url, { method: 'HEAD' }) .then( (res) => { let mimetype = res.headers.get('Content-type') - if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(frag|fs|glsl)$/) ) mimetype = 'x-shader/x-fragment' + if( url.replace(/#.*/,'').match(/\.(vert|vs)$/) ) mimetype = 'x-shader/x-fragment' //if( url.match(/\.(fbx|stl|obj)$/) ) mimetype = opts = { ...opts, frag, mimetype } return xrf.frag.src.type[ mimetype ] ? xrf.frag.src.type[ mimetype ](url,opts) : xrf.frag.src.type.unknown(url,opts) @@ -1365,15 +2298,16 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { xrf.frag.src.localSRC = (url,frag,opts) => { let {model,mesh,scene} = opts - setTimeout( () => { + //setTimeout( (mesh,scene) => { if( mesh.material ) mesh.material = mesh.material.clone() // clone, so we can individually highlight meshes let _model = { animations: model.animations, - scene: scene.clone() // *TODO* opts.isPortal ? scene : scene.clone() + scene: scene.clone() + // scene: opts.isPortal ? scene : scene.clone() } _model.scenes = [_model.scene] xrf.frag.src.addModel(_model,url,frag, opts) // current file - },500 ) + //},1000,mesh,scene ) } // scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects @@ -1382,7 +2316,6 @@ xrf.frag.src.scale = function(scene, opts, url){ // remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection let cleanScene = scene.clone() - if( !cleanScene ) debugger let remove = [] const notVisible = (n) => !n.visible || (n.material && !n.material.visible) cleanScene.traverse( (n) => notVisible(n) && n.children.length == 0 && (remove.push(n)) ) @@ -1411,7 +2344,7 @@ xrf.frag.src.scale = function(scene, opts, url){ xrf.frag.src.filterScene = (scene,opts) => { let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts - scene = xrf.filter.scene({scene,frag,reparent:true}) // *TODO* ,copyScene: opts.isPortal}) + scene = xrf.filter.scene({scene,frag,reparent:true,copyScene: opts.isPortal}) if( !opts.isLocal ){ scene.traverse( (m) => { @@ -1437,23 +2370,33 @@ xrf.frag.src.type['unknown'] = function( url, opts ){ reject(`${url} mimetype '${opts.mimetype}' not found or supported (yet)`) }) } +// this ns the global #t mediafragment handler (which affects the 3D animation) + xrf.frag.t = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("t",v) + return + } + + // otherwise handle global 3D animations if( !model.mixer ) return if( !model.animations || model.animations[0] == undefined ){ console.warn('no animations found in model') return xrf.emit( v.x == 0 ? 'stop' : 'play',{isPlaying: v.x != 0 }) } - + xrf.mixers.map ( (mixer) => { mixer.t = v // update speed - mixer.timeScale = mixer.loop.speed = v.x - mixer.loop.speedAbs = Math.abs(v.x) + mixer.timeScale = mixer.loop.speed + mixer.loop.speedAbs = Math.abs( mixer.timeScale ) - if( v.y != undefined || v.z != undefined ) mixer.updateLoop( v ) + mixer.updateLoop( v ) // play animations mixer.play( v ) @@ -1470,7 +2413,7 @@ xrf.addEventListener('parseModel', (opts) => { let {model} = opts let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene) mixer.model = model - mixer.loop = {timeStart:0,timeStop:0} + mixer.loop = {timeStart:0,timeStop:0,speed:1.0} mixer.i = xrf.mixers.length mixer.actions = [] @@ -1480,28 +2423,8 @@ xrf.addEventListener('parseModel', (opts) => { mixer.actions.push( mixer.clipAction( anim, model.scene ) ) }) - - mixer.checkZombies = (animations) => { - if( mixer.zombieCheck ) return // fire only once - animations.map( (anim) => { - // collect zombie animations and warn user - let zombies = anim.tracks.map( (t) => { - let name = t.name.replace(/\..*/,'') - let obj = model.scene.getObjectByName(name) - return !model.scene.getObjectByName(name) ? {anim:anim.name,obj:name} : undefined - }) - if( zombies.length > 0 && mixer.i == 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) - zombies - .filter( (z) => z ) // filter out undefined - .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) - console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) - } - }) - mixer.zombieCheck = true - } - mixer.play = (t) => { - mixer.isPlaying = t.x != 0 + mixer.isPlaying = t.x !== undefined && t.x != t.y mixer.updateLoop(t) xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying}) } @@ -1511,35 +2434,37 @@ xrf.addEventListener('parseModel', (opts) => { } mixer.updateLoop = (t) => { - mixer.loop.timeStart = t.y != undefined ? t.y : mixer.loop.timeStart - mixer.loop.timeStop = t.z != undefined ? t.z : mixer.loop.timeStop + if( t ){ + mixer.loop.timeStart = t.x != undefined ? t.x : mixer.loop.timeStart + mixer.loop.timeStop = t.y != undefined ? t.y : mixer.duration + } mixer.actions.map( (action) => { if( mixer.loop.timeStart != undefined ){ action.time = mixer.loop.timeStart action.setLoop( xrf.THREE.LoopOnce, ) action.timeScale = mixer.timeScale action.enabled = true - if( t.x != 0 ){ - action.play() - } + if( t && t.x != undefined ) action.play() } }) mixer.setTime(mixer.loop.timeStart) mixer.time = Math.abs( mixer.loop.timeStart ) mixer.update(0) - mixer.checkZombies( model.animations) } - // update loop when needed + // monkeypatch: update loop when needed if( !mixer.update.patched ){ + let update = mixer.update mixer.update = function(time){ mixer.time = Math.abs(mixer.time) if( time == 0 ) return update.call(this,time) // loop jump - if( mixer.loop.speed > 0.0 && (mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop) ){ - setTimeout( (time,anims) => mixer.updateLoop(time), 0, mixer.loop.timeStart ) // prevent recursion + if( mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop ){ + if( mixer.loop.enabled ){ + setTimeout( () => mixer.updateLoop(), 0 ) // prevent recursion + }else mixer.stop() } return update.call( this, time ) } @@ -1574,7 +2499,7 @@ xrf.addEventListener('render', (opts) => { xrf.mixers.map( (m) => m.isPlaying && (m.update( time )) ) // update active camera in case selected by dynamicKey in URI - if( xrf.model.camera && model.mixer.isPlaying ){ + if( xrf.model.camera && xrf.model.camera.length && model.mixer.isPlaying ){ let cam = xrf.camera.getCam() // cam.fov = model.cameras[0].fov (why is blender not exporting radians?) @@ -1591,22 +2516,95 @@ xrf.addEventListener('render', (opts) => { } }) -xrf.addEventListener('dynamicKey', (opts) => { - // select active camera if any - let {id,match,v} = opts - match.map( (w) => { - w.nodes.map( (node) => { - if( node.isCamera ){ - console.log("setting camera to "+node.name) - xrf.model.camera = node - } - }) - }) +// remove mixers and stop mixers when loading another scene +xrf.addEventListener('reset', (opts) => { + xrf.mixers.map( (m) => m.stop()) + xrf.mixers = [] }) +xrf.frag.uv = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + if( !mesh.geometry ) return // nothing to do here + if( v.floats.length != 4 ) return console.warn('xrfragment.js: got less than 4 uv values ') + + xrf.frag.uv.init(mesh) + mesh.uv.u = v.floats[0] + mesh.uv.v = v.floats[1] + mesh.uv.uspeed = v.floats[2] || 1.0 + mesh.uv.vspeed = v.floats[3] || 1.0 + mesh.uv.ushift = v.shift[0] || v.floats[0] < 0 // negative u is always relative + mesh.uv.vshift = v.shift[1] || v.floats[1] < 0 // negative v is always relative + mesh.uv.uloop = v.shift[2] || false + mesh.uv.vloop = v.shift[3] || false + + mesh.onBeforeRender = xrf.frag.uv.scroll +} + +xrf.frag.uv.init = function(mesh){ + if( !mesh.uv ) mesh.uv = {u:0, v:0, uspeed:1, vspeed:1, uloop:false, vloop:false, uv:false} + + let uv = mesh.geometry.getAttribute("uv") + if( !uv.old ) uv.old = mesh.geometry.getAttribute("uv").clone() +} + +xrf.frag.uv.scroll = function(){ + + let diffU = 0.0 // distance to end-state (non-looping mode) + let diffV = 0.0 // distance to end-state (non-looping mode) + let uv = this.geometry.getAttribute("uv") + + // translate! + for( let i = 0; i < uv.count; i++ ){ + + if( this.uv.uspeed == 1.0 ) uv.setX(i, this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u ) + if( this.uv.vspeed == 1.0 ) uv.setY(i, this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v ) + + if( this.uv.uspeed != 1.0 || this.uv.vspeed != 1.0 ){ + let u = uv.getX(i) + let v = uv.getY(i) + let uTarget = this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u + let vTarget = this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v + + // scroll U + if( this.uv.uloop ){ + u += this.uv.uspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(u-uTarget) > 10.0 ) u = uv.old.getX(i) + //u = u > uTarget ? u + (this.uv.uspeed * -xrf.clock.delta) + // : u + (this.uv.uspeed * xrf.clock.delta) + //diffU += Math.abs( u - uTarget ) // are we done yet? (non-looping mode) + } + + // scroll V + if( this.uv.vloop ){ + v += this.uv.vspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(v-vTarget) > 10.0 ) v = uv.old.getY(i) + //v = v > vTarget ? v + (this.uv.vspeed * -xrf.clock.delta) + // : v + (this.uv.vspeed * xrf.clock.delta) + //diffV += Math.abs( v - vTarget ) + } + uv.setXY(i,u,v) + } + + } + uv.needsUpdate = true + + if( (!this.uv.uloop && diffU < 0.05) && + (!this.uv.vloop && diffV < 0.05) + ){ // stop animating if done + this.onBeforeRender = function(){} + } +} xrf.getCollisionMeshes = () => { let meshes = [] xrf.scene.traverse( (n) => { - if( !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ + if( n.type == 'Mesh' && !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ meshes.push(n) } }) @@ -1645,7 +2643,6 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ const tempMatrix = new Matrix4(); // Pointer Events - const element = renderer.domElement; function onPointerEvent( event ) { @@ -1675,7 +2672,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ }else{ if( object.selected ) { _event.type = 'mouseleave' - object.dispatchEvent(_event) + object.dispatchEvent( _event) } } @@ -1692,7 +2689,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ // WebXR Controller Events // TODO: Dispatch pointerevents too - const events = { + const eventsMapper = { 'move': 'mousemove', 'select': 'click', 'selectstart': 'mousedown', @@ -1712,12 +2709,14 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ if ( intersections.length > 0 ) { + console.log(object.name) + const intersection = intersections[ 0 ]; object = intersection.object; const uv = intersection.uv; - _event.type = events[ event.type ]; + _event.type = eventsMapper[ event.type ]; _event.data.set( uv.x, 1 - uv.y ); object.dispatchEvent( _event ); @@ -1754,18 +2753,119 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ return new interactive(renderer,camera) } -/* - * TODO: refactor/fix this (queries are being refactored to filters) - */ +xrf.optimize = (opts) => { + opts.animatedObjects = [] + xrf.optimize + .checkAnimations(opts) + .freezeUnAnimatedObjects(opts) + .disableShadows(opts) + .disableEmbeddedLights(opts) + .removeDuplicateLights() +} + + // check unused animations +xrf.optimize.checkAnimations = (opts) => { + if( xrf.debug ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + model.animations.map( (anim) => { + // collect zombie animations and warn user + let zombies = anim.tracks.map( (t) => { + let name = t.name.replace(/\..*/,'') + let obj = model.scene.getObjectByName(name) + if( !model.scene.getObjectByName(name) ) return {anim:anim.name,obj:name} + else opts.animatedObjects.push(name) + return undefined + }) + if( zombies.length > 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) + zombies + .filter( (z) => z ) // filter out undefined + .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) + console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) + } + }) + return xrf.optimize +} + +xrf.optimize.freezeUnAnimatedObjects = (opts) => { + if( xrf.todo ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + let scene = model.scene + // increase performance by freezing all objects + scene.traverse( (n) => n.matrixAutoUpdate = false ) + // except animated objects and children + scene.traverse( (n) => { + if( ~opts.animatedObjects.indexOf(n.name) ){ + n.matrixAutoUpdate = true + n.traverse( (m) => m.matrixAutoUpdate = true ) + } + }) + return xrf.optimize +} + +xrf.optimize.disableShadows = (opts) => { + opts.model.scene.traverse( (n) => { + if( n.castShadow !== undefined ) n.castShadow = false + }) + return xrf.optimize +} + +xrf.optimize.disableEmbeddedLights = (opts) => { + if( !opts.isSRC ) return xrf.optimize + // remove lights from SRC's + opts.model.scene.traverse( (n) => { + if( n.type.match(/light/i) ) n.remove() + }) + return xrf.optimize +} + +xrf.optimize.removeDuplicateLights = () => { + // local/extern src's can cause duplicate lights which tax performance + let lights = {} + xrf.scene.traverse( (n) => { + if( n.type.match(/light/i) ){ + if( !lights[n.name] ) lights[n.name] = true + else n.remove() + } + }) + return xrf.optimize +} + +xrf.addEventListener('parseModel', (opts) => { + xrf.optimize(opts) +}) +// switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { + // select active camera if any + let {id,match,v} = opts + match.map( (w) => { + w.nodes.map( (node) => { + if( node.isCamera ){ + console.log("switching camera to cam: "+node.name) + xrf.model.camera = node + } + }) + }) +}) + +const doFilter = (opts) => { let {scene,id,match,v} = opts if( v.filter ){ let frags = {} frags[ v.filter.key ] = v xrf.filter.scene({frag:frags,scene}) } +} + +xrf.addEventListener('dynamicKey', doFilter ) +xrf.addEventListener('dynamicKeyValue', (opts) => { + if( xrf.debug ) console.log("*TODO* filter integers only") + // doFilter(opts) }) // spec: https://xrfragment.org/#filters @@ -1881,48 +2981,116 @@ xrf.filter.process = function(frag,scene,opts){ return scene } -xrf.frag.defaultPredefinedViews = (opts) => { - let {scene,model} = opts; - scene.traverse( (n) => { - if( n.userData && n.userData['#'] ){ - let frag = xrf.URI.parse( n.userData['#'] ) - if( !n.parent && document.location.hash.length < 2){ - xrf.navigator.to( n.userData['#'] ) // evaluate static XR fragments - }else{ - xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments - } - } +xrf.frag.dynamic.material = function(v,opts){ + let {match} = opts + + // update material in case of [*]= + let material + xrf.scene.traverse( (n) => n.material && (n.material.name == v.string) && (material = n.material) ) + if( !material && !v.reset ) return // nothing to do + + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, material, v.reset ) }) } -xrf.addEventListener('dynamicKeyValue', (opts) => { - let {scene,match,v} = opts - let objname = v.fragment - let autoscroll = v.z > 0 || v.w > 0 -return // DISABLED - scene.traverse( (mesh) => { - if( mesh.name == objname ){ - if( !mesh.geometry ) return console.warn(`mesh '${objname}' has no uvcoordinates to offset`) - let uv = mesh.geometry.getAttribute("uv") - if( !uv.old ) uv.old = uv.clone() - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.old.getX(i) + v.x, uv.old.getY(i) + v.y ) +xrf.frag.dynamic.material.set = function(mesh,material,reset){ + if( !mesh.materialOriginal ) mesh.materialOriginal = mesh.material + let visible = mesh.material.visible //remember + if( reset ){ + mesh.material = mesh.materialOriginal + }else mesh.material = material + mesh.material.visible = visible +} + +// for reset calls like href: xrf://!myobject e.g. +xrf.addEventListener('dynamicKey', (opts) => { + + let {v,match} = opts + + if( v.reset ){ + xrf.XRWG.deepApplyMatch(match,v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, null, v.reset ) + }) + } + +}) + +// this holds all the URI Template variables (https://www.rfc-editor.org/rfc/rfc6570) + +xrf.addEventListener('parseModel', (opts) => { + let {model,url,file} = opts + if( model.isSRC || opts.isSRC ) return // ignore SRC models + + xrf.URI.vars = new Proxy({},{ + set(me,k,v){ + if( k.match(/^(name)$/) ) return + me[k] = v + }, + get(me,k ){ + if( k == '__object' ){ + let obj = {} + for( let i in xrf.URI.vars ) obj[i] = xrf.URI.vars[i]() + return obj } + return me[k] + }, + }) - if( autoscroll ){ - if( mesh.removeUVListener ) mesh.removeUVListener() - mesh.removeUVListener = xrf.addEventListener('render', (opts) => { - let {time} = opts - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.getX(i) + v.z * time, uv.getY(i) + v.w * time) + model.scene.traverse( (n) => { + const variables = /{([a-zA-Z0-9-]+)}/g + + if( n.userData ){ + for( let i in n.userData ){ + if( i[0] == '#' || i.match(/^(href|tag)$/) ) continue // ignore XR Fragment aliases + if( i == 'src' ){ + // lets declare empty variables found in src-values ('https://foo.com/video.mp4#{somevar}') e.g. + if( n.userData[i].match(variables) ){ + let vars = [].concat( n.userData[i].match(variables) ) + const strip = (v) => v.replace(/[{}]/g,'') + vars.map( (v) => xrf.URI.vars[ strip(v) ] = () => '' ) } - uv.needsUpdate = true - }) + }else xrf.URI.vars[i] = () => n.userData[i] // declare variables with values } - - uv.needsUpdate = true } }) + +}) + + +xrf.addEventListener('dynamicKeyValue', (opts) => { + // select active camera if any + let {id,match,v} = opts + + if( !v.is( xrf.XRF.CUSTOMFRAG) ) return // only process custom frags from here + if( v.string.match(/(<|>)/) ) return // ignore filter values + + if( match.length > 0 ){ + xrf.frag.dynamic.material(v,opts) // check if fragment is an objectname + } + + if( !xrf.URI.vars[ v.string ] ) return console.error(`'${v.string}' metadata-key not found in scene`) + //if( xrf.URI.vars[ id ] && !match.length ) return console.error(`'${id}' object/tag/metadata-key not found in scene`) + + if( xrf.debug ) console.log(`URI.vars[${id}]='${v.string}'`) + + if( xrf.URI.vars[id] ){ + xrf.URI.vars[ id ] = xrf.URI.vars[ v.string ] // update var + xrf.scene.traverse( (n) => { + // re-expand src-values which use the updated URI Template var + if( n.userData && n.userData.src && n.userData.srcTemplate && n.userData.srcTemplate.match(`{${id}}`) ){ + let srcNewFragments = xrf.frag.src.expandURI( n ).replace(/.*#/,'') + console.log(`URI.vars[${id}] => updating ${n.name} => ${srcNewFragments}`) + let frag = xrf.hashbus.pub( srcNewFragments, n ) + } + }) + }else{ + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + console.log(v.string) + if( node.geometry ) xrf.hashbus.pub( xrf.URI.vars[ v.string ](), node) // apply fragment mesh(es) + }) + } + }) xrf.addEventListener('dynamicKey', (opts) => { let {scene,id,match,v} = opts @@ -2002,68 +3170,109 @@ let loadAudio = (mimetype) => function(url,opts){ let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) let frag = xrf.URI.parse( url ) - /* WebAudio: setup context via THREEjs */ - if( !camera.listener ){ - camera.listener = new THREE.AudioListener(); - // *FIXME* camera vs camerarig conflict - (camera.getCam ? camera.getCam() : camera).add( camera.listener ); - } - + xrf.init.audio() let isPositionalAudio = !(mesh.position.x == 0 && mesh.position.y == 0 && mesh.position.z == 0) const audioLoader = new THREE.AudioLoader(); let sound = isPositionalAudio ? new THREE.PositionalAudio( camera.listener) : new THREE.Audio( camera.listener ) - mesh.audio = {} + mesh.media = mesh.media || {} + mesh.media.audio = { set: (mediafragment,v) => mesh.media.audio[mediafragment] = v } audioLoader.load( url.replace(/#.*/,''), function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(false); - sound.setVolume(1.0); + sound.setVolume( 1.0 ) if( isPositionalAudio ){ sound.setRefDistance( mesh.scale.x); sound.setRolloffFactor(20.0) //sound.setDirectionalCone( 360, 360, 0.01 ); - } + }else sound.setVolume( mesh.scale.x ) - sound.playXRF = (t) => { - mesh.add(sound) + mesh.add(sound) + + sound.set = (mediafragment,v) => { try{ - if( sound.isPlaying && t.y != undefined ) sound.stop() - if( sound.isPlaying && t.y == undefined ) sound.pause() + sound[mediafragment] = v + + if( mediafragment == 't'){ + + if( sound.isPlaying && v.y != undefined && v.x == v.y ){ + sound.offset = v.x * buffer.sampleRate ; + sound.pause() + return + }else sound.stop() - let hardcodedLoop = frag.t != undefined - t = hardcodedLoop ? { ...frag.t, x: t.x} : t // override with hardcoded metadata except playstate (x) - if( t && t.x != 0 ){ - // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well - t.x = Math.abs(t.x) - sound.setPlaybackRate( t.x ) // WebAudio does not support negative playback - // setting loop - if( t.z ) sound.setLoop( true ) // apply embedded audio/video samplerate/fps or global mixer fps - let loopStart = hardcodedLoop ? t.y : t.y * buffer.sampleRate; - let loopEnd = hardcodedLoop ? t.z : t.z * buffer.sampleRate; - let timeStart = loopStart > 0 ? loopStart : (t.y == undefined ? xrf.model.mixer.time : t.y) + sound.setLoopStart(v.x); + sound.setLoopEnd(v.y || buffer.duration); + sound.offset = v.x; + sound.play() + } - if( t.z > 0 ) sound.setLoopEnd( loopEnd ) - if( t.y != undefined ){ - sound.setLoopStart( loopStart ) - sound.offset = loopStart - } + if( mediafragment == 's'){ + // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well + sound.pause() + sound.setPlaybackRate( Math.abs(v.x) ) // WebAudio does not support negative playback + sound.play() + } + + if( mediafragment == 'loop'){ + sound.pause() + sound.setLoop( v.loop ) sound.play() } }catch(e){ console.warn(e) } } - // autoplay if user already requested play - let autoplay = mesh.audio && mesh.audio.autoplay - mesh.audio = sound - if( autoplay ) xrf.hashbus.pub(mesh.audio.autoplay) + let lazySet = {} + let mediaFragments = ['t','loop','s'] + mediaFragments.map( (f) => mesh.media.audio[f] && (lazySet[f] = mesh.media.audio[f]) ) + mesh.media.audio = sound + + // autoplay if user already requested play (before the sound was loaded) + mediaFragments.map( (f) => { + if( lazySet[f] ) mesh.media.audio.set(f, lazySet[f] ) + }) + }); + + // apply Media fragments from URL + (['t','loop','s']).map( (f) => { + if( frag[f] ){ + mesh.media.audio.set( f, frag[f] ) + } + }) + } +xrf.init.audio = (opts) => { + let camera = xrf.camera + /* WebAudio: setup context via THREEjs */ + if( !camera.listener ){ + camera.listener = new THREE.AudioListener(); + // *FIXME* camera vs camerarig conflict + (camera.getCam ? camera.getCam() : camera).add( camera.listener ); + xrf.emit('audioInited',{listener:camera.listener, ...opts}) + } +} +xrf.addEventListener('init', xrf.init.audio ) + +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => { + if( n.media && n.media.audio ){ + if( n.media.audio.stop ) n.media.audio.stop() + if( n.media.audio.remove ) n.media.audio.remove() + } + }) +}) + + + let audioMimeTypes = [ + 'audio/x-wav', 'audio/wav', 'audio/mpeg', 'audio/mp3', @@ -2072,16 +3281,99 @@ let audioMimeTypes = [ 'application/ogg' ] audioMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadAudio(mimetype) ) +/* + * mimetype: model/gltf+json + */ -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => { - if( !n.audio ) return - if( !n.audio.playXRF ) n.audio.autoplay = t - else n.audio.playXRF(t) +xrf.frag.src.type['fbx'] = function( url, opts ){ + return new Promise( async (resolve,reject) => { + let {mesh,src} = opts + let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + let loader + + //let {THREE} = await import('https://unpkg.com/three@0.161.0/build/three.module.js') + //let { FBXLoader } = await import('three/addons/loaders/FBXLoader.js') + + //const Loader = xrf.loaders[ext] + //if( !Loader ) throw 'xrfragment: no loader passed to xrfragment for extension .'+ext + //if( !dir.match("://") ){ // force relative path + // dir = dir[0] == './' ? dir : `./${dir}` + // loader = new Loader().setPath( dir ) + //}else loader = new Loader() + + //loader.load(url, (model) => { + // model.isSRC = true + // resolve(model) + //}) }) -}) +} + +/* + * extensions: .frag/.fs/.vs/.vert + */ + +xrf.frag.src.type['x-shader/x-fragment'] = function(url,opts){ + let {mesh,THREE} = opts + + let isFragmentShader = /\.(fs|frag|glsl)$/ + let isVertexShader = /\.(vs|vert)$/ + + let shaderReqs = [] + let shaderCode = {} + let shader = { + fragment: { code: '', url: url.match( isFragmentShader ) ? url : '' }, + vertex: { code: '', url: url.match( isVertexShader ) ? url : '' } + } + + var onShaderLoaded = ((args) => (type, status, code) => { + shader[type].status = status + shader[type].code = code + if( shader.fragment.code && shader.vertex.code ){ + + let oldMaterial = mesh.material + mesh.material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2(1.0,1.0) } + }, + // basic shaders include following common vars/funcs: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/common.glsl.js + fragmentShader: shader.fragment.status == 200 ? shader.fragment.code : THREE.ShaderChunk.meshbasic_frag, + vertexShader: shader.vertex.status == 200 ? shader.vertex.code : THREE.ShaderChunk.meshbasic_vert, + + }); + + mesh.material.needsUpdate = true + mesh.needsUpdate = true + + mesh.onBeforeRender = () => { + if( !mesh.material || !mesh.material.uniforms ) return mesh.onBeforeRender = function(){} + mesh.material.uniforms.time.value = xrf.clock.elapsedTime + } + + } + + })({}) + + // sidecar-load vertex shader file + if( shader.fragment.url && !shader.vertex.url ){ + shader.vertex.url = shader.fragment.url.replace(/\.fs$/, '.vs') + .replace(/\.frag$/, '.vert') + } + + if( shader.fragment.url ){ + fetch(shader.fragment.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('fragment',res.status,code) ) ) + } + + if( shader.vertex.url ){ + fetch(shader.vertex.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('vertex',res.status,code) ) ) + } + +} + +xrf.frag.src.type['x-shader/x-vertex'] = xrf.frag.src.type['x-shader/x-fragment'] + /* * mimetype: model/gltf+json */ @@ -2153,6 +3445,14 @@ xrf.frag.src.type['image/png'] = function(url,opts){ mesh.material.map = texture mesh.material.needsUpdate = true mesh.needsUpdate = true + + //// *TODO* update clones in portals or dont clone scene of portals.. + //xrf.scene.traverse( (n) => { + // if( n.userData.src == mesh.userData.src && mesh.uuid != n.uuid ){ + // n.material = mesh.material + // n.material.needsUpdate = true + // } + //}) } let onLoad = (texture) => { @@ -2174,7 +3474,6 @@ xrf.frag.src.type['image/jpeg'] = xrf.frag.src.type['image/png'] xrf.portalNonEuclidian = function(opts){ let { frag, mesh, model, camera, scene, renderer} = opts - mesh.portal = { pos: mesh.position.clone(), posWorld: new xrf.THREE.Vector3(), @@ -2232,7 +3531,7 @@ xrf.portalNonEuclidian = function(opts){ mesh.portal.stencilObjects.children = stencilObjects xrf.portalNonEuclidian.stencilRef += 1 // each portal has unique stencil id - console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) + if( xrf.debug ) console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) return this } @@ -2245,6 +3544,9 @@ xrf.portalNonEuclidian = function(opts){ this.setupListeners = () => { + // below is a somewhat weird tapdance to render the portals **after** the scene + // is rendered (otherwise it messes up occlusion) + mesh.onAfterRender = function(renderer, scene, camera, geometry, material, group ){ mesh.portal.needUpdate = true } @@ -2264,7 +3566,7 @@ xrf.portalNonEuclidian = function(opts){ let cam = xrf.camera.getCam ? xrf.camera.getCam() : camera cam.getWorldPosition(cameraPosition) cam.getWorldDirection(cameraDirection) - if( cameraPosition.distanceTo(newPos) > 10.0 ) return // dont render far portals + if( cameraPosition.distanceTo(newPos) > 15.0 ) return // dont render far portals // init if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = true @@ -2373,7 +3675,9 @@ let loadVideo = (mimetype) => function(url,opts){ const THREE = xrf.THREE let frag = xrf.URI.parse( url ) - let video = mesh.video = document.createElement('video') + mesh.media = mesh.media || {} + + let video = mesh.media.video = document.createElement('video') video.setAttribute("crossOrigin","anonymous") video.setAttribute("playsinline",'') video.addEventListener('loadedmetadata', function(){ @@ -2383,36 +3687,48 @@ let loadVideo = (mimetype) => function(url,opts){ mat.map = texture mesh.material = mat // set range - //video.addEventListener('timeupdate', function timeupdate() { - // if (frag.t && video.currentTime < frag.t.y || video.currentTime >= frag.t.z ) { - // video.currentTime = frag.t.y - // } - //},false) + video.addEventListener('timeupdate', function timeupdate() { + if (video.t && video.t.y !== undefined && video.t.y > video.t.x && Math.abs(video.currentTime) >= video.t.y ){ + if( video.looping ) video.currentTime = video.t.x // speed means loop + else video.pause() + } + },false) }) video.src = url - video.playXRF = (t) => { - video.t = t - if( t.x == 0 ) video.pause() - else{ - video.playbackRate = Math.abs( t.x ) // html5 video does not support reverseplay :/ - video.play() + video.speed = 1.0 + video.looping = false + video.set = (mediafragment,v) => { + video[mediafragment] = v + + if( mediafragment == 't'){ + video.pause() + if( v.x !== undefined && v.x == v.y ) return // stop paused + else{ + video.currentTime = v.x + video.time = v.x + video.play() + } + } + if( mediafragment == 's' ){ + video.playbackRate = Math.abs( v.x ) // html5 video does not support reverseplay :/ + } + if( mediafragment == 'loop' ){ + video.looping = true } - if( t.y != undefined ) video.time = t.y } } +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => n.media && n.media.video && (n.media.video.pause()) && (n.media.video.remove()) ) +}) + let videoMimeTypes = [ 'video/ogg', 'video/mp4' ] videoMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadVideo(mimetype) ) - -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => n.video && (n.video.playXRF(t)) ) -}) window.AFRAME.registerComponent('xrf', { schema: { http: { type:'string'}, @@ -2452,7 +3768,7 @@ window.AFRAME.registerComponent('xrf', { } }) aScene.renderer.toneMapping = THREE.ACESFilmicToneMapping; - aScene.renderer.toneMappingExposure = 1.5; + aScene.renderer.toneMappingExposure = 1.25; if( !XRF.camera ) throw 'xrfragment: no camera detected, please declare ABOVE entities with xrf-attributes' // this is just for convenience (not part of spec): hide/show stuff based on VR/AR tags in 3D model @@ -2491,6 +3807,12 @@ window.AFRAME.registerComponent('xrf', { let com = blinkControls.components['blink-controls'] if( com ) com.update({collisionEntities:true}) else console.warn("xrfragments: blink-controls is not mounted, please run manually: $('[blink-controls]).components['blink-controls'].update({collisionEntities:true})") + + blinkControls.addEventListener('teleported', (e) => { + if( e.detail.newPosition.z < 0){ + console.warn('teleported to negative Z-value: https://github.com/jure/aframe-blink-controls/issues/30') + } + }) } // give headset users way to debug without a cumbersome usb-tapdance @@ -2499,6 +3821,9 @@ window.AFRAME.registerComponent('xrf', { } }) + xrf.addEventListener('navigateError', (opts) => { + AFRAME.fade.out() + }) xrf.addEventListener('navigateLoading', (opts) => { let p = opts.promise() @@ -2506,6 +3831,7 @@ window.AFRAME.registerComponent('xrf', { let isLocal = url.match(/^#/) let hasPos = url.match(/pos=/) let fastFadeMs = 200 + if( !AFRAME.fade ) return p.resolve() if( isLocal ){ if( hasPos ){ @@ -2527,16 +3853,19 @@ window.AFRAME.registerComponent('xrf', { // raycaster can find & execute it AFRAME.XRF.clickableMeshToEntity = (opts) => { let {mesh,clickHandler} = opts; - let el = document.createElement("a-entity") - el.setAttribute("xrf-get",mesh.name ) // turn into AFRAME entity - el.setAttribute("class","ray") // expose to raycaster - el.setAttribute("pressable", '') // detect hand-controller click - // respond to cursor via laser-controls (https://aframe.io/docs/1.4.0/components/laser-controls.html) - el.addEventListener("click", clickHandler ) - el.addEventListener("mouseenter", mesh.userData.XRF.href.selected(true) ) - el.addEventListener("mouseleave", mesh.userData.XRF.href.selected(false) ) - el.addEventListener("pressedstarted", clickHandler ) - $('a-scene').appendChild(el) + let createEl = function(c){ + let el = document.createElement("a-entity") + el.setAttribute("xrf-get",c.name ) // turn into AFRAME entity + el.setAttribute("class","ray") // expose to raycaster + el.setAttribute("pressable", '') // detect hand-controller click + // respond to cursor via laser-controls (https://aframe.io/docs/1.4.0/components/laser-controls.html) + el.addEventListener("click", clickHandler ) + el.addEventListener("mouseenter", mesh.userData.XRF.href.selected(true) ) + el.addEventListener("mouseleave", mesh.userData.XRF.href.selected(false) ) + el.addEventListener("pressedstarted", clickHandler ) + $('a-scene').appendChild(el) + } + createEl(mesh) } xrf.addEventListener('interactionReady', AFRAME.XRF.clickableMeshToEntity ) @@ -2788,6 +4117,13 @@ AFRAME.registerComponent('xrf-gaze',{ schema:{ spawn:{type:'boolean',default:false}, }, + events:{ + "fusing": function(e){ + if( e.detail.mouseEvent ) return // ignore click event + console.dir(e) + + } + }, setGazer: function(state){ let cam = document.querySelector("[camera]") if( state ){ @@ -2799,7 +4135,6 @@ AFRAME.registerComponent('xrf-gaze',{ raycaster="objects: .ray" visible="true" position="0 0 -1" - geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03" material="color: #BBBBBB; shader: flat"> ` }else{ @@ -2809,9 +4144,12 @@ AFRAME.registerComponent('xrf-gaze',{ } }, init:function(data){ - let enabled = () => AFRAME.utils.device.isMobile() let setVisible = (state) => { - if( enabled() ) this.setGazer(state) + if( AFRAME.utils.device.isMobile() ){ + this.setGazer(state) + if( state || xrf.debug ) this.el.setAttribute("geometry","primitive: ring; radiusInner: 0.02; radiusOuter: 0.03") + else this.el.removeAttribute("geometry") + } } setVisible(false); diff --git a/dist/xrfragment.js b/dist/xrfragment.js index 0299943..277b001 100644 --- a/dist/xrfragment.js +++ b/dist/xrfragment.js @@ -1,6 +1,13 @@ var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -14,6 +21,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -53,6 +80,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -65,6 +111,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -111,6 +172,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -144,6 +209,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -157,6 +271,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -174,6 +869,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -358,43 +1081,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -417,8 +1147,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -436,7 +1170,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -469,23 +1218,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -498,6 +1262,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -505,19 +1270,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -530,8 +1307,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -539,10 +1317,14 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; diff --git a/dist/xrfragment.lua b/dist/xrfragment.lua index 8f5bf66..8be889b 100644 --- a/dist/xrfragment.lua +++ b/dist/xrfragment.lua @@ -204,14 +204,19 @@ local Math = _hx_e() local Reflect = _hx_e() local String = _hx_e() local Std = _hx_e() +local StringBuf = _hx_e() local StringTools = _hx_e() __haxe_IMap = _hx_e() __haxe_Exception = _hx_e() __haxe_Log = _hx_e() __haxe_NativeStackTrace = _hx_e() -__haxe_ValueException = _hx_e() -__haxe_ds_StringMap = _hx_e() +__haxe__Template_TemplateExpr = _hx_e() __haxe_iterators_ArrayIterator = _hx_e() +__haxe_Template = _hx_e() +__haxe_ValueException = _hx_e() +__haxe_ds_List = _hx_e() +__haxe_ds__List_ListNode = _hx_e() +__haxe_ds_StringMap = _hx_e() __haxe_iterators_ArrayKeyValueIterator = _hx_e() __lua_Boot = _hx_e() __lua_UserData = _hx_e() @@ -592,6 +597,46 @@ EReg.prototype.match = function(self,s) do return self.m[1] ~= nil end; end; end +EReg.prototype.matched = function(self,n) + if ((self.m[1] == nil) or (n < 0)) then + _G.error(__haxe_Exception.thrown("EReg::matched"),0); + else + if (n == 0) then + local k = _G.string.sub(self.s, self.m[1], self.m[2]); + do return k end; + else + if (__lua_Boot.__instanceof(self.m[3], _G.table)) then + local mn = 2 * (n - 1); + if (__lua_Boot.__instanceof(self.m[3][mn + 1], Bool)) then + do return nil end; + end; + do return _G.string.sub(self.s, self.m[3][mn + 1], self.m[3][mn + 2]) end; + else + _G.error(__haxe_Exception.thrown("EReg:matched"),0); + end; + end; + end; +end +EReg.prototype.matchedLeft = function(self) + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _G.string.sub(self.s, 1, self.m[1] - 1) end +end +EReg.prototype.matchedRight = function(self) + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _G.string.sub(self.s, self.m[2] + 1) end +end +EReg.prototype.matchedPos = function(self) + local left = self:matchedLeft(); + local matched = self:matched(0); + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _hx_o({__fields__={pos=true,len=true},pos=__lua_lib_luautf8_Utf8.len(left),len=__lua_lib_luautf8_Utf8.len(matched)}) end +end EReg.prototype.split = function(self,s) if (self.global) then do return __lua_Lib.fillArray(_hx_wrap_if_string_field(__lua_lib_lrexlib_Rex,'split')(s, self.r)) end; @@ -688,6 +733,32 @@ Reflect.field = function(o,field) end; end; end +Reflect.getProperty = function(o,field) + if (o == nil) then + do return nil end; + else + if ((o.__properties__ ~= nil) and (Reflect.field(o, Std.string("get_") .. Std.string(field)) ~= nil)) then + do return Reflect.callMethod(o,Reflect.field(o, Std.string("get_") .. Std.string(field)),_hx_tab_array({}, 0)) end; + else + do return Reflect.field(o, field) end; + end; + end; +end +Reflect.callMethod = function(o,func,args) + if ((args == nil) or (args.length == 0)) then + do return func(o) end; + else + local self_arg = false; + if ((o ~= nil) and (o.__name__ == nil)) then + self_arg = true; + end; + if (self_arg) then + do return func(o, _hx_table.unpack(args, 0, args.length - 1)) end; + else + do return func(_hx_table.unpack(args, 0, args.length - 1)) end; + end; + end; +end Reflect.fields = function(o) if (_G.type(o) == "string") then do return Reflect.fields(String.prototype) end; @@ -695,6 +766,33 @@ Reflect.fields = function(o) do return _hx_field_arr(o) end; end; end +Reflect.isObject = function(v) + if (v == nil) then + do return false end; + end; + local t = type(v); + if (not ((t == "string") or ((t == "table") and (v.__enum__ == nil)))) then + if (t == "function") then + do return ((function() + local _hx_1 + if (_G.type(v) ~= "table") then + _hx_1 = false; else + _hx_1 = v.__name__; end + return _hx_1 + end )() or (function() + local _hx_2 + if (_G.type(v) ~= "table") then + _hx_2 = false; else + _hx_2 = v.__ename__; end + return _hx_2 + end )()) ~= nil end; + else + do return false end; + end; + else + do return true end; + end; +end Reflect.deleteField = function(o,field) if (not ((function() local _hx_1 @@ -1024,6 +1122,20 @@ Std.parseFloat = function(x) end; end +StringBuf.new = function() + local self = _hx_new(StringBuf.prototype) + StringBuf.super(self) + return self +end +StringBuf.super = function(self) + self.b = ({}); + self.length = 0; +end +StringBuf.__name__ = true +StringBuf.prototype = _hx_e(); + +StringBuf.prototype.__class__ = StringBuf + StringTools.new = {} StringTools.__name__ = true StringTools.urlDecode = function(s) @@ -1102,6 +1214,31 @@ end StringTools.trim = function(s) do return StringTools.ltrim(StringTools.rtrim(s)) end; end +StringTools.replace = function(s,sub,by) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(sub) > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, sub, idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(sub); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + do return ret:join(by) end; +end __haxe_IMap.new = {} __haxe_IMap.__name__ = true @@ -1125,6 +1262,13 @@ __haxe_Exception.super = function(self,message,previous,native) end; end __haxe_Exception.__name__ = true +__haxe_Exception.caught = function(value) + if (__lua_Boot.__instanceof(value, __haxe_Exception)) then + do return value end; + else + do return __haxe_ValueException.new(value, nil, value) end; + end; +end __haxe_Exception.thrown = function(value) if (__lua_Boot.__instanceof(value, __haxe_Exception)) then do return value:get_native() end; @@ -1135,12 +1279,17 @@ __haxe_Exception.thrown = function(value) end; end __haxe_Exception.prototype = _hx_e(); +__haxe_Exception.prototype.unwrap = function(self) + do return self.__nativeException end +end __haxe_Exception.prototype.get_native = function(self) do return self.__nativeException end end __haxe_Exception.prototype.__class__ = __haxe_Exception +__haxe_Exception.prototype.__properties__ = {get_native="get_native"} + __haxe_Log.new = {} __haxe_Log.__name__ = true __haxe_Log.formatOutput = function(v,infos) @@ -1203,26 +1352,15 @@ end __haxe_NativeStackTrace.exceptionStack = function() do return _hx_tab_array({}, 0) end; end - -__haxe_ValueException.new = function(value,previous,native) - local self = _hx_new(__haxe_ValueException.prototype) - __haxe_ValueException.super(self,value,previous,native) - return self -end -__haxe_ValueException.super = function(self,value,previous,native) - __haxe_Exception.super(self,Std.string(value),previous,native); - self.value = value; -end -__haxe_ValueException.__name__ = true -__haxe_ValueException.prototype = _hx_e(); - -__haxe_ValueException.prototype.__class__ = __haxe_ValueException -__haxe_ValueException.__super__ = __haxe_Exception -setmetatable(__haxe_ValueException.prototype,{__index=__haxe_Exception.prototype}) - -__haxe_ds_StringMap.new = {} -__haxe_ds_StringMap.__name__ = true -__haxe_ds_StringMap.__interfaces__ = {__haxe_IMap} +_hxClasses["haxe._Template.TemplateExpr"] = { __ename__ = true, __constructs__ = _hx_tab_array({[0]="OpVar","OpExpr","OpIf","OpStr","OpBlock","OpForeach","OpMacro"},7)} +__haxe__Template_TemplateExpr = _hxClasses["haxe._Template.TemplateExpr"]; +__haxe__Template_TemplateExpr.OpVar = function(v) local _x = _hx_tab_array({[0]="OpVar",0,v,__enum__=__haxe__Template_TemplateExpr}, 3); return _x; end +__haxe__Template_TemplateExpr.OpExpr = function(expr) local _x = _hx_tab_array({[0]="OpExpr",1,expr,__enum__=__haxe__Template_TemplateExpr}, 3); return _x; end +__haxe__Template_TemplateExpr.OpIf = function(expr,eif,eelse) local _x = _hx_tab_array({[0]="OpIf",2,expr,eif,eelse,__enum__=__haxe__Template_TemplateExpr}, 5); return _x; end +__haxe__Template_TemplateExpr.OpStr = function(str) local _x = _hx_tab_array({[0]="OpStr",3,str,__enum__=__haxe__Template_TemplateExpr}, 3); return _x; end +__haxe__Template_TemplateExpr.OpBlock = function(l) local _x = _hx_tab_array({[0]="OpBlock",4,l,__enum__=__haxe__Template_TemplateExpr}, 3); return _x; end +__haxe__Template_TemplateExpr.OpForeach = function(expr,loop) local _x = _hx_tab_array({[0]="OpForeach",5,expr,loop,__enum__=__haxe__Template_TemplateExpr}, 4); return _x; end +__haxe__Template_TemplateExpr.OpMacro = function(name,params) local _x = _hx_tab_array({[0]="OpMacro",6,name,params,__enum__=__haxe__Template_TemplateExpr}, 4); return _x; end __haxe_iterators_ArrayIterator.new = function(array) local self = _hx_new(__haxe_iterators_ArrayIterator.prototype) @@ -1250,6 +1388,941 @@ end __haxe_iterators_ArrayIterator.prototype.__class__ = __haxe_iterators_ArrayIterator +__haxe_Template.new = function(str) + local self = _hx_new(__haxe_Template.prototype) + __haxe_Template.super(self,str) + return self +end +__haxe_Template.super = function(self,str) + local tokens = self:parseTokens(str); + self.expr = self:parseBlock(tokens); + if (not tokens:isEmpty()) then + _G.error(__haxe_Exception.thrown(Std.string(Std.string("Unexpected '") .. Std.string(Std.string(tokens:first().s))) .. Std.string("'")),0); + end; +end +__haxe_Template.__name__ = true +__haxe_Template.prototype = _hx_e(); +__haxe_Template.prototype.execute = function(self,context,macros) + self.macros = (function() + local _hx_1 + if (macros == nil) then + _hx_1 = _hx_e(); else + _hx_1 = macros; end + return _hx_1 + end )(); + self.context = context; + self.stack = __haxe_ds_List.new(); + self.buf = StringBuf.new(); + self:run(self.expr); + do return _G.table.concat(self.buf.b) end +end +__haxe_Template.prototype.resolve = function(self,v) + if (v == "__current__") then + do return self.context end; + end; + if (Reflect.isObject(self.context)) then + local value = Reflect.getProperty(self.context, v); + local tmp; + if (value == nil) then + local o = self.context; + tmp = (function() + local _hx_1 + if ((_G.type(o) == "string") and ((String.prototype[v] ~= nil) or (v == "length"))) then + _hx_1 = true; elseif (o.__fields__ ~= nil) then + _hx_1 = o.__fields__[v] ~= nil; else + _hx_1 = o[v] ~= nil; end + return _hx_1 + end )(); + else + tmp = true; + end; + if (tmp) then + do return value end; + end; + end; + local _g_head = self.stack.h; + while (_g_head ~= nil) do + local val = _g_head.item; + _g_head = _g_head.next; + local ctx = val; + local value = Reflect.getProperty(ctx, v); + local tmp; + if (value == nil) then + local o = ctx; + tmp = (function() + local _hx_2 + if ((_G.type(o) == "string") and ((String.prototype[v] ~= nil) or (v == "length"))) then + _hx_2 = true; elseif (o.__fields__ ~= nil) then + _hx_2 = o.__fields__[v] ~= nil; else + _hx_2 = o[v] ~= nil; end + return _hx_2 + end )(); + else + tmp = true; + end; + if (tmp) then + do return value end; + end; + end; + do return Reflect.field(__haxe_Template.globals, v) end +end +__haxe_Template.prototype.parseTokens = function(self,data) + local tokens = __haxe_ds_List.new(); + local _hx_continue_1 = false; + while (__haxe_Template.splitter:match(data)) do repeat + local p = __haxe_Template.splitter:matchedPos(); + if (p.pos > 0) then + local pos = 0; + local len = p.pos; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(data)))) then + len = __lua_lib_luautf8_Utf8.len(data); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(data) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(data) + pos; + end; + if (pos < 0) then + pos = 0; + end; + tokens:add(_hx_o({__fields__={p=true,s=true,l=true},p=__lua_lib_luautf8_Utf8.sub(data, pos + 1, pos + len),s=true,l=nil})); + end; + if (__lua_lib_luautf8_Utf8.byte(data, p.pos + 1) == 58) then + local pos = p.pos + 2; + local len = p.len - 4; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(data)))) then + len = __lua_lib_luautf8_Utf8.len(data); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(data) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(data) + pos; + end; + if (pos < 0) then + pos = 0; + end; + tokens:add(_hx_o({__fields__={p=true,s=true,l=true},p=__lua_lib_luautf8_Utf8.sub(data, pos + 1, pos + len),s=false,l=nil})); + data = __haxe_Template.splitter:matchedRight(); + break; + end; + local parp = p.pos + p.len; + local npar = 1; + local params = _hx_tab_array({}, 0); + local part = ""; + while (true) do + local c = __lua_lib_luautf8_Utf8.byte(data, parp + 1); + parp = parp + 1; + if (c == 40) then + npar = npar + 1; + else + if (c == 41) then + npar = npar - 1; + if (npar <= 0) then + break; + end; + else + if (c == nil) then + _G.error(__haxe_Exception.thrown("Unclosed macro parenthesis"),0); + end; + end; + end; + if ((c == 44) and (npar == 1)) then + params:push(part); + part = ""; + else + part = Std.string(part) .. Std.string(__lua_lib_luautf8_Utf8.char(c)); + end; + end; + params:push(part); + tokens:add(_hx_o({__fields__={p=true,s=true,l=true},p=__haxe_Template.splitter:matched(2),s=false,l=params})); + local pos = parp; + local len = __lua_lib_luautf8_Utf8.len(data) - parp; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(data)))) then + len = __lua_lib_luautf8_Utf8.len(data); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(data) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(data) + pos; + end; + if (pos < 0) then + pos = 0; + end; + data = __lua_lib_luautf8_Utf8.sub(data, pos + 1, pos + len);until true + if _hx_continue_1 then + _hx_continue_1 = false; + break; + end; + + end; + if (__lua_lib_luautf8_Utf8.len(data) > 0) then + tokens:add(_hx_o({__fields__={p=true,s=true,l=true},p=data,s=true,l=nil})); + end; + do return tokens end +end +__haxe_Template.prototype.parseBlock = function(self,tokens) + local l = __haxe_ds_List.new(); + while (true) do + local t = tokens:first(); + if (t == nil) then + break; + end; + local tmp; + if (not t.s) then + if (not ((t.p == "end") or (t.p == "else"))) then + local _this = t.p; + local pos = 0; + local len = 7; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(_this)))) then + len = __lua_lib_luautf8_Utf8.len(_this); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(_this) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(_this) + pos; + end; + if (pos < 0) then + pos = 0; + end; + tmp = __lua_lib_luautf8_Utf8.sub(_this, pos + 1, pos + len) == "elseif "; + else + tmp = true; + end; + else + tmp = false; + end; + if (tmp) then + break; + end; + l:add(self:parse(tokens)); + end; + if (l.length == 1) then + do return l:first() end; + end; + do return __haxe__Template_TemplateExpr.OpBlock(l) end +end +__haxe_Template.prototype.parse = function(self,tokens) + local t = tokens:pop(); + local p = t.p; + if (t.s) then + do return __haxe__Template_TemplateExpr.OpStr(p) end; + end; + if (t.l ~= nil) then + local pe = __haxe_ds_List.new(); + local _g = 0; + local _g1 = t.l; + while (_g < _g1.length) do + local p = _g1[_g]; + _g = _g + 1; + pe:add(self:parseBlock(self:parseTokens(p))); + end; + do return __haxe__Template_TemplateExpr.OpMacro(p, pe) end; + end; + local kwdEnd = function(kwd) + local pos = -1; + local length = __lua_lib_luautf8_Utf8.len(kwd); + local pos1 = 0; + local len = length; + if ((len == nil) or (len > (pos1 + __lua_lib_luautf8_Utf8.len(p)))) then + len = __lua_lib_luautf8_Utf8.len(p); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(p) + len; + end; + end; + if (pos1 < 0) then + pos1 = __lua_lib_luautf8_Utf8.len(p) + pos1; + end; + if (pos1 < 0) then + pos1 = 0; + end; + if (__lua_lib_luautf8_Utf8.sub(p, pos1 + 1, pos1 + len) == kwd) then + pos = length; + local pos1 = length; + local len = nil; + if ((len == nil) or (len > (pos1 + __lua_lib_luautf8_Utf8.len(p)))) then + len = __lua_lib_luautf8_Utf8.len(p); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(p) + len; + end; + end; + if (pos1 < 0) then + pos1 = __lua_lib_luautf8_Utf8.len(p) + pos1; + end; + if (pos1 < 0) then + pos1 = 0; + end; + local s = __lua_lib_luautf8_Utf8.sub(p, pos1 + 1, pos1 + len); + local _g_codes = __lua_lib_luautf8_Utf8.codes(s); + local _g_str = s; + local _hx_1_cp_position, _hx_1_cp_codepoint = _g_codes(_g_str, 0); + local _g_codepoint = _hx_1_cp_codepoint; + local _g_position = _hx_1_cp_position; + while (_g_codepoint ~= nil) do + local ret = _g_codepoint; + local _hx_2_cp_position, _hx_2_cp_codepoint = _g_codes(_g_str, _g_position); + _g_codepoint = _hx_2_cp_codepoint; + _g_position = _hx_2_cp_position; + local c = ret; + if (c == 32) then + pos = pos + 1; + else + break; + end; + end; + end; + do return pos end; + end; + local pos = kwdEnd("if"); + if (pos > 0) then + local pos1 = pos; + local len = __lua_lib_luautf8_Utf8.len(p) - pos; + if ((len == nil) or (len > (pos1 + __lua_lib_luautf8_Utf8.len(p)))) then + len = __lua_lib_luautf8_Utf8.len(p); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(p) + len; + end; + end; + if (pos1 < 0) then + pos1 = __lua_lib_luautf8_Utf8.len(p) + pos1; + end; + if (pos1 < 0) then + pos1 = 0; + end; + p = __lua_lib_luautf8_Utf8.sub(p, pos1 + 1, pos1 + len); + local e = self:parseExpr(p); + local eif = self:parseBlock(tokens); + local t = tokens:first(); + local eelse; + if (t == nil) then + _G.error(__haxe_Exception.thrown("Unclosed 'if'"),0); + end; + if (t.p == "end") then + tokens:pop(); + eelse = nil; + else + if (t.p == "else") then + tokens:pop(); + eelse = self:parseBlock(tokens); + t = tokens:pop(); + if ((t == nil) or (t.p ~= "end")) then + _G.error(__haxe_Exception.thrown("Unclosed 'else'"),0); + end; + else + local _this = t.p; + local pos = 4; + local len = __lua_lib_luautf8_Utf8.len(t.p) - 4; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(_this)))) then + len = __lua_lib_luautf8_Utf8.len(_this); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(_this) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(_this) + pos; + end; + if (pos < 0) then + pos = 0; + end; + t.p = __lua_lib_luautf8_Utf8.sub(_this, pos + 1, pos + len); + eelse = self:parse(tokens); + end; + end; + do return __haxe__Template_TemplateExpr.OpIf(e, eif, eelse) end; + end; + local pos = kwdEnd("foreach"); + if (pos >= 0) then + local pos1 = pos; + local len = __lua_lib_luautf8_Utf8.len(p) - pos; + if ((len == nil) or (len > (pos1 + __lua_lib_luautf8_Utf8.len(p)))) then + len = __lua_lib_luautf8_Utf8.len(p); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(p) + len; + end; + end; + if (pos1 < 0) then + pos1 = __lua_lib_luautf8_Utf8.len(p) + pos1; + end; + if (pos1 < 0) then + pos1 = 0; + end; + p = __lua_lib_luautf8_Utf8.sub(p, pos1 + 1, pos1 + len); + local e = self:parseExpr(p); + local efor = self:parseBlock(tokens); + local t = tokens:pop(); + if ((t == nil) or (t.p ~= "end")) then + _G.error(__haxe_Exception.thrown("Unclosed 'foreach'"),0); + end; + do return __haxe__Template_TemplateExpr.OpForeach(e, efor) end; + end; + if (__haxe_Template.expr_splitter:match(p)) then + do return __haxe__Template_TemplateExpr.OpExpr(self:parseExpr(p)) end; + end; + do return __haxe__Template_TemplateExpr.OpVar(p) end +end +__haxe_Template.prototype.parseExpr = function(self,data) + local l = __haxe_ds_List.new(); + local expr = data; + while (__haxe_Template.expr_splitter:match(data)) do + local p = __haxe_Template.expr_splitter:matchedPos(); + local k = p.pos + p.len; + if (p.pos ~= 0) then + local pos = 0; + local len = p.pos; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(data)))) then + len = __lua_lib_luautf8_Utf8.len(data); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(data) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(data) + pos; + end; + if (pos < 0) then + pos = 0; + end; + l:add(_hx_o({__fields__={p=true,s=true},p=__lua_lib_luautf8_Utf8.sub(data, pos + 1, pos + len),s=true})); + end; + local p = __haxe_Template.expr_splitter:matched(0); + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(p, "\"", startIndex, true); + l:add(_hx_o({__fields__={p=true,s=true},p=p,s=(function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )() >= 0})); + data = __haxe_Template.expr_splitter:matchedRight(); + end; + if (__lua_lib_luautf8_Utf8.len(data) ~= 0) then + local _g_offset = 0; + local _g_s = data; + while (_g_offset < __lua_lib_luautf8_Utf8.len(_g_s)) do + local _g1_key = _g_offset; + _g_offset = _g_offset + 1; + local _g1_value = __lua_lib_luautf8_Utf8.byte(_g_s, (_g_offset - 1) + 1); + local i = _g1_key; + local c = _g1_value; + if (c ~= 32) then + local pos = i; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(data)))) then + len = __lua_lib_luautf8_Utf8.len(data); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(data) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(data) + pos; + end; + if (pos < 0) then + pos = 0; + end; + l:add(_hx_o({__fields__={p=true,s=true},p=__lua_lib_luautf8_Utf8.sub(data, pos + 1, pos + len),s=true})); + break; + end; + end; + end; + local e; + local _hx_status, _hx_result = pcall(function() + + e = self:makeExpr(l); + if (not l:isEmpty()) then + _G.error(__haxe_Exception.thrown(l:first().p),0); + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + local _g1 = __haxe_Exception.caught(_g):unwrap(); + if (__lua_Boot.__instanceof(_g1, String)) then + local s = _g1; + _G.error(__haxe_Exception.thrown(Std.string(Std.string(Std.string("Unexpected '") .. Std.string(s)) .. Std.string("' in ")) .. Std.string(expr)),0); + else + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return function() + local _hx_status, _hx_result = pcall(function() + + do return e() end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + local exc = __haxe_Exception.caught(_g):unwrap(); + _G.error(__haxe_Exception.thrown(Std.string(Std.string(Std.string("Error : ") .. Std.string(Std.string(exc))) .. Std.string(" in ")) .. Std.string(expr)),0); + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + end end +end +__haxe_Template.prototype.makeConst = function(self,v) + __haxe_Template.expr_trim:match(v); + v = __haxe_Template.expr_trim:matched(1); + if (__lua_lib_luautf8_Utf8.byte(v, 1) == 34) then + local pos = 1; + local len = __lua_lib_luautf8_Utf8.len(v) - 2; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(v)))) then + len = __lua_lib_luautf8_Utf8.len(v); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(v) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(v) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local str = __lua_lib_luautf8_Utf8.sub(v, pos + 1, pos + len); + do return function() + do return str end; + end end; + end; + if (__haxe_Template.expr_int:match(v)) then + local i = Std.parseInt(v); + do return function() + do return i end; + end end; + end; + if (__haxe_Template.expr_float:match(v)) then + local f = Std.parseFloat(v); + do return function() + do return f end; + end end; + end; + local me = self; + do return function() + do return me:resolve(v) end; + end end +end +__haxe_Template.prototype.makePath = function(self,e,l) + local p = l:first(); + if ((p == nil) or (p.p ~= ".")) then + do return e end; + end; + l:pop(); + local field = l:pop(); + if ((field == nil) or not field.s) then + _G.error(__haxe_Exception.thrown(field.p),0); + end; + local f = field.p; + __haxe_Template.expr_trim:match(f); + f = __haxe_Template.expr_trim:matched(1); + do return self:makePath(function() + do return Reflect.field(e(), f) end; + end, l) end +end +__haxe_Template.prototype.makeExpr = function(self,l) + do return self:makePath(self:makeExpr2(l), l) end +end +__haxe_Template.prototype.skipSpaces = function(self,l) + local p = l:first(); + while (p ~= nil) do + local s = p.p; + local _g_codes = __lua_lib_luautf8_Utf8.codes(s); + local _g_str = s; + local _hx_1_cp_position, _hx_1_cp_codepoint = _g_codes(_g_str, 0); + local _g_codepoint = _hx_1_cp_codepoint; + local _g_position = _hx_1_cp_position; + while (_g_codepoint ~= nil) do + local ret = _g_codepoint; + local _hx_2_cp_position, _hx_2_cp_codepoint = _g_codes(_g_str, _g_position); + _g_codepoint = _hx_2_cp_codepoint; + _g_position = _hx_2_cp_position; + local c = ret; + if (c ~= 32) then + do return end; + end; + end; + l:pop(); + p = l:first(); + end; +end +__haxe_Template.prototype.makeExpr2 = function(self,l) + self:skipSpaces(l); + local p = l:pop(); + self:skipSpaces(l); + if (p == nil) then + _G.error(__haxe_Exception.thrown(""),0); + end; + if (p.s) then + do return self:makeConst(p.p) end; + end; + local _g = p.p; + if (_g) == "!" then + local e = self:makeExpr(l); + do return function() + local v = e(); + if (v ~= nil) then + do return v == false end; + else + do return true end; + end; + end end; + elseif (_g) == "(" then + self:skipSpaces(l); + local e1 = self:makeExpr(l); + self:skipSpaces(l); + local p = l:pop(); + if ((p == nil) or p.s) then + _G.error(__haxe_Exception.thrown(p),0); + end; + if (p.p == ")") then + do return e1 end; + end; + self:skipSpaces(l); + local e2 = self:makeExpr(l); + self:skipSpaces(l); + local p2 = l:pop(); + self:skipSpaces(l); + if ((p2 == nil) or (p2.p ~= ")")) then + _G.error(__haxe_Exception.thrown(p2),0); + end; + local _g = p.p; + if (_g) == "!=" then + do return function() + do return e1() ~= e2() end; + end end; + elseif (_g) == "&&" then + do return function() + do return e1() and e2() end; + end end; + elseif (_g) == "*" then + do return function() + do return e1() * e2() end; + end end; + elseif (_g) == "+" then + do return function() + do return _hx_dyn_add(e1(),e2()) end; + end end; + elseif (_g) == "-" then + do return function() + do return e1() - e2() end; + end end; + elseif (_g) == "/" then + do return function() + do return e1() / e2() end; + end end; + elseif (_g) == "<" then + do return function() + do return e1() < e2() end; + end end; + elseif (_g) == "<=" then + do return function() + do return e1() <= e2() end; + end end; + elseif (_g) == "==" then + do return function() + do return e1() == e2() end; + end end; + elseif (_g) == ">" then + do return function() + do return e1() > e2() end; + end end; + elseif (_g) == ">=" then + do return function() + do return e1() >= e2() end; + end end; + elseif (_g) == "||" then + do return function() + do return e1() or e2() end; + end end;else + _G.error(__haxe_Exception.thrown(Std.string("Unknown operation ") .. Std.string(p.p)),0); end; + elseif (_g) == "-" then + local e = self:makeExpr(l); + do return function() + do return -e() end; + end end; end; + _G.error(__haxe_Exception.thrown(p.p),0); +end +__haxe_Template.prototype.run = function(self,e) + local tmp = e[1]; + if (tmp) == 0 then + local v = e[2]; + local _this = self.buf; + local str = Std.string(self:resolve(v)); + _G.table.insert(_this.b, str); + local _this = _this; + _this.length = _this.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 1 then + local e = e[2]; + local _this = self.buf; + local str = Std.string(e()); + _G.table.insert(_this.b, str); + local _this = _this; + _this.length = _this.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 2 then + local e1 = e[2]; + local eif = e[3]; + local eelse = e[4]; + local v = e1(); + if ((v == nil) or (v == false)) then + if (eelse ~= nil) then + self:run(eelse); + end; + else + self:run(eif); + end; + elseif (tmp) == 3 then + local str = e[2]; + local _this = self.buf; + local str = Std.string(str); + _G.table.insert(_this.b, str); + local _this = _this; + _this.length = _this.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 4 then + local l = e[2]; + local _g_head = l.h; + while (_g_head ~= nil) do + local val = _g_head.item; + _g_head = _g_head.next; + local e = val; + self:run(e); + end; + elseif (tmp) == 5 then + local e1 = e[2]; + local loop = e[3]; + local v = e1(); + local _hx_status, _hx_result = pcall(function() + + local x = v:iterator(); + if (x.hasNext == nil) then + _G.error(__haxe_Exception.thrown(nil),0); + end; + v = x; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + local _hx_status, _hx_result = pcall(function() + + if (v.hasNext == nil) then + _G.error(__haxe_Exception.thrown(nil),0); + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + _G.error(__haxe_Exception.thrown(Std.string("Cannot iter on ") .. Std.string(Std.string(v))),0); + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + self.stack:push(self.context); + local v = v; + local ctx = v; + while (ctx:hasNext()) do + local ctx = ctx:next(); + self.context = ctx; + self:run(loop); + end; + self.context = self.stack:pop(); + elseif (tmp) == 6 then + local m = e[2]; + local params = e[3]; + local v = Reflect.field(self.macros, m); + local pl = Array.new(); + local old = self.buf; + pl:push(_hx_bind(self,self.resolve)); + local _g_head = params.h; + while (_g_head ~= nil) do + local val = _g_head.item; + _g_head = _g_head.next; + local p = val; + if (p[1] == 0) then + local v = p[2]; + pl:push(self:resolve(v)); + else + self.buf = StringBuf.new(); + self:run(p); + pl:push(_G.table.concat(self.buf.b)); + end; + end; + self.buf = old; + local _hx_status, _hx_result = pcall(function() + + local _this = self.buf; + local str = Std.string(Reflect.callMethod(self.macros,v,pl)); + _G.table.insert(_this.b, str); + local _this = _this; + _this.length = _this.length + __lua_lib_luautf8_Utf8.len(str); + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + local e = __haxe_Exception.caught(_g):unwrap(); + local plstr; + local _hx_status, _hx_result = pcall(function() + + plstr = pl:join(","); + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + plstr = "???"; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + local msg = Std.string(Std.string(Std.string(Std.string(Std.string(Std.string("Macro call ") .. Std.string(m)) .. Std.string("(")) .. Std.string(plstr)) .. Std.string(") failed (")) .. Std.string(Std.string(e))) .. Std.string(")"); + _G.error(__haxe_Exception.thrown(msg),0); + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; end; +end + +__haxe_Template.prototype.__class__ = __haxe_Template + +__haxe_ValueException.new = function(value,previous,native) + local self = _hx_new(__haxe_ValueException.prototype) + __haxe_ValueException.super(self,value,previous,native) + return self +end +__haxe_ValueException.super = function(self,value,previous,native) + __haxe_Exception.super(self,Std.string(value),previous,native); + self.value = value; +end +__haxe_ValueException.__name__ = true +__haxe_ValueException.prototype = _hx_e(); +__haxe_ValueException.prototype.unwrap = function(self) + do return self.value end +end + +__haxe_ValueException.prototype.__class__ = __haxe_ValueException +__haxe_ValueException.__super__ = __haxe_Exception +setmetatable(__haxe_ValueException.prototype,{__index=__haxe_Exception.prototype}) +setmetatable(__haxe_ValueException.prototype.__properties__,{__index=__haxe_Exception.prototype.__properties__}) + +__haxe_ds_List.new = function() + local self = _hx_new(__haxe_ds_List.prototype) + __haxe_ds_List.super(self) + return self +end +__haxe_ds_List.super = function(self) + self.length = 0; +end +__haxe_ds_List.__name__ = true +__haxe_ds_List.prototype = _hx_e(); +__haxe_ds_List.prototype.add = function(self,item) + local next = nil; + local x = __haxe_ds__List_ListNode.new(item, next); + if (self.h == nil) then + self.h = x; + else + self.q.next = x; + end; + self.q = x; + self.length = self.length + 1; +end +__haxe_ds_List.prototype.push = function(self,item) + local x = __haxe_ds__List_ListNode.new(item, self.h); + self.h = x; + if (self.q == nil) then + self.q = x; + end; + self.length = self.length + 1; +end +__haxe_ds_List.prototype.first = function(self) + if (self.h == nil) then + do return nil end; + else + do return self.h.item end; + end; +end +__haxe_ds_List.prototype.pop = function(self) + if (self.h == nil) then + do return nil end; + end; + local x = self.h.item; + self.h = self.h.next; + if (self.h == nil) then + self.q = nil; + end; + self.length = self.length - 1; + do return x end +end +__haxe_ds_List.prototype.isEmpty = function(self) + do return self.h == nil end +end +__haxe_ds_List.prototype.toString = function(self) + local s_b = ({}); + local s_length = 0; + local first = true; + local l = self.h; + local str = "{"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + while (l ~= nil) do + if (first) then + first = false; + else + local str = ", "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + local str = Std.string(l.item); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + l = l.next; + end; + local str = "}"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(s_b) end +end + +__haxe_ds_List.prototype.__class__ = __haxe_ds_List + +__haxe_ds__List_ListNode.new = function(item,next) + local self = _hx_new(__haxe_ds__List_ListNode.prototype) + __haxe_ds__List_ListNode.super(self,item,next) + return self +end +__haxe_ds__List_ListNode.super = function(self,item,next) + self.item = item; + self.next = next; +end +__haxe_ds__List_ListNode.__name__ = true +__haxe_ds__List_ListNode.prototype = _hx_e(); + +__haxe_ds__List_ListNode.prototype.__class__ = __haxe_ds__List_ListNode + +__haxe_ds_StringMap.new = {} +__haxe_ds_StringMap.__name__ = true +__haxe_ds_StringMap.__interfaces__ = {__haxe_IMap} + __haxe_iterators_ArrayKeyValueIterator.new = function(array) local self = _hx_new(__haxe_iterators_ArrayKeyValueIterator.prototype) __haxe_iterators_ArrayKeyValueIterator.super(self,array) @@ -1699,31 +2772,31 @@ _hx_exports["xrfragment"]["Parser"] = __xrfragment_Parser __xrfragment_Parser.__name__ = true __xrfragment_Parser.parse = function(key,value,store,index) local Frag_h = ({}); - local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_PREDEFINED_VIEW),__xrfragment_XRF.PV_EXECUTE); + local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_PREDEFINED_VIEW),__xrfragment_XRF.PV_EXECUTE); if (value1 == nil) then Frag_h["#"] = __haxe_ds_StringMap.tnull; else Frag_h["#"] = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL); + local value1 = __xrfragment_XRF.T_URL; if (value1 == nil) then Frag_h.src = __haxe_ds_StringMap.tnull; else Frag_h.src = value1; end; - local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.T_PREDEFINED_VIEW); + local value1 = _hx_bit.bor(__xrfragment_XRF.T_URL,__xrfragment_XRF.T_PREDEFINED_VIEW); if (value1 == nil) then Frag_h.href = __haxe_ds_StringMap.tnull; else Frag_h.href = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING); + local value1 = _hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_STRING); if (value1 == nil) then Frag_h.tag = __haxe_ds_StringMap.tnull; else Frag_h.tag = value1; end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR); + local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR); if (value1 == nil) then Frag_h.pos = __haxe_ds_StringMap.tnull; else @@ -1735,54 +2808,66 @@ __xrfragment_Parser.parse = function(key,value,store,index) else Frag_h.rot = value1; end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA); + local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA); if (value1 == nil) then Frag_h.t = __haxe_ds_StringMap.tnull; else Frag_h.t = value1; end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA); + local value1 = _hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_MEDIAFRAG); if (value1 == nil) then - Frag_h.tv = __haxe_ds_StringMap.tnull; + Frag_h.s = __haxe_ds_StringMap.tnull; else - Frag_h.tv = value1; + Frag_h.s = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING); + local value1 = __xrfragment_XRF.PV_OVERRIDE; + if (value1 == nil) then + Frag_h.loop = __haxe_ds_StringMap.tnull; + else + Frag_h.loop = value1; + end; + local value1 = _hx_bit.bor(__xrfragment_XRF.T_VECTOR2,__xrfragment_XRF.T_MEDIAFRAG); + if (value1 == nil) then + Frag_h.uv = __haxe_ds_StringMap.tnull; + else + Frag_h.uv = value1; + end; + local value1 = _hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_STRING); if (value1 == nil) then Frag_h.namespace = __haxe_ds_StringMap.tnull; else Frag_h.namespace = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING); + local value1 = _hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_STRING); if (value1 == nil) then Frag_h.SPDX = __haxe_ds_StringMap.tnull; else Frag_h.SPDX = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING); + local value1 = _hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_STRING); if (value1 == nil) then Frag_h.unit = __haxe_ds_StringMap.tnull; else Frag_h.unit = value1; end; - local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING); + local value1 = _hx_bit.bor(__xrfragment_XRF.IMMUTABLE,__xrfragment_XRF.T_STRING); if (value1 == nil) then Frag_h.description = __haxe_ds_StringMap.tnull; else Frag_h.description = value1; end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA),__xrfragment_XRF.PROMPT); - if (value1 == nil) then - Frag_h.session = __haxe_ds_StringMap.tnull; - else - Frag_h.session = value1; - end; local keyStripped = __xrfragment_XRF.operators:replace(key, ""); local isPVDynamic = (__lua_lib_luautf8_Utf8.len(key) > 0) and (Frag_h[key] == nil); - local isPVDefault = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (key == "#"); if (isPVDynamic) then local v = __xrfragment_XRF.new(key, _hx_bit.bor(__xrfragment_XRF.PV_EXECUTE,__xrfragment_XRF.NAVIGATOR), index); v:validate(value); + v.flags = __xrfragment_XRF.set(__xrfragment_XRF.T_DYNAMICKEY, v.flags); + if (Frag_h[key] == nil) then + v.flags = __xrfragment_XRF.set(__xrfragment_XRF.CUSTOMFRAG, v.flags); + end; + if (__lua_lib_luautf8_Utf8.len(value) == 0) then + v.flags = __xrfragment_XRF.set(__xrfragment_XRF.T_DYNAMICKEYVALUE, v.flags); + end; store[keyStripped] = v; do return true end; end; @@ -1793,18 +2878,18 @@ __xrfragment_Parser.parse = function(key,value,store,index) local v = __xrfragment_XRF.new(key, ret, index); if (Frag_h[key] ~= nil) then if (not v:validate(value)) then - __haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=66,className="xrfragment.Parser",methodName="parse"})); + __haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=67,className="xrfragment.Parser",methodName="parse"})); do return false end; end; store[keyStripped] = v; if (__xrfragment_Parser.debug) then - __haxe_Log.trace(Std.string(Std.string(Std.string("✔ ") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=70,className="xrfragment.Parser",methodName="parse"})); + __haxe_Log.trace(Std.string(Std.string(Std.string("✔ ") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=71,className="xrfragment.Parser",methodName="parse"})); end; else if (__lua_Boot.__instanceof(value, String)) then v:guessType(v, value); end; - v.noXRF = true; + v.flags = __xrfragment_XRF.set(__xrfragment_XRF.CUSTOMFRAG, v.flags); store[keyStripped] = v; end; do return true end; @@ -1917,7 +3002,11 @@ __xrfragment_URI.parse = function(url,filter) local key = splitByEqual[0]; local value = ""; if (splitByEqual.length > 1) then - value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" ")); + if (__xrfragment_XRF.isVector:match(splitByEqual[1])) then + value = splitByEqual[1]; + else + value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" ")); + end; end; local ok = __xrfragment_Parser.parse(key, value, store, i); end; @@ -1935,6 +3024,41 @@ __xrfragment_URI.parse = function(url,filter) end; do return store end; end +__xrfragment_URI.template = function(uri,vars) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("#") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(uri, "#", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(uri)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(uri, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("#"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(uri, idx, __lua_lib_luautf8_Utf8.len(uri))); + idx = nil; + end; + end; + local parts = ret; + if (parts.length == 1) then + do return uri end; + end; + local frag = parts[1]; + frag = StringTools.replace(frag, "{", "::"); + frag = StringTools.replace(frag, "}", "::"); + frag = __haxe_Template.new(frag):execute(vars); + frag = StringTools.replace(frag, "null", ""); + parts[1] = frag; + do return parts:join("#") end; +end __xrfragment_XRF.new = function(_fragment,_flags,_index) local self = _hx_new(__xrfragment_XRF.prototype) @@ -1942,6 +3066,8 @@ __xrfragment_XRF.new = function(_fragment,_flags,_index) return self end __xrfragment_XRF.super = function(self,_fragment,_flags,_index) + self.floats = Array.new(); + self.shift = Array.new(); self.fragment = _fragment; self.flags = _flags; self.index = _index; @@ -1974,10 +3100,21 @@ __xrfragment_XRF.prototype.validate = function(self,value) end __xrfragment_XRF.prototype.guessType = function(self,v,str) v.string = str; + if (__xrfragment_XRF.isReset:match(v.fragment)) then + v.reset = true; + end; + if (v.fragment == "loop") then + v.loop = true; + end; if (not __lua_Boot.__instanceof(str, String)) then do return end; end; if (__lua_lib_luautf8_Utf8.len(str) > 0) then + if (__xrfragment_XRF.isXRFScheme:match(str)) then + v.xrfScheme = true; + str = __xrfragment_XRF.isXRFScheme:replace(str, ""); + v.string = str; + end; local idx = 1; local ret = _hx_tab_array({}, 0); while (idx ~= nil) do @@ -2023,18 +3160,23 @@ __xrfragment_XRF.prototype.guessType = function(self,v,str) idx = nil; end; end; - local xyzw = ret; - if (xyzw.length > 0) then - v.x = Std.parseFloat(xyzw[0]); + local xyzn = ret; + if (xyzn.length > 0) then + v.x = Std.parseFloat(xyzn[0]); end; - if (xyzw.length > 1) then - v.y = Std.parseFloat(xyzw[1]); + if (xyzn.length > 1) then + v.y = Std.parseFloat(xyzn[1]); end; - if (xyzw.length > 2) then - v.z = Std.parseFloat(xyzw[2]); + if (xyzn.length > 2) then + v.z = Std.parseFloat(xyzn[2]); end; - if (xyzw.length > 3) then - v.w = Std.parseFloat(xyzw[3]); + local _g = 0; + local _g1 = xyzn.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + v.shift:push(__xrfragment_XRF.isShift:match(xyzn[i])); + v.floats:push(Std.parseFloat(__xrfragment_XRF.isShift:replace(xyzn[i], ""))); end; end; if (__xrfragment_XRF.isColor:match(str)) then @@ -2047,6 +3189,7 @@ __xrfragment_XRF.prototype.guessType = function(self,v,str) if (__xrfragment_XRF.isInt:match(str)) then v.int = Std.parseInt(str); v.x = v.int; + v.floats:push(v.x); end; v.filter = __xrfragment_Filter.new(Std.string(Std.string(v.fragment) .. Std.string("=")) .. Std.string(v.string)); else @@ -2109,13 +3252,29 @@ local _hx_static_init = function() String.__name__ = true; Array.__name__ = true;EReg.FLAGS = __lua_lib_lrexlib_Rex.flags(); + __haxe_Template.splitter = EReg.new("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()", ""); + + __haxe_Template.expr_splitter = EReg.new("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)", ""); + + __haxe_Template.expr_trim = EReg.new("^[ ]*([^ ]+)[ ]*$", ""); + + __haxe_Template.expr_int = EReg.new("^[0-9]+$", ""); + + __haxe_Template.expr_float = EReg.new("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$", ""); + + __haxe_Template.globals = _hx_e(); + + __haxe_Template.hxKeepArrayIterator = __haxe_iterators_ArrayIterator.new(_hx_tab_array({}, 0)); + __haxe_ds_StringMap.tnull = ({}); __xrfragment_Parser.error = ""; __xrfragment_Parser.debug = false; - __xrfragment_XRF.ASSET = 1; + __xrfragment_URI.__meta__ = _hx_o({__fields__={statics=true},statics=_hx_o({__fields__={template=true},template=_hx_o({__fields__={keep=true},keep=nil})})}); + + __xrfragment_XRF.IMMUTABLE = 1; __xrfragment_XRF.PROP_BIND = 2; @@ -2123,7 +3282,7 @@ local _hx_static_init = function() __xrfragment_XRF.PROMPT = 8; - __xrfragment_XRF.ROUNDROBIN = 16; + __xrfragment_XRF.CUSTOMFRAG = 16; __xrfragment_XRF.NAVIGATOR = 32; @@ -2149,9 +3308,11 @@ local _hx_static_init = function() __xrfragment_XRF.T_STRING = 1048576; - __xrfragment_XRF.T_STRING_OBJ = 2097152; + __xrfragment_XRF.T_MEDIAFRAG = 2097152; - __xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; + __xrfragment_XRF.T_DYNAMICKEY = 4194304; + + __xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; __xrfragment_XRF.isColor = EReg.new("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", ""); @@ -2167,7 +3328,7 @@ local _hx_static_init = function() __xrfragment_XRF.isString = EReg.new(".*", ""); - __xrfragment_XRF.operators = EReg.new("(^-|[\\*]+)", ""); + __xrfragment_XRF.operators = EReg.new("(^[-]|^[!]|[\\*]$)", "g"); __xrfragment_XRF.isProp = EReg.new("^.*=[><=]?", ""); @@ -2177,7 +3338,30 @@ local _hx_static_init = function() __xrfragment_XRF.isNumber = EReg.new("^[0-9\\.]+$", ""); + __xrfragment_XRF.isMediaFrag = EReg.new("^([0-9\\.,\\*+-]+)$", ""); + __xrfragment_XRF.isReset = EReg.new("^!", ""); + + __xrfragment_XRF.isShift = EReg.new("^(\\+|--)", ""); + + __xrfragment_XRF.isXRFScheme = EReg.new("^xrf://", ""); + + +end + +_hx_bind = function(o,m) + if m == nil then return nil end; + local f; + if o._hx__closures == nil then + _G.rawset(o, '_hx__closures', {}); + else + f = o._hx__closures[m]; + end + if (f == nil) then + f = function(...) return m(o, ...) end; + o._hx__closures[m] = f; + end + return f; end _hx_print = print or (function() end) @@ -2207,5 +3391,13 @@ _hx_wrap_if_string_field = function(o, fld) end end +_hx_dyn_add = function(a,b) + if (_G.type(a) == 'string' or _G.type(b) == 'string') then + return Std.string(a)..Std.string(b) + else + return a + b; + end; +end; + _hx_static_init(); return _hx_exports diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js index b521fd5..deed6b7 100644 --- a/dist/xrfragment.module.js +++ b/dist/xrfragment.module.js @@ -1,42115 +1,18 @@ /* - * v0.5.1 generated at Wed Jan 31 06:46:04 PM UTC 2024 + * v0.5.1 generated at Fri Feb 16 04:36:12 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ -/* - * v0.5.1 generated at Wed Jan 31 06:44:12 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:43:35 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:43:07 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:41:43 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:40:21 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:38:14 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:37:44 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:37:14 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:36:42 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:32:37 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:32:29 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:30:50 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:30:12 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:30:10 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:29:25 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:28:22 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:28:15 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:25:10 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:21:21 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:21:16 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:19:22 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:19:16 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:07:48 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 06:06:06 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:31:21 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:30:06 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:30:04 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:22:29 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:19:51 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 04:17:46 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:59:52 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:58:34 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:58:00 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:55:23 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:54:51 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:53:58 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:53:57 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:43:39 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:43:06 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:42:39 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:36:35 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:36:21 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:35:15 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:33:37 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:33:34 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:32:30 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:32:12 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:32:03 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:30:03 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:28:21 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:27:56 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:27:08 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:26:52 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:26:44 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:25:43 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:25:40 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:25:05 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:25:01 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:23:47 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:23:12 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:22:42 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:22:33 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:21:58 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:16:06 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:12:22 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:12:04 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:11:50 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:09:24 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:08:57 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:08:12 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 02:07:34 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 01:59:28 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 01:51:20 PM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 11:37:04 AM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Wed Jan 31 11:36:43 AM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -/* - * v0.5.1 generated at Tue Jan 30 10:06:30 AM UTC 2024 - * https://xrfragment.org - * SPDX-License-Identifier: MPL-2.0 - */ -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -Reflect.copy = function(o) { - if(o == null) { - return null; - } - var o2 = { }; - var _g = 0; - var _g1 = Reflect.fields(o); - while(_g < _g1.length) { - var f = _g1[_g]; - ++_g; - o2[f] = Reflect.field(o,f); - } - return o2; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Filter.__name__ = true; -xrfragment_Filter.prototype = { - toObject: function() { - return Reflect.copy(this.q); - } - ,get: function() { - return Reflect.copy(this.q); - } - ,parse: function(str) { - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - var k = str.split("=")[0]; - var v = str.split("=")[1]; - var filter = { }; - if(q[prefix + k]) { - filter = q[prefix + k]; - } - if(xrfragment_XRF.isProp.match(str)) { - var oper = ""; - if(str.indexOf(">") != -1) { - oper = ">"; - } - if(str.indexOf("<") != -1) { - oper = "<"; - } - if(xrfragment_XRF.isExclude.match(k)) { - k = HxOverrides.substr(k,1,null); - } - v = HxOverrides.substr(v,oper.length,null); - if(oper.length == 0) { - oper = "="; - } - var rule = { }; - if(xrfragment_XRF.isNumber.match(v)) { - rule[oper] = parseFloat(v); - } else { - rule[oper] = v; - } - q["expr"] = rule; - } - var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; - q["deep"] = value; - var value = xrfragment_XRF.isExclude.match(str) ? false : true; - q["show"] = value; - var value = k.replace(xrfragment_XRF.operators.r,""); - q["key"] = value; - q["value"] = v; - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(token[i]); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - return v[property]; - } - } - if(Reflect.field(this.q,"expr")) { - var f = Reflect.field(this.q,"expr"); - if(!Reflect.field(this.q,"show")) { - if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { - ++qualify; - } - } else { - if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { - ++qualify; - } - if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { - ++qualify; - } - if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { - ++qualify; - } - if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { - ++qualify; - } - } - } - return qualify > 0; - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,store,index) { - var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; - var keyStripped = key.replace(xrfragment_XRF.operators.r,""); - var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; - if(isPVDynamic) { - var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); - v.validate(value); - store[keyStripped] = v; - return true; - } - var v = new xrfragment_XRF(key,Frag_h[key],index); - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - store[keyStripped] = v; - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); - } - } else { - if(typeof(value) == "string") { - v.guessType(v,value); - } - v.noXRF = true; - store[keyStripped] = v; - } - return true; -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url == null || url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store,i); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { - this.fragment = _fragment; - this.flags = _flags; - this.index = _index; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - var v = this.flags; - if(!(typeof(v) == "number" && ((v | 0) === v))) { - this.flags = 0; - } - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - var ok = true; - if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(typeof(str) != "string") { - return; - } - if(str.length > 0) { - if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); - } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); - } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); - } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.x = parseFloat(str); - v.float = v.x; - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - v.x = v.int; - } - v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); - } else { - v.filter = new xrfragment_Filter(v.fragment); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.METADATA = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); -xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); -xrfragment_XRF.isExclude = new EReg("^-",""); -xrfragment_XRF.isDeep = new EReg("\\*",""); -xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -42123,6 +26,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -42162,6 +85,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -42174,6 +116,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -42220,6 +177,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -42253,6 +214,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -42266,6 +276,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -42283,6 +874,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -42467,43 +1086,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -42526,8 +1152,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -42545,7 +1175,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -42578,23 +1223,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -42607,6 +1267,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -42614,19 +1275,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -42639,8 +1312,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -42648,11 +1322,15 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; export default xrfragment; diff --git a/dist/xrfragment.py b/dist/xrfragment.py index e7c7098..0f22456 100644 --- a/dist/xrfragment.py +++ b/dist/xrfragment.py @@ -3,10 +3,11 @@ import sys import math as python_lib_Math import math as Math import inspect as python_lib_Inspect +import re as python_lib_Re import sys as python_lib_Sys import functools as python_lib_Functools -import re as python_lib_Re import traceback as python_lib_Traceback +from io import StringIO as python_lib_io_StringIO import urllib.parse as python_lib_urllib_Parse @@ -54,6 +55,7 @@ class Enum: else: return self.tag + '(' + (', '.join(str(v) for v in self.params)) + ')' +Enum._hx_class = Enum class Class: pass @@ -130,17 +132,53 @@ class EReg: replace = _hx_local_0 return python_lib_Re.sub(self.pattern,replace,s,(0 if (self._hx_global) else 1)) +EReg._hx_class = EReg class Reflect: _hx_class_name = "Reflect" __slots__ = () - _hx_statics = ["field", "deleteField", "copy"] + _hx_statics = ["field", "getProperty", "callMethod", "isObject", "deleteField", "copy"] @staticmethod def field(o,field): return python_Boot.field(o,field) + @staticmethod + def getProperty(o,field): + if (o is None): + return None + if (field in python_Boot.keywords): + field = ("_hx_" + field) + elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): + field = ("_hx_" + field) + if isinstance(o,_hx_AnonObject): + return Reflect.field(o,field) + tmp = Reflect.field(o,("get_" + ("null" if field is None else field))) + if ((tmp is not None) and callable(tmp)): + return tmp() + else: + return Reflect.field(o,field) + + @staticmethod + def callMethod(o,func,args): + if callable(func): + return func(*args) + else: + return None + + @staticmethod + def isObject(v): + _g = Type.typeof(v) + tmp = _g.index + if (tmp == 4): + return True + elif (tmp == 6): + _g1 = _g.params[0] + return True + else: + return False + @staticmethod def deleteField(o,field): if (field in python_Boot.keywords): @@ -165,6 +203,7 @@ class Reflect: value = Reflect.field(o,f) setattr(o2,(("_hx_" + f) if ((f in python_Boot.keywords)) else (("_hx_" + f) if (((((len(f) > 2) and ((ord(f[0]) == 95))) and ((ord(f[1]) == 95))) and ((ord(f[(len(f) - 1)]) != 95)))) else f)),value) return o2 +Reflect._hx_class = Reflect class Std: @@ -359,6 +398,7 @@ class Std: if (r1 != x): return Std.parseFloat(r1) return Math.NaN +Std._hx_class = Std class Float: pass @@ -373,10 +413,21 @@ class Bool: pass class Dynamic: pass +class StringBuf: + _hx_class_name = "StringBuf" + __slots__ = ("b",) + _hx_fields = ["b"] + + def __init__(self): + self.b = python_lib_io_StringIO() + +StringBuf._hx_class = StringBuf + + class StringTools: _hx_class_name = "StringTools" __slots__ = () - _hx_statics = ["isSpace", "ltrim", "rtrim", "trim"] + _hx_statics = ["isSpace", "ltrim", "rtrim", "trim", "replace"] @staticmethod def isSpace(s,pos): @@ -414,18 +465,78 @@ class StringTools: def trim(s): return StringTools.ltrim(StringTools.rtrim(s)) + @staticmethod + def replace(s,sub,by): + _this = (list(s) if ((sub == "")) else s.split(sub)) + return by.join([python_Boot.toString1(x1,'') for x1 in _this]) +StringTools._hx_class = StringTools + +class ValueType(Enum): + __slots__ = () + _hx_class_name = "ValueType" + _hx_constructs = ["TNull", "TInt", "TFloat", "TBool", "TObject", "TFunction", "TClass", "TEnum", "TUnknown"] + + @staticmethod + def TClass(c): + return ValueType("TClass", 6, (c,)) + + @staticmethod + def TEnum(e): + return ValueType("TEnum", 7, (e,)) +ValueType.TNull = ValueType("TNull", 0, ()) +ValueType.TInt = ValueType("TInt", 1, ()) +ValueType.TFloat = ValueType("TFloat", 2, ()) +ValueType.TBool = ValueType("TBool", 3, ()) +ValueType.TObject = ValueType("TObject", 4, ()) +ValueType.TFunction = ValueType("TFunction", 5, ()) +ValueType.TUnknown = ValueType("TUnknown", 8, ()) +ValueType._hx_class = ValueType + + +class Type: + _hx_class_name = "Type" + __slots__ = () + _hx_statics = ["typeof"] + + @staticmethod + def typeof(v): + if (v is None): + return ValueType.TNull + elif isinstance(v,bool): + return ValueType.TBool + elif isinstance(v,int): + return ValueType.TInt + elif isinstance(v,float): + return ValueType.TFloat + elif isinstance(v,str): + return ValueType.TClass(str) + elif isinstance(v,list): + return ValueType.TClass(list) + elif (isinstance(v,_hx_AnonObject) or python_lib_Inspect.isclass(v)): + return ValueType.TObject + elif isinstance(v,Enum): + return ValueType.TEnum(v.__class__) + elif (isinstance(v,type) or hasattr(v,"_hx_class")): + return ValueType.TClass(v.__class__) + elif callable(v): + return ValueType.TFunction + else: + return ValueType.TUnknown +Type._hx_class = Type + class haxe_IMap: _hx_class_name = "haxe.IMap" __slots__ = () +haxe_IMap._hx_class = haxe_IMap class haxe_Exception(Exception): _hx_class_name = "haxe.Exception" - __slots__ = ("_hx___nativeStack", "_hx___nativeException", "_hx___previousException") - _hx_fields = ["__nativeStack", "__nativeException", "__previousException"] - _hx_methods = ["unwrap"] - _hx_statics = ["caught"] + __slots__ = ("_hx___nativeStack", "_hx___skipStack", "_hx___nativeException", "_hx___previousException") + _hx_fields = ["__nativeStack", "__skipStack", "__nativeException", "__previousException"] + _hx_methods = ["unwrap", "get_native"] + _hx_statics = ["caught", "thrown"] _hx_interfaces = [] _hx_super = Exception @@ -434,6 +545,7 @@ class haxe_Exception(Exception): self._hx___previousException = None self._hx___nativeException = None self._hx___nativeStack = None + self._hx___skipStack = 0 super().__init__(message) self._hx___previousException = previous if ((native is not None) and Std.isOfType(native,BaseException)): @@ -450,6 +562,9 @@ class haxe_Exception(Exception): def unwrap(self): return self._hx___nativeException + def get_native(self): + return self._hx___nativeException + @staticmethod def caught(value): if Std.isOfType(value,haxe_Exception): @@ -459,6 +574,18 @@ class haxe_Exception(Exception): else: return haxe_ValueException(value,None,value) + @staticmethod + def thrown(value): + if Std.isOfType(value,haxe_Exception): + return value.get_native() + elif Std.isOfType(value,BaseException): + return value + else: + e = haxe_ValueException(value) + e._hx___skipStack = (e._hx___skipStack + 1) + return e + +haxe_Exception._hx_class = haxe_Exception class haxe_NativeStackTrace: @@ -479,37 +606,41 @@ class haxe_NativeStackTrace: return infos else: return [] +haxe_NativeStackTrace._hx_class = haxe_NativeStackTrace +class haxe__Template_TemplateExpr(Enum): + __slots__ = () + _hx_class_name = "haxe._Template.TemplateExpr" + _hx_constructs = ["OpVar", "OpExpr", "OpIf", "OpStr", "OpBlock", "OpForeach", "OpMacro"] -class haxe_ValueException(haxe_Exception): - _hx_class_name = "haxe.ValueException" - __slots__ = ("value",) - _hx_fields = ["value"] - _hx_methods = ["unwrap"] - _hx_statics = [] - _hx_interfaces = [] - _hx_super = haxe_Exception + @staticmethod + def OpVar(v): + return haxe__Template_TemplateExpr("OpVar", 0, (v,)) + @staticmethod + def OpExpr(expr): + return haxe__Template_TemplateExpr("OpExpr", 1, (expr,)) - def __init__(self,value,previous = None,native = None): - self.value = None - super().__init__(Std.string(value),previous,native) - self.value = value + @staticmethod + def OpIf(expr,eif,eelse): + return haxe__Template_TemplateExpr("OpIf", 2, (expr,eif,eelse)) - def unwrap(self): - return self.value + @staticmethod + def OpStr(str): + return haxe__Template_TemplateExpr("OpStr", 3, (str,)) + @staticmethod + def OpBlock(l): + return haxe__Template_TemplateExpr("OpBlock", 4, (l,)) + @staticmethod + def OpForeach(expr,loop): + return haxe__Template_TemplateExpr("OpForeach", 5, (expr,loop)) -class haxe_ds_StringMap: - _hx_class_name = "haxe.ds.StringMap" - __slots__ = ("h",) - _hx_fields = ["h"] - _hx_interfaces = [haxe_IMap] - - def __init__(self): - self.h = dict() - + @staticmethod + def OpMacro(name,params): + return haxe__Template_TemplateExpr("OpMacro", 6, (name,params)) +haxe__Template_TemplateExpr._hx_class = haxe__Template_TemplateExpr class haxe_iterators_ArrayIterator: @@ -535,6 +666,613 @@ class haxe_iterators_ArrayIterator: return python_internal_ArrayImpl._get(self.array, _hx_local_2()) return _hx_local_3() +haxe_iterators_ArrayIterator._hx_class = haxe_iterators_ArrayIterator + + +class haxe_Template: + _hx_class_name = "haxe.Template" + __slots__ = ("expr", "context", "macros", "stack", "buf") + _hx_fields = ["expr", "context", "macros", "stack", "buf"] + _hx_methods = ["execute", "resolve", "parseTokens", "parseBlock", "parse", "parseExpr", "makeConst", "makePath", "makeExpr", "skipSpaces", "makeExpr2", "run"] + _hx_statics = ["splitter", "expr_splitter", "expr_trim", "expr_int", "expr_float", "globals", "hxKeepArrayIterator"] + + def __init__(self,_hx_str): + self.buf = None + self.stack = None + self.macros = None + self.context = None + self.expr = None + tokens = self.parseTokens(_hx_str) + self.expr = self.parseBlock(tokens) + if (not tokens.isEmpty()): + raise haxe_Exception.thrown((("Unexpected '" + Std.string(tokens.first().s)) + "'")) + + def execute(self,context,macros = None): + self.macros = (_hx_AnonObject({}) if ((macros is None)) else macros) + self.context = context + self.stack = haxe_ds_List() + self.buf = StringBuf() + self.run(self.expr) + return self.buf.b.getvalue() + + def resolve(self,v): + if (v == "__current__"): + return self.context + if Reflect.isObject(self.context): + value = Reflect.getProperty(self.context,v) + if ((value is not None) or python_Boot.hasField(self.context,v)): + return value + _g_head = self.stack.h + while (_g_head is not None): + val = _g_head.item + _g_head = _g_head.next + ctx = val + value = Reflect.getProperty(ctx,v) + if ((value is not None) or python_Boot.hasField(ctx,v)): + return value + return Reflect.field(haxe_Template.globals,v) + + def parseTokens(self,data): + tokens = haxe_ds_List() + while True: + _this = haxe_Template.splitter + _this.matchObj = python_lib_Re.search(_this.pattern,data) + if (not ((_this.matchObj is not None))): + break + _this1 = haxe_Template.splitter + p_pos = _this1.matchObj.start() + p_len = (_this1.matchObj.end() - _this1.matchObj.start()) + if (p_pos > 0): + tokens.add(_hx_AnonObject({'p': HxString.substr(data,0,p_pos), 's': True, 'l': None})) + if (HxString.charCodeAt(data,p_pos) == 58): + tokens.add(_hx_AnonObject({'p': HxString.substr(data,(p_pos + 2),(p_len - 4)), 's': False, 'l': None})) + _this2 = haxe_Template.splitter + data = HxString.substr(_this2.matchObj.string,_this2.matchObj.end(),None) + continue + parp = (p_pos + p_len) + npar = 1 + params = [] + part = "" + while True: + c = HxString.charCodeAt(data,parp) + parp = (parp + 1) + if (c == 40): + npar = (npar + 1) + elif (c == 41): + npar = (npar - 1) + if (npar <= 0): + break + elif (c is None): + raise haxe_Exception.thrown("Unclosed macro parenthesis") + if ((c == 44) and ((npar == 1))): + params.append(part) + part = "" + else: + part = (("null" if part is None else part) + HxOverrides.stringOrNull("".join(map(chr,[c])))) + params.append(part) + tokens.add(_hx_AnonObject({'p': haxe_Template.splitter.matchObj.group(2), 's': False, 'l': params})) + data = HxString.substr(data,parp,(len(data) - parp)) + if (len(data) > 0): + tokens.add(_hx_AnonObject({'p': data, 's': True, 'l': None})) + return tokens + + def parseBlock(self,tokens): + l = haxe_ds_List() + while True: + t = tokens.first() + if (t is None): + break + if ((not t.s) and ((((t.p == "end") or ((t.p == "else"))) or ((HxString.substr(t.p,0,7) == "elseif "))))): + break + l.add(self.parse(tokens)) + if (l.length == 1): + return l.first() + return haxe__Template_TemplateExpr.OpBlock(l) + + def parse(self,tokens): + t = tokens.pop() + p = t.p + if t.s: + return haxe__Template_TemplateExpr.OpStr(p) + if (t.l is not None): + pe = haxe_ds_List() + _g = 0 + _g1 = t.l + while (_g < len(_g1)): + p1 = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + pe.add(self.parseBlock(self.parseTokens(p1))) + return haxe__Template_TemplateExpr.OpMacro(p,pe) + def _hx_local_2(kwd): + pos = -1 + length = len(kwd) + if (HxString.substr(p,0,length) == kwd): + pos = length + _g_offset = 0 + _g_s = HxString.substr(p,length,None) + while (_g_offset < len(_g_s)): + index = _g_offset + _g_offset = (_g_offset + 1) + c = ord(_g_s[index]) + if (c == 32): + pos = (pos + 1) + else: + break + return pos + kwdEnd = _hx_local_2 + pos = kwdEnd("if") + if (pos > 0): + p = HxString.substr(p,pos,(len(p) - pos)) + e = self.parseExpr(p) + eif = self.parseBlock(tokens) + t = tokens.first() + eelse = None + if (t is None): + raise haxe_Exception.thrown("Unclosed 'if'") + if (t.p == "end"): + tokens.pop() + eelse = None + elif (t.p == "else"): + tokens.pop() + eelse = self.parseBlock(tokens) + t = tokens.pop() + if ((t is None) or ((t.p != "end"))): + raise haxe_Exception.thrown("Unclosed 'else'") + else: + t.p = HxString.substr(t.p,4,(len(t.p) - 4)) + eelse = self.parse(tokens) + return haxe__Template_TemplateExpr.OpIf(e,eif,eelse) + pos = kwdEnd("foreach") + if (pos >= 0): + p = HxString.substr(p,pos,(len(p) - pos)) + e = self.parseExpr(p) + efor = self.parseBlock(tokens) + t = tokens.pop() + if ((t is None) or ((t.p != "end"))): + raise haxe_Exception.thrown("Unclosed 'foreach'") + return haxe__Template_TemplateExpr.OpForeach(e,efor) + _this = haxe_Template.expr_splitter + _this.matchObj = python_lib_Re.search(_this.pattern,p) + if (_this.matchObj is not None): + return haxe__Template_TemplateExpr.OpExpr(self.parseExpr(p)) + return haxe__Template_TemplateExpr.OpVar(p) + + def parseExpr(self,data): + l = haxe_ds_List() + expr = data + while True: + _this = haxe_Template.expr_splitter + _this.matchObj = python_lib_Re.search(_this.pattern,data) + if (not ((_this.matchObj is not None))): + break + _this1 = haxe_Template.expr_splitter + p_pos = _this1.matchObj.start() + p_len = (_this1.matchObj.end() - _this1.matchObj.start()) + k = (p_pos + p_len) + if (p_pos != 0): + l.add(_hx_AnonObject({'p': HxString.substr(data,0,p_pos), 's': True})) + p = haxe_Template.expr_splitter.matchObj.group(0) + startIndex = None + l.add(_hx_AnonObject({'p': p, 's': (((p.find("\"") if ((startIndex is None)) else HxString.indexOfImpl(p,"\"",startIndex))) >= 0)})) + _this2 = haxe_Template.expr_splitter + data = HxString.substr(_this2.matchObj.string,_this2.matchObj.end(),None) + if (len(data) != 0): + _g_offset = 0 + _g_s = data + while (_g_offset < len(_g_s)): + _g1_key = _g_offset + s = _g_s + index = _g_offset + _g_offset = (_g_offset + 1) + _g1_value = (-1 if ((index >= len(s))) else ord(s[index])) + i = _g1_key + c = _g1_value + if (c != 32): + l.add(_hx_AnonObject({'p': HxString.substr(data,i,None), 's': True})) + break + e = None + try: + e = self.makeExpr(l) + if (not l.isEmpty()): + raise haxe_Exception.thrown(l.first().p) + except BaseException as _g: + None + _g1 = haxe_Exception.caught(_g).unwrap() + if Std.isOfType(_g1,str): + s = _g1 + raise haxe_Exception.thrown(((("Unexpected '" + ("null" if s is None else s)) + "' in ") + ("null" if expr is None else expr))) + else: + raise _g + def _hx_local_0(): + try: + return e() + except BaseException as _g: + None + exc = haxe_Exception.caught(_g).unwrap() + raise haxe_Exception.thrown(((("Error : " + Std.string(exc)) + " in ") + ("null" if expr is None else expr))) + return _hx_local_0 + + def makeConst(self,v): + _this = haxe_Template.expr_trim + _this.matchObj = python_lib_Re.search(_this.pattern,v) + v = haxe_Template.expr_trim.matchObj.group(1) + if (HxString.charCodeAt(v,0) == 34): + _hx_str = HxString.substr(v,1,(len(v) - 2)) + def _hx_local_0(): + return _hx_str + return _hx_local_0 + _this = haxe_Template.expr_int + _this.matchObj = python_lib_Re.search(_this.pattern,v) + if (_this.matchObj is not None): + i = Std.parseInt(v) + def _hx_local_1(): + return i + return _hx_local_1 + _this = haxe_Template.expr_float + _this.matchObj = python_lib_Re.search(_this.pattern,v) + if (_this.matchObj is not None): + f = Std.parseFloat(v) + def _hx_local_2(): + return f + return _hx_local_2 + me = self + def _hx_local_3(): + return me.resolve(v) + return _hx_local_3 + + def makePath(self,e,l): + p = l.first() + if ((p is None) or ((p.p != "."))): + return e + l.pop() + field = l.pop() + if ((field is None) or (not field.s)): + raise haxe_Exception.thrown(field.p) + f = field.p + _this = haxe_Template.expr_trim + _this.matchObj = python_lib_Re.search(_this.pattern,f) + f = haxe_Template.expr_trim.matchObj.group(1) + def _hx_local_1(): + def _hx_local_0(): + return Reflect.field(e(),f) + return self.makePath(_hx_local_0,l) + return _hx_local_1() + + def makeExpr(self,l): + return self.makePath(self.makeExpr2(l),l) + + def skipSpaces(self,l): + p = l.first() + while (p is not None): + _g_offset = 0 + _g_s = p.p + while (_g_offset < len(_g_s)): + index = _g_offset + _g_offset = (_g_offset + 1) + c = ord(_g_s[index]) + if (c != 32): + return + l.pop() + p = l.first() + + def makeExpr2(self,l): + self.skipSpaces(l) + p = l.pop() + self.skipSpaces(l) + if (p is None): + raise haxe_Exception.thrown("") + if p.s: + return self.makeConst(p.p) + _g = p.p + if (_g == "!"): + e = self.makeExpr(l) + def _hx_local_0(): + v = e() + if (v is not None): + return (v == False) + else: + return True + return _hx_local_0 + elif (_g == "("): + self.skipSpaces(l) + e1 = self.makeExpr(l) + self.skipSpaces(l) + p1 = l.pop() + if ((p1 is None) or p1.s): + raise haxe_Exception.thrown(p1) + if (p1.p == ")"): + return e1 + self.skipSpaces(l) + e2 = self.makeExpr(l) + self.skipSpaces(l) + p2 = l.pop() + self.skipSpaces(l) + if ((p2 is None) or ((p2.p != ")"))): + raise haxe_Exception.thrown(p2) + _g = p1.p + _hx_local_1 = len(_g) + if (_hx_local_1 == 1): + if (_g == "*"): + def _hx_local_2(): + return (e1() * e2()) + return _hx_local_2 + elif (_g == "+"): + def _hx_local_3(): + return python_Boot._add_dynamic(e1(),e2()) + return _hx_local_3 + elif (_g == "-"): + def _hx_local_4(): + return (e1() - e2()) + return _hx_local_4 + elif (_g == "/"): + def _hx_local_5(): + return (e1() / e2()) + return _hx_local_5 + elif (_g == "<"): + def _hx_local_6(): + return (e1() < e2()) + return _hx_local_6 + elif (_g == ">"): + def _hx_local_7(): + return (e1() > e2()) + return _hx_local_7 + else: + raise haxe_Exception.thrown(("Unknown operation " + HxOverrides.stringOrNull(p1.p))) + elif (_hx_local_1 == 2): + if (_g == "!="): + def _hx_local_8(): + return not HxOverrides.eq(e1(),e2()) + return _hx_local_8 + elif (_g == "&&"): + def _hx_local_9(): + return (e1() and e2()) + return _hx_local_9 + elif (_g == "<="): + def _hx_local_10(): + return (e1() <= e2()) + return _hx_local_10 + elif (_g == "=="): + def _hx_local_11(): + return HxOverrides.eq(e1(),e2()) + return _hx_local_11 + elif (_g == ">="): + def _hx_local_12(): + return (e1() >= e2()) + return _hx_local_12 + elif (_g == "||"): + def _hx_local_13(): + return (e1() or e2()) + return _hx_local_13 + else: + raise haxe_Exception.thrown(("Unknown operation " + HxOverrides.stringOrNull(p1.p))) + else: + raise haxe_Exception.thrown(("Unknown operation " + HxOverrides.stringOrNull(p1.p))) + elif (_g == "-"): + e3 = self.makeExpr(l) + def _hx_local_14(): + return -e3() + return _hx_local_14 + else: + pass + raise haxe_Exception.thrown(p.p) + + def run(self,e): + tmp = e.index + if (tmp == 0): + v = e.params[0] + _this = self.buf + s = Std.string(Std.string(self.resolve(v))) + _this.b.write(s) + elif (tmp == 1): + e1 = e.params[0] + _this = self.buf + s = Std.string(Std.string(e1())) + _this.b.write(s) + elif (tmp == 2): + e1 = e.params[0] + eif = e.params[1] + eelse = e.params[2] + v = e1() + if ((v is None) or ((v == False))): + if (eelse is not None): + self.run(eelse) + else: + self.run(eif) + elif (tmp == 3): + _hx_str = e.params[0] + _this = self.buf + s = Std.string(_hx_str) + _this.b.write(s) + elif (tmp == 4): + l = e.params[0] + _g_head = l.h + while (_g_head is not None): + val = _g_head.item + _g_head = _g_head.next + e1 = val + self.run(e1) + elif (tmp == 5): + e1 = e.params[0] + loop = e.params[1] + v = e1() + try: + x = Reflect.field(v,"iterator")() + if (Reflect.field(x,"hasNext") is None): + raise haxe_Exception.thrown(None) + v = x + except BaseException as _g: + None + try: + if (Reflect.field(v,"hasNext") is None): + raise haxe_Exception.thrown(None) + except BaseException as _g: + raise haxe_Exception.thrown(("Cannot iter on " + Std.string(v))) + self.stack.push(self.context) + v1 = v + ctx = v1 + while ctx.hasNext(): + ctx1 = ctx.next() + self.context = ctx1 + self.run(loop) + self.context = self.stack.pop() + elif (tmp == 6): + m = e.params[0] + params = e.params[1] + v = Reflect.field(self.macros,m) + pl = list() + old = self.buf + pl.append(self.resolve) + _g_head = params.h + while (_g_head is not None): + val = _g_head.item + _g_head = _g_head.next + p = val + if (p.index == 0): + v1 = p.params[0] + x = self.resolve(v1) + pl.append(x) + else: + self.buf = StringBuf() + self.run(p) + x1 = self.buf.b.getvalue() + pl.append(x1) + self.buf = old + try: + _this = self.buf + s = Std.string(Std.string(Reflect.callMethod(self.macros,v,pl))) + _this.b.write(s) + except BaseException as _g: + None + e = haxe_Exception.caught(_g).unwrap() + plstr = None + try: + plstr = ",".join([python_Boot.toString1(x1,'') for x1 in pl]) + except BaseException as _g: + plstr = "???" + msg = (((((("Macro call " + ("null" if m is None else m)) + "(") + ("null" if plstr is None else plstr)) + ") failed (") + Std.string(e)) + ")") + raise haxe_Exception.thrown(msg) + else: + pass + +haxe_Template._hx_class = haxe_Template + + +class haxe_ValueException(haxe_Exception): + _hx_class_name = "haxe.ValueException" + __slots__ = ("value",) + _hx_fields = ["value"] + _hx_methods = ["unwrap"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_Exception + + + def __init__(self,value,previous = None,native = None): + self.value = None + super().__init__(Std.string(value),previous,native) + self.value = value + + def unwrap(self): + return self.value + +haxe_ValueException._hx_class = haxe_ValueException + + +class haxe_ds_List: + _hx_class_name = "haxe.ds.List" + __slots__ = ("h", "q", "length") + _hx_fields = ["h", "q", "length"] + _hx_methods = ["add", "push", "first", "pop", "isEmpty", "toString"] + + def __init__(self): + self.q = None + self.h = None + self.length = 0 + + def add(self,item): + x = haxe_ds__List_ListNode(item,None) + if (self.h is None): + self.h = x + else: + self.q.next = x + self.q = x + _hx_local_0 = self + _hx_local_1 = _hx_local_0.length + _hx_local_0.length = (_hx_local_1 + 1) + _hx_local_1 + + def push(self,item): + x = haxe_ds__List_ListNode(item,self.h) + self.h = x + if (self.q is None): + self.q = x + _hx_local_0 = self + _hx_local_1 = _hx_local_0.length + _hx_local_0.length = (_hx_local_1 + 1) + _hx_local_1 + + def first(self): + if (self.h is None): + return None + else: + return self.h.item + + def pop(self): + if (self.h is None): + return None + x = self.h.item + self.h = self.h.next + if (self.h is None): + self.q = None + _hx_local_0 = self + _hx_local_1 = _hx_local_0.length + _hx_local_0.length = (_hx_local_1 - 1) + _hx_local_1 + return x + + def isEmpty(self): + return (self.h is None) + + def toString(self): + s_b = python_lib_io_StringIO() + first = True + l = self.h + s_b.write("{") + while (l is not None): + if first: + first = False + else: + s_b.write(", ") + s_b.write(Std.string(Std.string(l.item))) + l = l.next + s_b.write("}") + return s_b.getvalue() + +haxe_ds_List._hx_class = haxe_ds_List + + +class haxe_ds__List_ListNode: + _hx_class_name = "haxe.ds._List.ListNode" + __slots__ = ("item", "next") + _hx_fields = ["item", "next"] + + def __init__(self,item,next): + self.item = item + self.next = next + +haxe_ds__List_ListNode._hx_class = haxe_ds__List_ListNode + + +class haxe_ds_StringMap: + _hx_class_name = "haxe.ds.StringMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + +haxe_ds_StringMap._hx_class = haxe_ds_StringMap class haxe_iterators_ArrayKeyValueIterator: @@ -560,12 +1298,21 @@ class haxe_iterators_ArrayKeyValueIterator: return _hx_AnonObject({'value': python_internal_ArrayImpl._get(self.array, self.current), 'key': _hx_local_2()}) return _hx_local_3() +haxe_iterators_ArrayKeyValueIterator._hx_class = haxe_iterators_ArrayKeyValueIterator class python_Boot: _hx_class_name = "python.Boot" __slots__ = () - _hx_statics = ["keywords", "toString1", "fields", "simpleField", "hasField", "field", "getInstanceFields", "getSuperClass", "getClassFields", "prefixLength", "unhandleKeywords"] + _hx_statics = ["keywords", "_add_dynamic", "toString1", "fields", "simpleField", "hasField", "field", "getInstanceFields", "getSuperClass", "getClassFields", "prefixLength", "unhandleKeywords"] + + @staticmethod + def _add_dynamic(a,b): + if (isinstance(a,str) and isinstance(b,str)): + return (a + b) + if (isinstance(a,str) or isinstance(b,str)): + return (python_Boot.toString1(a,"") + python_Boot.toString1(b,"")) + return (a + b) @staticmethod def toString1(o,s): @@ -981,6 +1728,7 @@ class python_Boot: if (real in python_Boot.keywords): return real return name +python_Boot._hx_class = python_Boot class python_HaxeIterator: @@ -1016,12 +1764,13 @@ class python_HaxeIterator: self.checked = True return self.has +python_HaxeIterator._hx_class = python_HaxeIterator class python_internal_ArrayImpl: _hx_class_name = "python.internal.ArrayImpl" __slots__ = () - _hx_statics = ["get_length", "concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get"] + _hx_statics = ["get_length", "concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get", "_set"] @staticmethod def get_length(x): @@ -1157,11 +1906,30 @@ class python_internal_ArrayImpl: else: return None + @staticmethod + def _set(x,idx,v): + l = len(x) + while (l < idx): + x.append(None) + l = (l + 1) + if (l == idx): + x.append(v) + else: + x[idx] = v + return v +python_internal_ArrayImpl._hx_class = python_internal_ArrayImpl + class HxOverrides: _hx_class_name = "HxOverrides" __slots__ = () - _hx_statics = ["eq", "stringOrNull", "length", "arrayGet"] + _hx_statics = ["iterator", "eq", "stringOrNull", "length", "arrayGet"] + + @staticmethod + def iterator(x): + if isinstance(x,list): + return haxe_iterators_ArrayIterator(x) + return x.iterator() @staticmethod def eq(a,b): @@ -1194,6 +1962,7 @@ class HxOverrides: return None else: return a[i] +HxOverrides._hx_class = HxOverrides class python_internal_MethodClosure: @@ -1209,6 +1978,7 @@ class python_internal_MethodClosure: def __call__(self,*args): return self.func(self.obj,*args) +python_internal_MethodClosure._hx_class = python_internal_MethodClosure class HxString: @@ -1323,6 +2093,7 @@ class HxString: if (startIndex < 0): startIndex = 0 return s[startIndex:(startIndex + _hx_len)] +HxString._hx_class = HxString class xrfragment_Filter: @@ -1457,6 +2228,7 @@ class xrfragment_Filter: qualify = (qualify + 1) return (qualify > 0) +xrfragment_Filter._hx_class = xrfragment_Filter class xrfragment_Parser: @@ -1467,25 +2239,30 @@ class xrfragment_Parser: @staticmethod def parse(key,value,store,index = None): Frag = haxe_ds_StringMap() - Frag.h["#"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE) - Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) - Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW) - Frag.h["tag"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR) + Frag.h["#"] = ((xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE) + Frag.h["src"] = xrfragment_XRF.T_URL + Frag.h["href"] = (xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW) + Frag.h["tag"] = (xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING) + Frag.h["pos"] = ((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR) Frag.h["rot"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR) - Frag.h["t"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) - Frag.h["tv"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) - Frag.h["namespace"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["SPDX"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) | xrfragment_XRF.PROMPT) + Frag.h["t"] = ((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA) + Frag.h["s"] = (xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG) + Frag.h["loop"] = xrfragment_XRF.PV_OVERRIDE + Frag.h["uv"] = (xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG) + Frag.h["namespace"] = (xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING) + Frag.h["SPDX"] = (xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING) + Frag.h["unit"] = (xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING) + Frag.h["description"] = (xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING) keyStripped = xrfragment_XRF.operators.replace(key,"") isPVDynamic = ((len(key) > 0) and (not (key in Frag.h))) - isPVDefault = (((len(value) == 0) and ((len(key) > 0))) and ((key == "#"))) if isPVDynamic: v = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR),index) v.validate(value) + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags) + if (not (key in Frag.h)): + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags) + if (len(value) == 0): + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags) setattr(store,(("_hx_" + keyStripped) if ((keyStripped in python_Boot.keywords)) else (("_hx_" + keyStripped) if (((((len(keyStripped) > 2) and ((ord(keyStripped[0]) == 95))) and ((ord(keyStripped[1]) == 95))) and ((ord(keyStripped[(len(keyStripped) - 1)]) != 95)))) else keyStripped)),v) return True v = xrfragment_XRF(key,Frag.h.get(key,None),index) @@ -1499,15 +2276,16 @@ class xrfragment_Parser: else: if Std.isOfType(value,str): v.guessType(v,value) - v.noXRF = True + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags) setattr(store,(("_hx_" + keyStripped) if ((keyStripped in python_Boot.keywords)) else (("_hx_" + keyStripped) if (((((len(keyStripped) > 2) and ((ord(keyStripped[0]) == 95))) and ((ord(keyStripped[1]) == 95))) and ((ord(keyStripped[(len(keyStripped) - 1)]) != 95)))) else keyStripped)),v) return True +xrfragment_Parser._hx_class = xrfragment_Parser class xrfragment_URI: _hx_class_name = "xrfragment.URI" __slots__ = () - _hx_statics = ["parse"] + _hx_statics = ["__meta__", "parse", "template"] @staticmethod def parse(url,_hx_filter): @@ -1534,8 +2312,13 @@ class xrfragment_URI: key = (splitByEqual[0] if 0 < len(splitByEqual) else None) value = "" if (len(splitByEqual) > 1): - _this1 = regexPlus.split((splitByEqual[1] if 1 < len(splitByEqual) else None)) - value = python_lib_urllib_Parse.unquote(" ".join([python_Boot.toString1(x1,'') for x1 in _this1])) + _this1 = xrfragment_XRF.isVector + _this1.matchObj = python_lib_Re.search(_this1.pattern,(splitByEqual[1] if 1 < len(splitByEqual) else None)) + if (_this1.matchObj is not None): + value = (splitByEqual[1] if 1 < len(splitByEqual) else None) + else: + _this2 = regexPlus.split((splitByEqual[1] if 1 < len(splitByEqual) else None)) + value = python_lib_urllib_Parse.unquote(" ".join([python_Boot.toString1(x1,'') for x1 in _this2])) ok = xrfragment_Parser.parse(key,value,store,i) if ((_hx_filter is not None) and ((_hx_filter != 0))): _g = 0 @@ -1548,25 +2331,42 @@ class xrfragment_URI: Reflect.deleteField(store,key) return store + @staticmethod + def template(uri,vars): + parts = uri.split("#") + if (len(parts) == 1): + return uri + frag = (parts[1] if 1 < len(parts) else None) + frag = StringTools.replace(frag,"{","::") + frag = StringTools.replace(frag,"}","::") + frag = haxe_Template(frag).execute(vars) + frag = StringTools.replace(frag,"null","") + python_internal_ArrayImpl._set(parts, 1, frag) + return "#".join([python_Boot.toString1(x1,'') for x1 in parts]) +xrfragment_URI._hx_class = xrfragment_URI + class xrfragment_XRF: _hx_class_name = "xrfragment.XRF" - __slots__ = ("fragment", "flags", "index", "x", "y", "z", "w", "color", "string", "int", "float", "filter", "noXRF") - _hx_fields = ["fragment", "flags", "index", "x", "y", "z", "w", "color", "string", "int", "float", "filter", "noXRF"] + __slots__ = ("fragment", "flags", "index", "x", "y", "z", "shift", "floats", "color", "string", "int", "float", "filter", "reset", "loop", "xrfScheme") + _hx_fields = ["fragment", "flags", "index", "x", "y", "z", "shift", "floats", "color", "string", "int", "float", "filter", "reset", "loop", "xrfScheme"] _hx_methods = ["is", "validate", "guessType"] - _hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "METADATA", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "operators", "isProp", "isExclude", "isDeep", "isNumber", "set", "unset"] + _hx_statics = ["IMMUTABLE", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "CUSTOMFRAG", "NAVIGATOR", "METADATA", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_MEDIAFRAG", "T_DYNAMICKEY", "T_DYNAMICKEYVALUE", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "operators", "isProp", "isExclude", "isDeep", "isNumber", "isMediaFrag", "isReset", "isShift", "isXRFScheme", "set", "unset"] def __init__(self,_fragment,_flags,_index = None): - self.noXRF = None + self.xrfScheme = None + self.loop = None + self.reset = None self.filter = None self.float = None self.int = None self.string = None self.color = None - self.w = None self.z = None self.y = None self.x = None + self.floats = list() + self.shift = list() self.fragment = _fragment self.flags = _flags self.index = _index @@ -1587,19 +2387,42 @@ class xrfragment_XRF: def guessType(self,v,_hx_str): v.string = _hx_str + _this = xrfragment_XRF.isReset + _this.matchObj = python_lib_Re.search(_this.pattern,v.fragment) + if (_this.matchObj is not None): + v.reset = True + if (v.fragment == "loop"): + v.loop = True if (not Std.isOfType(_hx_str,str)): return if (len(_hx_str) > 0): + _this = xrfragment_XRF.isXRFScheme + _this.matchObj = python_lib_Re.search(_this.pattern,_hx_str) + if (_this.matchObj is not None): + v.xrfScheme = True + _hx_str = xrfragment_XRF.isXRFScheme.replace(_hx_str,"") + v.string = _hx_str if (len(_hx_str.split(",")) > 1): - xyzw = _hx_str.split(",") - if (len(xyzw) > 0): - v.x = Std.parseFloat((xyzw[0] if 0 < len(xyzw) else None)) - if (len(xyzw) > 1): - v.y = Std.parseFloat((xyzw[1] if 1 < len(xyzw) else None)) - if (len(xyzw) > 2): - v.z = Std.parseFloat((xyzw[2] if 2 < len(xyzw) else None)) - if (len(xyzw) > 3): - v.w = Std.parseFloat((xyzw[3] if 3 < len(xyzw) else None)) + xyzn = _hx_str.split(",") + if (len(xyzn) > 0): + v.x = Std.parseFloat((xyzn[0] if 0 < len(xyzn) else None)) + if (len(xyzn) > 1): + v.y = Std.parseFloat((xyzn[1] if 1 < len(xyzn) else None)) + if (len(xyzn) > 2): + v.z = Std.parseFloat((xyzn[2] if 2 < len(xyzn) else None)) + _g = 0 + _g1 = len(xyzn) + while (_g < _g1): + i = _g + _g = (_g + 1) + _this = v.shift + _this1 = xrfragment_XRF.isShift + _this1.matchObj = python_lib_Re.search(_this1.pattern,(xyzn[i] if i >= 0 and i < len(xyzn) else None)) + x = (_this1.matchObj is not None) + _this.append(x) + _this2 = v.floats + x1 = Std.parseFloat(xrfragment_XRF.isShift.replace((xyzn[i] if i >= 0 and i < len(xyzn) else None),"")) + _this2.append(x1) _this = xrfragment_XRF.isColor _this.matchObj = python_lib_Re.search(_this.pattern,_hx_str) if (_this.matchObj is not None): @@ -1614,6 +2437,9 @@ class xrfragment_XRF: if (_this.matchObj is not None): v.int = Std.parseInt(_hx_str) v.x = v.int + _this = v.floats + x = v.x + _this.append(x) v.filter = xrfragment_Filter(((HxOverrides.stringOrNull(v.fragment) + "=") + HxOverrides.stringOrNull(v.string))) else: v.filter = xrfragment_Filter(v.fragment) @@ -1626,21 +2452,30 @@ class xrfragment_XRF: def unset(flag,flags): return (flags & ~flag) +xrfragment_XRF._hx_class = xrfragment_XRF Math.NEGATIVE_INFINITY = float("-inf") Math.POSITIVE_INFINITY = float("inf") Math.NaN = float("nan") Math.PI = python_lib_Math.pi +haxe_Template.splitter = EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()","") +haxe_Template.expr_splitter = EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)","") +haxe_Template.expr_trim = EReg("^[ ]*([^ ]+)[ ]*$","") +haxe_Template.expr_int = EReg("^[0-9]+$","") +haxe_Template.expr_float = EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$","") +haxe_Template.globals = _hx_AnonObject({}) +haxe_Template.hxKeepArrayIterator = haxe_iterators_ArrayIterator([]) python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "global", "or", "yield", "assert", "else", "if", "pass", "None", "break", "except", "import", "raise", "True", "class", "exec", "in", "return", "False", "continue", "finally", "is", "try", "def", "for", "lambda", "while"]) python_Boot.prefixLength = len("_hx_") xrfragment_Parser.error = "" xrfragment_Parser.debug = False -xrfragment_XRF.ASSET = 1 +xrfragment_URI.__meta__ = _hx_AnonObject({'statics': _hx_AnonObject({'template': _hx_AnonObject({'keep': None})})}) +xrfragment_XRF.IMMUTABLE = 1 xrfragment_XRF.PROP_BIND = 2 xrfragment_XRF.QUERY_OPERATOR = 4 xrfragment_XRF.PROMPT = 8 -xrfragment_XRF.ROUNDROBIN = 16 +xrfragment_XRF.CUSTOMFRAG = 16 xrfragment_XRF.NAVIGATOR = 32 xrfragment_XRF.METADATA = 64 xrfragment_XRF.PV_OVERRIDE = 128 @@ -1653,8 +2488,9 @@ xrfragment_XRF.T_VECTOR3 = 131072 xrfragment_XRF.T_URL = 262144 xrfragment_XRF.T_PREDEFINED_VIEW = 524288 xrfragment_XRF.T_STRING = 1048576 -xrfragment_XRF.T_STRING_OBJ = 2097152 -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304 +xrfragment_XRF.T_MEDIAFRAG = 2097152 +xrfragment_XRF.T_DYNAMICKEY = 4194304 +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608 xrfragment_XRF.isColor = EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","") xrfragment_XRF.isInt = EReg("^[-0-9]+$","") xrfragment_XRF.isFloat = EReg("^[-0-9]+\\.[0-9]+$","") @@ -1662,8 +2498,12 @@ xrfragment_XRF.isVector = EReg("([,]+|\\w)","") xrfragment_XRF.isUrl = EReg("(://)?\\..*","") xrfragment_XRF.isUrlOrPretypedView = EReg("(^#|://)?\\..*","") xrfragment_XRF.isString = EReg(".*","") -xrfragment_XRF.operators = EReg("(^-|[\\*]+)","") +xrfragment_XRF.operators = EReg("(^[-]|^[!]|[\\*]$)","g") xrfragment_XRF.isProp = EReg("^.*=[><=]?","") xrfragment_XRF.isExclude = EReg("^-","") xrfragment_XRF.isDeep = EReg("\\*","") -xrfragment_XRF.isNumber = EReg("^[0-9\\.]+$","") \ No newline at end of file +xrfragment_XRF.isNumber = EReg("^[0-9\\.]+$","") +xrfragment_XRF.isMediaFrag = EReg("^([0-9\\.,\\*+-]+)$","") +xrfragment_XRF.isReset = EReg("^!","") +xrfragment_XRF.isShift = EReg("^(\\+|--)","") +xrfragment_XRF.isXRFScheme = EReg("^xrf://","") \ No newline at end of file diff --git a/dist/xrfragment.three.js b/dist/xrfragment.three.js index 97f6ab9..860d58c 100644 --- a/dist/xrfragment.three.js +++ b/dist/xrfragment.three.js @@ -1,11 +1,18 @@ /* - * v0.5.1 generated at Wed Jan 31 06:46:04 PM UTC 2024 + * v0.5.1 generated at Fri Feb 16 04:36:12 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -19,6 +26,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -58,6 +85,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -70,6 +116,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -116,6 +177,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -149,6 +214,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -162,6 +276,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -179,6 +874,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -363,43 +1086,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -422,8 +1152,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -441,7 +1175,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -474,23 +1223,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -503,6 +1267,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -510,19 +1275,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -535,8 +1312,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -544,12 +1322,16 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; // the core project uses #vanillajs #proxies #clean #noframework var $ = typeof $ != 'undefined' ? $ : (s) => document.querySelector(s) // respect jquery @@ -567,7 +1349,14 @@ var xrf = {} xrf.init = function(opts){ opts = opts || {} - xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + + xrf.debug = document.location.hostname.match(/^(localhost|[0-9])/) ? 0 : false + if( !xrf.debug ){ + console.log("add #debug=[0-9] to URL to see XR Fragment debuglog") + xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + } + if( xrf.debug != undefined ) xrf.stats() + xrf.Parser.debug = xrf.debug xrf.detectCameraRig(opts) for ( let i in opts ) xrf[i] = opts[i] @@ -607,6 +1396,16 @@ xrf.roundrobin = (frag, store) => { return store.rr[label].index = 0 } +xrf.stats = () => { + // bookmarklet from https://github.com/zlgenuine/threejs_stats + (function(){ + for( let i = 0; i < 4; i++ ){ + var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.showPanel( i ); + stats.dom.style.marginTop = `${i*48}px`; document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script); + } + })() +} + xrf.hasTag = (tag,tags) => String(tags).match( new RegExp(`(^| )${tag}( |$)`,`g`) ) // map library functions to xrf @@ -638,14 +1437,15 @@ xrf.addEventListener = function(eventName, callback, opts) { this._listeners[eventName].push(callback); // sort this._listeners[eventName] = this._listeners[eventName].sort( (a,b) => a.opts.weight > b.opts.weight ) - return () => { + callback.unlisten = () => { this._listeners[eventName] = this._listeners[eventName].filter( (c) => c != callback ) } + return callback.unlisten }; xrf.emit = function(eventName, data){ if( typeof data != 'object' ) throw 'emit() requires passing objects' - if( xrf.debug && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ + if( xrf.debug && xrf.debug > 1 && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ let label = String(`xrf.emit('${eventName}')`).padEnd(35," "); label += data.mesh && data.mesh.name ? '#'+data.mesh.name : '' console.groupCollapsed(label) @@ -689,9 +1489,10 @@ xrf.emit.promise = function(e, opts){ } xrf.addEventListener('reset', () => { -// *TODO* do this nicely -// xrf._listeners['renderPost'] = [] -// xrf._listeners['render'] = [] + let events = ['renderPost'] + events.map( (e) => { + if( xrf._listeners[e] ) xrf._listeners[e].map( (r) => r.unlisten && r.unlisten() ) + }) }) /*! rasterizeHTML.js - v1.3.1 - 2023-07-06 * http://www.github.com/cburgmer/rasterizeHTML.js @@ -720,6 +1521,7 @@ XRWG.match = (str,types,level) => { return n }) str = str.toLowerCase() + .replace(/[!-\*]/g,'') // remove excludes and wildcards if( level <10 ) res = res.filter( (n) => n.key == str ) if( level >=10 ) res = res.filter( (n) => n.word == str || n.key == str ) if( level >30 ) res = res.filter( (n) => n.word.match(str) || n.key == str ) @@ -738,11 +1540,12 @@ XRWG.generate = (opts) => { if( !key || key.match(/(^#$|name)/) ) return let node = XRWG.get( XRWG.cleankey(key) ) if( node ){ + node.types.push(type) node.nodes.push(spatialNode) }else{ - node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] } + node = { word: XRWG.cleankey(key), key, nodes:[spatialNode], types:[] } if( spatialNode.userData[key] ) node.value = spatialNode.userData[key] - node[type] = true + node.types.push(type) xrf.emit('XRWGnode',node) XRWG.push( node ) } @@ -767,22 +1570,48 @@ XRWG.generate = (opts) => { XRWG = XRWG.reverse() // the cleankey/get functions e.g. will persist xrf.emit('XRWG',XRWG) } + +XRWG.deepApplyMatch = function(match,v,cb){ + match.map( (m) => { + for( let i in m.types ){ + let type = m.types[i] + let node = m.nodes[i] + if (type == 'name' || type == 'tag'){ + cb(match,v,node,type) + if( v.filter.q.deep ) node.traverse( (c) => cb(match,v,c,t) ) + } + } + }) +} + // the hashbus (QueryString eventBus) is mentioned in the spec // // it allows metadata-keys ('foo' e.g.) of 3D scene-nodes (.userData.foo e.g.) to // react by executing code -let pub = function( url, model, flags ){ // evaluate fragments in url +let pub = function( url, node_or_model, flags ){ // evaluate fragments in url if( !url ) return if( !url.match(/#/) ) url = `#${url}` - model = model || xrf.model let { THREE, camera } = xrf - let frag = xrf.URI.parse( url, flags ) - let opts = {frag, mesh:xrf.camera, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE, hashbus: xrf.hashbus } + let frag = xrf.URI.parse( url, flags ) + let fromNode = node_or_model != xrf.model + + let opts = { + frag, + mesh: fromNode ? node_or_model : xrf.camera, + model: xrf.model, + camera: xrf.camera, + scene: xrf.scene, + renderer: xrf.renderer, + THREE: xrf.THREE, + hashbus: xrf.hashbus + } xrf.emit('hashbus',opts) .then( () => { for ( let k in frag ){ - pub.fragment(k,opts) + let nodeAlias = fromNode && opts.mesh && opts.mesh.userData && opts.mesh.userData[k] && opts.mesh.userData[k][0] == '#' + if( nodeAlias ) pub(opts.mesh.userData[k], opts.mesh) // evaluate node alias + else pub.fragment(k,opts) } }) return frag @@ -805,7 +1634,8 @@ pub.mesh = (mesh,model) => { pub.fragment = (k, opts ) => { // evaluate one fragment let frag = opts.frag[k]; - if( !opts.skipXRWG && frag.is( xrf.XRF.PV_EXECUTE ) ) pub.XRWG(opts) + let isPVorMediaFrag = frag.is( xrf.XRF.PV_EXECUTE ) || frag.is( xrf.XRF.T_MEDIAFRAG) + if( !opts.skipXRWG && isPVorMediaFrag ) pub.XRWG(k,opts) // call native function (xrf/env.js e.g.), or pass it to user decorator xrf.emit(k,opts) @@ -816,50 +1646,53 @@ pub.fragment = (k, opts ) => { // evaluate one fragment }) } -pub.XRWG = (opts) => { +pub.XRWG = (word,opts) => { let {frag,scene,model,renderer} = opts // if this query was triggered by an src-value, lets filter it const isSRC = opts.embedded && opts.embedded.fragment == 'src' if( !isSRC ){ // spec : https://xrfragment.org/#src - for ( let i in frag ) { - let v = frag[i] - let id = v.string || v.fragment - if( id == '#' || !id ) return - let match = xrf.XRWG.match(id) - if( v.is( xrf.XRF.PV_EXECUTE ) ){ - scene.XRF_PV_ORIGIN = v.string - // evaluate aliases - match.map( (w) => { - if( w.key == `#${id}` ){ - if( w.value && w.value[0] == '#' ){ - // if value is alias, execute fragment value - xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) - } + let triggeredByMesh = opts.model != opts.mesh + + let v = frag[word] + let id = v.is( xrf.XRF.T_DYNAMICKEY ) ? word : v.string || word + + if( id == '#' || !id ) return + let match = xrf.XRWG.match(id) + + if( !triggeredByMesh && (v.is( xrf.XRF.PV_EXECUTE ) || v.is( xrf.XRF.T_DYNAMIC)) && !v.is( xrf.XRF.T_DYNAMICKEYVALUE ) ){ + // evaluate global aliases or tag/objectnames + match.map( (w) => { + if( w.key == `#${id}` ){ + if( w.value && w.value[0] == '#' ){ + // if value is alias, execute fragment value + xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) } - }) - xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) - }else{ - xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) - } + } + }) + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) + }else if( v.string ){ + // evaluate global aliases + xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) + }else{ + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) } } } xrf.hashbus = { pub } -xrf.frag = {} +xrf.frag = {dynamic:{}} xrf.model = {} xrf.mixers = [] xrf.init = ((init) => function(opts){ - console.log("add #debug to URL to see XR Fragment debuglog") let scene = new opts.THREE.Group() opts.scene.add(scene) opts.scene = scene init(opts) - if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) + //if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) xrf.patchRenderer(opts) xrf.navigator.init() @@ -876,7 +1709,7 @@ xrf.patchRenderer = function(opts){ xrf.clock = new xrf.THREE.Clock() renderer.render = ((render) => function(scene,camera){ // update clock - let time = xrf.clock.getDelta() + let time = xrf.clock.delta = xrf.clock.getDelta() xrf.emit('render',{scene,camera,time,render}) // allow fragments to do something at renderframe render(scene,camera) xrf.emit('renderPost',{scene,camera,time,render,renderer}) // allow fragments to do something after renderframe @@ -884,21 +1717,6 @@ xrf.patchRenderer = function(opts){ } -xrf.patchLoader = function(loader){ - if( loader.prototype.load.xrf_patched ) return // prevent patching aliased loaders twice - loader.prototype.load = ((load) => function(url, onLoad, onProgress, onError){ - load.call( this, - url, - (model) => { - onLoad(model); - xrf.parseModel(model,url) - }, - onProgress, - onError) - })(loader.prototype.load) - loader.prototype.load.xrf_patched = true -} - xrf.getFile = (url) => url.split("/").pop().replace(/#.*/,'') // parseModel event is essential for src.js to hook into embedded loaded models @@ -913,9 +1731,9 @@ xrf.parseModel = function(model,url){ xrf.getLastModel = () => xrf.model.last xrf.reset = () => { - // remove mixers - xrf.mixers.map( (m) => m.stop()) // stop animations *TODO* move to t.js - xrf.mixers = [] + + // allow others to reset certain events + xrf.emit('reset',{}) const disposeObject = (obj) => { if (obj.children.length > 0) obj.children.forEach((child) => disposeObject(child)); @@ -929,17 +1747,11 @@ xrf.reset = () => { return true }; let nodes = [] - xrf.scene.traverse( (n) => n.audio && (n.audio.playXRF({x:0})) && (n.audio.remove()) ) // *TODO* move to src/audio.js xrf.scene.traverse( (child) => child.isXRF && (nodes.push(child)) ) nodes.map( disposeObject ) // leave non-XRF objects intact xrf.interactive = xrf.interactiveGroup( xrf.THREE, xrf.renderer, xrf.camera) xrf.add( xrf.interactive ) xrf.layers = 0 - - // allow others to reset certain events - xrf.emit('reset',{}) - // set the player to position 0,0,0 - xrf.camera.position.set(0,0,0) } xrf.parseUrl = (url) => { @@ -1025,15 +1837,17 @@ xrf.navigator.to = (url,flags,loader,data) => { if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash ) xrf.model = model - if( !model.isXRF ) xrf.emit('parseModel',{model,url,file}) // loader.load() does this automatically (but not loader.parse) + if( !model.isXRF ) xrf.parseModel(model,url) // this marks the model as an XRF model if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) ) + + // spec: 1. generate the XRWG + xrf.XRWG.generate({model,scene:model.scene}) + // spec: 2. init metadata inside model for non-SRC data if( !model.isSRC ){ model.scene.traverse( (mesh) => xrf.hashbus.pub.mesh(mesh,model) ) } - // spec: 1. generate the XRWG - xrf.XRWG.generate({model,scene:model.scene}) // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) xrf.frag.defaultPredefinedViews({model,scene:model.scene}) @@ -1045,10 +1859,17 @@ xrf.navigator.to = (url,flags,loader,data) => { xrf.emit('navigateLoaded',{url,model}) resolve(model) } - + if( data ){ // file upload loader.parse(data, "", onLoad ) - }else loader.load(url, onLoad ) + }else{ + try{ + loader.load(url, onLoad ) + }catch(e){ + console.error(e) + xrf.emit('navigateError',{url}) + } + } }) }) }) @@ -1086,6 +1907,7 @@ xrf.navigator.setupNavigateFallbacks = () => { xrf.addEventListener('navigate', (opts) => { let {url} = opts let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + // handle http links if( url.match(/^http/) && !xrf.loaders[ext] ){ let inIframe @@ -1170,6 +1992,11 @@ xrf.frag.href = function(v, opts){ let click = mesh.userData.XRF.href.exec = (e) => { + if( !mesh.material.visible ) return + + // bubble up! + mesh.traverseAncestors( (n) => n.userData && n.userData.href && n.dispatchEvent({type:e.type,data:{}}) ) + let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}` xrf .emit('href',{click:true,mesh,xrf:v}) // let all listeners agree @@ -1180,24 +2007,21 @@ xrf.frag.href = function(v, opts){ const hasPos = isLocal && v.string.match(/pos=/) const flags = isLocal ? xrf.XRF.PV_OVERRIDE : undefined - let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) - // always commit current location in case of teleport (keep a trail of last positions before we navigate) - //if( isLocal && !hasPos ){ - // xrf.hashbus.pub( v.string, xrf.model ) // publish to hashbus - //}else{ - //if( !e.nocommit && !document.location.hash.match(lastPos) ) xrf.navigator.updateHash(`#${lastPos}`) - xrf.navigator.to(v.string) // let's surf - //} + //let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) + if( v.xrfScheme ){ + xrf.hashbus.pub(v.string) + } else xrf.navigator.to(v.string) // let's surf }) .catch( console.error ) } let selected = mesh.userData.XRF.href.selected = (state) => () => { if( mesh.selected == state ) return // nothing changed + xrf.interactive.objects.map( (o) => { let newState = o.name == mesh.name ? state : false if( o.material ){ - if( o.material.uniforms ) o.material.uniforms.selected.value = newState + if( o.material.uniforms && o.material.uniforms.selected ) o.material.uniforms.selected.value = newState //if( o.material.emissive ) o.material.emissive.r = o.material.emissive.g = o.material.emissive.b = newState ? 2.0 : 1.0 if( o.material.emissive ){ if( !o.material.emissive.original ) o.material.emissive.original = o.material.emissive.clone() @@ -1230,6 +2054,47 @@ xrf.frag.href = function(v, opts){ }, 0, mesh ) } +xrf.addEventListener('audioInited', function(opts){ + let {THREE,listener} = opts + opts.audio = opts.audio || {} + opts.audio.click = opts.audio.click || '/example/assets/audio/click.wav' + opts.audio.hover = opts.audio.hover || '/example/assets/audio/hover.wav' + opts.audio.teleport = opts.audio.teleport || '/example/assets/audio/teleport.wav' + + let audio = xrf.frag.href.audio = {} + + actions = ['click','hover','teleport'] + actions.map( (action) => { + const audioLoader = new THREE.AudioLoader(); + audio[action] = new THREE.Audio( xrf.camera.listener ) + audioLoader.load( opts.audio[action], function( buffer ) { + audio[action].setBuffer( buffer ); + }) + }); + + xrf.addEventListener('href', (opts) => { + let v = opts.xrf + if( opts.selected ){ + xrf.frag.href.audio.hover.stop() + xrf.frag.href.audio.hover.play() + return + } + if( opts.click ){ + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.click.play() + return + } + }) + + xrf.addEventListener('navigateLoading', (e) => { + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.teleport.stop() + xrf.frag.href.audio.teleport.play() + }) + + +}) + /** * > above solutions were abducted from [[this|https://i.imgur.com/E3En0gJ.png]] and [[this|https://i.imgur.com/lpnTz3A.png]] survey result * @@ -1241,6 +2106,33 @@ xrf.frag.href = function(v, opts){ * * > capture of aframe/sandbox */ +// this is called by navigator.js rather than by a URL e.g. + +xrf.frag.defaultPredefinedViews = (opts) => { + let {scene,model} = opts; + scene.traverse( (n) => { + if( n.userData && n.userData['#'] ){ + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + } + }) +} +xrf.frag.loop = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("loop",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + // update loop + mixer.loop.enabled = v.loop + + }) + +} xrf.frag.pos = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1260,13 +2152,20 @@ xrf.frag.pos = function(v, opts){ camera.position.z = pos.z } + if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) + xrf.frag.pos.last = pos // remember camera.updateMatrixWorld() } + +xrf.addEventListener('reset', (opts) => { + // set the player to position 0,0,0 + xrf.camera.position.set(0,0,0) +}) xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts - console.log(" └ setting camera rotation to "+v.string) + if( xrf.debug ) console.log("#rot.js: setting camera rotation to "+v.string) if( !model.isSRC ){ camera.rotation.set( v.x * Math.PI / 180, @@ -1284,21 +2183,52 @@ xrf.frag.rot = function(v, opts){ ) } } +xrf.frag.s = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("s",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + mixer.s = v + + // update speed + mixer.timeScale = v.x || 1.0 + mixer.loop.speed = v.x || 1.0 + mixer.loop.speedAbs = Math.abs( v.x ) + + }) + +} // *TODO* use webgl instancing xrf.frag.src = function(v, opts){ opts.embedded = v // indicate embedded XR fragment let { mesh, model, camera, scene, renderer, THREE, hashbus, frag} = opts - let url = v.string - let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) - opts.isLocal = v.string[0] == '#' + let url = xrf.frag.src.expandURI( mesh, v.string ) + let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) + opts.isLocal = v.string[0] == '#' opts.isPortal = xrf.frag.src.renderAsPortal(mesh) - opts.isSRC = true + opts.isSRC = true + + if(xrf.debug) console.log(`src.js: instancing ${opts.isLocal?'local':'remote'} object ${url}`) if( opts.isLocal ){ - xrf.frag.src.localSRC(url,srcFrag,opts) // local + xrf.frag.src.localSRC(url,srcFrag,opts) // local }else xrf.frag.src.externalSRC(url,srcFrag,opts) // external file + + xrf.hashbus.pub( url.replace(/.*#/,''), mesh) // eval src-url fragments +} + +xrf.frag.src.expandURI = function(mesh,uri){ + if( uri ) mesh.userData.srcTemplate = uri + mesh.userData.src = xrf.URI.template( mesh.userData.srcTemplate, xrf.URI.vars.__object ) + return mesh.userData.src } xrf.frag.src.addModel = (model,url,frag,opts) => { @@ -1308,7 +2238,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { if( mesh.material && mesh.userData.src ) mesh.material.visible = false // hide placeholder object //enableSourcePortation(scene) - if( xrf.frag.src.renderAsPortal(mesh) ){ + if( opts.isPortal ){ // only add remote objects, because // local scene-objects are already added to scene xrf.portalNonEuclidian({...opts,model,scene:model.scene}) @@ -1316,10 +2246,11 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { }else{ xrf.frag.src.scale( scene, opts, url ) // scale scene mesh.add(scene) - xrf.emit('parseModel', {...opts, scene, model}) } // flag everything isSRC & isXRF mesh.traverse( (n) => { n.isSRC = n.isXRF = n[ opts.isLocal ? 'isSRCLocal' : 'isSRCExternal' ] = true }) + + xrf.emit('parseModel', {...opts, isSRC:true, scene, model}) } xrf.frag.src.renderAsPortal = (mesh) => { @@ -1350,7 +2281,9 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { fetch(url, { method: 'HEAD' }) .then( (res) => { let mimetype = res.headers.get('Content-type') - if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(frag|fs|glsl)$/) ) mimetype = 'x-shader/x-fragment' + if( url.replace(/#.*/,'').match(/\.(vert|vs)$/) ) mimetype = 'x-shader/x-fragment' //if( url.match(/\.(fbx|stl|obj)$/) ) mimetype = opts = { ...opts, frag, mimetype } return xrf.frag.src.type[ mimetype ] ? xrf.frag.src.type[ mimetype ](url,opts) : xrf.frag.src.type.unknown(url,opts) @@ -1365,15 +2298,16 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { xrf.frag.src.localSRC = (url,frag,opts) => { let {model,mesh,scene} = opts - setTimeout( () => { + //setTimeout( (mesh,scene) => { if( mesh.material ) mesh.material = mesh.material.clone() // clone, so we can individually highlight meshes let _model = { animations: model.animations, - scene: scene.clone() // *TODO* opts.isPortal ? scene : scene.clone() + scene: scene.clone() + // scene: opts.isPortal ? scene : scene.clone() } _model.scenes = [_model.scene] xrf.frag.src.addModel(_model,url,frag, opts) // current file - },500 ) + //},1000,mesh,scene ) } // scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects @@ -1382,7 +2316,6 @@ xrf.frag.src.scale = function(scene, opts, url){ // remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection let cleanScene = scene.clone() - if( !cleanScene ) debugger let remove = [] const notVisible = (n) => !n.visible || (n.material && !n.material.visible) cleanScene.traverse( (n) => notVisible(n) && n.children.length == 0 && (remove.push(n)) ) @@ -1411,7 +2344,7 @@ xrf.frag.src.scale = function(scene, opts, url){ xrf.frag.src.filterScene = (scene,opts) => { let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts - scene = xrf.filter.scene({scene,frag,reparent:true}) // *TODO* ,copyScene: opts.isPortal}) + scene = xrf.filter.scene({scene,frag,reparent:true,copyScene: opts.isPortal}) if( !opts.isLocal ){ scene.traverse( (m) => { @@ -1437,23 +2370,33 @@ xrf.frag.src.type['unknown'] = function( url, opts ){ reject(`${url} mimetype '${opts.mimetype}' not found or supported (yet)`) }) } +// this ns the global #t mediafragment handler (which affects the 3D animation) + xrf.frag.t = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("t",v) + return + } + + // otherwise handle global 3D animations if( !model.mixer ) return if( !model.animations || model.animations[0] == undefined ){ console.warn('no animations found in model') return xrf.emit( v.x == 0 ? 'stop' : 'play',{isPlaying: v.x != 0 }) } - + xrf.mixers.map ( (mixer) => { mixer.t = v // update speed - mixer.timeScale = mixer.loop.speed = v.x - mixer.loop.speedAbs = Math.abs(v.x) + mixer.timeScale = mixer.loop.speed + mixer.loop.speedAbs = Math.abs( mixer.timeScale ) - if( v.y != undefined || v.z != undefined ) mixer.updateLoop( v ) + mixer.updateLoop( v ) // play animations mixer.play( v ) @@ -1470,7 +2413,7 @@ xrf.addEventListener('parseModel', (opts) => { let {model} = opts let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene) mixer.model = model - mixer.loop = {timeStart:0,timeStop:0} + mixer.loop = {timeStart:0,timeStop:0,speed:1.0} mixer.i = xrf.mixers.length mixer.actions = [] @@ -1480,28 +2423,8 @@ xrf.addEventListener('parseModel', (opts) => { mixer.actions.push( mixer.clipAction( anim, model.scene ) ) }) - - mixer.checkZombies = (animations) => { - if( mixer.zombieCheck ) return // fire only once - animations.map( (anim) => { - // collect zombie animations and warn user - let zombies = anim.tracks.map( (t) => { - let name = t.name.replace(/\..*/,'') - let obj = model.scene.getObjectByName(name) - return !model.scene.getObjectByName(name) ? {anim:anim.name,obj:name} : undefined - }) - if( zombies.length > 0 && mixer.i == 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) - zombies - .filter( (z) => z ) // filter out undefined - .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) - console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) - } - }) - mixer.zombieCheck = true - } - mixer.play = (t) => { - mixer.isPlaying = t.x != 0 + mixer.isPlaying = t.x !== undefined && t.x != t.y mixer.updateLoop(t) xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying}) } @@ -1511,35 +2434,37 @@ xrf.addEventListener('parseModel', (opts) => { } mixer.updateLoop = (t) => { - mixer.loop.timeStart = t.y != undefined ? t.y : mixer.loop.timeStart - mixer.loop.timeStop = t.z != undefined ? t.z : mixer.loop.timeStop + if( t ){ + mixer.loop.timeStart = t.x != undefined ? t.x : mixer.loop.timeStart + mixer.loop.timeStop = t.y != undefined ? t.y : mixer.duration + } mixer.actions.map( (action) => { if( mixer.loop.timeStart != undefined ){ action.time = mixer.loop.timeStart action.setLoop( xrf.THREE.LoopOnce, ) action.timeScale = mixer.timeScale action.enabled = true - if( t.x != 0 ){ - action.play() - } + if( t && t.x != undefined ) action.play() } }) mixer.setTime(mixer.loop.timeStart) mixer.time = Math.abs( mixer.loop.timeStart ) mixer.update(0) - mixer.checkZombies( model.animations) } - // update loop when needed + // monkeypatch: update loop when needed if( !mixer.update.patched ){ + let update = mixer.update mixer.update = function(time){ mixer.time = Math.abs(mixer.time) if( time == 0 ) return update.call(this,time) // loop jump - if( mixer.loop.speed > 0.0 && (mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop) ){ - setTimeout( (time,anims) => mixer.updateLoop(time), 0, mixer.loop.timeStart ) // prevent recursion + if( mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop ){ + if( mixer.loop.enabled ){ + setTimeout( () => mixer.updateLoop(), 0 ) // prevent recursion + }else mixer.stop() } return update.call( this, time ) } @@ -1574,7 +2499,7 @@ xrf.addEventListener('render', (opts) => { xrf.mixers.map( (m) => m.isPlaying && (m.update( time )) ) // update active camera in case selected by dynamicKey in URI - if( xrf.model.camera && model.mixer.isPlaying ){ + if( xrf.model.camera && xrf.model.camera.length && model.mixer.isPlaying ){ let cam = xrf.camera.getCam() // cam.fov = model.cameras[0].fov (why is blender not exporting radians?) @@ -1591,22 +2516,95 @@ xrf.addEventListener('render', (opts) => { } }) -xrf.addEventListener('dynamicKey', (opts) => { - // select active camera if any - let {id,match,v} = opts - match.map( (w) => { - w.nodes.map( (node) => { - if( node.isCamera ){ - console.log("setting camera to "+node.name) - xrf.model.camera = node - } - }) - }) +// remove mixers and stop mixers when loading another scene +xrf.addEventListener('reset', (opts) => { + xrf.mixers.map( (m) => m.stop()) + xrf.mixers = [] }) +xrf.frag.uv = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + if( !mesh.geometry ) return // nothing to do here + if( v.floats.length != 4 ) return console.warn('xrfragment.js: got less than 4 uv values ') + + xrf.frag.uv.init(mesh) + mesh.uv.u = v.floats[0] + mesh.uv.v = v.floats[1] + mesh.uv.uspeed = v.floats[2] || 1.0 + mesh.uv.vspeed = v.floats[3] || 1.0 + mesh.uv.ushift = v.shift[0] || v.floats[0] < 0 // negative u is always relative + mesh.uv.vshift = v.shift[1] || v.floats[1] < 0 // negative v is always relative + mesh.uv.uloop = v.shift[2] || false + mesh.uv.vloop = v.shift[3] || false + + mesh.onBeforeRender = xrf.frag.uv.scroll +} + +xrf.frag.uv.init = function(mesh){ + if( !mesh.uv ) mesh.uv = {u:0, v:0, uspeed:1, vspeed:1, uloop:false, vloop:false, uv:false} + + let uv = mesh.geometry.getAttribute("uv") + if( !uv.old ) uv.old = mesh.geometry.getAttribute("uv").clone() +} + +xrf.frag.uv.scroll = function(){ + + let diffU = 0.0 // distance to end-state (non-looping mode) + let diffV = 0.0 // distance to end-state (non-looping mode) + let uv = this.geometry.getAttribute("uv") + + // translate! + for( let i = 0; i < uv.count; i++ ){ + + if( this.uv.uspeed == 1.0 ) uv.setX(i, this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u ) + if( this.uv.vspeed == 1.0 ) uv.setY(i, this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v ) + + if( this.uv.uspeed != 1.0 || this.uv.vspeed != 1.0 ){ + let u = uv.getX(i) + let v = uv.getY(i) + let uTarget = this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u + let vTarget = this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v + + // scroll U + if( this.uv.uloop ){ + u += this.uv.uspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(u-uTarget) > 10.0 ) u = uv.old.getX(i) + //u = u > uTarget ? u + (this.uv.uspeed * -xrf.clock.delta) + // : u + (this.uv.uspeed * xrf.clock.delta) + //diffU += Math.abs( u - uTarget ) // are we done yet? (non-looping mode) + } + + // scroll V + if( this.uv.vloop ){ + v += this.uv.vspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(v-vTarget) > 10.0 ) v = uv.old.getY(i) + //v = v > vTarget ? v + (this.uv.vspeed * -xrf.clock.delta) + // : v + (this.uv.vspeed * xrf.clock.delta) + //diffV += Math.abs( v - vTarget ) + } + uv.setXY(i,u,v) + } + + } + uv.needsUpdate = true + + if( (!this.uv.uloop && diffU < 0.05) && + (!this.uv.vloop && diffV < 0.05) + ){ // stop animating if done + this.onBeforeRender = function(){} + } +} xrf.getCollisionMeshes = () => { let meshes = [] xrf.scene.traverse( (n) => { - if( !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ + if( n.type == 'Mesh' && !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ meshes.push(n) } }) @@ -1645,7 +2643,6 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ const tempMatrix = new Matrix4(); // Pointer Events - const element = renderer.domElement; function onPointerEvent( event ) { @@ -1675,7 +2672,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ }else{ if( object.selected ) { _event.type = 'mouseleave' - object.dispatchEvent(_event) + object.dispatchEvent( _event) } } @@ -1692,7 +2689,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ // WebXR Controller Events // TODO: Dispatch pointerevents too - const events = { + const eventsMapper = { 'move': 'mousemove', 'select': 'click', 'selectstart': 'mousedown', @@ -1712,12 +2709,14 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ if ( intersections.length > 0 ) { + console.log(object.name) + const intersection = intersections[ 0 ]; object = intersection.object; const uv = intersection.uv; - _event.type = events[ event.type ]; + _event.type = eventsMapper[ event.type ]; _event.data.set( uv.x, 1 - uv.y ); object.dispatchEvent( _event ); @@ -1754,18 +2753,119 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ return new interactive(renderer,camera) } -/* - * TODO: refactor/fix this (queries are being refactored to filters) - */ +xrf.optimize = (opts) => { + opts.animatedObjects = [] + xrf.optimize + .checkAnimations(opts) + .freezeUnAnimatedObjects(opts) + .disableShadows(opts) + .disableEmbeddedLights(opts) + .removeDuplicateLights() +} + + // check unused animations +xrf.optimize.checkAnimations = (opts) => { + if( xrf.debug ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + model.animations.map( (anim) => { + // collect zombie animations and warn user + let zombies = anim.tracks.map( (t) => { + let name = t.name.replace(/\..*/,'') + let obj = model.scene.getObjectByName(name) + if( !model.scene.getObjectByName(name) ) return {anim:anim.name,obj:name} + else opts.animatedObjects.push(name) + return undefined + }) + if( zombies.length > 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) + zombies + .filter( (z) => z ) // filter out undefined + .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) + console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) + } + }) + return xrf.optimize +} + +xrf.optimize.freezeUnAnimatedObjects = (opts) => { + if( xrf.todo ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + let scene = model.scene + // increase performance by freezing all objects + scene.traverse( (n) => n.matrixAutoUpdate = false ) + // except animated objects and children + scene.traverse( (n) => { + if( ~opts.animatedObjects.indexOf(n.name) ){ + n.matrixAutoUpdate = true + n.traverse( (m) => m.matrixAutoUpdate = true ) + } + }) + return xrf.optimize +} + +xrf.optimize.disableShadows = (opts) => { + opts.model.scene.traverse( (n) => { + if( n.castShadow !== undefined ) n.castShadow = false + }) + return xrf.optimize +} + +xrf.optimize.disableEmbeddedLights = (opts) => { + if( !opts.isSRC ) return xrf.optimize + // remove lights from SRC's + opts.model.scene.traverse( (n) => { + if( n.type.match(/light/i) ) n.remove() + }) + return xrf.optimize +} + +xrf.optimize.removeDuplicateLights = () => { + // local/extern src's can cause duplicate lights which tax performance + let lights = {} + xrf.scene.traverse( (n) => { + if( n.type.match(/light/i) ){ + if( !lights[n.name] ) lights[n.name] = true + else n.remove() + } + }) + return xrf.optimize +} + +xrf.addEventListener('parseModel', (opts) => { + xrf.optimize(opts) +}) +// switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { + // select active camera if any + let {id,match,v} = opts + match.map( (w) => { + w.nodes.map( (node) => { + if( node.isCamera ){ + console.log("switching camera to cam: "+node.name) + xrf.model.camera = node + } + }) + }) +}) + +const doFilter = (opts) => { let {scene,id,match,v} = opts if( v.filter ){ let frags = {} frags[ v.filter.key ] = v xrf.filter.scene({frag:frags,scene}) } +} + +xrf.addEventListener('dynamicKey', doFilter ) +xrf.addEventListener('dynamicKeyValue', (opts) => { + if( xrf.debug ) console.log("*TODO* filter integers only") + // doFilter(opts) }) // spec: https://xrfragment.org/#filters @@ -1881,48 +2981,116 @@ xrf.filter.process = function(frag,scene,opts){ return scene } -xrf.frag.defaultPredefinedViews = (opts) => { - let {scene,model} = opts; - scene.traverse( (n) => { - if( n.userData && n.userData['#'] ){ - let frag = xrf.URI.parse( n.userData['#'] ) - if( !n.parent && document.location.hash.length < 2){ - xrf.navigator.to( n.userData['#'] ) // evaluate static XR fragments - }else{ - xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments - } - } +xrf.frag.dynamic.material = function(v,opts){ + let {match} = opts + + // update material in case of [*]= + let material + xrf.scene.traverse( (n) => n.material && (n.material.name == v.string) && (material = n.material) ) + if( !material && !v.reset ) return // nothing to do + + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, material, v.reset ) }) } -xrf.addEventListener('dynamicKeyValue', (opts) => { - let {scene,match,v} = opts - let objname = v.fragment - let autoscroll = v.z > 0 || v.w > 0 -return // DISABLED - scene.traverse( (mesh) => { - if( mesh.name == objname ){ - if( !mesh.geometry ) return console.warn(`mesh '${objname}' has no uvcoordinates to offset`) - let uv = mesh.geometry.getAttribute("uv") - if( !uv.old ) uv.old = uv.clone() - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.old.getX(i) + v.x, uv.old.getY(i) + v.y ) +xrf.frag.dynamic.material.set = function(mesh,material,reset){ + if( !mesh.materialOriginal ) mesh.materialOriginal = mesh.material + let visible = mesh.material.visible //remember + if( reset ){ + mesh.material = mesh.materialOriginal + }else mesh.material = material + mesh.material.visible = visible +} + +// for reset calls like href: xrf://!myobject e.g. +xrf.addEventListener('dynamicKey', (opts) => { + + let {v,match} = opts + + if( v.reset ){ + xrf.XRWG.deepApplyMatch(match,v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, null, v.reset ) + }) + } + +}) + +// this holds all the URI Template variables (https://www.rfc-editor.org/rfc/rfc6570) + +xrf.addEventListener('parseModel', (opts) => { + let {model,url,file} = opts + if( model.isSRC || opts.isSRC ) return // ignore SRC models + + xrf.URI.vars = new Proxy({},{ + set(me,k,v){ + if( k.match(/^(name)$/) ) return + me[k] = v + }, + get(me,k ){ + if( k == '__object' ){ + let obj = {} + for( let i in xrf.URI.vars ) obj[i] = xrf.URI.vars[i]() + return obj } + return me[k] + }, + }) - if( autoscroll ){ - if( mesh.removeUVListener ) mesh.removeUVListener() - mesh.removeUVListener = xrf.addEventListener('render', (opts) => { - let {time} = opts - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.getX(i) + v.z * time, uv.getY(i) + v.w * time) + model.scene.traverse( (n) => { + const variables = /{([a-zA-Z0-9-]+)}/g + + if( n.userData ){ + for( let i in n.userData ){ + if( i[0] == '#' || i.match(/^(href|tag)$/) ) continue // ignore XR Fragment aliases + if( i == 'src' ){ + // lets declare empty variables found in src-values ('https://foo.com/video.mp4#{somevar}') e.g. + if( n.userData[i].match(variables) ){ + let vars = [].concat( n.userData[i].match(variables) ) + const strip = (v) => v.replace(/[{}]/g,'') + vars.map( (v) => xrf.URI.vars[ strip(v) ] = () => '' ) } - uv.needsUpdate = true - }) + }else xrf.URI.vars[i] = () => n.userData[i] // declare variables with values } - - uv.needsUpdate = true } }) + +}) + + +xrf.addEventListener('dynamicKeyValue', (opts) => { + // select active camera if any + let {id,match,v} = opts + + if( !v.is( xrf.XRF.CUSTOMFRAG) ) return // only process custom frags from here + if( v.string.match(/(<|>)/) ) return // ignore filter values + + if( match.length > 0 ){ + xrf.frag.dynamic.material(v,opts) // check if fragment is an objectname + } + + if( !xrf.URI.vars[ v.string ] ) return console.error(`'${v.string}' metadata-key not found in scene`) + //if( xrf.URI.vars[ id ] && !match.length ) return console.error(`'${id}' object/tag/metadata-key not found in scene`) + + if( xrf.debug ) console.log(`URI.vars[${id}]='${v.string}'`) + + if( xrf.URI.vars[id] ){ + xrf.URI.vars[ id ] = xrf.URI.vars[ v.string ] // update var + xrf.scene.traverse( (n) => { + // re-expand src-values which use the updated URI Template var + if( n.userData && n.userData.src && n.userData.srcTemplate && n.userData.srcTemplate.match(`{${id}}`) ){ + let srcNewFragments = xrf.frag.src.expandURI( n ).replace(/.*#/,'') + console.log(`URI.vars[${id}] => updating ${n.name} => ${srcNewFragments}`) + let frag = xrf.hashbus.pub( srcNewFragments, n ) + } + }) + }else{ + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + console.log(v.string) + if( node.geometry ) xrf.hashbus.pub( xrf.URI.vars[ v.string ](), node) // apply fragment mesh(es) + }) + } + }) xrf.addEventListener('dynamicKey', (opts) => { let {scene,id,match,v} = opts @@ -2002,68 +3170,109 @@ let loadAudio = (mimetype) => function(url,opts){ let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) let frag = xrf.URI.parse( url ) - /* WebAudio: setup context via THREEjs */ - if( !camera.listener ){ - camera.listener = new THREE.AudioListener(); - // *FIXME* camera vs camerarig conflict - (camera.getCam ? camera.getCam() : camera).add( camera.listener ); - } - + xrf.init.audio() let isPositionalAudio = !(mesh.position.x == 0 && mesh.position.y == 0 && mesh.position.z == 0) const audioLoader = new THREE.AudioLoader(); let sound = isPositionalAudio ? new THREE.PositionalAudio( camera.listener) : new THREE.Audio( camera.listener ) - mesh.audio = {} + mesh.media = mesh.media || {} + mesh.media.audio = { set: (mediafragment,v) => mesh.media.audio[mediafragment] = v } audioLoader.load( url.replace(/#.*/,''), function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(false); - sound.setVolume(1.0); + sound.setVolume( 1.0 ) if( isPositionalAudio ){ sound.setRefDistance( mesh.scale.x); sound.setRolloffFactor(20.0) //sound.setDirectionalCone( 360, 360, 0.01 ); - } + }else sound.setVolume( mesh.scale.x ) - sound.playXRF = (t) => { - mesh.add(sound) + mesh.add(sound) + + sound.set = (mediafragment,v) => { try{ - if( sound.isPlaying && t.y != undefined ) sound.stop() - if( sound.isPlaying && t.y == undefined ) sound.pause() + sound[mediafragment] = v + + if( mediafragment == 't'){ + + if( sound.isPlaying && v.y != undefined && v.x == v.y ){ + sound.offset = v.x * buffer.sampleRate ; + sound.pause() + return + }else sound.stop() - let hardcodedLoop = frag.t != undefined - t = hardcodedLoop ? { ...frag.t, x: t.x} : t // override with hardcoded metadata except playstate (x) - if( t && t.x != 0 ){ - // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well - t.x = Math.abs(t.x) - sound.setPlaybackRate( t.x ) // WebAudio does not support negative playback - // setting loop - if( t.z ) sound.setLoop( true ) // apply embedded audio/video samplerate/fps or global mixer fps - let loopStart = hardcodedLoop ? t.y : t.y * buffer.sampleRate; - let loopEnd = hardcodedLoop ? t.z : t.z * buffer.sampleRate; - let timeStart = loopStart > 0 ? loopStart : (t.y == undefined ? xrf.model.mixer.time : t.y) + sound.setLoopStart(v.x); + sound.setLoopEnd(v.y || buffer.duration); + sound.offset = v.x; + sound.play() + } - if( t.z > 0 ) sound.setLoopEnd( loopEnd ) - if( t.y != undefined ){ - sound.setLoopStart( loopStart ) - sound.offset = loopStart - } + if( mediafragment == 's'){ + // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well + sound.pause() + sound.setPlaybackRate( Math.abs(v.x) ) // WebAudio does not support negative playback + sound.play() + } + + if( mediafragment == 'loop'){ + sound.pause() + sound.setLoop( v.loop ) sound.play() } }catch(e){ console.warn(e) } } - // autoplay if user already requested play - let autoplay = mesh.audio && mesh.audio.autoplay - mesh.audio = sound - if( autoplay ) xrf.hashbus.pub(mesh.audio.autoplay) + let lazySet = {} + let mediaFragments = ['t','loop','s'] + mediaFragments.map( (f) => mesh.media.audio[f] && (lazySet[f] = mesh.media.audio[f]) ) + mesh.media.audio = sound + + // autoplay if user already requested play (before the sound was loaded) + mediaFragments.map( (f) => { + if( lazySet[f] ) mesh.media.audio.set(f, lazySet[f] ) + }) + }); + + // apply Media fragments from URL + (['t','loop','s']).map( (f) => { + if( frag[f] ){ + mesh.media.audio.set( f, frag[f] ) + } + }) + } +xrf.init.audio = (opts) => { + let camera = xrf.camera + /* WebAudio: setup context via THREEjs */ + if( !camera.listener ){ + camera.listener = new THREE.AudioListener(); + // *FIXME* camera vs camerarig conflict + (camera.getCam ? camera.getCam() : camera).add( camera.listener ); + xrf.emit('audioInited',{listener:camera.listener, ...opts}) + } +} +xrf.addEventListener('init', xrf.init.audio ) + +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => { + if( n.media && n.media.audio ){ + if( n.media.audio.stop ) n.media.audio.stop() + if( n.media.audio.remove ) n.media.audio.remove() + } + }) +}) + + + let audioMimeTypes = [ + 'audio/x-wav', 'audio/wav', 'audio/mpeg', 'audio/mp3', @@ -2072,16 +3281,99 @@ let audioMimeTypes = [ 'application/ogg' ] audioMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadAudio(mimetype) ) +/* + * mimetype: model/gltf+json + */ -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => { - if( !n.audio ) return - if( !n.audio.playXRF ) n.audio.autoplay = t - else n.audio.playXRF(t) +xrf.frag.src.type['fbx'] = function( url, opts ){ + return new Promise( async (resolve,reject) => { + let {mesh,src} = opts + let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + let loader + + //let {THREE} = await import('https://unpkg.com/three@0.161.0/build/three.module.js') + //let { FBXLoader } = await import('three/addons/loaders/FBXLoader.js') + + //const Loader = xrf.loaders[ext] + //if( !Loader ) throw 'xrfragment: no loader passed to xrfragment for extension .'+ext + //if( !dir.match("://") ){ // force relative path + // dir = dir[0] == './' ? dir : `./${dir}` + // loader = new Loader().setPath( dir ) + //}else loader = new Loader() + + //loader.load(url, (model) => { + // model.isSRC = true + // resolve(model) + //}) }) -}) +} + +/* + * extensions: .frag/.fs/.vs/.vert + */ + +xrf.frag.src.type['x-shader/x-fragment'] = function(url,opts){ + let {mesh,THREE} = opts + + let isFragmentShader = /\.(fs|frag|glsl)$/ + let isVertexShader = /\.(vs|vert)$/ + + let shaderReqs = [] + let shaderCode = {} + let shader = { + fragment: { code: '', url: url.match( isFragmentShader ) ? url : '' }, + vertex: { code: '', url: url.match( isVertexShader ) ? url : '' } + } + + var onShaderLoaded = ((args) => (type, status, code) => { + shader[type].status = status + shader[type].code = code + if( shader.fragment.code && shader.vertex.code ){ + + let oldMaterial = mesh.material + mesh.material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2(1.0,1.0) } + }, + // basic shaders include following common vars/funcs: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/common.glsl.js + fragmentShader: shader.fragment.status == 200 ? shader.fragment.code : THREE.ShaderChunk.meshbasic_frag, + vertexShader: shader.vertex.status == 200 ? shader.vertex.code : THREE.ShaderChunk.meshbasic_vert, + + }); + + mesh.material.needsUpdate = true + mesh.needsUpdate = true + + mesh.onBeforeRender = () => { + if( !mesh.material || !mesh.material.uniforms ) return mesh.onBeforeRender = function(){} + mesh.material.uniforms.time.value = xrf.clock.elapsedTime + } + + } + + })({}) + + // sidecar-load vertex shader file + if( shader.fragment.url && !shader.vertex.url ){ + shader.vertex.url = shader.fragment.url.replace(/\.fs$/, '.vs') + .replace(/\.frag$/, '.vert') + } + + if( shader.fragment.url ){ + fetch(shader.fragment.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('fragment',res.status,code) ) ) + } + + if( shader.vertex.url ){ + fetch(shader.vertex.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('vertex',res.status,code) ) ) + } + +} + +xrf.frag.src.type['x-shader/x-vertex'] = xrf.frag.src.type['x-shader/x-fragment'] + /* * mimetype: model/gltf+json */ @@ -2153,6 +3445,14 @@ xrf.frag.src.type['image/png'] = function(url,opts){ mesh.material.map = texture mesh.material.needsUpdate = true mesh.needsUpdate = true + + //// *TODO* update clones in portals or dont clone scene of portals.. + //xrf.scene.traverse( (n) => { + // if( n.userData.src == mesh.userData.src && mesh.uuid != n.uuid ){ + // n.material = mesh.material + // n.material.needsUpdate = true + // } + //}) } let onLoad = (texture) => { @@ -2174,7 +3474,6 @@ xrf.frag.src.type['image/jpeg'] = xrf.frag.src.type['image/png'] xrf.portalNonEuclidian = function(opts){ let { frag, mesh, model, camera, scene, renderer} = opts - mesh.portal = { pos: mesh.position.clone(), posWorld: new xrf.THREE.Vector3(), @@ -2232,7 +3531,7 @@ xrf.portalNonEuclidian = function(opts){ mesh.portal.stencilObjects.children = stencilObjects xrf.portalNonEuclidian.stencilRef += 1 // each portal has unique stencil id - console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) + if( xrf.debug ) console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) return this } @@ -2245,6 +3544,9 @@ xrf.portalNonEuclidian = function(opts){ this.setupListeners = () => { + // below is a somewhat weird tapdance to render the portals **after** the scene + // is rendered (otherwise it messes up occlusion) + mesh.onAfterRender = function(renderer, scene, camera, geometry, material, group ){ mesh.portal.needUpdate = true } @@ -2264,7 +3566,7 @@ xrf.portalNonEuclidian = function(opts){ let cam = xrf.camera.getCam ? xrf.camera.getCam() : camera cam.getWorldPosition(cameraPosition) cam.getWorldDirection(cameraDirection) - if( cameraPosition.distanceTo(newPos) > 10.0 ) return // dont render far portals + if( cameraPosition.distanceTo(newPos) > 15.0 ) return // dont render far portals // init if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = true @@ -2373,7 +3675,9 @@ let loadVideo = (mimetype) => function(url,opts){ const THREE = xrf.THREE let frag = xrf.URI.parse( url ) - let video = mesh.video = document.createElement('video') + mesh.media = mesh.media || {} + + let video = mesh.media.video = document.createElement('video') video.setAttribute("crossOrigin","anonymous") video.setAttribute("playsinline",'') video.addEventListener('loadedmetadata', function(){ @@ -2383,33 +3687,45 @@ let loadVideo = (mimetype) => function(url,opts){ mat.map = texture mesh.material = mat // set range - //video.addEventListener('timeupdate', function timeupdate() { - // if (frag.t && video.currentTime < frag.t.y || video.currentTime >= frag.t.z ) { - // video.currentTime = frag.t.y - // } - //},false) + video.addEventListener('timeupdate', function timeupdate() { + if (video.t && video.t.y !== undefined && video.t.y > video.t.x && Math.abs(video.currentTime) >= video.t.y ){ + if( video.looping ) video.currentTime = video.t.x // speed means loop + else video.pause() + } + },false) }) video.src = url - video.playXRF = (t) => { - video.t = t - if( t.x == 0 ) video.pause() - else{ - video.playbackRate = Math.abs( t.x ) // html5 video does not support reverseplay :/ - video.play() + video.speed = 1.0 + video.looping = false + video.set = (mediafragment,v) => { + video[mediafragment] = v + + if( mediafragment == 't'){ + video.pause() + if( v.x !== undefined && v.x == v.y ) return // stop paused + else{ + video.currentTime = v.x + video.time = v.x + video.play() + } + } + if( mediafragment == 's' ){ + video.playbackRate = Math.abs( v.x ) // html5 video does not support reverseplay :/ + } + if( mediafragment == 'loop' ){ + video.looping = true } - if( t.y != undefined ) video.time = t.y } } +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => n.media && n.media.video && (n.media.video.pause()) && (n.media.video.remove()) ) +}) + let videoMimeTypes = [ 'video/ogg', 'video/mp4' ] videoMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadVideo(mimetype) ) - -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => n.video && (n.video.playXRF(t)) ) -}) diff --git a/dist/xrfragment.three.module.js b/dist/xrfragment.three.module.js index 49a577f..1350052 100644 --- a/dist/xrfragment.three.module.js +++ b/dist/xrfragment.three.module.js @@ -1,11 +1,18 @@ /* - * v0.5.1 generated at Wed Jan 31 06:46:04 PM UTC 2024 + * v0.5.1 generated at Fri Feb 16 04:36:12 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; (function ($global) { "use strict"; $hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; @@ -19,6 +26,26 @@ EReg.prototype = { this.r.s = s; return this.r.m != null; } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } ,split: function(s) { var d = "#__delim__#"; return s.replace(this.r,d).split(d); @@ -58,6 +85,25 @@ Reflect.field = function(o,field) { return null; } }; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; Reflect.fields = function(o) { var a = []; if(o != null) { @@ -70,6 +116,21 @@ Reflect.fields = function(o) { } return a; }; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; Reflect.deleteField = function(o,field) { if(!Object.prototype.hasOwnProperty.call(o,field)) { return false; @@ -116,6 +177,10 @@ Std.parseInt = function(x) { } return null; }; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; var StringTools = function() { }; StringTools.__name__ = true; StringTools.isSpace = function(s,pos) { @@ -149,6 +214,55 @@ StringTools.rtrim = function(s) { StringTools.trim = function(s) { return StringTools.ltrim(StringTools.rtrim(s)); }; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; @@ -162,6 +276,587 @@ haxe_iterators_ArrayIterator.prototype = { return this.array[this.current++]; } }; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -179,6 +874,34 @@ js_Boot.__string_rec = function(o,s) { case "function": return ""; case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } if(((o) instanceof Array)) { var str = "["; s += "\t"; @@ -363,43 +1086,50 @@ var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; xrfragment_Parser.__name__ = true; xrfragment_Parser.parse = function(key,value,store,index) { var Frag_h = Object.create(null); - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; - Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; var keyStripped = key.replace(xrfragment_XRF.operators.r,""); var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); - var isPVDefault = value.length == 0 && key.length > 0 && key == "#"; if(isPVDynamic) { var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } store[keyStripped] = v; return true; } var v = new xrfragment_XRF(key,Frag_h[key],index); if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); return false; } store[keyStripped] = v; if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string); + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); } } else { if(typeof(value) == "string") { v.guessType(v,value); } - v.noXRF = true; + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); store[keyStripped] = v; } return true; @@ -422,8 +1152,12 @@ xrfragment_URI.parse = function(url,filter) { var key = splitByEqual[0]; var value = ""; if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } } var ok = xrfragment_Parser.parse(key,value,store,i); } @@ -441,7 +1175,22 @@ xrfragment_URI.parse = function(url,filter) { } return store; }; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; this.fragment = _fragment; this.flags = _flags; this.index = _index; @@ -474,23 +1223,38 @@ xrfragment_XRF.prototype = { } ,guessType: function(v,str) { v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } if(typeof(str) != "string") { return; } if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } if(str.split(",").length > 1) { - var xyzw = str.split(","); - if(xyzw.length > 0) { - v.x = parseFloat(xyzw[0]); + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); } - if(xyzw.length > 1) { - v.y = parseFloat(xyzw[1]); + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); } - if(xyzw.length > 2) { - v.z = parseFloat(xyzw[2]); + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); } - if(xyzw.length > 3) { - v.w = parseFloat(xyzw[3]); + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); } } if(xrfragment_XRF.isColor.match(str)) { @@ -503,6 +1267,7 @@ xrfragment_XRF.prototype = { if(xrfragment_XRF.isInt.match(str)) { v.int = Std.parseInt(str); v.x = v.int; + v.floats.push(v.x); } v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); } else { @@ -510,19 +1275,31 @@ xrfragment_XRF.prototype = { } } }; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); xrfragment_Parser.error = ""; xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_XRF.IMMUTABLE = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; +xrfragment_XRF.CUSTOMFRAG = 16; xrfragment_XRF.NAVIGATOR = 32; xrfragment_XRF.METADATA = 64; xrfragment_XRF.PV_OVERRIDE = 128; @@ -535,8 +1312,9 @@ xrfragment_XRF.T_VECTOR3 = 131072; xrfragment_XRF.T_URL = 262144; xrfragment_XRF.T_PREDEFINED_VIEW = 524288; xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); @@ -544,12 +1322,16 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); xrfragment_XRF.isString = new EReg(".*",""); -xrfragment_XRF.operators = new EReg("(^-|[\\*]+)",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); xrfragment_XRF.isExclude = new EReg("^-",""); xrfragment_XRF.isDeep = new EReg("\\*",""); xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); -})({}); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; // the core project uses #vanillajs #proxies #clean #noframework var $ = typeof $ != 'undefined' ? $ : (s) => document.querySelector(s) // respect jquery @@ -567,7 +1349,14 @@ var xrf = {} xrf.init = function(opts){ opts = opts || {} - xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + + xrf.debug = document.location.hostname.match(/^(localhost|[0-9])/) ? 0 : false + if( !xrf.debug ){ + console.log("add #debug=[0-9] to URL to see XR Fragment debuglog") + xrf.debug = parseInt( ( document.location.hash.match(/debug=([0-9])/) || [0,'0'] )[1] ) + } + if( xrf.debug != undefined ) xrf.stats() + xrf.Parser.debug = xrf.debug xrf.detectCameraRig(opts) for ( let i in opts ) xrf[i] = opts[i] @@ -607,6 +1396,16 @@ xrf.roundrobin = (frag, store) => { return store.rr[label].index = 0 } +xrf.stats = () => { + // bookmarklet from https://github.com/zlgenuine/threejs_stats + (function(){ + for( let i = 0; i < 4; i++ ){ + var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.showPanel( i ); + stats.dom.style.marginTop = `${i*48}px`; document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script); + } + })() +} + xrf.hasTag = (tag,tags) => String(tags).match( new RegExp(`(^| )${tag}( |$)`,`g`) ) // map library functions to xrf @@ -638,14 +1437,15 @@ xrf.addEventListener = function(eventName, callback, opts) { this._listeners[eventName].push(callback); // sort this._listeners[eventName] = this._listeners[eventName].sort( (a,b) => a.opts.weight > b.opts.weight ) - return () => { + callback.unlisten = () => { this._listeners[eventName] = this._listeners[eventName].filter( (c) => c != callback ) } + return callback.unlisten }; xrf.emit = function(eventName, data){ if( typeof data != 'object' ) throw 'emit() requires passing objects' - if( xrf.debug && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ + if( xrf.debug && xrf.debug > 1 && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){ let label = String(`xrf.emit('${eventName}')`).padEnd(35," "); label += data.mesh && data.mesh.name ? '#'+data.mesh.name : '' console.groupCollapsed(label) @@ -689,9 +1489,10 @@ xrf.emit.promise = function(e, opts){ } xrf.addEventListener('reset', () => { -// *TODO* do this nicely -// xrf._listeners['renderPost'] = [] -// xrf._listeners['render'] = [] + let events = ['renderPost'] + events.map( (e) => { + if( xrf._listeners[e] ) xrf._listeners[e].map( (r) => r.unlisten && r.unlisten() ) + }) }) /*! rasterizeHTML.js - v1.3.1 - 2023-07-06 * http://www.github.com/cburgmer/rasterizeHTML.js @@ -720,6 +1521,7 @@ XRWG.match = (str,types,level) => { return n }) str = str.toLowerCase() + .replace(/[!-\*]/g,'') // remove excludes and wildcards if( level <10 ) res = res.filter( (n) => n.key == str ) if( level >=10 ) res = res.filter( (n) => n.word == str || n.key == str ) if( level >30 ) res = res.filter( (n) => n.word.match(str) || n.key == str ) @@ -738,11 +1540,12 @@ XRWG.generate = (opts) => { if( !key || key.match(/(^#$|name)/) ) return let node = XRWG.get( XRWG.cleankey(key) ) if( node ){ + node.types.push(type) node.nodes.push(spatialNode) }else{ - node = { word: XRWG.cleankey(key), key, nodes:[spatialNode] } + node = { word: XRWG.cleankey(key), key, nodes:[spatialNode], types:[] } if( spatialNode.userData[key] ) node.value = spatialNode.userData[key] - node[type] = true + node.types.push(type) xrf.emit('XRWGnode',node) XRWG.push( node ) } @@ -767,22 +1570,48 @@ XRWG.generate = (opts) => { XRWG = XRWG.reverse() // the cleankey/get functions e.g. will persist xrf.emit('XRWG',XRWG) } + +XRWG.deepApplyMatch = function(match,v,cb){ + match.map( (m) => { + for( let i in m.types ){ + let type = m.types[i] + let node = m.nodes[i] + if (type == 'name' || type == 'tag'){ + cb(match,v,node,type) + if( v.filter.q.deep ) node.traverse( (c) => cb(match,v,c,t) ) + } + } + }) +} + // the hashbus (QueryString eventBus) is mentioned in the spec // // it allows metadata-keys ('foo' e.g.) of 3D scene-nodes (.userData.foo e.g.) to // react by executing code -let pub = function( url, model, flags ){ // evaluate fragments in url +let pub = function( url, node_or_model, flags ){ // evaluate fragments in url if( !url ) return if( !url.match(/#/) ) url = `#${url}` - model = model || xrf.model let { THREE, camera } = xrf - let frag = xrf.URI.parse( url, flags ) - let opts = {frag, mesh:xrf.camera, model, camera: xrf.camera, scene: xrf.scene, renderer: xrf.renderer, THREE: xrf.THREE, hashbus: xrf.hashbus } + let frag = xrf.URI.parse( url, flags ) + let fromNode = node_or_model != xrf.model + + let opts = { + frag, + mesh: fromNode ? node_or_model : xrf.camera, + model: xrf.model, + camera: xrf.camera, + scene: xrf.scene, + renderer: xrf.renderer, + THREE: xrf.THREE, + hashbus: xrf.hashbus + } xrf.emit('hashbus',opts) .then( () => { for ( let k in frag ){ - pub.fragment(k,opts) + let nodeAlias = fromNode && opts.mesh && opts.mesh.userData && opts.mesh.userData[k] && opts.mesh.userData[k][0] == '#' + if( nodeAlias ) pub(opts.mesh.userData[k], opts.mesh) // evaluate node alias + else pub.fragment(k,opts) } }) return frag @@ -805,7 +1634,8 @@ pub.mesh = (mesh,model) => { pub.fragment = (k, opts ) => { // evaluate one fragment let frag = opts.frag[k]; - if( !opts.skipXRWG && frag.is( xrf.XRF.PV_EXECUTE ) ) pub.XRWG(opts) + let isPVorMediaFrag = frag.is( xrf.XRF.PV_EXECUTE ) || frag.is( xrf.XRF.T_MEDIAFRAG) + if( !opts.skipXRWG && isPVorMediaFrag ) pub.XRWG(k,opts) // call native function (xrf/env.js e.g.), or pass it to user decorator xrf.emit(k,opts) @@ -816,50 +1646,53 @@ pub.fragment = (k, opts ) => { // evaluate one fragment }) } -pub.XRWG = (opts) => { +pub.XRWG = (word,opts) => { let {frag,scene,model,renderer} = opts // if this query was triggered by an src-value, lets filter it const isSRC = opts.embedded && opts.embedded.fragment == 'src' if( !isSRC ){ // spec : https://xrfragment.org/#src - for ( let i in frag ) { - let v = frag[i] - let id = v.string || v.fragment - if( id == '#' || !id ) return - let match = xrf.XRWG.match(id) - if( v.is( xrf.XRF.PV_EXECUTE ) ){ - scene.XRF_PV_ORIGIN = v.string - // evaluate aliases - match.map( (w) => { - if( w.key == `#${id}` ){ - if( w.value && w.value[0] == '#' ){ - // if value is alias, execute fragment value - xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) - } + let triggeredByMesh = opts.model != opts.mesh + + let v = frag[word] + let id = v.is( xrf.XRF.T_DYNAMICKEY ) ? word : v.string || word + + if( id == '#' || !id ) return + let match = xrf.XRWG.match(id) + + if( !triggeredByMesh && (v.is( xrf.XRF.PV_EXECUTE ) || v.is( xrf.XRF.T_DYNAMIC)) && !v.is( xrf.XRF.T_DYNAMICKEYVALUE ) ){ + // evaluate global aliases or tag/objectnames + match.map( (w) => { + if( w.key == `#${id}` ){ + if( w.value && w.value[0] == '#' ){ + // if value is alias, execute fragment value + xrf.hashbus.pub( w.value, xrf.model, xrf.XRF.METADATA | xrf.XRF.PV_OVERRIDE | xrf.XRF.NAVIGATOR ) } - }) - xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) - }else{ - xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) - } + } + }) + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) + }else if( v.string ){ + // evaluate global aliases + xrf.emit('dynamicKeyValue',{ ...opts,v,frag,id,match,scene }) + }else{ + xrf.emit('dynamicKey',{ ...opts,v,frag,id,match,scene }) } } } xrf.hashbus = { pub } -xrf.frag = {} +xrf.frag = {dynamic:{}} xrf.model = {} xrf.mixers = [] xrf.init = ((init) => function(opts){ - console.log("add #debug to URL to see XR Fragment debuglog") let scene = new opts.THREE.Group() opts.scene.add(scene) opts.scene = scene init(opts) - if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) + //if( opts.loaders ) Object.values(opts.loaders).map( xrf.patchLoader ) xrf.patchRenderer(opts) xrf.navigator.init() @@ -876,7 +1709,7 @@ xrf.patchRenderer = function(opts){ xrf.clock = new xrf.THREE.Clock() renderer.render = ((render) => function(scene,camera){ // update clock - let time = xrf.clock.getDelta() + let time = xrf.clock.delta = xrf.clock.getDelta() xrf.emit('render',{scene,camera,time,render}) // allow fragments to do something at renderframe render(scene,camera) xrf.emit('renderPost',{scene,camera,time,render,renderer}) // allow fragments to do something after renderframe @@ -884,21 +1717,6 @@ xrf.patchRenderer = function(opts){ } -xrf.patchLoader = function(loader){ - if( loader.prototype.load.xrf_patched ) return // prevent patching aliased loaders twice - loader.prototype.load = ((load) => function(url, onLoad, onProgress, onError){ - load.call( this, - url, - (model) => { - onLoad(model); - xrf.parseModel(model,url) - }, - onProgress, - onError) - })(loader.prototype.load) - loader.prototype.load.xrf_patched = true -} - xrf.getFile = (url) => url.split("/").pop().replace(/#.*/,'') // parseModel event is essential for src.js to hook into embedded loaded models @@ -913,9 +1731,9 @@ xrf.parseModel = function(model,url){ xrf.getLastModel = () => xrf.model.last xrf.reset = () => { - // remove mixers - xrf.mixers.map( (m) => m.stop()) // stop animations *TODO* move to t.js - xrf.mixers = [] + + // allow others to reset certain events + xrf.emit('reset',{}) const disposeObject = (obj) => { if (obj.children.length > 0) obj.children.forEach((child) => disposeObject(child)); @@ -929,17 +1747,11 @@ xrf.reset = () => { return true }; let nodes = [] - xrf.scene.traverse( (n) => n.audio && (n.audio.playXRF({x:0})) && (n.audio.remove()) ) // *TODO* move to src/audio.js xrf.scene.traverse( (child) => child.isXRF && (nodes.push(child)) ) nodes.map( disposeObject ) // leave non-XRF objects intact xrf.interactive = xrf.interactiveGroup( xrf.THREE, xrf.renderer, xrf.camera) xrf.add( xrf.interactive ) xrf.layers = 0 - - // allow others to reset certain events - xrf.emit('reset',{}) - // set the player to position 0,0,0 - xrf.camera.position.set(0,0,0) } xrf.parseUrl = (url) => { @@ -1025,15 +1837,17 @@ xrf.navigator.to = (url,flags,loader,data) => { if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash ) xrf.model = model - if( !model.isXRF ) xrf.emit('parseModel',{model,url,file}) // loader.load() does this automatically (but not loader.parse) + if( !model.isXRF ) xrf.parseModel(model,url) // this marks the model as an XRF model if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) ) + + // spec: 1. generate the XRWG + xrf.XRWG.generate({model,scene:model.scene}) + // spec: 2. init metadata inside model for non-SRC data if( !model.isSRC ){ model.scene.traverse( (mesh) => xrf.hashbus.pub.mesh(mesh,model) ) } - // spec: 1. generate the XRWG - xrf.XRWG.generate({model,scene:model.scene}) // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) xrf.frag.defaultPredefinedViews({model,scene:model.scene}) @@ -1045,10 +1859,17 @@ xrf.navigator.to = (url,flags,loader,data) => { xrf.emit('navigateLoaded',{url,model}) resolve(model) } - + if( data ){ // file upload loader.parse(data, "", onLoad ) - }else loader.load(url, onLoad ) + }else{ + try{ + loader.load(url, onLoad ) + }catch(e){ + console.error(e) + xrf.emit('navigateError',{url}) + } + } }) }) }) @@ -1086,6 +1907,7 @@ xrf.navigator.setupNavigateFallbacks = () => { xrf.addEventListener('navigate', (opts) => { let {url} = opts let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + // handle http links if( url.match(/^http/) && !xrf.loaders[ext] ){ let inIframe @@ -1170,6 +1992,11 @@ xrf.frag.href = function(v, opts){ let click = mesh.userData.XRF.href.exec = (e) => { + if( !mesh.material.visible ) return + + // bubble up! + mesh.traverseAncestors( (n) => n.userData && n.userData.href && n.dispatchEvent({type:e.type,data:{}}) ) + let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}` xrf .emit('href',{click:true,mesh,xrf:v}) // let all listeners agree @@ -1180,24 +2007,21 @@ xrf.frag.href = function(v, opts){ const hasPos = isLocal && v.string.match(/pos=/) const flags = isLocal ? xrf.XRF.PV_OVERRIDE : undefined - let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) - // always commit current location in case of teleport (keep a trail of last positions before we navigate) - //if( isLocal && !hasPos ){ - // xrf.hashbus.pub( v.string, xrf.model ) // publish to hashbus - //}else{ - //if( !e.nocommit && !document.location.hash.match(lastPos) ) xrf.navigator.updateHash(`#${lastPos}`) - xrf.navigator.to(v.string) // let's surf - //} + //let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) + if( v.xrfScheme ){ + xrf.hashbus.pub(v.string) + } else xrf.navigator.to(v.string) // let's surf }) .catch( console.error ) } let selected = mesh.userData.XRF.href.selected = (state) => () => { if( mesh.selected == state ) return // nothing changed + xrf.interactive.objects.map( (o) => { let newState = o.name == mesh.name ? state : false if( o.material ){ - if( o.material.uniforms ) o.material.uniforms.selected.value = newState + if( o.material.uniforms && o.material.uniforms.selected ) o.material.uniforms.selected.value = newState //if( o.material.emissive ) o.material.emissive.r = o.material.emissive.g = o.material.emissive.b = newState ? 2.0 : 1.0 if( o.material.emissive ){ if( !o.material.emissive.original ) o.material.emissive.original = o.material.emissive.clone() @@ -1230,6 +2054,47 @@ xrf.frag.href = function(v, opts){ }, 0, mesh ) } +xrf.addEventListener('audioInited', function(opts){ + let {THREE,listener} = opts + opts.audio = opts.audio || {} + opts.audio.click = opts.audio.click || '/example/assets/audio/click.wav' + opts.audio.hover = opts.audio.hover || '/example/assets/audio/hover.wav' + opts.audio.teleport = opts.audio.teleport || '/example/assets/audio/teleport.wav' + + let audio = xrf.frag.href.audio = {} + + actions = ['click','hover','teleport'] + actions.map( (action) => { + const audioLoader = new THREE.AudioLoader(); + audio[action] = new THREE.Audio( xrf.camera.listener ) + audioLoader.load( opts.audio[action], function( buffer ) { + audio[action].setBuffer( buffer ); + }) + }); + + xrf.addEventListener('href', (opts) => { + let v = opts.xrf + if( opts.selected ){ + xrf.frag.href.audio.hover.stop() + xrf.frag.href.audio.hover.play() + return + } + if( opts.click ){ + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.click.play() + return + } + }) + + xrf.addEventListener('navigateLoading', (e) => { + xrf.frag.href.audio.click.stop() + xrf.frag.href.audio.teleport.stop() + xrf.frag.href.audio.teleport.play() + }) + + +}) + /** * > above solutions were abducted from [[this|https://i.imgur.com/E3En0gJ.png]] and [[this|https://i.imgur.com/lpnTz3A.png]] survey result * @@ -1241,6 +2106,33 @@ xrf.frag.href = function(v, opts){ * * > capture of aframe/sandbox */ +// this is called by navigator.js rather than by a URL e.g. + +xrf.frag.defaultPredefinedViews = (opts) => { + let {scene,model} = opts; + scene.traverse( (n) => { + if( n.userData && n.userData['#'] ){ + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + } + }) +} +xrf.frag.loop = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("loop",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + // update loop + mixer.loop.enabled = v.loop + + }) + +} xrf.frag.pos = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1260,13 +2152,20 @@ xrf.frag.pos = function(v, opts){ camera.position.z = pos.z } + if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) + xrf.frag.pos.last = pos // remember camera.updateMatrixWorld() } + +xrf.addEventListener('reset', (opts) => { + // set the player to position 0,0,0 + xrf.camera.position.set(0,0,0) +}) xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts - console.log(" └ setting camera rotation to "+v.string) + if( xrf.debug ) console.log("#rot.js: setting camera rotation to "+v.string) if( !model.isSRC ){ camera.rotation.set( v.x * Math.PI / 180, @@ -1284,21 +2183,52 @@ xrf.frag.rot = function(v, opts){ ) } } +xrf.frag.s = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("s",v) + return + } + + // otherwise handle global 3D animations + xrf.mixers.map ( (mixer) => { + mixer.s = v + + // update speed + mixer.timeScale = v.x || 1.0 + mixer.loop.speed = v.x || 1.0 + mixer.loop.speedAbs = Math.abs( v.x ) + + }) + +} // *TODO* use webgl instancing xrf.frag.src = function(v, opts){ opts.embedded = v // indicate embedded XR fragment let { mesh, model, camera, scene, renderer, THREE, hashbus, frag} = opts - let url = v.string - let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) - opts.isLocal = v.string[0] == '#' + let url = xrf.frag.src.expandURI( mesh, v.string ) + let srcFrag = opts.srcFrag = xrfragment.URI.parse(url) + opts.isLocal = v.string[0] == '#' opts.isPortal = xrf.frag.src.renderAsPortal(mesh) - opts.isSRC = true + opts.isSRC = true + + if(xrf.debug) console.log(`src.js: instancing ${opts.isLocal?'local':'remote'} object ${url}`) if( opts.isLocal ){ - xrf.frag.src.localSRC(url,srcFrag,opts) // local + xrf.frag.src.localSRC(url,srcFrag,opts) // local }else xrf.frag.src.externalSRC(url,srcFrag,opts) // external file + + xrf.hashbus.pub( url.replace(/.*#/,''), mesh) // eval src-url fragments +} + +xrf.frag.src.expandURI = function(mesh,uri){ + if( uri ) mesh.userData.srcTemplate = uri + mesh.userData.src = xrf.URI.template( mesh.userData.srcTemplate, xrf.URI.vars.__object ) + return mesh.userData.src } xrf.frag.src.addModel = (model,url,frag,opts) => { @@ -1308,7 +2238,7 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { if( mesh.material && mesh.userData.src ) mesh.material.visible = false // hide placeholder object //enableSourcePortation(scene) - if( xrf.frag.src.renderAsPortal(mesh) ){ + if( opts.isPortal ){ // only add remote objects, because // local scene-objects are already added to scene xrf.portalNonEuclidian({...opts,model,scene:model.scene}) @@ -1316,10 +2246,11 @@ xrf.frag.src.addModel = (model,url,frag,opts) => { }else{ xrf.frag.src.scale( scene, opts, url ) // scale scene mesh.add(scene) - xrf.emit('parseModel', {...opts, scene, model}) } // flag everything isSRC & isXRF mesh.traverse( (n) => { n.isSRC = n.isXRF = n[ opts.isLocal ? 'isSRCLocal' : 'isSRCExternal' ] = true }) + + xrf.emit('parseModel', {...opts, isSRC:true, scene, model}) } xrf.frag.src.renderAsPortal = (mesh) => { @@ -1350,7 +2281,9 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { fetch(url, { method: 'HEAD' }) .then( (res) => { let mimetype = res.headers.get('Content-type') - if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(gltf|glb)$/) ) mimetype = 'gltf' + if( url.replace(/#.*/,'').match(/\.(frag|fs|glsl)$/) ) mimetype = 'x-shader/x-fragment' + if( url.replace(/#.*/,'').match(/\.(vert|vs)$/) ) mimetype = 'x-shader/x-fragment' //if( url.match(/\.(fbx|stl|obj)$/) ) mimetype = opts = { ...opts, frag, mimetype } return xrf.frag.src.type[ mimetype ] ? xrf.frag.src.type[ mimetype ](url,opts) : xrf.frag.src.type.unknown(url,opts) @@ -1365,15 +2298,16 @@ xrf.frag.src.externalSRC = (url,frag,opts) => { xrf.frag.src.localSRC = (url,frag,opts) => { let {model,mesh,scene} = opts - setTimeout( () => { + //setTimeout( (mesh,scene) => { if( mesh.material ) mesh.material = mesh.material.clone() // clone, so we can individually highlight meshes let _model = { animations: model.animations, - scene: scene.clone() // *TODO* opts.isPortal ? scene : scene.clone() + scene: scene.clone() + // scene: opts.isPortal ? scene : scene.clone() } _model.scenes = [_model.scene] xrf.frag.src.addModel(_model,url,frag, opts) // current file - },500 ) + //},1000,mesh,scene ) } // scale embedded XR fragments https://xrfragment.org/#scaling%20of%20instanced%20objects @@ -1382,7 +2316,6 @@ xrf.frag.src.scale = function(scene, opts, url){ // remove invisible objects (hidden by selectors) which might corrupt boundingbox size-detection let cleanScene = scene.clone() - if( !cleanScene ) debugger let remove = [] const notVisible = (n) => !n.visible || (n.material && !n.material.visible) cleanScene.traverse( (n) => notVisible(n) && n.children.length == 0 && (remove.push(n)) ) @@ -1411,7 +2344,7 @@ xrf.frag.src.scale = function(scene, opts, url){ xrf.frag.src.filterScene = (scene,opts) => { let { mesh, model, camera, renderer, THREE, hashbus, frag} = opts - scene = xrf.filter.scene({scene,frag,reparent:true}) // *TODO* ,copyScene: opts.isPortal}) + scene = xrf.filter.scene({scene,frag,reparent:true,copyScene: opts.isPortal}) if( !opts.isLocal ){ scene.traverse( (m) => { @@ -1437,23 +2370,33 @@ xrf.frag.src.type['unknown'] = function( url, opts ){ reject(`${url} mimetype '${opts.mimetype}' not found or supported (yet)`) }) } +// this ns the global #t mediafragment handler (which affects the 3D animation) + xrf.frag.t = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + // handle object media players + if( mesh && mesh.media ){ + for( let i in mesh.media ) mesh.media[i].set("t",v) + return + } + + // otherwise handle global 3D animations if( !model.mixer ) return if( !model.animations || model.animations[0] == undefined ){ console.warn('no animations found in model') return xrf.emit( v.x == 0 ? 'stop' : 'play',{isPlaying: v.x != 0 }) } - + xrf.mixers.map ( (mixer) => { mixer.t = v // update speed - mixer.timeScale = mixer.loop.speed = v.x - mixer.loop.speedAbs = Math.abs(v.x) + mixer.timeScale = mixer.loop.speed + mixer.loop.speedAbs = Math.abs( mixer.timeScale ) - if( v.y != undefined || v.z != undefined ) mixer.updateLoop( v ) + mixer.updateLoop( v ) // play animations mixer.play( v ) @@ -1470,7 +2413,7 @@ xrf.addEventListener('parseModel', (opts) => { let {model} = opts let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene) mixer.model = model - mixer.loop = {timeStart:0,timeStop:0} + mixer.loop = {timeStart:0,timeStop:0,speed:1.0} mixer.i = xrf.mixers.length mixer.actions = [] @@ -1480,28 +2423,8 @@ xrf.addEventListener('parseModel', (opts) => { mixer.actions.push( mixer.clipAction( anim, model.scene ) ) }) - - mixer.checkZombies = (animations) => { - if( mixer.zombieCheck ) return // fire only once - animations.map( (anim) => { - // collect zombie animations and warn user - let zombies = anim.tracks.map( (t) => { - let name = t.name.replace(/\..*/,'') - let obj = model.scene.getObjectByName(name) - return !model.scene.getObjectByName(name) ? {anim:anim.name,obj:name} : undefined - }) - if( zombies.length > 0 && mixer.i == 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) - zombies - .filter( (z) => z ) // filter out undefined - .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) - console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) - } - }) - mixer.zombieCheck = true - } - mixer.play = (t) => { - mixer.isPlaying = t.x != 0 + mixer.isPlaying = t.x !== undefined && t.x != t.y mixer.updateLoop(t) xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying}) } @@ -1511,35 +2434,37 @@ xrf.addEventListener('parseModel', (opts) => { } mixer.updateLoop = (t) => { - mixer.loop.timeStart = t.y != undefined ? t.y : mixer.loop.timeStart - mixer.loop.timeStop = t.z != undefined ? t.z : mixer.loop.timeStop + if( t ){ + mixer.loop.timeStart = t.x != undefined ? t.x : mixer.loop.timeStart + mixer.loop.timeStop = t.y != undefined ? t.y : mixer.duration + } mixer.actions.map( (action) => { if( mixer.loop.timeStart != undefined ){ action.time = mixer.loop.timeStart action.setLoop( xrf.THREE.LoopOnce, ) action.timeScale = mixer.timeScale action.enabled = true - if( t.x != 0 ){ - action.play() - } + if( t && t.x != undefined ) action.play() } }) mixer.setTime(mixer.loop.timeStart) mixer.time = Math.abs( mixer.loop.timeStart ) mixer.update(0) - mixer.checkZombies( model.animations) } - // update loop when needed + // monkeypatch: update loop when needed if( !mixer.update.patched ){ + let update = mixer.update mixer.update = function(time){ mixer.time = Math.abs(mixer.time) if( time == 0 ) return update.call(this,time) // loop jump - if( mixer.loop.speed > 0.0 && (mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop) ){ - setTimeout( (time,anims) => mixer.updateLoop(time), 0, mixer.loop.timeStart ) // prevent recursion + if( mixer.loop.timeStop > 0 && mixer.time > mixer.loop.timeStop ){ + if( mixer.loop.enabled ){ + setTimeout( () => mixer.updateLoop(), 0 ) // prevent recursion + }else mixer.stop() } return update.call( this, time ) } @@ -1574,7 +2499,7 @@ xrf.addEventListener('render', (opts) => { xrf.mixers.map( (m) => m.isPlaying && (m.update( time )) ) // update active camera in case selected by dynamicKey in URI - if( xrf.model.camera && model.mixer.isPlaying ){ + if( xrf.model.camera && xrf.model.camera.length && model.mixer.isPlaying ){ let cam = xrf.camera.getCam() // cam.fov = model.cameras[0].fov (why is blender not exporting radians?) @@ -1591,22 +2516,95 @@ xrf.addEventListener('render', (opts) => { } }) -xrf.addEventListener('dynamicKey', (opts) => { - // select active camera if any - let {id,match,v} = opts - match.map( (w) => { - w.nodes.map( (node) => { - if( node.isCamera ){ - console.log("setting camera to "+node.name) - xrf.model.camera = node - } - }) - }) +// remove mixers and stop mixers when loading another scene +xrf.addEventListener('reset', (opts) => { + xrf.mixers.map( (m) => m.stop()) + xrf.mixers = [] }) +xrf.frag.uv = function(v, opts){ + let { frag, mesh, model, camera, scene, renderer, THREE} = opts + + if( !mesh.geometry ) return // nothing to do here + if( v.floats.length != 4 ) return console.warn('xrfragment.js: got less than 4 uv values ') + + xrf.frag.uv.init(mesh) + mesh.uv.u = v.floats[0] + mesh.uv.v = v.floats[1] + mesh.uv.uspeed = v.floats[2] || 1.0 + mesh.uv.vspeed = v.floats[3] || 1.0 + mesh.uv.ushift = v.shift[0] || v.floats[0] < 0 // negative u is always relative + mesh.uv.vshift = v.shift[1] || v.floats[1] < 0 // negative v is always relative + mesh.uv.uloop = v.shift[2] || false + mesh.uv.vloop = v.shift[3] || false + + mesh.onBeforeRender = xrf.frag.uv.scroll +} + +xrf.frag.uv.init = function(mesh){ + if( !mesh.uv ) mesh.uv = {u:0, v:0, uspeed:1, vspeed:1, uloop:false, vloop:false, uv:false} + + let uv = mesh.geometry.getAttribute("uv") + if( !uv.old ) uv.old = mesh.geometry.getAttribute("uv").clone() +} + +xrf.frag.uv.scroll = function(){ + + let diffU = 0.0 // distance to end-state (non-looping mode) + let diffV = 0.0 // distance to end-state (non-looping mode) + let uv = this.geometry.getAttribute("uv") + + // translate! + for( let i = 0; i < uv.count; i++ ){ + + if( this.uv.uspeed == 1.0 ) uv.setX(i, this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u ) + if( this.uv.vspeed == 1.0 ) uv.setY(i, this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v ) + + if( this.uv.uspeed != 1.0 || this.uv.vspeed != 1.0 ){ + let u = uv.getX(i) + let v = uv.getY(i) + let uTarget = this.uv.ushift ? uv.getX(i) + this.uv.u : uv.old.getX(i) + this.uv.u + let vTarget = this.uv.vshift ? uv.getY(i) + this.uv.v : uv.old.getY(i) + this.uv.v + + // scroll U + if( this.uv.uloop ){ + u += this.uv.uspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(u-uTarget) > 10.0 ) u = uv.old.getX(i) + //u = u > uTarget ? u + (this.uv.uspeed * -xrf.clock.delta) + // : u + (this.uv.uspeed * xrf.clock.delta) + //diffU += Math.abs( u - uTarget ) // are we done yet? (non-looping mode) + } + + // scroll V + if( this.uv.vloop ){ + v += this.uv.vspeed * xrf.clock.delta + }else{ + // *TODO* tween to offset + //// recover from super-high uv-values due to looped scrolling + //// recover from super-high uv-values due to looped scrolling + //if( Math.abs(v-vTarget) > 10.0 ) v = uv.old.getY(i) + //v = v > vTarget ? v + (this.uv.vspeed * -xrf.clock.delta) + // : v + (this.uv.vspeed * xrf.clock.delta) + //diffV += Math.abs( v - vTarget ) + } + uv.setXY(i,u,v) + } + + } + uv.needsUpdate = true + + if( (!this.uv.uloop && diffU < 0.05) && + (!this.uv.vloop && diffV < 0.05) + ){ // stop animating if done + this.onBeforeRender = function(){} + } +} xrf.getCollisionMeshes = () => { let meshes = [] xrf.scene.traverse( (n) => { - if( !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ + if( n.type == 'Mesh' && !n.userData.href && !n.userData.src && xrf.hasNoMaterial(n) ){ meshes.push(n) } }) @@ -1645,7 +2643,6 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ const tempMatrix = new Matrix4(); // Pointer Events - const element = renderer.domElement; function onPointerEvent( event ) { @@ -1675,7 +2672,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ }else{ if( object.selected ) { _event.type = 'mouseleave' - object.dispatchEvent(_event) + object.dispatchEvent( _event) } } @@ -1692,7 +2689,7 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ // WebXR Controller Events // TODO: Dispatch pointerevents too - const events = { + const eventsMapper = { 'move': 'mousemove', 'select': 'click', 'selectstart': 'mousedown', @@ -1712,12 +2709,14 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ if ( intersections.length > 0 ) { + console.log(object.name) + const intersection = intersections[ 0 ]; object = intersection.object; const uv = intersection.uv; - _event.type = events[ event.type ]; + _event.type = eventsMapper[ event.type ]; _event.data.set( uv.x, 1 - uv.y ); object.dispatchEvent( _event ); @@ -1754,18 +2753,119 @@ xrf.interactiveGroup = function(THREE,renderer,camera){ return new interactive(renderer,camera) } -/* - * TODO: refactor/fix this (queries are being refactored to filters) - */ +xrf.optimize = (opts) => { + opts.animatedObjects = [] + xrf.optimize + .checkAnimations(opts) + .freezeUnAnimatedObjects(opts) + .disableShadows(opts) + .disableEmbeddedLights(opts) + .removeDuplicateLights() +} + + // check unused animations +xrf.optimize.checkAnimations = (opts) => { + if( xrf.debug ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + model.animations.map( (anim) => { + // collect zombie animations and warn user + let zombies = anim.tracks.map( (t) => { + let name = t.name.replace(/\..*/,'') + let obj = model.scene.getObjectByName(name) + if( !model.scene.getObjectByName(name) ) return {anim:anim.name,obj:name} + else opts.animatedObjects.push(name) + return undefined + }) + if( zombies.length > 0 ){ // only warn for zombies in main scene (because src-scenes might be filtered anyways) + zombies + .filter( (z) => z ) // filter out undefined + .map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) ) + console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`) + } + }) + return xrf.optimize +} + +xrf.optimize.freezeUnAnimatedObjects = (opts) => { + if( xrf.todo ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's") + return xrf.optimize + + let {model} = opts + let scene = model.scene + // increase performance by freezing all objects + scene.traverse( (n) => n.matrixAutoUpdate = false ) + // except animated objects and children + scene.traverse( (n) => { + if( ~opts.animatedObjects.indexOf(n.name) ){ + n.matrixAutoUpdate = true + n.traverse( (m) => m.matrixAutoUpdate = true ) + } + }) + return xrf.optimize +} + +xrf.optimize.disableShadows = (opts) => { + opts.model.scene.traverse( (n) => { + if( n.castShadow !== undefined ) n.castShadow = false + }) + return xrf.optimize +} + +xrf.optimize.disableEmbeddedLights = (opts) => { + if( !opts.isSRC ) return xrf.optimize + // remove lights from SRC's + opts.model.scene.traverse( (n) => { + if( n.type.match(/light/i) ) n.remove() + }) + return xrf.optimize +} + +xrf.optimize.removeDuplicateLights = () => { + // local/extern src's can cause duplicate lights which tax performance + let lights = {} + xrf.scene.traverse( (n) => { + if( n.type.match(/light/i) ){ + if( !lights[n.name] ) lights[n.name] = true + else n.remove() + } + }) + return xrf.optimize +} + +xrf.addEventListener('parseModel', (opts) => { + xrf.optimize(opts) +}) +// switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { + // select active camera if any + let {id,match,v} = opts + match.map( (w) => { + w.nodes.map( (node) => { + if( node.isCamera ){ + console.log("switching camera to cam: "+node.name) + xrf.model.camera = node + } + }) + }) +}) + +const doFilter = (opts) => { let {scene,id,match,v} = opts if( v.filter ){ let frags = {} frags[ v.filter.key ] = v xrf.filter.scene({frag:frags,scene}) } +} + +xrf.addEventListener('dynamicKey', doFilter ) +xrf.addEventListener('dynamicKeyValue', (opts) => { + if( xrf.debug ) console.log("*TODO* filter integers only") + // doFilter(opts) }) // spec: https://xrfragment.org/#filters @@ -1881,48 +2981,116 @@ xrf.filter.process = function(frag,scene,opts){ return scene } -xrf.frag.defaultPredefinedViews = (opts) => { - let {scene,model} = opts; - scene.traverse( (n) => { - if( n.userData && n.userData['#'] ){ - let frag = xrf.URI.parse( n.userData['#'] ) - if( !n.parent && document.location.hash.length < 2){ - xrf.navigator.to( n.userData['#'] ) // evaluate static XR fragments - }else{ - xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments - } - } +xrf.frag.dynamic.material = function(v,opts){ + let {match} = opts + + // update material in case of [*]= + let material + xrf.scene.traverse( (n) => n.material && (n.material.name == v.string) && (material = n.material) ) + if( !material && !v.reset ) return // nothing to do + + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, material, v.reset ) }) } -xrf.addEventListener('dynamicKeyValue', (opts) => { - let {scene,match,v} = opts - let objname = v.fragment - let autoscroll = v.z > 0 || v.w > 0 -return // DISABLED - scene.traverse( (mesh) => { - if( mesh.name == objname ){ - if( !mesh.geometry ) return console.warn(`mesh '${objname}' has no uvcoordinates to offset`) - let uv = mesh.geometry.getAttribute("uv") - if( !uv.old ) uv.old = uv.clone() - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.old.getX(i) + v.x, uv.old.getY(i) + v.y ) +xrf.frag.dynamic.material.set = function(mesh,material,reset){ + if( !mesh.materialOriginal ) mesh.materialOriginal = mesh.material + let visible = mesh.material.visible //remember + if( reset ){ + mesh.material = mesh.materialOriginal + }else mesh.material = material + mesh.material.visible = visible +} + +// for reset calls like href: xrf://!myobject e.g. +xrf.addEventListener('dynamicKey', (opts) => { + + let {v,match} = opts + + if( v.reset ){ + xrf.XRWG.deepApplyMatch(match,v, (match,v,node,type) => { + if( node.material ) xrf.frag.dynamic.material.set( node, null, v.reset ) + }) + } + +}) + +// this holds all the URI Template variables (https://www.rfc-editor.org/rfc/rfc6570) + +xrf.addEventListener('parseModel', (opts) => { + let {model,url,file} = opts + if( model.isSRC || opts.isSRC ) return // ignore SRC models + + xrf.URI.vars = new Proxy({},{ + set(me,k,v){ + if( k.match(/^(name)$/) ) return + me[k] = v + }, + get(me,k ){ + if( k == '__object' ){ + let obj = {} + for( let i in xrf.URI.vars ) obj[i] = xrf.URI.vars[i]() + return obj } + return me[k] + }, + }) - if( autoscroll ){ - if( mesh.removeUVListener ) mesh.removeUVListener() - mesh.removeUVListener = xrf.addEventListener('render', (opts) => { - let {time} = opts - for( let i = 0; i < uv.count; i++ ){ - uv.setXY(i, uv.getX(i) + v.z * time, uv.getY(i) + v.w * time) + model.scene.traverse( (n) => { + const variables = /{([a-zA-Z0-9-]+)}/g + + if( n.userData ){ + for( let i in n.userData ){ + if( i[0] == '#' || i.match(/^(href|tag)$/) ) continue // ignore XR Fragment aliases + if( i == 'src' ){ + // lets declare empty variables found in src-values ('https://foo.com/video.mp4#{somevar}') e.g. + if( n.userData[i].match(variables) ){ + let vars = [].concat( n.userData[i].match(variables) ) + const strip = (v) => v.replace(/[{}]/g,'') + vars.map( (v) => xrf.URI.vars[ strip(v) ] = () => '' ) } - uv.needsUpdate = true - }) + }else xrf.URI.vars[i] = () => n.userData[i] // declare variables with values } - - uv.needsUpdate = true } }) + +}) + + +xrf.addEventListener('dynamicKeyValue', (opts) => { + // select active camera if any + let {id,match,v} = opts + + if( !v.is( xrf.XRF.CUSTOMFRAG) ) return // only process custom frags from here + if( v.string.match(/(<|>)/) ) return // ignore filter values + + if( match.length > 0 ){ + xrf.frag.dynamic.material(v,opts) // check if fragment is an objectname + } + + if( !xrf.URI.vars[ v.string ] ) return console.error(`'${v.string}' metadata-key not found in scene`) + //if( xrf.URI.vars[ id ] && !match.length ) return console.error(`'${id}' object/tag/metadata-key not found in scene`) + + if( xrf.debug ) console.log(`URI.vars[${id}]='${v.string}'`) + + if( xrf.URI.vars[id] ){ + xrf.URI.vars[ id ] = xrf.URI.vars[ v.string ] // update var + xrf.scene.traverse( (n) => { + // re-expand src-values which use the updated URI Template var + if( n.userData && n.userData.src && n.userData.srcTemplate && n.userData.srcTemplate.match(`{${id}}`) ){ + let srcNewFragments = xrf.frag.src.expandURI( n ).replace(/.*#/,'') + console.log(`URI.vars[${id}] => updating ${n.name} => ${srcNewFragments}`) + let frag = xrf.hashbus.pub( srcNewFragments, n ) + } + }) + }else{ + xrf.XRWG.deepApplyMatch(match, v, (match,v,node,type) => { + console.log(v.string) + if( node.geometry ) xrf.hashbus.pub( xrf.URI.vars[ v.string ](), node) // apply fragment mesh(es) + }) + } + }) xrf.addEventListener('dynamicKey', (opts) => { let {scene,id,match,v} = opts @@ -2002,68 +3170,109 @@ let loadAudio = (mimetype) => function(url,opts){ let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) let frag = xrf.URI.parse( url ) - /* WebAudio: setup context via THREEjs */ - if( !camera.listener ){ - camera.listener = new THREE.AudioListener(); - // *FIXME* camera vs camerarig conflict - (camera.getCam ? camera.getCam() : camera).add( camera.listener ); - } - + xrf.init.audio() let isPositionalAudio = !(mesh.position.x == 0 && mesh.position.y == 0 && mesh.position.z == 0) const audioLoader = new THREE.AudioLoader(); let sound = isPositionalAudio ? new THREE.PositionalAudio( camera.listener) : new THREE.Audio( camera.listener ) - mesh.audio = {} + mesh.media = mesh.media || {} + mesh.media.audio = { set: (mediafragment,v) => mesh.media.audio[mediafragment] = v } audioLoader.load( url.replace(/#.*/,''), function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(false); - sound.setVolume(1.0); + sound.setVolume( 1.0 ) if( isPositionalAudio ){ sound.setRefDistance( mesh.scale.x); sound.setRolloffFactor(20.0) //sound.setDirectionalCone( 360, 360, 0.01 ); - } + }else sound.setVolume( mesh.scale.x ) - sound.playXRF = (t) => { - mesh.add(sound) + mesh.add(sound) + + sound.set = (mediafragment,v) => { try{ - if( sound.isPlaying && t.y != undefined ) sound.stop() - if( sound.isPlaying && t.y == undefined ) sound.pause() + sound[mediafragment] = v + + if( mediafragment == 't'){ + + if( sound.isPlaying && v.y != undefined && v.x == v.y ){ + sound.offset = v.x * buffer.sampleRate ; + sound.pause() + return + }else sound.stop() - let hardcodedLoop = frag.t != undefined - t = hardcodedLoop ? { ...frag.t, x: t.x} : t // override with hardcoded metadata except playstate (x) - if( t && t.x != 0 ){ - // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well - t.x = Math.abs(t.x) - sound.setPlaybackRate( t.x ) // WebAudio does not support negative playback - // setting loop - if( t.z ) sound.setLoop( true ) // apply embedded audio/video samplerate/fps or global mixer fps - let loopStart = hardcodedLoop ? t.y : t.y * buffer.sampleRate; - let loopEnd = hardcodedLoop ? t.z : t.z * buffer.sampleRate; - let timeStart = loopStart > 0 ? loopStart : (t.y == undefined ? xrf.model.mixer.time : t.y) + sound.setLoopStart(v.x); + sound.setLoopEnd(v.y || buffer.duration); + sound.offset = v.x; + sound.play() + } - if( t.z > 0 ) sound.setLoopEnd( loopEnd ) - if( t.y != undefined ){ - sound.setLoopStart( loopStart ) - sound.offset = loopStart - } + if( mediafragment == 's'){ + // *TODO* https://stackoverflow.com/questions/12484052/how-can-i-reverse-playback-in-web-audio-api-but-keep-a-forward-version-as-well + sound.pause() + sound.setPlaybackRate( Math.abs(v.x) ) // WebAudio does not support negative playback + sound.play() + } + + if( mediafragment == 'loop'){ + sound.pause() + sound.setLoop( v.loop ) sound.play() } }catch(e){ console.warn(e) } } - // autoplay if user already requested play - let autoplay = mesh.audio && mesh.audio.autoplay - mesh.audio = sound - if( autoplay ) xrf.hashbus.pub(mesh.audio.autoplay) + let lazySet = {} + let mediaFragments = ['t','loop','s'] + mediaFragments.map( (f) => mesh.media.audio[f] && (lazySet[f] = mesh.media.audio[f]) ) + mesh.media.audio = sound + + // autoplay if user already requested play (before the sound was loaded) + mediaFragments.map( (f) => { + if( lazySet[f] ) mesh.media.audio.set(f, lazySet[f] ) + }) + }); + + // apply Media fragments from URL + (['t','loop','s']).map( (f) => { + if( frag[f] ){ + mesh.media.audio.set( f, frag[f] ) + } + }) + } +xrf.init.audio = (opts) => { + let camera = xrf.camera + /* WebAudio: setup context via THREEjs */ + if( !camera.listener ){ + camera.listener = new THREE.AudioListener(); + // *FIXME* camera vs camerarig conflict + (camera.getCam ? camera.getCam() : camera).add( camera.listener ); + xrf.emit('audioInited',{listener:camera.listener, ...opts}) + } +} +xrf.addEventListener('init', xrf.init.audio ) + +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => { + if( n.media && n.media.audio ){ + if( n.media.audio.stop ) n.media.audio.stop() + if( n.media.audio.remove ) n.media.audio.remove() + } + }) +}) + + + let audioMimeTypes = [ + 'audio/x-wav', 'audio/wav', 'audio/mpeg', 'audio/mp3', @@ -2072,16 +3281,99 @@ let audioMimeTypes = [ 'application/ogg' ] audioMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadAudio(mimetype) ) +/* + * mimetype: model/gltf+json + */ -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => { - if( !n.audio ) return - if( !n.audio.playXRF ) n.audio.autoplay = t - else n.audio.playXRF(t) +xrf.frag.src.type['fbx'] = function( url, opts ){ + return new Promise( async (resolve,reject) => { + let {mesh,src} = opts + let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url) + let loader + + //let {THREE} = await import('https://unpkg.com/three@0.161.0/build/three.module.js') + //let { FBXLoader } = await import('three/addons/loaders/FBXLoader.js') + + //const Loader = xrf.loaders[ext] + //if( !Loader ) throw 'xrfragment: no loader passed to xrfragment for extension .'+ext + //if( !dir.match("://") ){ // force relative path + // dir = dir[0] == './' ? dir : `./${dir}` + // loader = new Loader().setPath( dir ) + //}else loader = new Loader() + + //loader.load(url, (model) => { + // model.isSRC = true + // resolve(model) + //}) }) -}) +} + +/* + * extensions: .frag/.fs/.vs/.vert + */ + +xrf.frag.src.type['x-shader/x-fragment'] = function(url,opts){ + let {mesh,THREE} = opts + + let isFragmentShader = /\.(fs|frag|glsl)$/ + let isVertexShader = /\.(vs|vert)$/ + + let shaderReqs = [] + let shaderCode = {} + let shader = { + fragment: { code: '', url: url.match( isFragmentShader ) ? url : '' }, + vertex: { code: '', url: url.match( isVertexShader ) ? url : '' } + } + + var onShaderLoaded = ((args) => (type, status, code) => { + shader[type].status = status + shader[type].code = code + if( shader.fragment.code && shader.vertex.code ){ + + let oldMaterial = mesh.material + mesh.material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2(1.0,1.0) } + }, + // basic shaders include following common vars/funcs: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/common.glsl.js + fragmentShader: shader.fragment.status == 200 ? shader.fragment.code : THREE.ShaderChunk.meshbasic_frag, + vertexShader: shader.vertex.status == 200 ? shader.vertex.code : THREE.ShaderChunk.meshbasic_vert, + + }); + + mesh.material.needsUpdate = true + mesh.needsUpdate = true + + mesh.onBeforeRender = () => { + if( !mesh.material || !mesh.material.uniforms ) return mesh.onBeforeRender = function(){} + mesh.material.uniforms.time.value = xrf.clock.elapsedTime + } + + } + + })({}) + + // sidecar-load vertex shader file + if( shader.fragment.url && !shader.vertex.url ){ + shader.vertex.url = shader.fragment.url.replace(/\.fs$/, '.vs') + .replace(/\.frag$/, '.vert') + } + + if( shader.fragment.url ){ + fetch(shader.fragment.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('fragment',res.status,code) ) ) + } + + if( shader.vertex.url ){ + fetch(shader.vertex.url) + .then( (res) => res.text().then( (code) => onShaderLoaded('vertex',res.status,code) ) ) + } + +} + +xrf.frag.src.type['x-shader/x-vertex'] = xrf.frag.src.type['x-shader/x-fragment'] + /* * mimetype: model/gltf+json */ @@ -2153,6 +3445,14 @@ xrf.frag.src.type['image/png'] = function(url,opts){ mesh.material.map = texture mesh.material.needsUpdate = true mesh.needsUpdate = true + + //// *TODO* update clones in portals or dont clone scene of portals.. + //xrf.scene.traverse( (n) => { + // if( n.userData.src == mesh.userData.src && mesh.uuid != n.uuid ){ + // n.material = mesh.material + // n.material.needsUpdate = true + // } + //}) } let onLoad = (texture) => { @@ -2174,7 +3474,6 @@ xrf.frag.src.type['image/jpeg'] = xrf.frag.src.type['image/png'] xrf.portalNonEuclidian = function(opts){ let { frag, mesh, model, camera, scene, renderer} = opts - mesh.portal = { pos: mesh.position.clone(), posWorld: new xrf.THREE.Vector3(), @@ -2232,7 +3531,7 @@ xrf.portalNonEuclidian = function(opts){ mesh.portal.stencilObjects.children = stencilObjects xrf.portalNonEuclidian.stencilRef += 1 // each portal has unique stencil id - console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) + if( xrf.debug ) console.log(`enabling portal for object '${mesh.name}' (stencilRef:${mesh.portal.stencilRef})`) return this } @@ -2245,6 +3544,9 @@ xrf.portalNonEuclidian = function(opts){ this.setupListeners = () => { + // below is a somewhat weird tapdance to render the portals **after** the scene + // is rendered (otherwise it messes up occlusion) + mesh.onAfterRender = function(renderer, scene, camera, geometry, material, group ){ mesh.portal.needUpdate = true } @@ -2264,7 +3566,7 @@ xrf.portalNonEuclidian = function(opts){ let cam = xrf.camera.getCam ? xrf.camera.getCam() : camera cam.getWorldPosition(cameraPosition) cam.getWorldDirection(cameraDirection) - if( cameraPosition.distanceTo(newPos) > 10.0 ) return // dont render far portals + if( cameraPosition.distanceTo(newPos) > 15.0 ) return // dont render far portals // init if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = true @@ -2373,7 +3675,9 @@ let loadVideo = (mimetype) => function(url,opts){ const THREE = xrf.THREE let frag = xrf.URI.parse( url ) - let video = mesh.video = document.createElement('video') + mesh.media = mesh.media || {} + + let video = mesh.media.video = document.createElement('video') video.setAttribute("crossOrigin","anonymous") video.setAttribute("playsinline",'') video.addEventListener('loadedmetadata', function(){ @@ -2383,34 +3687,46 @@ let loadVideo = (mimetype) => function(url,opts){ mat.map = texture mesh.material = mat // set range - //video.addEventListener('timeupdate', function timeupdate() { - // if (frag.t && video.currentTime < frag.t.y || video.currentTime >= frag.t.z ) { - // video.currentTime = frag.t.y - // } - //},false) + video.addEventListener('timeupdate', function timeupdate() { + if (video.t && video.t.y !== undefined && video.t.y > video.t.x && Math.abs(video.currentTime) >= video.t.y ){ + if( video.looping ) video.currentTime = video.t.x // speed means loop + else video.pause() + } + },false) }) video.src = url - video.playXRF = (t) => { - video.t = t - if( t.x == 0 ) video.pause() - else{ - video.playbackRate = Math.abs( t.x ) // html5 video does not support reverseplay :/ - video.play() + video.speed = 1.0 + video.looping = false + video.set = (mediafragment,v) => { + video[mediafragment] = v + + if( mediafragment == 't'){ + video.pause() + if( v.x !== undefined && v.x == v.y ) return // stop paused + else{ + video.currentTime = v.x + video.time = v.x + video.play() + } + } + if( mediafragment == 's' ){ + video.playbackRate = Math.abs( v.x ) // html5 video does not support reverseplay :/ + } + if( mediafragment == 'loop' ){ + video.looping = true } - if( t.y != undefined ) video.time = t.y } } +// stop playing audio when loading another scene +xrf.addEventListener('reset', () => { + xrf.scene.traverse( (n) => n.media && n.media.video && (n.media.video.pause()) && (n.media.video.remove()) ) +}) + let videoMimeTypes = [ 'video/ogg', 'video/mp4' ] videoMimeTypes.map( (mimetype) => xrf.frag.src.type[ mimetype ] = loadVideo(mimetype) ) - -// listen to t XR fragment changes -xrf.addEventListener('t', (opts) => { - let t = opts.frag.t - xrf.scene.traverse( (n) => n.video && (n.video.playXRF(t)) ) -}) export default xrf;