diff --git a/dist/xrfragment.aframe.all.js b/dist/xrfragment.aframe.all.js index 8878571..0a81c81 100644 --- a/dist/xrfragment.aframe.all.js +++ b/dist/xrfragment.aframe.all.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Dec 12 05:22:39 PM CET 2023 + * v0.5.1 generated at Tue Dec 12 06:06:16 PM CET 2023 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1180,6 +1180,7 @@ xrf.frag.pos = function(v, opts){ camera.position.y = v.y camera.position.z = v.z } + camera.updateMatrixWorld() } xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1190,6 +1191,8 @@ xrf.frag.rot = function(v, opts){ v.y * Math.PI / 180, v.z * Math.PI / 180 ) + camera.rotation.offset = camera.rotation.clone() // remember + //camera.updateProjectionMatrix() }else{ obj = model.scene.isReparented ? model.scene.children[0] : model.scene obj.rotation.set( @@ -2765,6 +2768,59 @@ window.AFRAME.registerComponent('xrf', { }, }) +// look-controls turns off autoUpdateMatrix (of player) which +// will break teleporting and other stuff +// overriding this is easier then adding updateMatrixWorld() everywhere else + +//AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () {} +//AFRAME.components['look-controls'].Component.prototype.onExitVR = function () {} +AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () { + var sceneEl = this.el.sceneEl; + if (!sceneEl.checkHeadsetConnected()) { return; } + this.saveCameraPose(); + this.el.object3D.position.set(0, 0, 0); + this.el.object3D.rotation.set(0, 0, 0); + if (sceneEl.hasWebXR) { + // this.el.object3D.matrixAutoUpdate = false; + this.el.object3D.updateMatrix(); + } +} + +/** + * Restore the pose. + */ +AFRAME.components['look-controls'].Component.prototype.onExitVR = function () { + if (!this.el.sceneEl.checkHeadsetConnected()) { return; } + this.restoreCameraPose(); + this.previousHMDPosition.set(0, 0, 0); + this.el.object3D.matrixAutoUpdate = true; +} + +// it also needs to apply the offset (in case the #rot was used in URLS) + +AFRAME.components['look-controls'].Component.prototype.updateOrientation = function () { + var object3D = this.el.object3D; + var pitchObject = this.pitchObject; + var yawObject = this.yawObject; + var sceneEl = this.el.sceneEl; + + // In VR or AR mode, THREE is in charge of updating the camera pose. + if ((sceneEl.is('vr-mode') || sceneEl.is('ar-mode')) && sceneEl.checkHeadsetConnected()) { + // With WebXR THREE applies headset pose to the object3D internally. + return; + } + + this.updateMagicWindowOrientation(); + + let offsetX = object3D.rotation.offset ? object3D.rotation.offset.x : 0 + let offsetY = object3D.rotation.offset ? object3D.rotation.offset.y : 0 + + // On mobile, do camera rotation with touch events and sensors. + object3D.rotation.x = this.magicWindowDeltaEuler.x + offsetX + pitchObject.rotation.x; + object3D.rotation.y = this.magicWindowDeltaEuler.y + offsetY + yawObject.rotation.y; + object3D.rotation.z = this.magicWindowDeltaEuler.z; + object3D.matrixAutoUpdate = true +} window.AFRAME.registerComponent('xrf-button', { schema: { label: { @@ -2803,6 +2859,7 @@ window.AFRAME.registerComponent('xrf-button', { depth: 0.005 }); el.setAttribute('material', { + shader: "flat", color: this.color, transparent:true, opacity:0.7 @@ -3004,19 +3061,6 @@ window.AFRAME.registerComponent('xrf-get', { }); -// gaze click on mobile VR - -AFRAME.registerComponent('xrf-moveplayer',{ - schema:{ - }, - init:function(data){ - this.player = document.querySelector('#player') - }, - tick:function(){ - this.player.object3D.rotation.copy( this.el.object3D.rotation ) - this.player.object3D.position.copy( this.el.object3D.position ) - } -}); window.AFRAME.registerComponent('xrf-wear', { schema:{ el: {type:"selector"}, diff --git a/dist/xrfragment.aframe.js b/dist/xrfragment.aframe.js index 8e1628f..15cebad 100644 --- a/dist/xrfragment.aframe.js +++ b/dist/xrfragment.aframe.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Dec 12 05:22:39 PM CET 2023 + * v0.5.1 generated at Tue Dec 12 06:06:16 PM CET 2023 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1174,6 +1174,7 @@ xrf.frag.pos = function(v, opts){ camera.position.y = v.y camera.position.z = v.z } + camera.updateMatrixWorld() } xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1184,6 +1185,8 @@ xrf.frag.rot = function(v, opts){ v.y * Math.PI / 180, v.z * Math.PI / 180 ) + camera.rotation.offset = camera.rotation.clone() // remember + //camera.updateProjectionMatrix() }else{ obj = model.scene.isReparented ? model.scene.children[0] : model.scene obj.rotation.set( @@ -2759,6 +2762,59 @@ window.AFRAME.registerComponent('xrf', { }, }) +// look-controls turns off autoUpdateMatrix (of player) which +// will break teleporting and other stuff +// overriding this is easier then adding updateMatrixWorld() everywhere else + +//AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () {} +//AFRAME.components['look-controls'].Component.prototype.onExitVR = function () {} +AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () { + var sceneEl = this.el.sceneEl; + if (!sceneEl.checkHeadsetConnected()) { return; } + this.saveCameraPose(); + this.el.object3D.position.set(0, 0, 0); + this.el.object3D.rotation.set(0, 0, 0); + if (sceneEl.hasWebXR) { + // this.el.object3D.matrixAutoUpdate = false; + this.el.object3D.updateMatrix(); + } +} + +/** + * Restore the pose. + */ +AFRAME.components['look-controls'].Component.prototype.onExitVR = function () { + if (!this.el.sceneEl.checkHeadsetConnected()) { return; } + this.restoreCameraPose(); + this.previousHMDPosition.set(0, 0, 0); + this.el.object3D.matrixAutoUpdate = true; +} + +// it also needs to apply the offset (in case the #rot was used in URLS) + +AFRAME.components['look-controls'].Component.prototype.updateOrientation = function () { + var object3D = this.el.object3D; + var pitchObject = this.pitchObject; + var yawObject = this.yawObject; + var sceneEl = this.el.sceneEl; + + // In VR or AR mode, THREE is in charge of updating the camera pose. + if ((sceneEl.is('vr-mode') || sceneEl.is('ar-mode')) && sceneEl.checkHeadsetConnected()) { + // With WebXR THREE applies headset pose to the object3D internally. + return; + } + + this.updateMagicWindowOrientation(); + + let offsetX = object3D.rotation.offset ? object3D.rotation.offset.x : 0 + let offsetY = object3D.rotation.offset ? object3D.rotation.offset.y : 0 + + // On mobile, do camera rotation with touch events and sensors. + object3D.rotation.x = this.magicWindowDeltaEuler.x + offsetX + pitchObject.rotation.x; + object3D.rotation.y = this.magicWindowDeltaEuler.y + offsetY + yawObject.rotation.y; + object3D.rotation.z = this.magicWindowDeltaEuler.z; + object3D.matrixAutoUpdate = true +} window.AFRAME.registerComponent('xrf-button', { schema: { label: { @@ -2797,6 +2853,7 @@ window.AFRAME.registerComponent('xrf-button', { depth: 0.005 }); el.setAttribute('material', { + shader: "flat", color: this.color, transparent:true, opacity:0.7 @@ -2998,19 +3055,6 @@ window.AFRAME.registerComponent('xrf-get', { }); -// gaze click on mobile VR - -AFRAME.registerComponent('xrf-moveplayer',{ - schema:{ - }, - init:function(data){ - this.player = document.querySelector('#player') - }, - tick:function(){ - this.player.object3D.rotation.copy( this.el.object3D.rotation ) - this.player.object3D.position.copy( this.el.object3D.position ) - } -}); window.AFRAME.registerComponent('xrf-wear', { schema:{ el: {type:"selector"}, diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js index 83d0b52..b66ca5b 100644 --- a/dist/xrfragment.module.js +++ b/dist/xrfragment.module.js @@ -1,3 +1,108 @@ +/* + * v0.5.1 generated at Tue Dec 12 06:06:16 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 06:05:51 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 06:04:30 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 06:02:03 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 06:00:56 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:58:50 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:57:10 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:56:31 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:54:08 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:53:16 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:53:02 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:52:22 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:52:11 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:49:33 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:48:11 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:45:33 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:45:12 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:45:02 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:43:23 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:43:05 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Dec 12 05:37:10 PM CET 2023 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ /* * v0.5.1 generated at Tue Dec 12 05:22:39 PM CET 2023 * https://xrfragment.org @@ -59276,3 +59381,11532 @@ 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; diff --git a/dist/xrfragment.three.js b/dist/xrfragment.three.js index 9b6ade9..31dfbcb 100644 --- a/dist/xrfragment.three.js +++ b/dist/xrfragment.three.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Dec 12 05:22:39 PM CET 2023 + * v0.5.1 generated at Tue Dec 12 06:06:16 PM CET 2023 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1174,6 +1174,7 @@ xrf.frag.pos = function(v, opts){ camera.position.y = v.y camera.position.z = v.z } + camera.updateMatrixWorld() } xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1184,6 +1185,8 @@ xrf.frag.rot = function(v, opts){ v.y * Math.PI / 180, v.z * Math.PI / 180 ) + camera.rotation.offset = camera.rotation.clone() // remember + //camera.updateProjectionMatrix() }else{ obj = model.scene.isReparented ? model.scene.children[0] : model.scene obj.rotation.set( diff --git a/dist/xrfragment.three.module.js b/dist/xrfragment.three.module.js index 80c7dc8..40b7360 100644 --- a/dist/xrfragment.three.module.js +++ b/dist/xrfragment.three.module.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Dec 12 05:22:39 PM CET 2023 + * v0.5.1 generated at Tue Dec 12 06:06:16 PM CET 2023 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1174,6 +1174,7 @@ xrf.frag.pos = function(v, opts){ camera.position.y = v.y camera.position.z = v.z } + camera.updateMatrixWorld() } xrf.frag.rot = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -1184,6 +1185,8 @@ xrf.frag.rot = function(v, opts){ v.y * Math.PI / 180, v.z * Math.PI / 180 ) + camera.rotation.offset = camera.rotation.clone() // remember + //camera.updateProjectionMatrix() }else{ obj = model.scene.isReparented ? model.scene.children[0] : model.scene obj.rotation.set( diff --git a/example/aframe/sandbox/index.html b/example/aframe/sandbox/index.html index 5905b91..cbcfc5a 100644 --- a/example/aframe/sandbox/index.html +++ b/example/aframe/sandbox/index.html @@ -29,8 +29,8 @@ - - + + diff --git a/make b/make index a48201c..94f409a 100755 --- a/make +++ b/make @@ -93,7 +93,7 @@ build(){ test -f /tmp/xrf-aframe.js || { wget "https://aframe.io/releases/1.5.0/aframe.min.js" -O /tmp/xrf-aframe.js wget "https://cdn.jsdelivr.net/npm/aframe-blink-controls/dist/aframe-blink-controls.min.js" -O /tmp/xrf-blink.js - for i in /tmp/xrf-*.js; do echo -e "\n" >> $i; done # add extra linebreak to prevent bundle issues + #for i in /tmp/xrf-*.js; do echo -e "\n" >> $i; done # add extra linebreak to prevent bundle issues } cat /tmp/xrf-*.js dist/xrfragment.aframe.js > dist/xrfragment.aframe.all.js diff --git a/src/3rd/js/aframe/patch.look-controls.js b/src/3rd/js/aframe/patch.look-controls.js new file mode 100644 index 0000000..d62f858 --- /dev/null +++ b/src/3rd/js/aframe/patch.look-controls.js @@ -0,0 +1,53 @@ +// look-controls turns off autoUpdateMatrix (of player) which +// will break teleporting and other stuff +// overriding this is easier then adding updateMatrixWorld() everywhere else + +//AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () {} +//AFRAME.components['look-controls'].Component.prototype.onExitVR = function () {} +AFRAME.components['look-controls'].Component.prototype.onEnterVR = function () { + var sceneEl = this.el.sceneEl; + if (!sceneEl.checkHeadsetConnected()) { return; } + this.saveCameraPose(); + this.el.object3D.position.set(0, 0, 0); + this.el.object3D.rotation.set(0, 0, 0); + if (sceneEl.hasWebXR) { + // this.el.object3D.matrixAutoUpdate = false; + this.el.object3D.updateMatrix(); + } +} + +/** + * Restore the pose. + */ +AFRAME.components['look-controls'].Component.prototype.onExitVR = function () { + if (!this.el.sceneEl.checkHeadsetConnected()) { return; } + this.restoreCameraPose(); + this.previousHMDPosition.set(0, 0, 0); + this.el.object3D.matrixAutoUpdate = true; +} + +// it also needs to apply the offset (in case the #rot was used in URLS) + +AFRAME.components['look-controls'].Component.prototype.updateOrientation = function () { + var object3D = this.el.object3D; + var pitchObject = this.pitchObject; + var yawObject = this.yawObject; + var sceneEl = this.el.sceneEl; + + // In VR or AR mode, THREE is in charge of updating the camera pose. + if ((sceneEl.is('vr-mode') || sceneEl.is('ar-mode')) && sceneEl.checkHeadsetConnected()) { + // With WebXR THREE applies headset pose to the object3D internally. + return; + } + + this.updateMagicWindowOrientation(); + + let offsetX = object3D.rotation.offset ? object3D.rotation.offset.x : 0 + let offsetY = object3D.rotation.offset ? object3D.rotation.offset.y : 0 + + // On mobile, do camera rotation with touch events and sensors. + object3D.rotation.x = this.magicWindowDeltaEuler.x + offsetX + pitchObject.rotation.x; + object3D.rotation.y = this.magicWindowDeltaEuler.y + offsetY + yawObject.rotation.y; + object3D.rotation.z = this.magicWindowDeltaEuler.z; + object3D.matrixAutoUpdate = true +} diff --git a/src/3rd/js/aframe/xrf-button.js b/src/3rd/js/aframe/xrf-button.js index 895a0fd..0e6fcd2 100644 --- a/src/3rd/js/aframe/xrf-button.js +++ b/src/3rd/js/aframe/xrf-button.js @@ -36,6 +36,7 @@ window.AFRAME.registerComponent('xrf-button', { depth: 0.005 }); el.setAttribute('material', { + shader: "flat", color: this.color, transparent:true, opacity:0.7 diff --git a/src/3rd/js/aframe/xrf-moveplayer.js b/src/3rd/js/aframe/xrf-moveplayer.js deleted file mode 100644 index 354bbe8..0000000 --- a/src/3rd/js/aframe/xrf-moveplayer.js +++ /dev/null @@ -1,13 +0,0 @@ -// gaze click on mobile VR - -AFRAME.registerComponent('xrf-moveplayer',{ - schema:{ - }, - init:function(data){ - this.player = document.querySelector('#player') - }, - tick:function(){ - this.player.object3D.rotation.copy( this.el.object3D.rotation ) - this.player.object3D.position.copy( this.el.object3D.position ) - } -}); diff --git a/src/3rd/js/three/xrf/pos.js b/src/3rd/js/three/xrf/pos.js index 0f0398e..1fc85a4 100644 --- a/src/3rd/js/three/xrf/pos.js +++ b/src/3rd/js/three/xrf/pos.js @@ -15,4 +15,5 @@ xrf.frag.pos = function(v, opts){ camera.position.y = v.y camera.position.z = v.z } + camera.updateMatrixWorld() } diff --git a/src/3rd/js/three/xrf/rot.js b/src/3rd/js/three/xrf/rot.js index a40ade2..3154474 100644 --- a/src/3rd/js/three/xrf/rot.js +++ b/src/3rd/js/three/xrf/rot.js @@ -7,6 +7,8 @@ xrf.frag.rot = function(v, opts){ v.y * Math.PI / 180, v.z * Math.PI / 180 ) + camera.rotation.offset = camera.rotation.clone() // remember + //camera.updateProjectionMatrix() }else{ obj = model.scene.isReparented ? model.scene.children[0] : model.scene obj.rotation.set(