a3js 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a3js.cjs.js +76 -76
- package/dist/a3js.es.js +8631 -8836
- package/package.json +1 -1
package/dist/a3js.cjs.js
CHANGED
|
@@ -1,62 +1,78 @@
|
|
|
1
|
-
"use strict";var Ln=Object.create;var Kt=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var Nn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sn(e))!bn.call(n,r)&&r!==t&&Kt(n,r,{get:()=>e[r],enumerable:!(i=On(e,r))||i.enumerable});return n};var xn=(n,e,t)=>(t=n!=null?Ln(In(n)):{},Nn(e||!n||!n.__esModule?Kt(t,"default",{value:n,enumerable:!0}):t,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),kn=require("fflate");function Cn(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Ie=Cn(A);function Pn(n){return 2*n}function wn(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}async function Mn(n){const t=await(await fetch(n)).arrayBuffer();return await new Promise((r,c)=>{kn.unzip(new Uint8Array(t),(s,u)=>{s?c(s):r(u)})})}function Fn(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n[e]){const t=Un(e);return new Blob([new Uint8Array(n[e])],{type:t})}else throw new Error(`readBlobFromUnzipped(): no file at ${e}`)}const Dn={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function Un(n){for(const[e,t]of Object.entries(Dn))if(t.test(n))return e;return"application/octet-stream"}var Ee=(n,e)=>()=>(e||(e={exports:{}},n(e.exports,e)),e.exports),$t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VERSION=void 0,n.VERSION="9.0.1"}),be=Ee((n,e)=>{var t=n&&n.__spreadArray||function(D,Y){for(var z=0,te=Y.length,de=D.length;z<te;z++,de++)D[de]=Y[z];return D};Object.defineProperty(n,"__esModule",{value:!0}),n.toFastProperties=n.timer=n.peek=n.isES2015MapSupported=n.PRINT_WARNING=n.PRINT_ERROR=n.packArray=n.IDENTITY=n.NOOP=n.merge=n.groupBy=n.defaults=n.assignNoOverwrite=n.assign=n.zipObject=n.sortBy=n.indexOf=n.some=n.difference=n.every=n.isObject=n.isRegExp=n.isArray=n.partial=n.uniq=n.compact=n.reduce=n.findAll=n.find=n.cloneObj=n.cloneArr=n.contains=n.has=n.pick=n.reject=n.filter=n.dropRight=n.drop=n.isFunction=n.isUndefined=n.isString=n.forEach=n.last=n.first=n.flatten=n.map=n.mapValues=n.values=n.keys=n.isEmpty=void 0;function i(D){return D&&D.length===0}n.isEmpty=i;function r(D){return D==null?[]:Object.keys(D)}n.keys=r;function c(D){for(var Y=[],z=Object.keys(D),te=0;te<z.length;te++)Y.push(D[z[te]]);return Y}n.values=c;function s(D,Y){for(var z=[],te=r(D),de=0;de<te.length;de++){var Ae=te[de];z.push(Y.call(null,D[Ae],Ae))}return z}n.mapValues=s;function u(D,Y){for(var z=[],te=0;te<D.length;te++)z.push(Y.call(null,D[te],te));return z}n.map=u;function a(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Array.isArray(te)?Y=Y.concat(a(te)):Y.push(te)}return Y}n.flatten=a;function o(D){return i(D)?void 0:D[0]}n.first=o;function h(D){var Y=D&&D.length;return Y?D[Y-1]:void 0}n.last=h;function l(D,Y){if(Array.isArray(D))for(var z=0;z<D.length;z++)Y.call(null,D[z],z);else if(q(D))for(var te=r(D),z=0;z<te.length;z++){var de=te[z],Ae=D[de];Y.call(null,Ae,de)}else throw Error("non exhaustive match")}n.forEach=l;function p(D){return typeof D=="string"}n.isString=p;function m(D){return D===void 0}n.isUndefined=m;function E(D){return D instanceof Function}n.isFunction=E;function T(D,Y){return Y===void 0&&(Y=1),D.slice(Y,D.length)}n.drop=T;function f(D,Y){return Y===void 0&&(Y=1),D.slice(0,D.length-Y)}n.dropRight=f;function d(D,Y){var z=[];if(Array.isArray(D))for(var te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.filter=d;function y(D,Y){return d(D,function(z){return!Y(z)})}n.reject=y;function v(D,Y){for(var z=Object.keys(D),te={},de=0;de<z.length;de++){var Ae=z[de],L=D[Ae];Y(L)&&(te[Ae]=L)}return te}n.pick=v;function g(D,Y){return q(D)?D.hasOwnProperty(Y):!1}n.has=g;function b(D,Y){return K(D,function(z){return z===Y})!==void 0}n.contains=b;function w(D){for(var Y=[],z=0;z<D.length;z++)Y.push(D[z]);return Y}n.cloneArr=w;function P(D){var Y={};for(var z in D)Object.prototype.hasOwnProperty.call(D,z)&&(Y[z]=D[z]);return Y}n.cloneObj=P;function K(D,Y){for(var z=0;z<D.length;z++){var te=D[z];if(Y.call(null,te))return te}}n.find=K;function S(D,Y){for(var z=[],te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.findAll=S;function G(D,Y,z){for(var te=Array.isArray(D),de=te?D:c(D),Ae=te?[]:r(D),L=z,R=0;R<de.length;R++)L=Y.call(null,L,de[R],te?R:Ae[R]);return L}n.reduce=G;function x(D){return y(D,function(Y){return Y==null})}n.compact=x;function I(D,Y){Y===void 0&&(Y=function(te){return te});var z=[];return G(D,function(te,de){var Ae=Y(de);return b(z,Ae)?te:(z.push(Ae),te.concat(de))},[])}n.uniq=I;function M(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];var te=[null],de=te.concat(Y);return Function.bind.apply(D,de)}n.partial=M;function C(D){return Array.isArray(D)}n.isArray=C;function X(D){return D instanceof RegExp}n.isRegExp=X;function q(D){return D instanceof Object}n.isObject=q;function V(D,Y){for(var z=0;z<D.length;z++)if(!Y(D[z],z))return!1;return!0}n.every=V;function $(D,Y){return y(D,function(z){return b(Y,z)})}n.difference=$;function Z(D,Y){for(var z=0;z<D.length;z++)if(Y(D[z]))return!0;return!1}n.some=Z;function ce(D,Y){for(var z=0;z<D.length;z++)if(D[z]===Y)return z;return-1}n.indexOf=ce;function se(D,Y){var z=w(D);return z.sort(function(te,de){return Y(te)-Y(de)}),z}n.sortBy=se;function ae(D,Y){if(D.length!==Y.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},te=0;te<D.length;te++)z[D[te]]=Y[te];return z}n.zipObject=ae;function ne(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];D[R]=de[R]}return D}n.assign=ne;function he(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];g(D,R)||(D[R]=de[R])}return D}n.assignNoOverwrite=he;function U(){for(var D=[],Y=0;Y<arguments.length;Y++)D[Y]=arguments[Y];return he.apply(void 0,t([{}],D))}n.defaults=U;function j(D,Y){var z={};return l(D,function(te){var de=Y(te),Ae=z[de];Ae?Ae.push(te):z[de]=[te]}),z}n.groupBy=j;function W(D,Y){for(var z=P(D),te=r(Y),de=0;de<te.length;de++){var Ae=te[de],L=Y[Ae];z[Ae]=L}return z}n.merge=W;function Q(){}n.NOOP=Q;function J(D){return D}n.IDENTITY=J;function ie(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Y.push(te!==void 0?te:void 0)}return Y}n.packArray=ie;function ge(D){console&&console.error&&console.error("Error: "+D)}n.PRINT_ERROR=ge;function pe(D){console&&console.warn&&console.warn("Warning: "+D)}n.PRINT_WARNING=pe;function Oe(){return typeof Map=="function"}n.isES2015MapSupported=Oe;function Ue(D){return D[D.length-1]}n.peek=Ue;function He(D){var Y=new Date().getTime(),z=D(),te=new Date().getTime(),de=te-Y;return{time:de,value:z}}n.timer=He;function De(D){function Y(){}Y.prototype=D;var z=new Y;function te(){return typeof z.bar}return te(),te(),D}n.toFastProperties=De}),Bt=Ee((n,e)=>{(function(t,i){typeof define=="function"&&define.amd?define([],i):typeof e=="object"&&e.exports?e.exports=i():t.regexpToAst=i()})(typeof self<"u"?self:n,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(f){this.idx=f.idx,this.input=f.input,this.groupIdx=f.groupIdx},t.prototype.pattern=function(f){this.idx=0,this.input=f,this.groupIdx=0,this.consumeChar("/");var d=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:f.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(y,"global");break;case"i":a(y,"ignoreCase");break;case"m":a(y,"multiLine");break;case"u":a(y,"unicode");break;case"y":a(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:d,loc:this.loc(0)}},t.prototype.disjunction=function(){var f=[],d=this.idx;for(f.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),f.push(this.alternative());return{type:"Disjunction",value:f,loc:this.loc(d)}},t.prototype.alternative=function(){for(var f=[],d=this.idx;this.isTerm();)f.push(this.term());return{type:"Alternative",value:f,loc:this.loc(d)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var f=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(f)};case"$":return{type:"EndAnchor",loc:this.loc(f)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(f)};case"B":return{type:"NonWordBoundary",loc:this.loc(f)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var d;switch(this.popChar()){case"=":d="Lookahead";break;case"!":d="NegativeLookahead";break}o(d);var y=this.disjunction();return this.consumeChar(")"),{type:d,value:y,loc:this.loc(f)}}h()},t.prototype.quantifier=function(f){var d,y=this.idx;switch(this.popChar()){case"*":d={atLeast:0,atMost:1/0};break;case"+":d={atLeast:1,atMost:1/0};break;case"?":d={atLeast:0,atMost:1};break;case"{":var v=this.integerIncludingZero();switch(this.popChar()){case"}":d={atLeast:v,atMost:v};break;case",":var g;this.isDigit()?(g=this.integerIncludingZero(),d={atLeast:v,atMost:g}):d={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(f===!0&&d===void 0)return;o(d);break}if(!(f===!0&&d===void 0))return o(d),this.peekChar(0)==="?"?(this.consumeChar("?"),d.greedy=!1):d.greedy=!0,d.type="Quantifier",d.loc=this.loc(y),d},t.prototype.atom=function(){var f,d=this.idx;switch(this.peekChar()){case".":f=this.dotAll();break;case"\\":f=this.atomEscape();break;case"[":f=this.characterClass();break;case"(":f=this.group();break}return f===void 0&&this.isPatternCharacter()&&(f=this.patternCharacter()),o(f),f.loc=this.loc(d),this.isQuantifier()&&(f.quantifier=this.quantifier()),f},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
2
|
-
|
|
1
|
+
"use strict";var on=Object.create;var xt=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var ln=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of an(e))!un.call(n,i)&&i!==t&&xt(n,i,{get:()=>e[i],enumerable:!(r=sn(e,i))||r.enumerable});return n};var fn=(n,e,t)=>(t=n!=null?on(cn(n)):{},ln(e||!n||!n.__esModule?xt(t,"default",{value:n,enumerable:!0}):t,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),Ut=require("fflate");function hn(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Ae=hn(A);function Bt(n){return typeof n=="string"}function Ot(n){return n.isMesh===!0}function dn(n){return n.type==="RoundedBoxGeometry"}function pn(n){return n.type==="BoxGeometry"}function mn(n){return n.type==="SphereGeometry"}function yn(n){return n.type==="IcosahedronGeometry"}function gn(n){return n.type==="CylinderGeometry"}function Tn(n){return n.type==="CapsuleGeometry"}class En{object;option;constructor(e,t){this.object=e,this.option=t}}let Ge;class et{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!et.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),et.RAPIER=e,Ge=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOption(e)&&(t=e.timestep);const r=new Ge.World(e.gravity);return new vn(r,t)}isRapierWorldOption(e){return"enableCCD"in e&&"timestep"in e}}class vn{world;timestep;constructor(e,t){this.world=e,this.timestep=t,this.world.integrationParameters.dt=this.timestep}add(e){kt(e)&&e.addOneself(this)}remove(e){kt(e)&&e.removeOneself(this)}update(e){const t=Math.ceil(e/this.timestep);for(let r=0;r<t;r++)this.world.step()}}class Gt extends En{}function kt(n){return"addOneself"in n&&"removeOneself"in n}class Rn extends Gt{bodyDesc;body;colliderDescs=[];colliders=[];constructor(e,t){switch(super(e,t),t.rigidBody){case"dynamic":this.bodyDesc=Ge.RigidBodyDesc.dynamic();break;case"kinematic":this.bodyDesc=Ge.RigidBodyDesc.kinematicPositionBased();break;case"fixed":this.bodyDesc=Ge.RigidBodyDesc.fixed();break}this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.bodyDesc.setRotation({x:e.rot.x,y:e.rot.y,z:e.rot.z,w:e.rot.w});const r=[];this.object.object.traverse(c=>{if(Ot(c)){const s=On(c.geometry);if(s)this.colliderDescs.push(s.colliderDesc),s.colliderDesc.setRestitution(t.restitution).setFriction(t.friction),r.push(s.volume);else{let u,a;switch(t.meshCollider){case"tri_mesh":u=An(c),a=Ct(c.geometry);break;case"convex_hull":u=_n(c),a=Ct(c.geometry);break}u&&(this.colliderDescs.push(u),r.push(a))}}});let i=r.reduce((c,s)=>c+s,0);for(let c=0;c<this.colliderDescs.length;c++)this.colliderDescs[c].setRestitution(t.restitution),this.colliderDescs[c].setFriction(t.friction),this.colliderDescs[c].setMass(t.mass*(r[c]/i))}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const r=this.body.rotation();e.rot.set(r.x,r.y,r.z,r.w),e.object.quaternion.set(r.x,r.y,r.z,r.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{this.colliders.push(e.world.createCollider(t,this.body))})}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1)})}setLocOverride(e){this.body&&this.body.setTranslation(e,!0)}setQuatOverride(e){this.body&&this.body.setRotation(e,!0)}setScaleOverride(e){}}function An(n){let e=null;if(Ot(n)){const t=n;t.updateWorldMatrix(!0,!0);const r=t.geometry.clone();r.applyMatrix4(t.matrixWorld);const i=r.attributes.position.array;let c=r.index?r.index.array:null;if(c)c instanceof Uint32Array||(c=new Uint32Array(c));else{const s=r.attributes.position.count;c=new Uint32Array(s);for(let u=0;u<s;u++)c[u]=u}i instanceof Float32Array&&(e=Ge.ColliderDesc.trimesh(i,c))}return e}function _n(n){let e=null;if(Ot(n)){const t=n;t.updateWorldMatrix(!0,!0);const r=t.geometry.clone();r.applyMatrix4(t.matrixWorld);const i=r.attributes.position.array;i instanceof Float32Array&&(e=Ge.ColliderDesc.convexHull(i))}return e}function Ct(n){const e=n.attributes.position;if(!e)throw new Error("position attribute not found");const t=n.index,r=e.array;let i=0;const c=new Ae.Vector3,s=new Ae.Vector3,u=new Ae.Vector3;if(t){const a=t.array;for(let o=0;o<a.length;o+=3){const h=a[o]*3,l=a[o+1]*3,m=a[o+2]*3;c.set(r[h],r[h+1],r[h+2]),s.set(r[l],r[l+1],r[l+2]),u.set(r[m],r[m+1],r[m+2]),i+=c.dot(s.clone().cross(u))}}else for(let a=0;a<r.length;a+=9)c.set(r[a],r[a+1],r[a+2]),s.set(r[a+3],r[a+4],r[a+5]),u.set(r[a+6],r[a+7],r[a+8]),i+=c.dot(s.clone().cross(u));return Math.abs(i)/6}function On(n){if(dn(n)){const e=n.parameters,t=typeof e?.width=="number"?e.width/2:.5,r=typeof e?.height=="number"?e.height/2:.5,i=typeof e?.depth=="number"?e.depth/2:.5,c=.1;return{colliderDesc:Ge.ColliderDesc.roundCuboid(t-c,r-c,i-c,c),volume:2*t*2*r*2*i}}else if(pn(n)){const e=n.parameters,t=typeof e?.width=="number"?e.width/2:.5,r=typeof e?.height=="number"?e.height/2:.5,i=typeof e?.depth=="number"?e.depth/2:.5;return{colliderDesc:Ge.ColliderDesc.cuboid(t,r,i),volume:2*t*2*r*2*i}}else if(mn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:Ge.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(yn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:Ge.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(gn(n)){const e=n.parameters,t=typeof e?.radiusBottom=="number"?e.radiusBottom:.5,r=typeof e?.height=="number"?e.height:.5;return{colliderDesc:Ge.ColliderDesc.cylinder(r/2,t),volume:Math.PI*t*t*r}}else if(Tn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:.5,r=typeof e?.height=="number"?e.height:.5;return{colliderDesc:Ge.ColliderDesc.capsule(r/2,t),volume:4/3*Math.PI*t*t*t+Math.PI*t*t*r}}return null}class nt{scene;objects;static physics=new et;physicsWorld=null;physicsDt=1/60;static async initPhysics(){await nt.physics.init()}constructor(){this.scene=new Ae.Scene,this.objects=[],nt.physics.isInitialized&&(this.physicsWorld=nt.physics.createWorld({gravity:{x:0,y:-9.81,z:0},timestep:this.physicsDt}))}add(e){if(this.scene.add(e.object),this.objects.push(e),e.scene=this,e.controlMode==="physics")if(this.physicsWorld){if(!e.physics){const t=e.getPhysicsOption();e.initPhysics(t)}e.physics&&this.physicsWorld.add(e.physics)}else console.log("物理エンジンを初期化してない状態で、物理エンジンを必要とするObjectA3が追加されました。")}remove(e){this.scene.remove(e.object);{const t=this.objects.indexOf(e);this.objects[t]=this.objects[this.objects.length-1],this.objects.pop()}e.scene=null,e.controlMode==="physics"&&this.physicsWorld&&e.physics&&this.physicsWorld.remove(e.physics)}update(e){this.physicsWorld&&this.physicsWorld.update(e);for(const t of this.objects)t.controlMode!=="manual"&&t.update(e)}}class je{_x;_y;_z;get x(){return this._x}get y(){return this._y}get z(){return this._z}constructor(e,t,r){typeof e=="number"?(this._x=e,this._y=t,this._z=r):typeof e>"u"?this._x=this._y=this._z=0:(this._x=e.x,this._y=e.y,this._z=e.z)}set(e,t,r){return typeof e=="number"?(this._x=e,this._y=t,this._z=r):(this._x=e.x,this._y=e.y,this._z=e.z),this}add(e){return this._x+=e.x,this._y+=e.y,this._z+=e.z,this}lerp(e,t,r){this._x=(1-r)*e.x+r*t.x,this._y=(1-r)*e.y+r*t.y,this._z=(1-r)*e.z+r*t.z}}class $e{_x;_y;_z;_w;get x(){return this._x}get y(){return this._y}get z(){return this._z}get w(){return this._w}constructor(e,t,r,i){typeof e=="number"?(this._x=e,this._y=t,this._z=r,this._w=i):typeof e>"u"?(this._x=this._y=this._z=0,this._w=1):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w)}set(e,t,r,i){return typeof e=="number"?(this._x=e,this._y=t,this._z=r,this._w=i):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w),this}lerp(e,t,r){this._x=(1-r)*e.x+r*t.x,this._y=(1-r)*e.y+r*t.y,this._z=(1-r)*e.z+r*t.z,this._w=(1-r)*e.z+r*t.w}slerp(e,t,r){if(r<0||r>1){console.log("Quat.slerp(): t must be in [0,1]");return}const i=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(i<.9995){const c=Math.acos(i),s=Math.sin((1-r)*c)/Math.sin(c),u=Math.sin(r*c)/Math.sin(c);this._x=s*e.x+u*t.x,this._y=s*e.y+u*t.y,this._z=s*e.z+u*t.z,this._w=s*e.w+u*t.w}else{this._x=(1-r)*e.x+r*t.x,this._y=(1-r)*e.y+r*t.y,this._z=(1-r)*e.z+r*t.z,this._w=(1-r)*e.w+r*t.w;const c=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);c<1e-4?(console.log("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/c,this._y*=1/c,this._z*=1/c,this._w*=1/c)}}}class Xe{_loc=new je(0,0,0);_rot=new $e(0,0,0,1);_scale=new je(1,1,1);object;controlMode="manual";scene=null;physics=null;balloon=null;interpolation=null;constructor(e){this.object=this.initObject(e)}setControlMode(e){this.controlMode=e,e==="interpolated"&&!this.interpolation&&(this.interpolation=new Sn(this)),e==="physics"&&!this.physics&&this.initPhysics(this.getPhysicsOption())}update(e){switch(this.controlMode){case"manual":break;case"interpolated":this.interpolation&&this.interpolation.interpolate(this,e);break;case"physics":this.physics&&this.physics.synchronize(this);break;case"user":console.log('"user"モードを使う場合は自分でupdateメソッドをオーバーライドして実装して下さい。');break}}getPhysicsOption(){return{rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",mass:1,friction:.5,restitution:.5}}initPhysics(e){this.physics=new Rn(this,e),this.controlMode="physics"}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new Ln(e)}get location(){return this._loc}setLocation(e,t,r){const i=new je;switch(typeof e=="number"?i.set(e,t,r):i.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setLoc(this,i);break;case"physics":break;default:this.location.set(i),this.object.position.set(i.x,i.y,i.z);break}}setLocationOverride(e,t,r){const i=new je;switch(typeof e=="number"?i.set(e,t,r):i.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setLocOverride(this,i);break;case"physics":this.physics&&this.physics.setLocOverride(i);break}this.location.set(i),this.object.position.set(i.x,i.y,i.z)}get rot(){return this._rot}setQuat(e,t,r,i){const c=new $e;switch(typeof e=="number"?c.set(e,t,r,i):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setQuat(this,c);break;case"physics":break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}setQuatOverride(e,t,r,i){const c=new $e;switch(typeof e=="number"?c.set(e,t,r,i):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setQuatOverride(this,c);break;case"physics":this.physics&&this.physics.setQuatOverride(c);break}this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w)}get scale(){return this._scale}setScale(e,t,r){const i=new je;switch(typeof e=="number"?i.set(e,t,r):i.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setScale(this,i);break;case"physics":break;default:this.scale.set(i),this.object.scale.set(i.x,i.y,i.z);break}}setScaleOverride(e,t,r){const i=new je;switch(typeof e=="number"?i.set(e,t,r):i.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setScaleOverride(this,i);break;case"physics":this.physics&&this.physics.setScaleOverride(i);break}this.scale.set(i),this.object.scale.set(i.x,i.y,i.z)}contains(e){let t=!1;return this.object.traverse(r=>{r==e&&(t=!0)}),t}}class Ln{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class Sn{firstLoc;firstRot;firstScale;nowLoc;nowRot;nowScale;lastLoc;lastRot;lastScale;nowTime;duration;constructor(e){this.firstLoc=new je(e.location),this.firstRot=new $e(e.rot),this.firstScale=new je(e.scale),this.nowLoc=new je(e.location),this.nowRot=new $e(e.rot),this.nowScale=new je(e.scale),this.lastLoc=new je(e.location),this.lastRot=new $e(e.rot),this.lastScale=new je(e.scale),this.nowTime=0,this.duration=1}setLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=0}setLocOverride(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=1}setQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=0}setQuatOverride(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=1}setScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=0}setScaleOverride(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=1}smoothstep(e){return e*e*(3-2*e)}interpolate(e,t){this.nowTime+=t,this.nowTime>this.duration&&(this.nowTime=this.duration);const r=this.nowTime/this.duration,i=this.smoothstep(r);this.nowLoc.lerp(this.firstLoc,this.lastLoc,i),this.nowRot.slerp(this.firstRot,this.lastRot,i),this.nowScale.lerp(this.firstScale,this.lastScale,i),e.location.set(this.nowLoc),e.object.position.set(this.nowLoc.x,this.nowLoc.y,this.nowLoc.z),e.rot.set(this.nowRot),e.object.quaternion.set(this.nowRot.x,this.nowRot.y,this.nowRot.z,this.nowRot.w),e.scale.set(this.nowScale),e.object.scale.set(this.nowScale.x,this.nowScale.y,this.nowScale.z)}}class jt extends Xe{}class Lt{scene;camera;constructor(e){this.scene=new nt,this.camera=e,this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3)}replaceScene(e){this.scene.scene.remove(this.camera.object),e.scene.add(this.camera.object);const t=this.scene;return this.scene=e,t}updateScene(e){this.scene.update(e)}}class st extends jt{camera;headLight;constructor(e){super(e),this.camera=e,this.headLight=new Ae.SpotLight(16777215,1,0,Math.PI/3,0,0),this.headLight.rotation.x=3.14/2,this.object.add(this.camera),this.object.add(this.headLight)}initObject(){return new Ae.Object3D}getHeadLight(){return this.headLight}setAspect(e){In(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}}function In(n){return n.isPerspectiveCamera===!0}class Vt extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;constructor(e){super(),e||(e={}),e.camera||(e.camera=new Ae.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new st(e.camera);this.base=new Lt(t),this.scene=this.base.scene,this.camera=this.base.camera;const r={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new Ae.WebGLRenderer(r),"opaque"in e&&this.renderer.setClearAlpha(0),this.clock=new Ae.Clock,this.style="display: block; background: rgba(0,0,0,0);",this.renderer.domElement.style="display: block; width: 100%; height: 100%; margin: 0; padding: 0;",this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();bn(this.camera3js)&&(this.camera3js.aspect=e/t),this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js)};myMouseClickedListener=e=>{if(this.camera instanceof st){const t=new Ae.Raycaster,r=new Ae.Vector2,i=e.target.getBoundingClientRect(),c=e.clientX-i.left,s=e.clientY-i.top;r.x=2*(c/i.width)-1,r.y=-2*(s/i.height)+1,t.setFromCamera(r,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-canvas",Vt);function bn(n){return n.isPerspectiveCamera===!0}const Nn=`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 100px;
|
|
4
|
+
left: 100px;
|
|
5
|
+
/* width: 300px; */
|
|
6
|
+
border: 1px solid #555;
|
|
7
|
+
background: white;
|
|
8
|
+
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.3);
|
|
9
|
+
`,xn=`
|
|
10
|
+
background: #444;
|
|
11
|
+
color: white;
|
|
12
|
+
padding: 8px;
|
|
13
|
+
cursor: move;
|
|
14
|
+
user-select: none; /* 文字選択を防ぐ */
|
|
15
|
+
`;class zt extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;isDragging=!1;offsetX=0;offsetY=0;constructor(e,t){super(),this.camera3js=new Ae.PerspectiveCamera(75,e/t,.1,1e3);const r=new st(this.camera3js);this.base=new Lt(r),this.scene=this.base.scene,this.camera=this.base.camera,this.renderer=new Ae.WebGLRenderer,this.clock=new Ae.Clock,this.camera3js.aspect=e/t,this.renderer.setSize(e,t),this.style=Nn,document.body?document.body.appendChild(this):document.addEventListener("DOMContentLoaded",()=>{document.body.append(this)},{once:!0});const i=document.createElement("div");i.textContent="A3Window",i.style=xn,this.appendChild(i),i.addEventListener("mousedown",this.mouseDownListener),document.addEventListener("mousemove",this.mouseMoveListener),document.addEventListener("mouseup",this.mouseUpListener),this.renderer.domElement.style=`display: block; width: ${e}px; height: ${t}px; margin: 0; padding: 0;`,this.renderer.domElement.width=e,this.renderer.domElement.width=t,this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();this.camera3js.aspect=e/t,this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}mouseDownListener=e=>{this.isDragging=!0,this.offsetX=e.clientX-this.offsetLeft,this.offsetY=e.clientY-this.offsetTop};mouseMoveListener=e=>{this.isDragging&&(this.style.left=e.clientX-this.offsetX+"px",this.style.top=e.clientY-this.offsetY+"px")};mouseUpListener=()=>{this.isDragging=!1};replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.scene&&(this.scene.update(e),this.renderer.render(this.scene.scene,this.camera3js))};myMouseClickedListener=e=>{if(this.camera instanceof st){const t=new Ae.Raycaster,r=new Ae.Vector2,i=e.target.getBoundingClientRect(),c=e.clientX-i.left,s=e.clientY-i.top;r.x=2*(c/i.width)-1,r.y=-2*(s/i.height)+1,t.setFromCamera(r,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-window",zt);class kn extends Xe{constructor(e){super(),e&&e.physics?this.setControlMode("physics"):this.setControlMode("user")}initObject(){const e=new Ae.BoxGeometry,t=new Ae.MeshStandardMaterial({color:65280});return new Ae.Mesh(e,t)}initPhysics(e){this.physics=new Cn(this,e)}update(e){this.controlMode==="physics"?super.update(e):this.controlMode==="interpolated"?super.update(e):(this.object.rotation.x+=e,this.object.rotation.y+=e,this.object.rotation.z+=e)}}class Cn extends Gt{bodyDesc;body=null;colliderDesc;collider=null;constructor(e,t){super(e,t),this.bodyDesc=et.RAPIER.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.colliderDesc=et.RAPIER.ColliderDesc.cuboid(.5,.5,.5),this.colliderDesc.setRestitution(.3).setFriction(.6)}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const r=this.body.rotation();e.rot.set(r.x,r.y,r.z,r.w),e.object.quaternion.set(r.x,r.y,r.z,r.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.collider=e.world.createCollider(this.colliderDesc,this.body)}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.collider&&e.world.removeCollider(this.collider,!1)}setLocOverride(e){this.body&&this.body.setTranslation(e,!0)}setQuatOverride(e){this.body&&this.body.setRotation(e,!0)}setScaleOverride(e){}}class Pn extends A.Loader{constructor(e){super(e)}load(e,t,r,i){const c=this,s=new A.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(u){const a=c.parse(JSON.parse(u));t&&t(a)},r,i)}parse(e){return new Ht(e)}}class Ht{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,r="ltr"){const i=[],c=wn(e,t,this.data,r);for(let s=0,u=c.length;s<u;s++)i.push(...c[s].toShapes());return i}}function wn(n,e,t,r){const i=Array.from(n),c=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*c,u=[];let a=0,o=0;(r=="rtl"||r=="tb")&&i.reverse();for(let h=0;h<i.length;h++){const l=i[h];if(l===`
|
|
16
|
+
`)a=0,o-=s;else{const m=Mn(l,c,a,o,t);r=="tb"?(a=0,o+=t.ascender*c):a+=m.offsetX,u.push(m.path)}}return u}function Mn(n,e,t,r,i){const c=i.glyphs[n]||i.glyphs["?"];if(!c){console.error('THREE.Font: character "'+n+'" does not exists in font family '+i.familyName+".");return}const s=new A.ShapePath;let u,a,o,h,l,m,p,E;if(c.o){const T=c._cachedOutline||(c._cachedOutline=c.o.split(" "));for(let f=0,d=T.length;f<d;)switch(T[f++]){case"m":u=T[f++]*e+t,a=T[f++]*e+r,s.moveTo(u,a);break;case"l":u=T[f++]*e+t,a=T[f++]*e+r,s.lineTo(u,a);break;case"q":o=T[f++]*e+t,h=T[f++]*e+r,l=T[f++]*e+t,m=T[f++]*e+r,s.quadraticCurveTo(l,m,o,h);break;case"b":o=T[f++]*e+t,h=T[f++]*e+r,l=T[f++]*e+t,m=T[f++]*e+r,p=T[f++]*e+t,E=T[f++]*e+r,s.bezierCurveTo(l,m,p,E,o,h);break}}return{offsetX:c.ha*e,path:s}}class Fn extends A.ExtrudeGeometry{constructor(e,t={}){const r=t.font;if(r===void 0)super();else{const i=r.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(i,t)}this.type="TextGeometry"}}function Dn(n){return 2*n}function Un(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}async function Wt(n){const t=await(await fetch(n)).arrayBuffer();return await new Promise((i,c)=>{Ut.unzip(new Uint8Array(t),(s,u)=>{s?c(s):i(u)})})}function Bn(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n[e])return Ut.strFromU8(n[e]);throw new Error(`readStringFromUnzipped(): no file at ${e}`)}function Gn(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n[e]){const t=Vn(e);return new Blob([new Uint8Array(n[e])],{type:t})}else throw new Error(`readBlobFromUnzipped(): no file at ${e}`)}const jn={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function Vn(n){for(const[e,t]of Object.entries(jn))if(t.test(n))return e;return"application/octet-stream"}let ft=null;async function zn(n){if(n.match(/.zip$/i)){let e=n.substring(n.lastIndexOf("/"));e=e.substring(0,e.length-4);const t=await Wt(n),r=Bn(t,e);ft=new Ht(JSON.parse(r))}else ft=await new Pn().loadAsync(n)}class Hn extends Xe{initObject(e){let t;if(Bt(e)?t=e:t="ERROR",ft==null){const r=new Ae.BoxGeometry,i=new Ae.MeshStandardMaterial({color:16711680});return new Ae.Mesh(r,i)}else{const r={font:ft,size:1,depth:.5,curveSegments:12},i=new Fn(t,r);i.center();const c=new Ae.MeshStandardMaterial({color:65280});return new Ae.Mesh(i,c)}}}function Pt(n,e){if(e===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===A.TriangleFanDrawMode||e===A.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const s=[],u=n.getAttribute("position");if(u!==void 0){for(let a=0;a<u.count;a++)s.push(a);n.setIndex(s),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const r=t.count-2,i=[];if(e===A.TriangleFanDrawMode)for(let s=1;s<=r;s++)i.push(t.getX(0)),i.push(t.getX(s)),i.push(t.getX(s+1));else for(let s=0;s<r;s++)s%2===0?(i.push(t.getX(s)),i.push(t.getX(s+1)),i.push(t.getX(s+2))):(i.push(t.getX(s+2)),i.push(t.getX(s+1)),i.push(t.getX(s)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=n.clone();return c.setIndex(i),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class Wn extends A.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Qn(t)}),this.register(function(t){return new Zn(t)}),this.register(function(t){return new sr(t)}),this.register(function(t){return new ar(t)}),this.register(function(t){return new cr(t)}),this.register(function(t){return new $n(t)}),this.register(function(t){return new er(t)}),this.register(function(t){return new tr(t)}),this.register(function(t){return new nr(t)}),this.register(function(t){return new qn(t)}),this.register(function(t){return new rr(t)}),this.register(function(t){return new Jn(t)}),this.register(function(t){return new or(t)}),this.register(function(t){return new ir(t)}),this.register(function(t){return new Yn(t)}),this.register(function(t){return new ur(t)}),this.register(function(t){return new lr(t)})}load(e,t,r,i){const c=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const o=A.LoaderUtils.extractUrlBase(e);s=A.LoaderUtils.resolveURL(o,this.path)}else s=A.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const u=function(o){i?i(o):console.error(o),c.manager.itemError(e),c.manager.itemEnd(e)},a=new A.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{c.parse(o,s,function(h){t(h),c.manager.itemEnd(e)},u)}catch(h){u(h)}},r,u)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,i){let c;const s={},u={},a=new TextDecoder;if(typeof e=="string")c=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===Kt){try{s[Re.KHR_BINARY_GLTF]=new fr(e)}catch(l){i&&i(l);return}c=JSON.parse(s[Re.KHR_BINARY_GLTF].content)}else c=JSON.parse(a.decode(e));else c=e;if(c.asset===void 0||c.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const o=new Or(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const l=this.pluginCallbacks[h](o);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),u[l.name]=l,s[l.name]=!0}if(c.extensionsUsed)for(let h=0;h<c.extensionsUsed.length;++h){const l=c.extensionsUsed[h],m=c.extensionsRequired||[];switch(l){case Re.KHR_MATERIALS_UNLIT:s[l]=new Xn;break;case Re.KHR_DRACO_MESH_COMPRESSION:s[l]=new hr(c,this.dracoLoader);break;case Re.KHR_TEXTURE_TRANSFORM:s[l]=new dr;break;case Re.KHR_MESH_QUANTIZATION:s[l]=new pr;break;default:m.indexOf(l)>=0&&u[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}o.setExtensions(s),o.setPlugins(u),o.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,c){r.parse(e,t,i,c)})}}function Kn(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Yn{constructor(e){this.parser=e,this.name=Re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r<i;r++){const c=t[r];c.extensions&&c.extensions[this.name]&&c.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,c.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let i=t.cache.get(r);if(i)return i;const c=t.json,a=((c.extensions&&c.extensions[this.name]||{}).lights||[])[e];let o;const h=new A.Color(16777215);a.color!==void 0&&h.setRGB(a.color[0],a.color[1],a.color[2],A.LinearSRGBColorSpace);const l=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new A.DirectionalLight(h),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new A.PointLight(h),o.distance=l;break;case"spot":o=new A.SpotLight(h),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),Ye(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(o),t.cache.add(r,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,c=r.json.nodes[e],u=(c.extensions&&c.extensions[this.name]||{}).light;return u===void 0?null:this._loadLight(u).then(function(a){return r._getNodeRef(t.cache,u,a)})}}class Xn{constructor(){this.name=Re.KHR_MATERIALS_UNLIT}getMaterialType(){return A.MeshBasicMaterial}extendParams(e,t,r){const i=[];e.color=new A.Color(1,1,1),e.opacity=1;const c=t.pbrMetallicRoughness;if(c){if(Array.isArray(c.baseColorFactor)){const s=c.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],A.LinearSRGBColorSpace),e.opacity=s[3]}c.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",c.baseColorTexture,A.SRGBColorSpace))}return Promise.all(i)}}class qn{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=i.extensions[this.name].emissiveStrength;return c!==void 0&&(t.emissiveIntensity=c),Promise.resolve()}}class Qn{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&c.push(r.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&c.push(r.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(c.push(r.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const u=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new A.Vector2(u,u)}return Promise.all(c)}}class Zn{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=i.extensions[this.name];return t.dispersion=c.dispersion!==void 0?c.dispersion:0,Promise.resolve()}}class Jn{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&c.push(r.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&c.push(r.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(c)}}class $n{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[];t.sheenColor=new A.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];if(s.sheenColorFactor!==void 0){const u=s.sheenColorFactor;t.sheenColor.setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&c.push(r.assignTexture(t,"sheenColorMap",s.sheenColorTexture,A.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&c.push(r.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(c)}}class er{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&c.push(r.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(c)}}class tr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&c.push(r.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const u=s.attenuationColor||[1,1,1];return t.attenuationColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),Promise.all(c)}}class nr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=i.extensions[this.name];return t.ior=c.ior!==void 0?c.ior:1.5,Promise.resolve()}}class rr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&c.push(r.assignTexture(t,"specularIntensityMap",s.specularTexture));const u=s.specularColorFactor||[1,1,1];return t.specularColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&c.push(r.assignTexture(t,"specularColorMap",s.specularColorTexture,A.SRGBColorSpace)),Promise.all(c)}}class ir{constructor(e){this.parser=e,this.name=Re.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&c.push(r.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(c)}}class or{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const c=[],s=i.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&c.push(r.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(c)}}class sr{constructor(e){this.parser=e,this.name=Re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const c=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,c.source,s)}}class ar{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,r=this.parser,i=r.json,c=i.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=i.images[s.source];let a=r.textureLoader;if(u.uri){const o=r.options.manager.getHandler(u.uri);o!==null&&(a=o)}return r.loadTextureImage(e,s.source,a)}}class cr{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,r=this.parser,i=r.json,c=i.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=i.images[s.source];let a=r.textureLoader;if(u.uri){const o=r.options.manager.getHandler(u.uri);o!==null&&(a=o)}return r.loadTextureImage(e,s.source,a)}}class ur{constructor(e){this.name=Re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],c=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return c.then(function(u){const a=i.byteOffset||0,o=i.byteLength||0,h=i.count,l=i.byteStride,m=new Uint8Array(u,a,o);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(h,l,m,i.mode,i.filter).then(function(p){return p.buffer}):s.ready.then(function(){const p=new ArrayBuffer(h*l);return s.decodeGltfBuffer(new Uint8Array(p),h,l,m,i.mode,i.filter),p})})}else return null}}class lr{constructor(e){this.name=Re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const o of i.primitives)if(o.mode!==He.TRIANGLES&&o.mode!==He.TRIANGLE_STRIP&&o.mode!==He.TRIANGLE_FAN&&o.mode!==void 0)return null;const s=r.extensions[this.name].attributes,u=[],a={};for(const o in s)u.push(this.parser.getDependency("accessor",s[o]).then(h=>(a[o]=h,a[o])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(o=>{const h=o.pop(),l=h.isGroup?h.children:[h],m=o[0].count,p=[];for(const E of l){const T=new A.Matrix4,f=new A.Vector3,d=new A.Quaternion,y=new A.Vector3(1,1,1),v=new A.InstancedMesh(E.geometry,E.material,m);for(let g=0;g<m;g++)a.TRANSLATION&&f.fromBufferAttribute(a.TRANSLATION,g),a.ROTATION&&d.fromBufferAttribute(a.ROTATION,g),a.SCALE&&y.fromBufferAttribute(a.SCALE,g),v.setMatrixAt(g,T.compose(f,d,y));for(const g in a)if(g==="_COLOR_0"){const b=a[g];v.instanceColor=new A.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&E.geometry.setAttribute(g,a[g]);A.Object3D.prototype.copy.call(v,E),this.parser.assignFinalMaterial(v),p.push(v)}return h.isGroup?(h.clear(),h.add(...p),h):p[0]}))}}const Kt="glTF",it=12,wt={JSON:1313821514,BIN:5130562};class fr{constructor(e){this.name=Re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,it),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Kt)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-it,c=new DataView(e,it);let s=0;for(;s<i;){const u=c.getUint32(s,!0);s+=4;const a=c.getUint32(s,!0);if(s+=4,a===wt.JSON){const o=new Uint8Array(e,it+s,u);this.content=r.decode(o)}else if(a===wt.BIN){const o=it+s;this.body=e.slice(o,o+u)}s+=u}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class hr{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,i=this.dracoLoader,c=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,u={},a={},o={};for(const h in s){const l=At[h]||h.toLowerCase();u[l]=s[h]}for(const h in e.attributes){const l=At[h]||h.toLowerCase();if(s[h]!==void 0){const m=r.accessors[e.attributes[h]],p=rt[m.componentType];o[l]=p.name,a[l]=m.normalized===!0}}return t.getDependency("bufferView",c).then(function(h){return new Promise(function(l,m){i.decodeDracoFile(h,function(p){for(const E in p.attributes){const T=p.attributes[E],f=a[E];f!==void 0&&(T.normalized=f)}l(p)},u,o,A.LinearSRGBColorSpace,m)})})}}class dr{constructor(){this.name=Re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class pr{constructor(){this.name=Re.KHR_MESH_QUANTIZATION}}class Yt extends A.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,c=e*i*3+i;for(let s=0;s!==i;s++)t[s]=r[c+s];return t}interpolate_(e,t,r,i){const c=this.resultBuffer,s=this.sampleValues,u=this.valueSize,a=u*2,o=u*3,h=i-t,l=(r-t)/h,m=l*l,p=m*l,E=e*o,T=E-o,f=-2*p+3*m,d=p-m,y=1-f,v=d-m+l;for(let g=0;g!==u;g++){const b=s[T+g+u],w=s[T+g+a]*h,C=s[E+g+u],Y=s[E+g]*h;c[g]=y*b+v*w+f*C+d*Y}return c}}const mr=new A.Quaternion;class yr extends Yt{interpolate_(e,t,r,i){const c=super.interpolate_(e,t,r,i);return mr.fromArray(c).normalize().toArray(c),c}}const He={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},rt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Mt={9728:A.NearestFilter,9729:A.LinearFilter,9984:A.NearestMipmapNearestFilter,9985:A.LinearMipmapNearestFilter,9986:A.NearestMipmapLinearFilter,9987:A.LinearMipmapLinearFilter},Ft={33071:A.ClampToEdgeWrapping,33648:A.MirroredRepeatWrapping,10497:A.RepeatWrapping},Tt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},At={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ze={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},gr={CUBICSPLINE:void 0,LINEAR:A.InterpolateLinear,STEP:A.InterpolateDiscrete},Et={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Tr(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new A.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:A.FrontSide})),n.DefaultMaterial}function Je(n,e,t){for(const r in t.extensions)n[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function Ye(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Er(n,e,t){let r=!1,i=!1,c=!1;for(let o=0,h=e.length;o<h;o++){const l=e[o];if(l.POSITION!==void 0&&(r=!0),l.NORMAL!==void 0&&(i=!0),l.COLOR_0!==void 0&&(c=!0),r&&i&&c)break}if(!r&&!i&&!c)return Promise.resolve(n);const s=[],u=[],a=[];for(let o=0,h=e.length;o<h;o++){const l=e[o];if(r){const m=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):n.attributes.position;s.push(m)}if(i){const m=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):n.attributes.normal;u.push(m)}if(c){const m=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):n.attributes.color;a.push(m)}}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a)]).then(function(o){const h=o[0],l=o[1],m=o[2];return r&&(n.morphAttributes.position=h),i&&(n.morphAttributes.normal=l),c&&(n.morphAttributes.color=m),n.morphTargetsRelative=!0,n})}function vr(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,r=e.weights.length;t<r;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let r=0,i=t.length;r<i;r++)n.morphTargetDictionary[t[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Rr(n){let e;const t=n.extensions&&n.extensions[Re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+vt(t.attributes):e=n.indices+":"+vt(n.attributes)+":"+n.mode,n.targets!==void 0)for(let r=0,i=n.targets.length;r<i;r++)e+=":"+vt(n.targets[r]);return e}function vt(n){let e="";const t=Object.keys(n).sort();for(let r=0,i=t.length;r<i;r++)e+=t[r]+":"+n[t[r]]+";";return e}function _t(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ar(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const _r=new A.Matrix4;class Or{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Kn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,c=!1,s=-1;if(typeof navigator<"u"){const u=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(u)===!0;const a=u.match(/Version\/(\d+)/);i=r&&a?parseInt(a[1],10):-1,c=u.indexOf("Firefox")>-1,s=c?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||c&&s<98?this.textureLoader=new A.TextureLoader(this.options.manager):this.textureLoader=new A.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new A.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,c=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(s){const u={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:r,userData:{}};return Je(c,u,i),Ye(u,i),Promise.all(r._invokeAll(function(a){return a.afterRoot&&a.afterRoot(u)})).then(function(){for(const a of u.scenes)a.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,c=t.length;i<c;i++){const s=t[i].joints;for(let u=0,a=s.length;u<a;u++)e[s[u]].isBone=!0}for(let i=0,c=e.length;i<c;i++){const s=e[i];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(r[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const i=r.clone(),c=(s,u)=>{const a=this.associations.get(s);a!=null&&this.associations.set(u,a);for(const[o,h]of s.children.entries())c(h,u.children[o])};return c(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const i=e(t[r]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let i=0;i<t.length;i++){const c=e(t[i]);c&&r.push(c)}return r}getDependency(e,t){const r=e+":"+t;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(c){return c.loadNode&&c.loadNode(t)});break;case"mesh":i=this._invokeOne(function(c){return c.loadMesh&&c.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(c){return c.loadBufferView&&c.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(c){return c.loadMaterial&&c.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(c){return c.loadTexture&&c.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(c){return c.loadAnimation&&c.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(c){return c!=this&&c.getDependency&&c.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(r,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(c,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Re.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(c,s){r.load(A.LoaderUtils.resolveURL(t.uri,i.path),c,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(r){const i=t.byteLength||0,c=t.byteOffset||0;return r.slice(c,c+i)})}loadAccessor(e){const t=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const s=Tt[i.type],u=rt[i.componentType],a=i.normalized===!0,o=new u(i.count*s);return Promise.resolve(new A.BufferAttribute(o,s,a))}const c=[];return i.bufferView!==void 0?c.push(this.getDependency("bufferView",i.bufferView)):c.push(null),i.sparse!==void 0&&(c.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),c.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(c).then(function(s){const u=s[0],a=Tt[i.type],o=rt[i.componentType],h=o.BYTES_PER_ELEMENT,l=h*a,m=i.byteOffset||0,p=i.bufferView!==void 0?r.bufferViews[i.bufferView].byteStride:void 0,E=i.normalized===!0;let T,f;if(p&&p!==l){const d=Math.floor(m/p),y="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+d+":"+i.count;let v=t.cache.get(y);v||(T=new o(u,d*p,i.count*p/h),v=new A.InterleavedBuffer(T,p/h),t.cache.add(y,v)),f=new A.InterleavedBufferAttribute(v,a,m%p/h,E)}else u===null?T=new o(i.count*a):T=new o(u,m,i.count*a),f=new A.BufferAttribute(T,a,E);if(i.sparse!==void 0){const d=Tt.SCALAR,y=rt[i.sparse.indices.componentType],v=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,b=new y(s[1],v,i.sparse.count*d),w=new o(s[2],g,i.sparse.count*a);u!==null&&(f=new A.BufferAttribute(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let C=0,Y=b.length;C<Y;C++){const I=b[C];if(f.setX(I,w[C*a]),a>=2&&f.setY(I,w[C*a+1]),a>=3&&f.setZ(I,w[C*a+2]),a>=4&&f.setW(I,w[C*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=E}return f})}loadTexture(e){const t=this.json,r=this.options,c=t.textures[e].source,s=t.images[c];let u=this.textureLoader;if(s.uri){const a=r.manager.getHandler(s.uri);a!==null&&(u=a)}return this.loadTextureImage(e,c,u)}loadTextureImage(e,t,r){const i=this,c=this.json,s=c.textures[e],u=c.images[t],a=(u.uri||u.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const o=this.loadImageSource(t,r).then(function(h){h.flipY=!1,h.name=s.name||u.name||"",h.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(h.name=u.uri);const m=(c.samplers||{})[s.sampler]||{};return h.magFilter=Mt[m.magFilter]||A.LinearFilter,h.minFilter=Mt[m.minFilter]||A.LinearMipmapLinearFilter,h.wrapS=Ft[m.wrapS]||A.RepeatWrapping,h.wrapT=Ft[m.wrapT]||A.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==A.NearestFilter&&h.minFilter!==A.LinearFilter,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[a]=o,o}loadImageSource(e,t){const r=this,i=this.json,c=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const s=i.images[e],u=self.URL||self.webkitURL;let a=s.uri||"",o=!1;if(s.bufferView!==void 0)a=r.getDependency("bufferView",s.bufferView).then(function(l){o=!0;const m=new Blob([l],{type:s.mimeType});return a=u.createObjectURL(m),a});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(l){return new Promise(function(m,p){let E=m;t.isImageBitmapLoader===!0&&(E=function(T){const f=new A.Texture(T);f.needsUpdate=!0,m(f)}),t.load(A.LoaderUtils.resolveURL(l,c.path),E,void 0,p)})}).then(function(l){return o===!0&&u.revokeObjectURL(a),Ye(l,s),l.userData.mimeType=s.mimeType||Ar(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),l});return this.sourceCache[e]=h,h}assignTexture(e,t,r,i){const c=this;return this.getDependency("texture",r.index).then(function(s){if(!s)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(s=s.clone(),s.channel=r.texCoord),c.extensions[Re.KHR_TEXTURE_TRANSFORM]){const u=r.extensions!==void 0?r.extensions[Re.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const a=c.associations.get(s);s=c.extensions[Re.KHR_TEXTURE_TRANSFORM].extendTexture(s,u),c.associations.set(s,a)}}return i!==void 0&&(s.colorSpace=i),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,c=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+r.uuid;let a=this.cache.get(u);a||(a=new A.PointsMaterial,A.Material.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,a.sizeAttenuation=!1,this.cache.add(u,a)),r=a}else if(e.isLine){const u="LineBasicMaterial:"+r.uuid;let a=this.cache.get(u);a||(a=new A.LineBasicMaterial,A.Material.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,this.cache.add(u,a)),r=a}if(i||c||s){let u="ClonedMaterial:"+r.uuid+":";i&&(u+="derivative-tangents:"),c&&(u+="vertex-colors:"),s&&(u+="flat-shading:");let a=this.cache.get(u);a||(a=r.clone(),c&&(a.vertexColors=!0),s&&(a.flatShading=!0),i&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(u,a),this.associations.set(a,this.associations.get(r))),r=a}e.material=r}getMaterialType(){return A.MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,i=this.extensions,c=r.materials[e];let s;const u={},a=c.extensions||{},o=[];if(a[Re.KHR_MATERIALS_UNLIT]){const l=i[Re.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),o.push(l.extendParams(u,c,t))}else{const l=c.pbrMetallicRoughness||{};if(u.color=new A.Color(1,1,1),u.opacity=1,Array.isArray(l.baseColorFactor)){const m=l.baseColorFactor;u.color.setRGB(m[0],m[1],m[2],A.LinearSRGBColorSpace),u.opacity=m[3]}l.baseColorTexture!==void 0&&o.push(t.assignTexture(u,"map",l.baseColorTexture,A.SRGBColorSpace)),u.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,u.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(o.push(t.assignTexture(u,"metalnessMap",l.metallicRoughnessTexture)),o.push(t.assignTexture(u,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,u)})))}c.doubleSided===!0&&(u.side=A.DoubleSide);const h=c.alphaMode||Et.OPAQUE;if(h===Et.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,h===Et.MASK&&(u.alphaTest=c.alphaCutoff!==void 0?c.alphaCutoff:.5)),c.normalTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"normalMap",c.normalTexture)),u.normalScale=new A.Vector2(1,1),c.normalTexture.scale!==void 0)){const l=c.normalTexture.scale;u.normalScale.set(l,l)}if(c.occlusionTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"aoMap",c.occlusionTexture)),c.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=c.occlusionTexture.strength)),c.emissiveFactor!==void 0&&s!==A.MeshBasicMaterial){const l=c.emissiveFactor;u.emissive=new A.Color().setRGB(l[0],l[1],l[2],A.LinearSRGBColorSpace)}return c.emissiveTexture!==void 0&&s!==A.MeshBasicMaterial&&o.push(t.assignTexture(u,"emissiveMap",c.emissiveTexture,A.SRGBColorSpace)),Promise.all(o).then(function(){const l=new s(u);return c.name&&(l.name=c.name),Ye(l,c),t.associations.set(l,{materials:e}),c.extensions&&Je(i,l,c),l})}createUniqueName(e){const t=A.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function c(u){return r[Re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(a){return Dt(a,u,t)})}const s=[];for(let u=0,a=e.length;u<a;u++){const o=e[u],h=Rr(o),l=i[h];if(l)s.push(l.promise);else{let m;o.extensions&&o.extensions[Re.KHR_DRACO_MESH_COMPRESSION]?m=c(o):m=Dt(new A.BufferGeometry,o,t),i[h]={primitive:o,promise:m},s.push(m)}}return Promise.all(s)}loadMesh(e){const t=this,r=this.json,i=this.extensions,c=r.meshes[e],s=c.primitives,u=[];for(let a=0,o=s.length;a<o;a++){const h=s[a].material===void 0?Tr(this.cache):this.getDependency("material",s[a].material);u.push(h)}return u.push(t.loadGeometries(s)),Promise.all(u).then(function(a){const o=a.slice(0,a.length-1),h=a[a.length-1],l=[];for(let p=0,E=h.length;p<E;p++){const T=h[p],f=s[p];let d;const y=o[p];if(f.mode===He.TRIANGLES||f.mode===He.TRIANGLE_STRIP||f.mode===He.TRIANGLE_FAN||f.mode===void 0)d=c.isSkinnedMesh===!0?new A.SkinnedMesh(T,y):new A.Mesh(T,y),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),f.mode===He.TRIANGLE_STRIP?d.geometry=Pt(d.geometry,A.TriangleStripDrawMode):f.mode===He.TRIANGLE_FAN&&(d.geometry=Pt(d.geometry,A.TriangleFanDrawMode));else if(f.mode===He.LINES)d=new A.LineSegments(T,y);else if(f.mode===He.LINE_STRIP)d=new A.Line(T,y);else if(f.mode===He.LINE_LOOP)d=new A.LineLoop(T,y);else if(f.mode===He.POINTS)d=new A.Points(T,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(d.geometry.morphAttributes).length>0&&vr(d,c),d.name=t.createUniqueName(c.name||"mesh_"+e),Ye(d,c),f.extensions&&Je(i,d,f),t.assignFinalMaterial(d),l.push(d)}for(let p=0,E=l.length;p<E;p++)t.associations.set(l[p],{meshes:e,primitives:p});if(l.length===1)return c.extensions&&Je(i,l[0],c),l[0];const m=new A.Group;c.extensions&&Je(i,m,c),t.associations.set(m,{meshes:e});for(let p=0,E=l.length;p<E;p++)m.add(l[p]);return m})}loadCamera(e){let t;const r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?t=new A.PerspectiveCamera(A.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(t=new A.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),Ye(t,r),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],r=[];for(let i=0,c=t.joints.length;i<c;i++)r.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(i){const c=i.pop(),s=i,u=[],a=[];for(let o=0,h=s.length;o<h;o++){const l=s[o];if(l){u.push(l);const m=new A.Matrix4;c!==null&&m.fromArray(c.array,o*16),a.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new A.Skeleton(u,a)})}loadAnimation(e){const t=this.json,r=this,i=t.animations[e],c=i.name?i.name:"animation_"+e,s=[],u=[],a=[],o=[],h=[];for(let l=0,m=i.channels.length;l<m;l++){const p=i.channels[l],E=i.samplers[p.sampler],T=p.target,f=T.node,d=i.parameters!==void 0?i.parameters[E.input]:E.input,y=i.parameters!==void 0?i.parameters[E.output]:E.output;T.node!==void 0&&(s.push(this.getDependency("node",f)),u.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",y)),o.push(E),h.push(T))}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a),Promise.all(o),Promise.all(h)]).then(function(l){const m=l[0],p=l[1],E=l[2],T=l[3],f=l[4],d=[];for(let v=0,g=m.length;v<g;v++){const b=m[v],w=p[v],C=E[v],Y=T[v],I=f[v];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const G=r._createAnimationTracks(b,w,C,Y,I);if(G)for(let M=0;M<G.length;M++)d.push(G[M])}const y=new A.AnimationClip(c,void 0,d);return Ye(y,i),y})}createNodeMesh(e){const t=this.json,r=this,i=t.nodes[e];return i.mesh===void 0?null:r.getDependency("mesh",i.mesh).then(function(c){const s=r._getNodeRef(r.meshCache,i.mesh,c);return i.weights!==void 0&&s.traverse(function(u){if(u.isMesh)for(let a=0,o=i.weights.length;a<o;a++)u.morphTargetInfluences[a]=i.weights[a]}),s})}loadNode(e){const t=this.json,r=this,i=t.nodes[e],c=r._loadNodeShallow(e),s=[],u=i.children||[];for(let o=0,h=u.length;o<h;o++)s.push(r.getDependency("node",u[o]));const a=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([c,Promise.all(s),a]).then(function(o){const h=o[0],l=o[1],m=o[2];m!==null&&h.traverse(function(p){p.isSkinnedMesh&&p.bind(m,_r)});for(let p=0,E=l.length;p<E;p++)h.add(l[p]);return h})}_loadNodeShallow(e){const t=this.json,r=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const c=t.nodes[e],s=c.name?i.createUniqueName(c.name):"",u=[],a=i._invokeOne(function(o){return o.createNodeMesh&&o.createNodeMesh(e)});return a&&u.push(a),c.camera!==void 0&&u.push(i.getDependency("camera",c.camera).then(function(o){return i._getNodeRef(i.cameraCache,c.camera,o)})),i._invokeAll(function(o){return o.createNodeAttachment&&o.createNodeAttachment(e)}).forEach(function(o){u.push(o)}),this.nodeCache[e]=Promise.all(u).then(function(o){let h;if(c.isBone===!0?h=new A.Bone:o.length>1?h=new A.Group:o.length===1?h=o[0]:h=new A.Object3D,h!==o[0])for(let l=0,m=o.length;l<m;l++)h.add(o[l]);if(c.name&&(h.userData.name=c.name,h.name=s),Ye(h,c),c.extensions&&Je(r,h,c),c.matrix!==void 0){const l=new A.Matrix4;l.fromArray(c.matrix),h.applyMatrix4(l)}else c.translation!==void 0&&h.position.fromArray(c.translation),c.rotation!==void 0&&h.quaternion.fromArray(c.rotation),c.scale!==void 0&&h.scale.fromArray(c.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(c.mesh!==void 0&&i.meshCache.refs[c.mesh]>1){const l=i.associations.get(h);i.associations.set(h,{...l})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],i=this,c=new A.Group;r.name&&(c.name=i.createUniqueName(r.name)),Ye(c,r),r.extensions&&Je(t,c,r);const s=r.nodes||[],u=[];for(let a=0,o=s.length;a<o;a++)u.push(i.getDependency("node",s[a]));return Promise.all(u).then(function(a){for(let h=0,l=a.length;h<l;h++)c.add(a[h]);const o=h=>{const l=new Map;for(const[m,p]of i.associations)(m instanceof A.Material||m instanceof A.Texture)&&l.set(m,p);return h.traverse(m=>{const p=i.associations.get(m);p!=null&&l.set(m,p)}),l};return i.associations=o(c),c})}_createAnimationTracks(e,t,r,i,c){const s=[],u=e.name?e.name:e.uuid,a=[];Ze[c.path]===Ze.weights?e.traverse(function(m){m.morphTargetInfluences&&a.push(m.name?m.name:m.uuid)}):a.push(u);let o;switch(Ze[c.path]){case Ze.weights:o=A.NumberKeyframeTrack;break;case Ze.rotation:o=A.QuaternionKeyframeTrack;break;case Ze.translation:case Ze.scale:o=A.VectorKeyframeTrack;break;default:r.itemSize===1?o=A.NumberKeyframeTrack:o=A.VectorKeyframeTrack;break}const h=i.interpolation!==void 0?gr[i.interpolation]:A.InterpolateLinear,l=this._getArrayFromAccessor(r);for(let m=0,p=a.length;m<p;m++){const E=new o(a[m]+"."+Ze[c.path],t.array,l,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),s.push(E)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const r=_t(t.constructor),i=new Float32Array(t.length);for(let c=0,s=t.length;c<s;c++)i[c]=t[c]*r;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const i=this instanceof A.QuaternionKeyframeTrack?yr:Yt;return new i(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Lr(n,e,t){const r=e.attributes,i=new A.Box3;if(r.POSITION!==void 0){const u=t.json.accessors[r.POSITION],a=u.min,o=u.max;if(a!==void 0&&o!==void 0){if(i.set(new A.Vector3(a[0],a[1],a[2]),new A.Vector3(o[0],o[1],o[2])),u.normalized){const h=_t(rt[u.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const c=e.targets;if(c!==void 0){const u=new A.Vector3,a=new A.Vector3;for(let o=0,h=c.length;o<h;o++){const l=c[o];if(l.POSITION!==void 0){const m=t.json.accessors[l.POSITION],p=m.min,E=m.max;if(p!==void 0&&E!==void 0){if(a.setX(Math.max(Math.abs(p[0]),Math.abs(E[0]))),a.setY(Math.max(Math.abs(p[1]),Math.abs(E[1]))),a.setZ(Math.max(Math.abs(p[2]),Math.abs(E[2]))),m.normalized){const T=_t(rt[m.componentType]);a.multiplyScalar(T)}u.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(u)}n.boundingBox=i;const s=new A.Sphere;i.getCenter(s.center),s.radius=i.min.distanceTo(i.max)/2,n.boundingSphere=s}function Dt(n,e,t){const r=e.attributes,i=[];function c(s,u){return t.getDependency("accessor",s).then(function(a){n.setAttribute(u,a)})}for(const s in r){const u=At[s]||s.toLowerCase();u in n.attributes||i.push(c(r[s],u))}if(e.indices!==void 0&&!n.index){const s=t.getDependency("accessor",e.indices).then(function(u){n.setIndex(u)});i.push(s)}return A.ColorManagement.workingColorSpace!==A.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${A.ColorManagement.workingColorSpace}" not supported.`),Ye(n,e),Lr(n,e,t),Promise.all(i).then(function(){return e.targets!==void 0?Er(n,e.targets,t):n})}const Rt=new WeakMap;class Sr extends A.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){const c=new A.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,s=>{this.parse(s,t,i)},r,i)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,A.SRGBColorSpace,r).catch(r)}decodeDracoFile(e,t,r,i,c=A.LinearSRGBColorSpace,s=()=>{}){const u={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:c};return this.decodeGeometry(e,u).then(t).catch(s)}decodeGeometry(e,t){const r=JSON.stringify(t);if(Rt.has(e)){const a=Rt.get(e);if(a.key===r)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const c=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(c,s).then(a=>(i=a,new Promise((o,h)=>{i._callbacks[c]={resolve:o,reject:h},i.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return u.catch(()=>!0).then(()=>{i&&c&&this._releaseTask(i,c)}),Rt.set(e,{key:r,promise:u}),u}_createGeometry(e){const t=new A.BufferGeometry;e.index&&t.setIndex(new A.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const{name:i,array:c,itemSize:s,stride:u,vertexColorSpace:a}=e.attributes[r];let o;if(s===u)o=new A.BufferAttribute(c,s);else{const h=new A.InterleavedBuffer(c,u);o=new A.InterleavedBufferAttribute(h,s,0)}i==="color"&&(this._assignVertexColorSpace(o,a),o.normalized=!(c instanceof Float32Array)),t.setAttribute(i,o)}return t}_assignVertexColorSpace(e,t){if(t!==A.SRGBColorSpace)return;const r=new A.Color;for(let i=0,c=e.count;i<c;i++)r.fromBufferAttribute(e,i),A.ColorManagement.colorSpaceToWorking(r,A.SRGBColorSpace),e.setXYZ(i,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new A.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((i,c)=>{r.load(e,i,void 0,c)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{const i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const c=Ir.toString(),s=["/* draco decoder */",i,"","/* worker */",c.substring(c.indexOf("{")+1,c.lastIndexOf("}"))].join(`
|
|
17
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(c){const s=c.data;switch(s.type){case"decode":i._callbacks[s.id].resolve(s);break;case"error":i._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,c){return i._taskLoad>c._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ir(){let n,e;onmessage=function(s){const u=s.data;switch(u.type){case"init":n=u.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(l){h({draco:l})},DracoDecoderModule(n)});break;case"decode":const a=u.buffer,o=u.taskConfig;e.then(h=>{const l=h.draco,m=new l.Decoder;try{const p=t(l,m,new Int8Array(a),o),E=p.attributes.map(T=>T.array.buffer);p.index&&E.push(p.index.array.buffer),self.postMessage({type:"decode",id:u.id,geometry:p},E)}catch(p){console.error(p),self.postMessage({type:"error",id:u.id,error:p.message})}finally{l.destroy(m)}});break}};function t(s,u,a,o){const h=o.attributeIDs,l=o.attributeTypes;let m,p;const E=u.GetEncodedGeometryType(a);if(E===s.TRIANGULAR_MESH)m=new s.Mesh,p=u.DecodeArrayToMesh(a,a.byteLength,m);else if(E===s.POINT_CLOUD)m=new s.PointCloud,p=u.DecodeArrayToPointCloud(a,a.byteLength,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const T={index:null,attributes:[]};for(const f in h){const d=self[l[f]];let y,v;if(o.useUniqueIDs)v=h[f],y=u.GetAttributeByUniqueId(m,v);else{if(v=u.GetAttributeId(m,s[h[f]]),v===-1)continue;y=u.GetAttribute(m,v)}const g=i(s,u,m,f,d,y);f==="color"&&(g.vertexColorSpace=o.vertexColorSpace),T.attributes.push(g)}return E===s.TRIANGULAR_MESH&&(T.index=r(s,u,m)),s.destroy(m),T}function r(s,u,a){const h=a.num_faces()*3,l=h*4,m=s._malloc(l);u.GetTrianglesUInt32Array(a,l,m);const p=new Uint32Array(s.HEAPF32.buffer,m,h).slice();return s._free(m),{array:p,itemSize:1}}function i(s,u,a,o,h,l){const m=a.num_points(),p=l.num_components(),E=c(s,h),T=p*h.BYTES_PER_ELEMENT,f=Math.ceil(T/4)*4,d=f/h.BYTES_PER_ELEMENT,y=m*T,v=m*f,g=s._malloc(y);u.GetAttributeDataArrayForAllPoints(a,l,E,y,g);const b=new h(s.HEAPF32.buffer,g,y/h.BYTES_PER_ELEMENT);let w;if(T===f)w=b.slice();else{w=new h(v/h.BYTES_PER_ELEMENT);let C=0;for(let Y=0,I=b.length;Y<I;Y++){for(let G=0;G<p;G++)w[C+G]=b[Y*p+G];C+=d}}return s._free(g),{name:o,count:m,itemSize:p,array:w,stride:d}}function c(s,u){switch(u){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}function br(n){return"morphTargetDictionary"in n&&n.morphTargetDictionary!==void 0&&"morphTargetInfluences"in n&&Array.isArray(n.morphTargetInfluences)}const Xt=new Wn,qt=new Sr;qt.setDecoderPath("/examples/jsm/libs/draco/");Xt.setDRACOLoader(qt);class Nr extends Xe{ready;model=null;constructor(e){super(),this.ready=this.asyncInit(e),this.setControlMode("user")}initObject(){return new Ae.Object3D}async asyncInit(e){if(Bt(e)){const t=await Xt.loadAsync(e),r=new Ae.AnimationMixer(t.scene),i={};console.log(`File: ${e}`),console.log(" actions:");for(let s=0;s<t.animations.length;s++){const u=t.animations[s],a=r.clipAction(u);i[u.name]=a,console.log(` ${u.name}`)}console.log(" morphs:");const c={};t.scene.traverse(s=>{if(br(s)){const{morphTargetDictionary:u,morphTargetInfluences:a}=s;Object.keys(u).forEach(o=>{const h=s.name+"."+o,l=u[o];c[h]={array:a,idx:l},console.log(` ${h}`)})}}),this.model={gltf:t,mixer:r,actions:i,morphs:c},this.object.add(this.model.gltf.scene)}else{const t=new Ae.BoxGeometry,r=new Ae.MeshStandardMaterial({color:16711680}),i=new Ae.Mesh(t,r);this.object.add(i)}return this}action(e){if(this.model){this.model.mixer.stopAllAction();const t=this.model.actions[e];t&&t.play()}}morph(e,t){if(this.model&&e in this.model.morphs){const{array:r,idx:i}=this.model.morphs[e];r[i]=t}}update(e){this.model&&this.model.mixer.update(e)}}var Ee=(n,e)=>()=>(e||(e={exports:{}},n(e.exports,e)),e.exports),Qt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VERSION=void 0,n.VERSION="9.0.1"}),Ie=Ee((n,e)=>{var t=n&&n.__spreadArray||function(D,K){for(var V=0,ee=K.length,he=D.length;V<ee;V++,he++)D[he]=K[V];return D};Object.defineProperty(n,"__esModule",{value:!0}),n.toFastProperties=n.timer=n.peek=n.isES2015MapSupported=n.PRINT_WARNING=n.PRINT_ERROR=n.packArray=n.IDENTITY=n.NOOP=n.merge=n.groupBy=n.defaults=n.assignNoOverwrite=n.assign=n.zipObject=n.sortBy=n.indexOf=n.some=n.difference=n.every=n.isObject=n.isRegExp=n.isArray=n.partial=n.uniq=n.compact=n.reduce=n.findAll=n.find=n.cloneObj=n.cloneArr=n.contains=n.has=n.pick=n.reject=n.filter=n.dropRight=n.drop=n.isFunction=n.isUndefined=n.isString=n.forEach=n.last=n.first=n.flatten=n.map=n.mapValues=n.values=n.keys=n.isEmpty=void 0;function r(D){return D&&D.length===0}n.isEmpty=r;function i(D){return D==null?[]:Object.keys(D)}n.keys=i;function c(D){for(var K=[],V=Object.keys(D),ee=0;ee<V.length;ee++)K.push(D[V[ee]]);return K}n.values=c;function s(D,K){for(var V=[],ee=i(D),he=0;he<ee.length;he++){var _e=ee[he];V.push(K.call(null,D[_e],_e))}return V}n.mapValues=s;function u(D,K){for(var V=[],ee=0;ee<D.length;ee++)V.push(K.call(null,D[ee],ee));return V}n.map=u;function a(D){for(var K=[],V=0;V<D.length;V++){var ee=D[V];Array.isArray(ee)?K=K.concat(a(ee)):K.push(ee)}return K}n.flatten=a;function o(D){return r(D)?void 0:D[0]}n.first=o;function h(D){var K=D&&D.length;return K?D[K-1]:void 0}n.last=h;function l(D,K){if(Array.isArray(D))for(var V=0;V<D.length;V++)K.call(null,D[V],V);else if(Q(D))for(var ee=i(D),V=0;V<ee.length;V++){var he=ee[V],_e=D[he];K.call(null,_e,he)}else throw Error("non exhaustive match")}n.forEach=l;function m(D){return typeof D=="string"}n.isString=m;function p(D){return D===void 0}n.isUndefined=p;function E(D){return D instanceof Function}n.isFunction=E;function T(D,K){return K===void 0&&(K=1),D.slice(K,D.length)}n.drop=T;function f(D,K){return K===void 0&&(K=1),D.slice(0,D.length-K)}n.dropRight=f;function d(D,K){var V=[];if(Array.isArray(D))for(var ee=0;ee<D.length;ee++){var he=D[ee];K.call(null,he)&&V.push(he)}return V}n.filter=d;function y(D,K){return d(D,function(V){return!K(V)})}n.reject=y;function v(D,K){for(var V=Object.keys(D),ee={},he=0;he<V.length;he++){var _e=V[he],O=D[_e];K(O)&&(ee[_e]=O)}return ee}n.pick=v;function g(D,K){return Q(D)?D.hasOwnProperty(K):!1}n.has=g;function b(D,K){return Y(D,function(V){return V===K})!==void 0}n.contains=b;function w(D){for(var K=[],V=0;V<D.length;V++)K.push(D[V]);return K}n.cloneArr=w;function C(D){var K={};for(var V in D)Object.prototype.hasOwnProperty.call(D,V)&&(K[V]=D[V]);return K}n.cloneObj=C;function Y(D,K){for(var V=0;V<D.length;V++){var ee=D[V];if(K.call(null,ee))return ee}}n.find=Y;function I(D,K){for(var V=[],ee=0;ee<D.length;ee++){var he=D[ee];K.call(null,he)&&V.push(he)}return V}n.findAll=I;function G(D,K,V){for(var ee=Array.isArray(D),he=ee?D:c(D),_e=ee?[]:i(D),O=V,R=0;R<he.length;R++)O=K.call(null,O,he[R],ee?R:_e[R]);return O}n.reduce=G;function M(D){return y(D,function(K){return K==null})}n.compact=M;function S(D,K){K===void 0&&(K=function(ee){return ee});var V=[];return G(D,function(ee,he){var _e=K(he);return b(V,_e)?ee:(V.push(_e),ee.concat(he))},[])}n.uniq=S;function P(D){for(var K=[],V=1;V<arguments.length;V++)K[V-1]=arguments[V];var ee=[null],he=ee.concat(K);return Function.bind.apply(D,he)}n.partial=P;function k(D){return Array.isArray(D)}n.isArray=k;function X(D){return D instanceof RegExp}n.isRegExp=X;function Q(D){return D instanceof Object}n.isObject=Q;function H(D,K){for(var V=0;V<D.length;V++)if(!K(D[V],V))return!1;return!0}n.every=H;function $(D,K){return y(D,function(V){return b(K,V)})}n.difference=$;function te(D,K){for(var V=0;V<D.length;V++)if(K(D[V]))return!0;return!1}n.some=te;function ae(D,K){for(var V=0;V<D.length;V++)if(D[V]===K)return V;return-1}n.indexOf=ae;function se(D,K){var V=w(D);return V.sort(function(ee,he){return K(ee)-K(he)}),V}n.sortBy=se;function ce(D,K){if(D.length!==K.length)throw Error("can't zipObject with different number of keys and values!");for(var V={},ee=0;ee<D.length;ee++)V[D[ee]]=K[ee];return V}n.zipObject=ce;function ne(D){for(var K=[],V=1;V<arguments.length;V++)K[V-1]=arguments[V];for(var ee=0;ee<K.length;ee++)for(var he=K[ee],_e=i(he),O=0;O<_e.length;O++){var R=_e[O];D[R]=he[R]}return D}n.assign=ne;function de(D){for(var K=[],V=1;V<arguments.length;V++)K[V-1]=arguments[V];for(var ee=0;ee<K.length;ee++)for(var he=K[ee],_e=i(he),O=0;O<_e.length;O++){var R=_e[O];g(D,R)||(D[R]=he[R])}return D}n.assignNoOverwrite=de;function U(){for(var D=[],K=0;K<arguments.length;K++)D[K]=arguments[K];return de.apply(void 0,t([{}],D))}n.defaults=U;function j(D,K){var V={};return l(D,function(ee){var he=K(ee),_e=V[he];_e?_e.push(ee):V[he]=[ee]}),V}n.groupBy=j;function W(D,K){for(var V=C(D),ee=i(K),he=0;he<ee.length;he++){var _e=ee[he],O=K[_e];V[_e]=O}return V}n.merge=W;function q(){}n.NOOP=q;function Z(D){return D}n.IDENTITY=Z;function ie(D){for(var K=[],V=0;V<D.length;V++){var ee=D[V];K.push(ee!==void 0?ee:void 0)}return K}n.packArray=ie;function ge(D){console&&console.error&&console.error("Error: "+D)}n.PRINT_ERROR=ge;function me(D){console&&console.warn&&console.warn("Warning: "+D)}n.PRINT_WARNING=me;function xe(){return typeof Map=="function"}n.isES2015MapSupported=xe;function De(D){return D[D.length-1]}n.peek=De;function ze(D){var K=new Date().getTime(),V=D(),ee=new Date().getTime(),he=ee-K;return{time:he,value:V}}n.timer=ze;function Fe(D){function K(){}K.prototype=D;var V=new K;function ee(){return typeof V.bar}return ee(),ee(),D}n.toFastProperties=Fe}),St=Ee((n,e)=>{(function(t,r){typeof define=="function"&&define.amd?define([],r):typeof e=="object"&&e.exports?e.exports=r():t.regexpToAst=r()})(typeof self<"u"?self:n,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(f){this.idx=f.idx,this.input=f.input,this.groupIdx=f.groupIdx},t.prototype.pattern=function(f){this.idx=0,this.input=f,this.groupIdx=0,this.consumeChar("/");var d=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:f.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(y,"global");break;case"i":a(y,"ignoreCase");break;case"m":a(y,"multiLine");break;case"u":a(y,"unicode");break;case"y":a(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:d,loc:this.loc(0)}},t.prototype.disjunction=function(){var f=[],d=this.idx;for(f.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),f.push(this.alternative());return{type:"Disjunction",value:f,loc:this.loc(d)}},t.prototype.alternative=function(){for(var f=[],d=this.idx;this.isTerm();)f.push(this.term());return{type:"Alternative",value:f,loc:this.loc(d)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var f=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(f)};case"$":return{type:"EndAnchor",loc:this.loc(f)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(f)};case"B":return{type:"NonWordBoundary",loc:this.loc(f)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var d;switch(this.popChar()){case"=":d="Lookahead";break;case"!":d="NegativeLookahead";break}o(d);var y=this.disjunction();return this.consumeChar(")"),{type:d,value:y,loc:this.loc(f)}}h()},t.prototype.quantifier=function(f){var d,y=this.idx;switch(this.popChar()){case"*":d={atLeast:0,atMost:1/0};break;case"+":d={atLeast:1,atMost:1/0};break;case"?":d={atLeast:0,atMost:1};break;case"{":var v=this.integerIncludingZero();switch(this.popChar()){case"}":d={atLeast:v,atMost:v};break;case",":var g;this.isDigit()?(g=this.integerIncludingZero(),d={atLeast:v,atMost:g}):d={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(f===!0&&d===void 0)return;o(d);break}if(!(f===!0&&d===void 0))return o(d),this.peekChar(0)==="?"?(this.consumeChar("?"),d.greedy=!1):d.greedy=!0,d.type="Quantifier",d.loc=this.loc(y),d},t.prototype.atom=function(){var f,d=this.idx;switch(this.peekChar()){case".":f=this.dotAll();break;case"\\":f=this.atomEscape();break;case"[":f=this.characterClass();break;case"(":f=this.group();break}return f===void 0&&this.isPatternCharacter()&&(f=this.patternCharacter()),o(f),f.loc=this.loc(d),this.isQuantifier()&&(f.quantifier=this.quantifier()),f},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
18
|
+
`),s("\r"),s("\u2028"),s("\u2029")]}},t.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.decimalEscapeAtom=function(){var f=this.positiveInteger();return{type:"GroupBackReference",value:f}},t.prototype.characterClassEscape=function(){var f,d=!1;switch(this.popChar()){case"d":f=m;break;case"D":f=m,d=!0;break;case"s":f=E;break;case"S":f=E,d=!0;break;case"w":f=p;break;case"W":f=p,d=!0;break}return o(f),{type:"Set",value:f,complement:d}},t.prototype.controlEscapeAtom=function(){var f;switch(this.popChar()){case"f":f=s("\f");break;case"n":f=s(`
|
|
3
19
|
`);break;case"r":f=s("\r");break;case"t":f=s(" ");break;case"v":f=s("\v");break}return o(f),{type:"Character",value:f}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var f=this.popChar();if(/[a-zA-Z]/.test(f)===!1)throw Error("Invalid ");var d=f.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:d}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:s("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){var f=this.popChar();return{type:"Character",value:s(f)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|
4
20
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var f=this.popChar();return{type:"Character",value:s(f)}}},t.prototype.characterClass=function(){var f=[],d=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),d=!0);this.isClassAtom();){var y=this.classAtom(),v=y.type==="Character";if(v&&this.isRangeDash()){this.consumeChar("-");var g=this.classAtom(),b=g.type==="Character";if(b){if(g.value<y.value)throw Error("Range out of order in character class");f.push({from:y.value,to:g.value})}else u(y.value,f),f.push(s("-")),u(g.value,f)}else u(y.value,f)}return this.consumeChar("]"),{type:"Set",complement:d,value:f}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
|
|
5
|
-
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},t.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:s("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.group=function(){var f=!0;(this.consumeChar("("),this.peekChar(0))==="?"?(this.consumeChar("?"),this.consumeChar(":"),f=!1):this.groupIdx++;var d=this.disjunction();this.consumeChar(")");var y={type:"Group",capturing:f,value:d};return f&&(y.idx=this.groupIdx),y},t.prototype.positiveInteger=function(){var f=this.popChar();if(c.test(f)===!1)throw Error("Expecting a positive integer");for(;
|
|
6
|
-
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:s(f)}}},t.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},t.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},t.prototype.isDigit=function(){return
|
|
21
|
+
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},t.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:s("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.group=function(){var f=!0;(this.consumeChar("("),this.peekChar(0))==="?"?(this.consumeChar("?"),this.consumeChar(":"),f=!1):this.groupIdx++;var d=this.disjunction();this.consumeChar(")");var y={type:"Group",capturing:f,value:d};return f&&(y.idx=this.groupIdx),y},t.prototype.positiveInteger=function(){var f=this.popChar();if(c.test(f)===!1)throw Error("Expecting a positive integer");for(;i.test(this.peekChar(0));)f+=this.popChar();return parseInt(f,10)},t.prototype.integerIncludingZero=function(){var f=this.popChar();if(i.test(f)===!1)throw Error("Expecting an integer");for(;i.test(this.peekChar(0));)f+=this.popChar();return parseInt(f,10)},t.prototype.patternCharacter=function(){var f=this.popChar();switch(f){case`
|
|
22
|
+
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:s(f)}}},t.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},t.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},t.prototype.isDigit=function(){return i.test(this.peekChar(0))},t.prototype.isClassAtom=function(f){switch(f===void 0&&(f=0),this.peekChar(f)){case"]":case`
|
|
7
23
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},t.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},t.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}},t.prototype.isQuantifier=function(){var f=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(f)}},t.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
8
|
-
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(f){for(var d="",y=0;y<f;y++){var v=this.popChar();if(
|
|
9
|
-
`),s("\r"),s(" "),s("\v"),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s("\u2028"),s("\u2029"),s(" "),s(" "),s(" "),s("\uFEFF")];function T(){}return T.prototype.visitChildren=function(f){for(var d in f){var y=f[d];f.hasOwnProperty(d)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(v){this.visit(v)},this))}},T.prototype.visit=function(f){switch(f.type){case"Pattern":this.visitPattern(f);break;case"Flags":this.visitFlags(f);break;case"Disjunction":this.visitDisjunction(f);break;case"Alternative":this.visitAlternative(f);break;case"StartAnchor":this.visitStartAnchor(f);break;case"EndAnchor":this.visitEndAnchor(f);break;case"WordBoundary":this.visitWordBoundary(f);break;case"NonWordBoundary":this.visitNonWordBoundary(f);break;case"Lookahead":this.visitLookahead(f);break;case"NegativeLookahead":this.visitNegativeLookahead(f);break;case"Character":this.visitCharacter(f);break;case"Set":this.visitSet(f);break;case"Group":this.visitGroup(f);break;case"GroupBackReference":this.visitGroupBackReference(f);break;case"Quantifier":this.visitQuantifier(f);break}this.visitChildren(f)},T.prototype.visitPattern=function(f){},T.prototype.visitFlags=function(f){},T.prototype.visitDisjunction=function(f){},T.prototype.visitAlternative=function(f){},T.prototype.visitStartAnchor=function(f){},T.prototype.visitEndAnchor=function(f){},T.prototype.visitWordBoundary=function(f){},T.prototype.visitNonWordBoundary=function(f){},T.prototype.visitLookahead=function(f){},T.prototype.visitNegativeLookahead=function(f){},T.prototype.visitCharacter=function(f){},T.prototype.visitSet=function(f){},T.prototype.visitGroup=function(f){},T.prototype.visitGroupBackReference=function(f){},T.prototype.visitQuantifier=function(f){},{RegExpParser:t,BaseRegExpVisitor:T,VERSION:"0.5.0"}})}),
|
|
10
|
-
`;function u(T,f){f===void 0&&(f=!1);try{var d=
|
|
24
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(f){for(var d="",y=0;y<f;y++){var v=this.popChar();if(r.test(v)===!1)throw Error("Expecting a HexDecimal digits");d+=v}var g=parseInt(d,16);return{type:"Character",value:g}},t.prototype.peekChar=function(f){return f===void 0&&(f=0),this.input[this.idx+f]},t.prototype.popChar=function(){var f=this.peekChar(0);return this.consumeChar(),f},t.prototype.consumeChar=function(f){if(f!==void 0&&this.input[this.idx]!==f)throw Error("Expected: '"+f+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},t.prototype.loc=function(f){return{begin:f,end:this.idx}};var r=/[0-9a-fA-F]/,i=/[0-9]/,c=/[1-9]/;function s(f){return f.charCodeAt(0)}function u(f,d){f.length!==void 0?f.forEach(function(y){d.push(y)}):d.push(f)}function a(f,d){if(f[d]===!0)throw"duplicate flag "+d;f[d]=!0}function o(f){if(f===void 0)throw Error("Internal Error - Should never get here!")}function h(){throw Error("Internal Error - Should never get here!")}var l,m=[];for(l=s("0");l<=s("9");l++)m.push(l);var p=[s("_")].concat(m);for(l=s("a");l<=s("z");l++)p.push(l);for(l=s("A");l<=s("Z");l++)p.push(l);var E=[s(" "),s("\f"),s(`
|
|
25
|
+
`),s("\r"),s(" "),s("\v"),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s("\u2028"),s("\u2029"),s(" "),s(" "),s(" "),s("\uFEFF")];function T(){}return T.prototype.visitChildren=function(f){for(var d in f){var y=f[d];f.hasOwnProperty(d)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(v){this.visit(v)},this))}},T.prototype.visit=function(f){switch(f.type){case"Pattern":this.visitPattern(f);break;case"Flags":this.visitFlags(f);break;case"Disjunction":this.visitDisjunction(f);break;case"Alternative":this.visitAlternative(f);break;case"StartAnchor":this.visitStartAnchor(f);break;case"EndAnchor":this.visitEndAnchor(f);break;case"WordBoundary":this.visitWordBoundary(f);break;case"NonWordBoundary":this.visitNonWordBoundary(f);break;case"Lookahead":this.visitLookahead(f);break;case"NegativeLookahead":this.visitNegativeLookahead(f);break;case"Character":this.visitCharacter(f);break;case"Set":this.visitSet(f);break;case"Group":this.visitGroup(f);break;case"GroupBackReference":this.visitGroupBackReference(f);break;case"Quantifier":this.visitQuantifier(f);break}this.visitChildren(f)},T.prototype.visitPattern=function(f){},T.prototype.visitFlags=function(f){},T.prototype.visitDisjunction=function(f){},T.prototype.visitAlternative=function(f){},T.prototype.visitStartAnchor=function(f){},T.prototype.visitEndAnchor=function(f){},T.prototype.visitWordBoundary=function(f){},T.prototype.visitNonWordBoundary=function(f){},T.prototype.visitLookahead=function(f){},T.prototype.visitNegativeLookahead=function(f){},T.prototype.visitCharacter=function(f){},T.prototype.visitSet=function(f){},T.prototype.visitGroup=function(f){},T.prototype.visitGroupBackReference=function(f){},T.prototype.visitQuantifier=function(f){},{RegExpParser:t,BaseRegExpVisitor:T,VERSION:"0.5.0"}})}),It=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clearRegExpParserCache=n.getRegExpAst=void 0;var e=St(),t={},r=new e.RegExpParser;function i(s){var u=s.toString();if(t.hasOwnProperty(u))return t[u];var a=r.pattern(u);return t[u]=a,a}n.getRegExpAst=i;function c(){t={}}n.clearRegExpParserCache=c}),xr=Ee(n=>{var e=n&&n.__extends||(function(){var T=function(f,d){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,v){y.__proto__=v}||function(y,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(y[g]=v[g])},T(f,d)};return function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");T(f,d);function y(){this.constructor=f}f.prototype=d===null?Object.create(d):(y.prototype=d.prototype,new y)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.canMatchCharCode=n.firstCharOptimizedIndices=n.getOptimizedStartCodesIndices=n.failedOptimizationPrefixMsg=void 0;var t=St(),r=Ie(),i=It(),c=Zt(),s="Complement Sets are not supported for first char optimization";n.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
|
|
26
|
+
`;function u(T,f){f===void 0&&(f=!1);try{var d=i.getRegExpAst(T),y=a(d.value,{},d.flags.ignoreCase);return y}catch(g){if(g.message===s)f&&r.PRINT_WARNING(""+n.failedOptimizationPrefixMsg+(" Unable to optimize: < "+T.toString()+` >
|
|
11
27
|
`)+` Complement Sets cannot be automatically optimized.
|
|
12
28
|
This will disable the lexer's first char optimizations.
|
|
13
29
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var v="";f&&(v=`
|
|
14
30
|
This will disable the lexer's first char optimizations.
|
|
15
|
-
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),
|
|
31
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),r.PRINT_ERROR(n.failedOptimizationPrefixMsg+`
|
|
16
32
|
`+(" Failed parsing: < "+T.toString()+` >
|
|
17
33
|
`)+(" Using the regexp-to-ast library version: "+t.VERSION+`
|
|
18
|
-
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}n.getOptimizedStartCodesIndices=u;function a(T,f,d){switch(T.type){case"Disjunction":for(var y=0;y<T.value.length;y++)a(T.value[y],f,d);break;case"Alternative":for(var v=T.value,y=0;y<v.length;y++){var g=v[y];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var b=g;switch(b.type){case"Character":o(b.value,f,d);break;case"Set":if(b.complement===!0)throw Error(s);
|
|
19
|
-
`],tracer:function(
|
|
34
|
+
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}n.getOptimizedStartCodesIndices=u;function a(T,f,d){switch(T.type){case"Disjunction":for(var y=0;y<T.value.length;y++)a(T.value[y],f,d);break;case"Alternative":for(var v=T.value,y=0;y<v.length;y++){var g=v[y];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var b=g;switch(b.type){case"Character":o(b.value,f,d);break;case"Set":if(b.complement===!0)throw Error(s);r.forEach(b.value,function(Y){if(typeof Y=="number")o(Y,f,d);else{var I=Y;if(d===!0)for(var G=I.from;G<=I.to;G++)o(G,f,d);else{for(var G=I.from;G<=I.to&&G<c.minOptimizationVal;G++)o(G,f,d);if(I.to>=c.minOptimizationVal)for(var M=I.from>=c.minOptimizationVal?I.from:c.minOptimizationVal,S=I.to,P=c.charCodeToOptimizedIndex(M),k=c.charCodeToOptimizedIndex(S),X=P;X<=k;X++)f[X]=X}}});break;case"Group":a(b.value,f,d);break;default:throw Error("Non Exhaustive Match")}var w=b.quantifier!==void 0&&b.quantifier.atLeast===0;if(b.type==="Group"&&m(b)===!1||b.type!=="Group"&&w===!1)break}break;default:throw Error("non exhaustive match!")}return r.values(f)}n.firstCharOptimizedIndices=a;function o(T,f,d){var y=c.charCodeToOptimizedIndex(T);f[y]=y,d===!0&&h(T,f)}function h(T,f){var d=String.fromCharCode(T),y=d.toUpperCase();if(y!==d){var v=c.charCodeToOptimizedIndex(y.charCodeAt(0));f[v]=v}else{var g=d.toLowerCase();if(g!==d){var v=c.charCodeToOptimizedIndex(g.charCodeAt(0));f[v]=v}}}function l(T,f){return r.find(T.value,function(d){if(typeof d=="number")return r.contains(f,d);var y=d;return r.find(f,function(v){return y.from<=v&&v<=y.to})!==void 0})}function m(T){return T.quantifier&&T.quantifier.atLeast===0?!0:T.value?r.isArray(T.value)?r.every(T.value,m):m(T.value):!1}var p=(function(T){e(f,T);function f(d){var y=T.call(this)||this;return y.targetCharCodes=d,y.found=!1,y}return f.prototype.visitChildren=function(d){if(this.found!==!0){switch(d.type){case"Lookahead":this.visitLookahead(d);return;case"NegativeLookahead":this.visitNegativeLookahead(d);return}T.prototype.visitChildren.call(this,d)}},f.prototype.visitCharacter=function(d){r.contains(this.targetCharCodes,d.value)&&(this.found=!0)},f.prototype.visitSet=function(d){d.complement?l(d,this.targetCharCodes)===void 0&&(this.found=!0):l(d,this.targetCharCodes)!==void 0&&(this.found=!0)},f})(t.BaseRegExpVisitor);function E(T,f){if(f instanceof RegExp){var d=i.getRegExpAst(f),y=new p(T);return y.visit(d),y.found}else return r.find(f,function(v){return r.contains(T,v.charCodeAt(0))})!==void 0}n.canMatchCharCode=E}),Zt=Ee(n=>{var e=n&&n.__extends||(function(){var U=function(j,W){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(q,Z){q.__proto__=Z}||function(q,Z){for(var ie in Z)Object.prototype.hasOwnProperty.call(Z,ie)&&(q[ie]=Z[ie])},U(j,W)};return function(j,W){if(typeof W!="function"&&W!==null)throw new TypeError("Class extends value "+String(W)+" is not a constructor or null");U(j,W);function q(){this.constructor=j}j.prototype=W===null?Object.create(W):(q.prototype=W.prototype,new q)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.charCodeToOptimizedIndex=n.minOptimizationVal=n.buildLineBreakIssueMessage=n.LineTerminatorOptimizedTester=n.isShortPattern=n.isCustomPattern=n.cloneEmptyGroups=n.performWarningRuntimeChecks=n.performRuntimeChecks=n.addStickyFlag=n.addStartOfInput=n.findUnreachablePatterns=n.findModesThatDoNotExist=n.findInvalidGroupType=n.findDuplicatePatterns=n.findUnsupportedFlags=n.findStartOfInputAnchor=n.findEmptyMatchRegExps=n.findEndOfInputAnchor=n.findInvalidPatterns=n.findMissingPatterns=n.validatePatterns=n.analyzeTokenTypes=n.enableSticky=n.disableSticky=n.SUPPORT_STICKY=n.MODES=n.DEFAULT_MODE=void 0;var t=St(),r=ht(),i=Ie(),c=xr(),s=It(),u="PATTERN";n.DEFAULT_MODE="defaultMode",n.MODES="modes",n.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function a(){n.SUPPORT_STICKY=!1}n.disableSticky=a;function o(){n.SUPPORT_STICKY=!0}n.enableSticky=o;function h(U,j){j=i.defaults(j,{useSticky:n.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
35
|
+
`],tracer:function(O,R){return R()}});var W=j.tracer;W("initCharCodeToOptimizedIndexMap",function(){de()});var q;W("Reject Lexer.NA",function(){q=i.reject(U,function(O){return O[u]===r.Lexer.NA})});var Z=!1,ie;W("Transform Patterns",function(){Z=!1,ie=i.map(q,function(O){var R=O[u];if(i.isRegExp(R)){var _=R.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!R.ignoreCase?_:_.length===2&&_[0]==="\\"&&!i.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:j.useSticky?S(R):M(R)}else{if(i.isFunction(R))return Z=!0,{exec:R};if(i.has(R,"exec"))return Z=!0,R;if(typeof R=="string"){if(R.length===1)return R;var N=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),L=new RegExp(N);return j.useSticky?S(L):M(L)}else throw Error("non exhaustive match")}})});var ge,me,xe,De,ze;W("misc mapping",function(){ge=i.map(q,function(O){return O.tokenTypeIdx}),me=i.map(q,function(O){var R=O.GROUP;if(R!==r.Lexer.SKIPPED){if(i.isString(R))return R;if(i.isUndefined(R))return!1;throw Error("non exhaustive match")}}),xe=i.map(q,function(O){var R=O.LONGER_ALT;if(R){var _=i.indexOf(q,R);return _}}),De=i.map(q,function(O){return O.PUSH_MODE}),ze=i.map(q,function(O){return i.has(O,"POP_MODE")})});var Fe;W("Line Terminator Handling",function(){var O=ae(j.lineTerminatorCharacters);Fe=i.map(q,function(R){return!1}),j.positionTracking!=="onlyOffset"&&(Fe=i.map(q,function(R){if(i.has(R,"LINE_BREAKS"))return R.LINE_BREAKS;if($(R,O)===!1)return c.canMatchCharCode(O,R.PATTERN)}))});var D,K,V,ee;W("Misc Mapping #2",function(){D=i.map(q,Q),K=i.map(ie,H),V=i.reduce(q,function(O,R){var _=R.GROUP;return i.isString(_)&&_!==r.Lexer.SKIPPED&&(O[_]=[]),O},{}),ee=i.map(ie,function(O,R){return{pattern:ie[R],longerAlt:xe[R],canLineTerminator:Fe[R],isCustom:D[R],short:K[R],group:me[R],push:De[R],pop:ze[R],tokenTypeIdx:ge[R],tokenType:q[R]}})});var he=!0,_e=[];return j.safeMode||W("First Char Optimization",function(){_e=i.reduce(q,function(O,R,_){if(typeof R.PATTERN=="string"){var N=R.PATTERN.charCodeAt(0),L=ne(N);se(O,L,ee[_])}else if(i.isArray(R.START_CHARS_HINT)){var x;i.forEach(R.START_CHARS_HINT,function(B){var z=typeof B=="string"?B.charCodeAt(0):B,J=ne(z);x!==J&&(x=J,se(O,J,ee[_]))})}else if(i.isRegExp(R.PATTERN))if(R.PATTERN.unicode)he=!1,j.ensureOptimizations&&i.PRINT_ERROR(""+c.failedOptimizationPrefixMsg+(" Unable to analyze < "+R.PATTERN.toString()+` > pattern.
|
|
20
36
|
`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
21
37
|
This will disable the lexer's first char optimizations.
|
|
22
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var F=c.getOptimizedStartCodesIndices(R.PATTERN,j.ensureOptimizations);
|
|
38
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var F=c.getOptimizedStartCodesIndices(R.PATTERN,j.ensureOptimizations);i.isEmpty(F)&&(he=!1),i.forEach(F,function(B){se(O,B,ee[_])})}else j.ensureOptimizations&&i.PRINT_ERROR(""+c.failedOptimizationPrefixMsg+(" TokenType: <"+R.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
23
39
|
`)+` This will disable the lexer's first char optimizations.
|
|
24
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),
|
|
25
|
-
Token Type: ->`+
|
|
26
|
-
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:
|
|
27
|
-
Token Type: ->`+
|
|
28
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:
|
|
29
|
-
`+("Because it appears AFTER the Token Type ->"+
|
|
30
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.push({message:
|
|
31
|
-
`,type:
|
|
32
|
-
`,type:
|
|
33
|
-
`,type:
|
|
34
|
-
`),type:
|
|
40
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),he=!1;return O},[])}),W("ArrayPacking",function(){_e=i.packArray(_e)}),{emptyGroups:V,patternIdxToConfig:ee,charCodeToPatternIdxToConfig:_e,hasCustom:Z,canBeOptimized:he}}n.analyzeTokenTypes=h;function l(U,j){var W=[],q=p(U);W=W.concat(q.errors);var Z=E(q.valid),ie=Z.valid;return W=W.concat(Z.errors),W=W.concat(m(ie)),W=W.concat(w(ie)),W=W.concat(C(ie,j)),W=W.concat(Y(ie)),W}n.validatePatterns=l;function m(U){var j=[],W=i.filter(U,function(q){return i.isRegExp(q[u])});return j=j.concat(f(W)),j=j.concat(v(W)),j=j.concat(g(W)),j=j.concat(b(W)),j=j.concat(d(W)),j}function p(U){var j=i.filter(U,function(Z){return!i.has(Z,u)}),W=i.map(j,function(Z){return{message:"Token Type: ->"+Z.name+"<- missing static 'PATTERN' property",type:r.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[Z]}}),q=i.difference(U,j);return{errors:W,valid:q}}n.findMissingPatterns=p;function E(U){var j=i.filter(U,function(Z){var ie=Z[u];return!i.isRegExp(ie)&&!i.isFunction(ie)&&!i.has(ie,"exec")&&!i.isString(ie)}),W=i.map(j,function(Z){return{message:"Token Type: ->"+Z.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:r.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[Z]}}),q=i.difference(U,j);return{errors:W,valid:q}}n.findInvalidPatterns=E;var T=/[^\\][\$]/;function f(U){var j=(function(Z){e(ie,Z);function ie(){var ge=Z!==null&&Z.apply(this,arguments)||this;return ge.found=!1,ge}return ie.prototype.visitEndAnchor=function(ge){this.found=!0},ie})(t.BaseRegExpVisitor),W=i.filter(U,function(Z){var ie=Z[u];try{var ge=s.getRegExpAst(ie),me=new j;return me.visit(ge),me.found}catch{return T.test(ie.source)}}),q=i.map(W,function(Z){return{message:`Unexpected RegExp Anchor Error:
|
|
41
|
+
Token Type: ->`+Z.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
42
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[Z]}});return q}n.findEndOfInputAnchor=f;function d(U){var j=i.filter(U,function(q){var Z=q[u];return Z.test("")}),W=i.map(j,function(q){return{message:"Token Type: ->"+q.name+"<- static 'PATTERN' must not match an empty string",type:r.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[q]}});return W}n.findEmptyMatchRegExps=d;var y=/[^\\[][\^]|^\^/;function v(U){var j=(function(Z){e(ie,Z);function ie(){var ge=Z!==null&&Z.apply(this,arguments)||this;return ge.found=!1,ge}return ie.prototype.visitStartAnchor=function(ge){this.found=!0},ie})(t.BaseRegExpVisitor),W=i.filter(U,function(Z){var ie=Z[u];try{var ge=s.getRegExpAst(ie),me=new j;return me.visit(ge),me.found}catch{return y.test(ie.source)}}),q=i.map(W,function(Z){return{message:`Unexpected RegExp Anchor Error:
|
|
43
|
+
Token Type: ->`+Z.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
44
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[Z]}});return q}n.findStartOfInputAnchor=v;function g(U){var j=i.filter(U,function(q){var Z=q[u];return Z instanceof RegExp&&(Z.multiline||Z.global)}),W=i.map(j,function(q){return{message:"Token Type: ->"+q.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:r.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[q]}});return W}n.findUnsupportedFlags=g;function b(U){var j=[],W=i.map(U,function(ie){return i.reduce(U,function(ge,me){return ie.PATTERN.source===me.PATTERN.source&&!i.contains(j,me)&&me.PATTERN!==r.Lexer.NA&&(j.push(me),ge.push(me)),ge},[])});W=i.compact(W);var q=i.filter(W,function(ie){return ie.length>1}),Z=i.map(q,function(ie){var ge=i.map(ie,function(xe){return xe.name}),me=i.first(ie).PATTERN;return{message:"The same RegExp pattern ->"+me+"<-"+("has been used in all of the following Token Types: "+ge.join(", ")+" <-"),type:r.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:ie}});return Z}n.findDuplicatePatterns=b;function w(U){var j=i.filter(U,function(q){if(!i.has(q,"GROUP"))return!1;var Z=q.GROUP;return Z!==r.Lexer.SKIPPED&&Z!==r.Lexer.NA&&!i.isString(Z)}),W=i.map(j,function(q){return{message:"Token Type: ->"+q.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:r.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[q]}});return W}n.findInvalidGroupType=w;function C(U,j){var W=i.filter(U,function(Z){return Z.PUSH_MODE!==void 0&&!i.contains(j,Z.PUSH_MODE)}),q=i.map(W,function(Z){var ie="Token Type: ->"+Z.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+Z.PUSH_MODE+"<-which does not exist";return{message:ie,type:r.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[Z]}});return q}n.findModesThatDoNotExist=C;function Y(U){var j=[],W=i.reduce(U,function(q,Z,ie){var ge=Z.PATTERN;return ge===r.Lexer.NA||(i.isString(ge)?q.push({str:ge,idx:ie,tokenType:Z}):i.isRegExp(ge)&&G(ge)&&q.push({str:ge.source,idx:ie,tokenType:Z})),q},[]);return i.forEach(U,function(q,Z){i.forEach(W,function(ie){var ge=ie.str,me=ie.idx,xe=ie.tokenType;if(Z<me&&I(ge,q.PATTERN)){var De="Token: ->"+xe.name+`<- can never be matched.
|
|
45
|
+
`+("Because it appears AFTER the Token Type ->"+q.name+"<-")+`in the lexer's definition.
|
|
46
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.push({message:De,type:r.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[q,xe]})}})}),j}n.findUnreachablePatterns=Y;function I(U,j){if(i.isRegExp(j)){var W=j.exec(U);return W!==null&&W.index===0}else{if(i.isFunction(j))return j(U,0,[],{});if(i.has(j,"exec"))return j.exec(U,0,[],{});if(typeof j=="string")return j===U;throw Error("non exhaustive match")}}function G(U){var j=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return i.find(j,function(W){return U.source.indexOf(W)!==-1})===void 0}function M(U){var j=U.ignoreCase?"i":"";return new RegExp("^(?:"+U.source+")",j)}n.addStartOfInput=M;function S(U){var j=U.ignoreCase?"iy":"y";return new RegExp(""+U.source,j)}n.addStickyFlag=S;function P(U,j,W){var q=[];return i.has(U,n.DEFAULT_MODE)||q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.DEFAULT_MODE+`> property in its definition
|
|
47
|
+
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),i.has(U,n.MODES)||q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.MODES+`> property in its definition
|
|
48
|
+
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),i.has(U,n.MODES)&&i.has(U,n.DEFAULT_MODE)&&!i.has(U.modes,U.defaultMode)&&q.push({message:"A MultiMode Lexer cannot be initialized with a "+n.DEFAULT_MODE+": <"+U.defaultMode+`>which does not exist
|
|
49
|
+
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),i.has(U,n.MODES)&&i.forEach(U.modes,function(Z,ie){i.forEach(Z,function(ge,me){i.isUndefined(ge)&&q.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+ie+"> at index: <"+me+`>
|
|
50
|
+
`),type:r.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),q}n.performRuntimeChecks=P;function k(U,j,W){var q=[],Z=!1,ie=i.compact(i.flatten(i.mapValues(U.modes,function(xe){return xe}))),ge=i.reject(ie,function(xe){return xe[u]===r.Lexer.NA}),me=ae(W);return j&&i.forEach(ge,function(xe){var De=$(xe,me);if(De!==!1){var ze=te(xe,De),Fe={message:ze,type:De.issue,tokenType:xe};q.push(Fe)}else i.has(xe,"LINE_BREAKS")?xe.LINE_BREAKS===!0&&(Z=!0):c.canMatchCharCode(me,xe.PATTERN)&&(Z=!0)}),j&&!Z&&q.push({message:`Warning: No LINE_BREAKS Found.
|
|
35
51
|
This Lexer has been defined to track line and column information,
|
|
36
52
|
But none of the Token Types can be identified as matching a line terminator.
|
|
37
53
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
38
|
-
for details.`,type:
|
|
54
|
+
for details.`,type:r.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),q}n.performWarningRuntimeChecks=k;function X(U){var j={},W=i.keys(U);return i.forEach(W,function(q){var Z=U[q];if(i.isArray(Z))j[q]=[];else throw Error("non exhaustive match")}),j}n.cloneEmptyGroups=X;function Q(U){var j=U.PATTERN;if(i.isRegExp(j))return!1;if(i.isFunction(j)||i.has(j,"exec"))return!0;if(i.isString(j))return!1;throw Error("non exhaustive match")}n.isCustomPattern=Q;function H(U){return i.isString(U)&&U.length===1?U.charCodeAt(0):!1}n.isShortPattern=H,n.LineTerminatorOptimizedTester={test:function(U){for(var j=U.length,W=this.lastIndex;W<j;W++){var q=U.charCodeAt(W);if(q===10)return this.lastIndex=W+1,!0;if(q===13)return U.charCodeAt(W+1)===10?this.lastIndex=W+2:this.lastIndex=W+1,!0}return!1},lastIndex:0};function $(U,j){if(i.has(U,"LINE_BREAKS"))return!1;if(i.isRegExp(U.PATTERN)){try{c.canMatchCharCode(j,U.PATTERN)}catch(W){return{issue:r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:W.message}}return!1}else{if(i.isString(U.PATTERN))return!1;if(Q(U))return{issue:r.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function te(U,j){if(j.issue===r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
39
55
|
`+(" The problem is in the <"+U.name+`> Token Type
|
|
40
56
|
`)+(" Root cause: "+j.errMsg+`.
|
|
41
|
-
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(j.issue===
|
|
57
|
+
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(j.issue===r.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
42
58
|
`+(" The problem is in the <"+U.name+`> Token Type
|
|
43
|
-
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}n.buildLineBreakIssueMessage=
|
|
44
|
-
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:
|
|
45
|
-
a boolean 2nd argument is no longer supported`);this.config=t.merge(s,h);var
|
|
46
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(h.safeMode&&h.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');l.trackStartLines=/full|onlyStart/i.test(l.config.positionTracking),l.trackEndLines=/full/i.test(l.config.positionTracking),t.isArray(o)?(
|
|
59
|
+
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}n.buildLineBreakIssueMessage=te;function ae(U){var j=i.map(U,function(W){return i.isString(W)&&W.length>0?W.charCodeAt(0):W});return j}function se(U,j,W){U[j]===void 0?U[j]=[W]:U[j].push(W)}n.minOptimizationVal=256;var ce=[];function ne(U){return U<n.minOptimizationVal?U:ce[U]}n.charCodeToOptimizedIndex=ne;function de(){if(i.isEmpty(ce)){ce=new Array(65536);for(var U=0;U<65536;U++)ce[U]=U>255?255+~~(U/255):U}}}),at=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isTokenType=n.hasExtendingTokensTypesMapProperty=n.hasExtendingTokensTypesProperty=n.hasCategoriesProperty=n.hasShortKeyProperty=n.singleAssignCategoriesToksMap=n.assignCategoriesMapProp=n.assignCategoriesTokensProp=n.assignTokenDefaultProps=n.expandCategories=n.augmentTokenTypes=n.tokenIdxToClass=n.tokenShortNameIdx=n.tokenStructuredMatcherNoCategories=n.tokenStructuredMatcher=void 0;var e=Ie();function t(T,f){var d=T.tokenTypeIdx;return d===f.tokenTypeIdx?!0:f.isParent===!0&&f.categoryMatchesMap[d]===!0}n.tokenStructuredMatcher=t;function r(T,f){return T.tokenTypeIdx===f.tokenTypeIdx}n.tokenStructuredMatcherNoCategories=r,n.tokenShortNameIdx=1,n.tokenIdxToClass={};function i(T){var f=c(T);s(f),a(f),u(f),e.forEach(f,function(d){d.isParent=d.categoryMatches.length>0})}n.augmentTokenTypes=i;function c(T){for(var f=e.cloneArr(T),d=T,y=!0;y;){d=e.compact(e.flatten(e.map(d,function(g){return g.CATEGORIES})));var v=e.difference(d,f);f=f.concat(v),e.isEmpty(v)?y=!1:d=v}return f}n.expandCategories=c;function s(T){e.forEach(T,function(f){h(f)||(n.tokenIdxToClass[n.tokenShortNameIdx]=f,f.tokenTypeIdx=n.tokenShortNameIdx++),l(f)&&!e.isArray(f.CATEGORIES)&&(f.CATEGORIES=[f.CATEGORIES]),l(f)||(f.CATEGORIES=[]),m(f)||(f.categoryMatches=[]),p(f)||(f.categoryMatchesMap={})})}n.assignTokenDefaultProps=s;function u(T){e.forEach(T,function(f){f.categoryMatches=[],e.forEach(f.categoryMatchesMap,function(d,y){f.categoryMatches.push(n.tokenIdxToClass[y].tokenTypeIdx)})})}n.assignCategoriesTokensProp=u;function a(T){e.forEach(T,function(f){o([],f)})}n.assignCategoriesMapProp=a;function o(T,f){e.forEach(T,function(d){f.categoryMatchesMap[d.tokenTypeIdx]=!0}),e.forEach(f.CATEGORIES,function(d){var y=T.concat(f);e.contains(y,d)||o(y,d)})}n.singleAssignCategoriesToksMap=o;function h(T){return e.has(T,"tokenTypeIdx")}n.hasShortKeyProperty=h;function l(T){return e.has(T,"CATEGORIES")}n.hasCategoriesProperty=l;function m(T){return e.has(T,"categoryMatches")}n.hasExtendingTokensTypesProperty=m;function p(T){return e.has(T,"categoryMatchesMap")}n.hasExtendingTokensTypesMapProperty=p;function E(T){return e.has(T,"tokenTypeIdx")}n.isTokenType=E}),Jt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultLexerErrorProvider=void 0,n.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,r,i,c){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+","+(" skipped "+r+" characters.")}}}),ht=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Lexer=n.LexerDefinitionErrorType=void 0;var e=Zt(),t=Ie(),r=at(),i=Jt(),c=It();(function(a){a[a.MISSING_PATTERN=0]="MISSING_PATTERN",a[a.INVALID_PATTERN=1]="INVALID_PATTERN",a[a.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",a[a.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",a[a.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",a[a.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",a[a.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",a[a.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",a[a.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",a[a.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",a[a.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",a[a.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",a[a.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",a[a.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",a[a.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",a[a.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",a[a.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(n.LexerDefinitionErrorType||(n.LexerDefinitionErrorType={}));var s={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
60
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:i.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(s);var u=(function(){function a(o,h){var l=this;if(h===void 0&&(h=s),this.lexerDefinition=o,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof h=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
61
|
+
a boolean 2nd argument is no longer supported`);this.config=t.merge(s,h);var m=this.config.traceInitPerf;m===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof m=="number"&&(this.traceInitMaxIdent=m,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var p,E=!0;l.TRACE_INIT("Lexer Config handling",function(){if(l.config.lineTerminatorsPattern===s.lineTerminatorsPattern)l.config.lineTerminatorsPattern=e.LineTerminatorOptimizedTester;else if(l.config.lineTerminatorCharacters===s.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
62
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(h.safeMode&&h.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');l.trackStartLines=/full|onlyStart/i.test(l.config.positionTracking),l.trackEndLines=/full/i.test(l.config.positionTracking),t.isArray(o)?(p={modes:{}},p.modes[e.DEFAULT_MODE]=t.cloneArr(o),p[e.DEFAULT_MODE]=e.DEFAULT_MODE):(E=!1,p=t.cloneObj(o))}),l.config.skipValidations===!1&&(l.TRACE_INIT("performRuntimeChecks",function(){l.lexerDefinitionErrors=l.lexerDefinitionErrors.concat(e.performRuntimeChecks(p,l.trackStartLines,l.config.lineTerminatorCharacters))}),l.TRACE_INIT("performWarningRuntimeChecks",function(){l.lexerDefinitionWarning=l.lexerDefinitionWarning.concat(e.performWarningRuntimeChecks(p,l.trackStartLines,l.config.lineTerminatorCharacters))})),p.modes=p.modes?p.modes:{},t.forEach(p.modes,function(y,v){p.modes[v]=t.reject(y,function(g){return t.isUndefined(g)})});var T=t.keys(p.modes);if(t.forEach(p.modes,function(y,v){l.TRACE_INIT("Mode: <"+v+"> processing",function(){if(l.modes.push(v),l.config.skipValidations===!1&&l.TRACE_INIT("validatePatterns",function(){l.lexerDefinitionErrors=l.lexerDefinitionErrors.concat(e.validatePatterns(y,T))}),t.isEmpty(l.lexerDefinitionErrors)){r.augmentTokenTypes(y);var g;l.TRACE_INIT("analyzeTokenTypes",function(){g=e.analyzeTokenTypes(y,{lineTerminatorCharacters:l.config.lineTerminatorCharacters,positionTracking:h.positionTracking,ensureOptimizations:h.ensureOptimizations,safeMode:h.safeMode,tracer:l.TRACE_INIT.bind(l)})}),l.patternIdxToConfig[v]=g.patternIdxToConfig,l.charCodeToPatternIdxToConfig[v]=g.charCodeToPatternIdxToConfig,l.emptyGroups=t.merge(l.emptyGroups,g.emptyGroups),l.hasCustom=g.hasCustom||l.hasCustom,l.canModeBeOptimized[v]=g.canBeOptimized}})}),l.defaultMode=p.defaultMode,!t.isEmpty(l.lexerDefinitionErrors)&&!l.config.deferDefinitionErrorsHandling){var f=t.map(l.lexerDefinitionErrors,function(y){return y.message}),d=f.join(`-----------------------
|
|
47
63
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
48
64
|
`+d)}t.forEach(l.lexerDefinitionWarning,function(y){t.PRINT_WARNING(y.message)}),l.TRACE_INIT("Choosing sub-methods implementations",function(){if(e.SUPPORT_STICKY?(l.chopInput=t.IDENTITY,l.match=l.matchWithTest):(l.updateLastIndex=t.NOOP,l.match=l.matchWithExec),E&&(l.handleModes=t.NOOP),l.trackStartLines===!1&&(l.computeNewColumn=t.IDENTITY),l.trackEndLines===!1&&(l.updateTokenEndLineColumnLocation=t.NOOP),/full/i.test(l.config.positionTracking))l.createTokenInstance=l.createFullToken;else if(/onlyStart/i.test(l.config.positionTracking))l.createTokenInstance=l.createStartOnlyToken;else if(/onlyOffset/i.test(l.config.positionTracking))l.createTokenInstance=l.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+l.config.positionTracking+'"');l.hasCustom?(l.addToken=l.addTokenUsingPush,l.handlePayload=l.handlePayloadWithCustom):(l.addToken=l.addTokenUsingMemberAccess,l.handlePayload=l.handlePayloadNoCustom)}),l.TRACE_INIT("Failed Optimization Warnings",function(){var y=t.reduce(l.canModeBeOptimized,function(v,g,b){return g===!1&&v.push(b),v},[]);if(h.ensureOptimizations&&!t.isEmpty(y))throw Error("Lexer Modes: < "+y.join(", ")+` > cannot be optimized.
|
|
49
65
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
50
|
-
Or inspect the console log for details on how to resolve these issues.`)}),l.TRACE_INIT("clearRegExpParserCache",function(){c.clearRegExpParserCache()}),l.TRACE_INIT("toFastProperties",function(){t.toFastProperties(l)})})}return a.prototype.tokenize=function(o,h){if(h===void 0&&(h=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var l=t.map(this.lexerDefinitionErrors,function(E){return E.message}),
|
|
66
|
+
Or inspect the console log for details on how to resolve these issues.`)}),l.TRACE_INIT("clearRegExpParserCache",function(){c.clearRegExpParserCache()}),l.TRACE_INIT("toFastProperties",function(){t.toFastProperties(l)})})}return a.prototype.tokenize=function(o,h){if(h===void 0&&(h=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var l=t.map(this.lexerDefinitionErrors,function(E){return E.message}),m=l.join(`-----------------------
|
|
51
67
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
52
|
-
`+
|
|
53
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(g,a)&&(w.CATEGORIES=g[a]),i.augmentTokenTypes([w]),e.has(g,o)&&(w.LABEL=g[o]),e.has(g,h)&&(w.GROUP=g[h]),e.has(g,p)&&(w.POP_MODE=g[p]),e.has(g,l)&&(w.PUSH_MODE=g[l]),e.has(g,m)&&(w.LONGER_ALT=g[m]),e.has(g,E)&&(w.LINE_BREAKS=g[E]),e.has(g,T)&&(w.START_CHARS_HINT=g[T]),w}n.EOF=f({name:"EOF",pattern:t.Lexer.NA}),i.augmentTokenTypes([n.EOF]);function y(g,b,w,P,K,S,G,x){return{image:b,startOffset:w,endOffset:P,startLine:K,endLine:S,startColumn:G,endColumn:x,tokenTypeIdx:g.tokenTypeIdx,tokenType:g}}n.createTokenInstance=y;function v(g,b){return i.tokenStructuredMatcher(g,b)}n.tokenMatcher=v}),ze=Ee(n=>{var e=n&&n.__extends||(function(){var d=function(y,v){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,b){g.__proto__=b}||function(g,b){for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w])},d(y,v)};return function(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");d(y,v);function g(){this.constructor=y}y.prototype=v===null?Object.create(v):(g.prototype=v.prototype,new g)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.serializeProduction=n.serializeGrammar=n.Terminal=n.Alternation=n.RepetitionWithSeparator=n.Repetition=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Option=n.Alternative=n.Rule=n.NonTerminal=n.AbstractProduction=void 0;var t=be(),i=ct(),r=(function(){function d(y){this._definition=y}return Object.defineProperty(d.prototype,"definition",{get:function(){return this._definition},set:function(y){this._definition=y},enumerable:!1,configurable:!0}),d.prototype.accept=function(y){y.visit(this),t.forEach(this.definition,function(v){v.accept(y)})},d})();n.AbstractProduction=r;var c=(function(d){e(y,d);function y(v){var g=d.call(this,[])||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(v){},enumerable:!1,configurable:!0}),y.prototype.accept=function(v){v.visit(this)},y})(r);n.NonTerminal=c;var s=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.orgText="",t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Rule=s;var u=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.ignoreAmbiguities=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Alternative=u;var a=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Option=a;var o=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatory=o;var h=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatoryWithSeparator=h;var l=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Repetition=l;var p=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionWithSeparator=p;var m=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,g.ignoreAmbiguities=!1,g.hasPredicates=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this._definition},set:function(v){this._definition=v},enumerable:!1,configurable:!0}),y})(r);n.Alternation=m;var E=(function(){function d(y){this.idx=1,t.assign(this,t.pick(y,function(v){return v!==void 0}))}return d.prototype.accept=function(y){y.visit(this)},d})();n.Terminal=E;function T(d){return t.map(d,f)}n.serializeGrammar=T;function f(d){function y(b){return t.map(b,f)}if(d instanceof c)return{type:"NonTerminal",name:d.nonTerminalName,idx:d.idx};if(d instanceof u)return{type:"Alternative",definition:y(d.definition)};if(d instanceof a)return{type:"Option",idx:d.idx,definition:y(d.definition)};if(d instanceof o)return{type:"RepetitionMandatory",idx:d.idx,definition:y(d.definition)};if(d instanceof h)return{type:"RepetitionMandatoryWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof p)return{type:"RepetitionWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof l)return{type:"Repetition",idx:d.idx,definition:y(d.definition)};if(d instanceof m)return{type:"Alternation",idx:d.idx,definition:y(d.definition)};if(d instanceof E){var v={type:"Terminal",name:d.terminalType.name,label:i.tokenLabel(d.terminalType),idx:d.idx},g=d.terminalType.PATTERN;return d.terminalType.PATTERN&&(v.pattern=t.isRegExp(g)?g.source:g),v}else{if(d instanceof s)return{type:"Rule",name:d.name,orgText:d.orgText,definition:y(d.definition)};throw Error("non exhaustive match")}}n.serializeProduction=f}),jt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RestWalker=void 0;var e=be(),t=ze(),i=(function(){function c(){}return c.prototype.walk=function(s,u){var a=this;u===void 0&&(u=[]),e.forEach(s.definition,function(o,h){var l=e.drop(s.definition,h+1);if(o instanceof t.NonTerminal)a.walkProdRef(o,l,u);else if(o instanceof t.Terminal)a.walkTerminal(o,l,u);else if(o instanceof t.Alternative)a.walkFlat(o,l,u);else if(o instanceof t.Option)a.walkOption(o,l,u);else if(o instanceof t.RepetitionMandatory)a.walkAtLeastOne(o,l,u);else if(o instanceof t.RepetitionMandatoryWithSeparator)a.walkAtLeastOneSep(o,l,u);else if(o instanceof t.RepetitionWithSeparator)a.walkManySep(o,l,u);else if(o instanceof t.Repetition)a.walkMany(o,l,u);else if(o instanceof t.Alternation)a.walkOr(o,l,u);else throw Error("non exhaustive match")})},c.prototype.walkTerminal=function(s,u,a){},c.prototype.walkProdRef=function(s,u,a){},c.prototype.walkFlat=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkOption=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkAtLeastOne=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkAtLeastOneSep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkMany=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkManySep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkOr=function(s,u,a){var o=this,h=u.concat(a);e.forEach(s.definition,function(l){var p=new t.Alternative({definition:[l]});o.walk(p,h)})},c})();n.RestWalker=i;function r(c,s,u){var a=[new t.Option({definition:[new t.Terminal({terminalType:c.separator})].concat(c.definition)})],o=a.concat(s,u);return o}}),gt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GAstVisitor=void 0;var e=ze(),t=(function(){function i(){}return i.prototype.visit=function(r){var c=r;switch(c.constructor){case e.NonTerminal:return this.visitNonTerminal(c);case e.Alternative:return this.visitAlternative(c);case e.Option:return this.visitOption(c);case e.RepetitionMandatory:return this.visitRepetitionMandatory(c);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(c);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(c);case e.Repetition:return this.visitRepetition(c);case e.Alternation:return this.visitAlternation(c);case e.Terminal:return this.visitTerminal(c);case e.Rule:return this.visitRule(c);default:throw Error("non exhaustive match")}},i.prototype.visitNonTerminal=function(r){},i.prototype.visitAlternative=function(r){},i.prototype.visitOption=function(r){},i.prototype.visitRepetition=function(r){},i.prototype.visitRepetitionMandatory=function(r){},i.prototype.visitRepetitionMandatoryWithSeparator=function(r){},i.prototype.visitRepetitionWithSeparator=function(r){},i.prototype.visitAlternation=function(r){},i.prototype.visitTerminal=function(r){},i.prototype.visitRule=function(r){},i})();n.GAstVisitor=t}),At=Ee(n=>{var e=n&&n.__extends||(function(){var p=function(m,E){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var d in f)Object.prototype.hasOwnProperty.call(f,d)&&(T[d]=f[d])},p(m,E)};return function(m,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");p(m,E);function T(){this.constructor=m}m.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.collectMethods=n.DslMethodsCollectorVisitor=n.getProductionDslName=n.isBranchingProd=n.isOptionalProd=n.isSequenceProd=void 0;var t=be(),i=ze(),r=gt();function c(p){return p instanceof i.Alternative||p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionMandatory||p instanceof i.RepetitionMandatoryWithSeparator||p instanceof i.RepetitionWithSeparator||p instanceof i.Terminal||p instanceof i.Rule}n.isSequenceProd=c;function s(p,m){m===void 0&&(m=[]);var E=p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionWithSeparator;return E?!0:p instanceof i.Alternation?t.some(p.definition,function(T){return s(T,m)}):p instanceof i.NonTerminal&&t.contains(m,p)?!1:p instanceof i.AbstractProduction?(p instanceof i.NonTerminal&&m.push(p),t.every(p.definition,function(T){return s(T,m)})):!1}n.isOptionalProd=s;function u(p){return p instanceof i.Alternation}n.isBranchingProd=u;function a(p){if(p instanceof i.NonTerminal)return"SUBRULE";if(p instanceof i.Option)return"OPTION";if(p instanceof i.Alternation)return"OR";if(p instanceof i.RepetitionMandatory)return"AT_LEAST_ONE";if(p instanceof i.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(p instanceof i.RepetitionWithSeparator)return"MANY_SEP";if(p instanceof i.Repetition)return"MANY";if(p instanceof i.Terminal)return"CONSUME";throw Error("non exhaustive match")}n.getProductionDslName=a;var o=(function(p){e(m,p);function m(){var E=p!==null&&p.apply(this,arguments)||this;return E.separator="-",E.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},E}return m.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},m.prototype.visitTerminal=function(E){var T=E.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitNonTerminal=function(E){var T=E.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitOption=function(E){this.dslMethods.option.push(E)},m.prototype.visitRepetitionWithSeparator=function(E){this.dslMethods.repetitionWithSeparator.push(E)},m.prototype.visitRepetitionMandatory=function(E){this.dslMethods.repetitionMandatory.push(E)},m.prototype.visitRepetitionMandatoryWithSeparator=function(E){this.dslMethods.repetitionMandatoryWithSeparator.push(E)},m.prototype.visitRepetition=function(E){this.dslMethods.repetition.push(E)},m.prototype.visitAlternation=function(E){this.dslMethods.alternation.push(E)},m})(r.GAstVisitor);n.DslMethodsCollectorVisitor=o;var h=new o;function l(p){h.reset(),p.accept(h);var m=h.dslMethods;return h.reset(),m}n.collectMethods=l}),nn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.firstForTerminal=n.firstForBranching=n.firstForSequence=n.first=void 0;var e=be(),t=ze(),i=At();function r(a){if(a instanceof t.NonTerminal)return r(a.referencedRule);if(a instanceof t.Terminal)return u(a);if(i.isSequenceProd(a))return c(a);if(i.isBranchingProd(a))return s(a);throw Error("non exhaustive match")}n.first=r;function c(a){for(var o=[],h=a.definition,l=0,p=h.length>l,m,E=!0;p&&E;)m=h[l],E=i.isOptionalProd(m),o=o.concat(r(m)),l=l+1,p=h.length>l;return e.uniq(o)}n.firstForSequence=c;function s(a){var o=e.map(a.definition,function(h){return r(h)});return e.uniq(e.flatten(o))}n.firstForBranching=s;function u(a){return[a.terminalType]}n.firstForTerminal=u}),rn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IN=void 0,n.IN="_~IN~_"}),Gn=Ee(n=>{var e=n&&n.__extends||(function(){var l=function(p,m){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(E[f]=T[f])},l(p,m)};return function(p,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");l(p,m);function E(){this.constructor=p}p.prototype=m===null?Object.create(m):(E.prototype=m.prototype,new E)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.buildInProdFollowPrefix=n.buildBetweenProdsFollowPrefix=n.computeAllProdsFollows=n.ResyncFollowsWalker=void 0;var t=jt(),i=nn(),r=be(),c=rn(),s=ze(),u=(function(l){e(p,l);function p(m){var E=l.call(this)||this;return E.topProd=m,E.follows={},E}return p.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},p.prototype.walkTerminal=function(m,E,T){},p.prototype.walkProdRef=function(m,E,T){var f=o(m.referencedRule,m.idx)+this.topProd.name,d=E.concat(T),y=new s.Alternative({definition:d}),v=i.first(y);this.follows[f]=v},p})(t.RestWalker);n.ResyncFollowsWalker=u;function a(l){var p={};return r.forEach(l,function(m){var E=new u(m).startWalking();r.assign(p,E)}),p}n.computeAllProdsFollows=a;function o(l,p){return l.name+p+c.IN}n.buildBetweenProdsFollowPrefix=o;function h(l){var p=l.terminalType.name;return p+l.idx+c.IN}n.buildInProdFollowPrefix=h}),_t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultGrammarValidatorErrorProvider=n.defaultGrammarResolverErrorProvider=n.defaultParserErrorProvider=void 0;var e=ct(),t=be(),i=be(),r=ze(),c=At();n.defaultParserErrorProvider={buildMismatchTokenMessage:function(s){var u=s.expected,a=s.actual;s.previous,s.ruleName;var o=e.hasTokenLabel(u),h=o?"--> "+e.tokenLabel(u)+" <--":"token of type --> "+u.name+" <--",l="Expecting "+h+" but found --> '"+a.image+"' <--";return l},buildNotAllInputParsedMessage:function(s){var u=s.firstRedundant;return s.ruleName,"Redundant input, expecting EOF but found: "+u.image},buildNoViableAltMessage:function(s){var u=s.expectedPathsPerAlt,a=s.actual;s.previous;var o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=i.first(a).image,p=`
|
|
54
|
-
but found: '`+l+"'";if(o)return h+o+
|
|
68
|
+
`+m)}var p=this.tokenizeInternal(o,h);return p},a.prototype.tokenizeInternal=function(o,h){var l=this,m,p,E,T,f,d,y,v,g,b,w,C,Y,I,G=o,M=G.length,S=0,P=0,k=this.hasCustom?0:Math.floor(o.length/10),X=new Array(k),Q=[],H=this.trackStartLines?1:void 0,$=this.trackStartLines?1:void 0,te=e.cloneEmptyGroups(this.emptyGroups),ae=this.trackStartLines,se=this.config.lineTerminatorsPattern,ce=0,ne=[],de=[],U=[],j=[];Object.freeze(j);var W=void 0;function q(){return ne}function Z(x){var F=e.charCodeToOptimizedIndex(x),B=de[F];return B===void 0?j:B}var ie=function(x){if(U.length===1&&x.tokenType.PUSH_MODE===void 0){var F=l.config.errorMessageProvider.buildUnableToPopLexerModeMessage(x);Q.push({offset:x.startOffset,line:x.startLine!==void 0?x.startLine:void 0,column:x.startColumn!==void 0?x.startColumn:void 0,length:x.image.length,message:F})}else{U.pop();var B=t.last(U);ne=l.patternIdxToConfig[B],de=l.charCodeToPatternIdxToConfig[B],ce=ne.length;var z=l.canModeBeOptimized[B]&&l.config.safeMode===!1;de&&z?W=Z:W=q}};function ge(x){U.push(x),de=this.charCodeToPatternIdxToConfig[x],ne=this.patternIdxToConfig[x],ce=ne.length,ce=ne.length;var F=this.canModeBeOptimized[x]&&this.config.safeMode===!1;de&&F?W=Z:W=q}ge.call(this,h);for(var me;S<M;){f=null;var xe=G.charCodeAt(S),De=W(xe),ze=De.length;for(m=0;m<ze;m++){me=De[m];var Fe=me.pattern;d=null;var D=me.short;if(D!==!1?xe===D&&(f=Fe):me.isCustom===!0?(I=Fe.exec(G,S,X,te),I!==null?(f=I[0],I.payload!==void 0&&(d=I.payload)):f=null):(this.updateLastIndex(Fe,S),f=this.match(Fe,o,S)),f!==null){if(T=me.longerAlt,T!==void 0){var K=ne[T],V=K.pattern;y=null,K.isCustom===!0?(I=V.exec(G,S,X,te),I!==null?(E=I[0],I.payload!==void 0&&(y=I.payload)):E=null):(this.updateLastIndex(V,S),E=this.match(V,o,S)),E&&E.length>f.length&&(f=E,d=y,me=K)}break}}if(f!==null){if(v=f.length,g=me.group,g!==void 0&&(b=me.tokenTypeIdx,w=this.createTokenInstance(f,S,b,me.tokenType,H,$,v),this.handlePayload(w,d),g===!1?P=this.addToken(X,P,w):te[g].push(w)),o=this.chopInput(o,v),S=S+v,$=this.computeNewColumn($,v),ae===!0&&me.canLineTerminator===!0){var ee=0,he=void 0,_e=void 0;se.lastIndex=0;do he=se.test(f),he===!0&&(_e=se.lastIndex-1,ee++);while(he===!0);ee!==0&&(H=H+ee,$=v-_e,this.updateTokenEndLineColumnLocation(w,g,_e,ee,H,$,v))}this.handleModes(me,ie,ge,w)}else{for(var O=S,R=H,_=$,N=!1;!N&&S<M;)for(G.charCodeAt(S),o=this.chopInput(o,1),S++,p=0;p<ce;p++){var L=ne[p],Fe=L.pattern,D=L.short;if(D!==!1?G.charCodeAt(S)===D&&(N=!0):L.isCustom===!0?N=Fe.exec(G,S,X,te)!==null:(this.updateLastIndex(Fe,S),N=Fe.exec(o)!==null),N===!0)break}C=S-O,Y=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(G,O,C,R,_),Q.push({offset:O,line:R,column:_,length:C,message:Y})}}return this.hasCustom||(X.length=P),{tokens:X,groups:te,errors:Q}},a.prototype.handleModes=function(o,h,l,m){if(o.pop===!0){var p=o.push;h(m),p!==void 0&&l.call(this,p)}else o.push!==void 0&&l.call(this,o.push)},a.prototype.chopInput=function(o,h){return o.substring(h)},a.prototype.updateLastIndex=function(o,h){o.lastIndex=h},a.prototype.updateTokenEndLineColumnLocation=function(o,h,l,m,p,E,T){var f,d;h!==void 0&&(f=l===T-1,d=f?-1:0,m===1&&f===!0||(o.endLine=p+d,o.endColumn=E-1+-d))},a.prototype.computeNewColumn=function(o,h){return o+h},a.prototype.createTokenInstance=function(){for(var o=[],h=0;h<arguments.length;h++)o[h]=arguments[h];return null},a.prototype.createOffsetOnlyToken=function(o,h,l,m){return{image:o,startOffset:h,tokenTypeIdx:l,tokenType:m}},a.prototype.createStartOnlyToken=function(o,h,l,m,p,E){return{image:o,startOffset:h,startLine:p,startColumn:E,tokenTypeIdx:l,tokenType:m}},a.prototype.createFullToken=function(o,h,l,m,p,E,T){return{image:o,startOffset:h,endOffset:h+T-1,startLine:p,endLine:p,startColumn:E,endColumn:E+T-1,tokenTypeIdx:l,tokenType:m}},a.prototype.addToken=function(o,h,l){return 666},a.prototype.addTokenUsingPush=function(o,h,l){return o.push(l),h},a.prototype.addTokenUsingMemberAccess=function(o,h,l){return o[h]=l,h++,h},a.prototype.handlePayload=function(o,h){},a.prototype.handlePayloadNoCustom=function(o,h){},a.prototype.handlePayloadWithCustom=function(o,h){h!==null&&(o.payload=h)},a.prototype.match=function(o,h,l){return null},a.prototype.matchWithTest=function(o,h,l){var m=o.test(h);return m===!0?h.substring(l,o.lastIndex):null},a.prototype.matchWithExec=function(o,h){var l=o.exec(h);return l!==null?l[0]:l},a.prototype.TRACE_INIT=function(o,h){if(this.traceInitPerf===!0){this.traceInitIndent++;var l=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(l+"--> <"+o+">");var m=t.timer(h),p=m.time,E=m.value,T=p>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&T(l+"<-- <"+o+"> time: "+p+"ms"),this.traceInitIndent--,E}else return h()},a.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",a.NA=/NOT_APPLICABLE/,a})();n.Lexer=u}),tt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tokenMatcher=n.createTokenInstance=n.EOF=n.createToken=n.hasTokenLabel=n.tokenName=n.tokenLabel=void 0;var e=Ie(),t=ht(),r=at();function i(g){return s(g)?g.LABEL:g.name}n.tokenLabel=i;function c(g){return g.name}n.tokenName=c;function s(g){return e.isString(g.LABEL)&&g.LABEL!==""}n.hasTokenLabel=s;var u="parent",a="categories",o="label",h="group",l="push_mode",m="pop_mode",p="longer_alt",E="line_breaks",T="start_chars_hint";function f(g){return d(g)}n.createToken=f;function d(g){var b=g.pattern,w={};if(w.name=g.name,e.isUndefined(b)||(w.PATTERN=b),e.has(g,u))throw`The parent property is no longer supported.
|
|
69
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(g,a)&&(w.CATEGORIES=g[a]),r.augmentTokenTypes([w]),e.has(g,o)&&(w.LABEL=g[o]),e.has(g,h)&&(w.GROUP=g[h]),e.has(g,m)&&(w.POP_MODE=g[m]),e.has(g,l)&&(w.PUSH_MODE=g[l]),e.has(g,p)&&(w.LONGER_ALT=g[p]),e.has(g,E)&&(w.LINE_BREAKS=g[E]),e.has(g,T)&&(w.START_CHARS_HINT=g[T]),w}n.EOF=f({name:"EOF",pattern:t.Lexer.NA}),r.augmentTokenTypes([n.EOF]);function y(g,b,w,C,Y,I,G,M){return{image:b,startOffset:w,endOffset:C,startLine:Y,endLine:I,startColumn:G,endColumn:M,tokenTypeIdx:g.tokenTypeIdx,tokenType:g}}n.createTokenInstance=y;function v(g,b){return r.tokenStructuredMatcher(g,b)}n.tokenMatcher=v}),Ve=Ee(n=>{var e=n&&n.__extends||(function(){var d=function(y,v){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,b){g.__proto__=b}||function(g,b){for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w])},d(y,v)};return function(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");d(y,v);function g(){this.constructor=y}y.prototype=v===null?Object.create(v):(g.prototype=v.prototype,new g)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.serializeProduction=n.serializeGrammar=n.Terminal=n.Alternation=n.RepetitionWithSeparator=n.Repetition=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Option=n.Alternative=n.Rule=n.NonTerminal=n.AbstractProduction=void 0;var t=Ie(),r=tt(),i=(function(){function d(y){this._definition=y}return Object.defineProperty(d.prototype,"definition",{get:function(){return this._definition},set:function(y){this._definition=y},enumerable:!1,configurable:!0}),d.prototype.accept=function(y){y.visit(this),t.forEach(this.definition,function(v){v.accept(y)})},d})();n.AbstractProduction=i;var c=(function(d){e(y,d);function y(v){var g=d.call(this,[])||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(v){},enumerable:!1,configurable:!0}),y.prototype.accept=function(v){v.visit(this)},y})(i);n.NonTerminal=c;var s=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.orgText="",t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.Rule=s;var u=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.ignoreAmbiguities=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.Alternative=u;var a=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.Option=a;var o=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.RepetitionMandatory=o;var h=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.RepetitionMandatoryWithSeparator=h;var l=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.Repetition=l;var m=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(i);n.RepetitionWithSeparator=m;var p=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,g.ignoreAmbiguities=!1,g.hasPredicates=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this._definition},set:function(v){this._definition=v},enumerable:!1,configurable:!0}),y})(i);n.Alternation=p;var E=(function(){function d(y){this.idx=1,t.assign(this,t.pick(y,function(v){return v!==void 0}))}return d.prototype.accept=function(y){y.visit(this)},d})();n.Terminal=E;function T(d){return t.map(d,f)}n.serializeGrammar=T;function f(d){function y(b){return t.map(b,f)}if(d instanceof c)return{type:"NonTerminal",name:d.nonTerminalName,idx:d.idx};if(d instanceof u)return{type:"Alternative",definition:y(d.definition)};if(d instanceof a)return{type:"Option",idx:d.idx,definition:y(d.definition)};if(d instanceof o)return{type:"RepetitionMandatory",idx:d.idx,definition:y(d.definition)};if(d instanceof h)return{type:"RepetitionMandatoryWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof m)return{type:"RepetitionWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof l)return{type:"Repetition",idx:d.idx,definition:y(d.definition)};if(d instanceof p)return{type:"Alternation",idx:d.idx,definition:y(d.definition)};if(d instanceof E){var v={type:"Terminal",name:d.terminalType.name,label:r.tokenLabel(d.terminalType),idx:d.idx},g=d.terminalType.PATTERN;return d.terminalType.PATTERN&&(v.pattern=t.isRegExp(g)?g.source:g),v}else{if(d instanceof s)return{type:"Rule",name:d.name,orgText:d.orgText,definition:y(d.definition)};throw Error("non exhaustive match")}}n.serializeProduction=f}),bt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RestWalker=void 0;var e=Ie(),t=Ve(),r=(function(){function c(){}return c.prototype.walk=function(s,u){var a=this;u===void 0&&(u=[]),e.forEach(s.definition,function(o,h){var l=e.drop(s.definition,h+1);if(o instanceof t.NonTerminal)a.walkProdRef(o,l,u);else if(o instanceof t.Terminal)a.walkTerminal(o,l,u);else if(o instanceof t.Alternative)a.walkFlat(o,l,u);else if(o instanceof t.Option)a.walkOption(o,l,u);else if(o instanceof t.RepetitionMandatory)a.walkAtLeastOne(o,l,u);else if(o instanceof t.RepetitionMandatoryWithSeparator)a.walkAtLeastOneSep(o,l,u);else if(o instanceof t.RepetitionWithSeparator)a.walkManySep(o,l,u);else if(o instanceof t.Repetition)a.walkMany(o,l,u);else if(o instanceof t.Alternation)a.walkOr(o,l,u);else throw Error("non exhaustive match")})},c.prototype.walkTerminal=function(s,u,a){},c.prototype.walkProdRef=function(s,u,a){},c.prototype.walkFlat=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkOption=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkAtLeastOne=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkAtLeastOneSep=function(s,u,a){var o=i(s,u,a);this.walk(s,o)},c.prototype.walkMany=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkManySep=function(s,u,a){var o=i(s,u,a);this.walk(s,o)},c.prototype.walkOr=function(s,u,a){var o=this,h=u.concat(a);e.forEach(s.definition,function(l){var m=new t.Alternative({definition:[l]});o.walk(m,h)})},c})();n.RestWalker=r;function i(c,s,u){var a=[new t.Option({definition:[new t.Terminal({terminalType:c.separator})].concat(c.definition)})],o=a.concat(s,u);return o}}),ct=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GAstVisitor=void 0;var e=Ve(),t=(function(){function r(){}return r.prototype.visit=function(i){var c=i;switch(c.constructor){case e.NonTerminal:return this.visitNonTerminal(c);case e.Alternative:return this.visitAlternative(c);case e.Option:return this.visitOption(c);case e.RepetitionMandatory:return this.visitRepetitionMandatory(c);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(c);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(c);case e.Repetition:return this.visitRepetition(c);case e.Alternation:return this.visitAlternation(c);case e.Terminal:return this.visitTerminal(c);case e.Rule:return this.visitRule(c);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(i){},r.prototype.visitAlternative=function(i){},r.prototype.visitOption=function(i){},r.prototype.visitRepetition=function(i){},r.prototype.visitRepetitionMandatory=function(i){},r.prototype.visitRepetitionMandatoryWithSeparator=function(i){},r.prototype.visitRepetitionWithSeparator=function(i){},r.prototype.visitAlternation=function(i){},r.prototype.visitTerminal=function(i){},r.prototype.visitRule=function(i){},r})();n.GAstVisitor=t}),dt=Ee(n=>{var e=n&&n.__extends||(function(){var m=function(p,E){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var d in f)Object.prototype.hasOwnProperty.call(f,d)&&(T[d]=f[d])},m(p,E)};return function(p,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");m(p,E);function T(){this.constructor=p}p.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.collectMethods=n.DslMethodsCollectorVisitor=n.getProductionDslName=n.isBranchingProd=n.isOptionalProd=n.isSequenceProd=void 0;var t=Ie(),r=Ve(),i=ct();function c(m){return m instanceof r.Alternative||m instanceof r.Option||m instanceof r.Repetition||m instanceof r.RepetitionMandatory||m instanceof r.RepetitionMandatoryWithSeparator||m instanceof r.RepetitionWithSeparator||m instanceof r.Terminal||m instanceof r.Rule}n.isSequenceProd=c;function s(m,p){p===void 0&&(p=[]);var E=m instanceof r.Option||m instanceof r.Repetition||m instanceof r.RepetitionWithSeparator;return E?!0:m instanceof r.Alternation?t.some(m.definition,function(T){return s(T,p)}):m instanceof r.NonTerminal&&t.contains(p,m)?!1:m instanceof r.AbstractProduction?(m instanceof r.NonTerminal&&p.push(m),t.every(m.definition,function(T){return s(T,p)})):!1}n.isOptionalProd=s;function u(m){return m instanceof r.Alternation}n.isBranchingProd=u;function a(m){if(m instanceof r.NonTerminal)return"SUBRULE";if(m instanceof r.Option)return"OPTION";if(m instanceof r.Alternation)return"OR";if(m instanceof r.RepetitionMandatory)return"AT_LEAST_ONE";if(m instanceof r.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(m instanceof r.RepetitionWithSeparator)return"MANY_SEP";if(m instanceof r.Repetition)return"MANY";if(m instanceof r.Terminal)return"CONSUME";throw Error("non exhaustive match")}n.getProductionDslName=a;var o=(function(m){e(p,m);function p(){var E=m!==null&&m.apply(this,arguments)||this;return E.separator="-",E.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},E}return p.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},p.prototype.visitTerminal=function(E){var T=E.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},p.prototype.visitNonTerminal=function(E){var T=E.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},p.prototype.visitOption=function(E){this.dslMethods.option.push(E)},p.prototype.visitRepetitionWithSeparator=function(E){this.dslMethods.repetitionWithSeparator.push(E)},p.prototype.visitRepetitionMandatory=function(E){this.dslMethods.repetitionMandatory.push(E)},p.prototype.visitRepetitionMandatoryWithSeparator=function(E){this.dslMethods.repetitionMandatoryWithSeparator.push(E)},p.prototype.visitRepetition=function(E){this.dslMethods.repetition.push(E)},p.prototype.visitAlternation=function(E){this.dslMethods.alternation.push(E)},p})(i.GAstVisitor);n.DslMethodsCollectorVisitor=o;var h=new o;function l(m){h.reset(),m.accept(h);var p=h.dslMethods;return h.reset(),p}n.collectMethods=l}),$t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.firstForTerminal=n.firstForBranching=n.firstForSequence=n.first=void 0;var e=Ie(),t=Ve(),r=dt();function i(a){if(a instanceof t.NonTerminal)return i(a.referencedRule);if(a instanceof t.Terminal)return u(a);if(r.isSequenceProd(a))return c(a);if(r.isBranchingProd(a))return s(a);throw Error("non exhaustive match")}n.first=i;function c(a){for(var o=[],h=a.definition,l=0,m=h.length>l,p,E=!0;m&&E;)p=h[l],E=r.isOptionalProd(p),o=o.concat(i(p)),l=l+1,m=h.length>l;return e.uniq(o)}n.firstForSequence=c;function s(a){var o=e.map(a.definition,function(h){return i(h)});return e.uniq(e.flatten(o))}n.firstForBranching=s;function u(a){return[a.terminalType]}n.firstForTerminal=u}),en=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IN=void 0,n.IN="_~IN~_"}),kr=Ee(n=>{var e=n&&n.__extends||(function(){var l=function(m,p){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(E[f]=T[f])},l(m,p)};return function(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");l(m,p);function E(){this.constructor=m}m.prototype=p===null?Object.create(p):(E.prototype=p.prototype,new E)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.buildInProdFollowPrefix=n.buildBetweenProdsFollowPrefix=n.computeAllProdsFollows=n.ResyncFollowsWalker=void 0;var t=bt(),r=$t(),i=Ie(),c=en(),s=Ve(),u=(function(l){e(m,l);function m(p){var E=l.call(this)||this;return E.topProd=p,E.follows={},E}return m.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},m.prototype.walkTerminal=function(p,E,T){},m.prototype.walkProdRef=function(p,E,T){var f=o(p.referencedRule,p.idx)+this.topProd.name,d=E.concat(T),y=new s.Alternative({definition:d}),v=r.first(y);this.follows[f]=v},m})(t.RestWalker);n.ResyncFollowsWalker=u;function a(l){var m={};return i.forEach(l,function(p){var E=new u(p).startWalking();i.assign(m,E)}),m}n.computeAllProdsFollows=a;function o(l,m){return l.name+m+c.IN}n.buildBetweenProdsFollowPrefix=o;function h(l){var m=l.terminalType.name;return m+l.idx+c.IN}n.buildInProdFollowPrefix=h}),pt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultGrammarValidatorErrorProvider=n.defaultGrammarResolverErrorProvider=n.defaultParserErrorProvider=void 0;var e=tt(),t=Ie(),r=Ie(),i=Ve(),c=dt();n.defaultParserErrorProvider={buildMismatchTokenMessage:function(s){var u=s.expected,a=s.actual;s.previous,s.ruleName;var o=e.hasTokenLabel(u),h=o?"--> "+e.tokenLabel(u)+" <--":"token of type --> "+u.name+" <--",l="Expecting "+h+" but found --> '"+a.image+"' <--";return l},buildNotAllInputParsedMessage:function(s){var u=s.firstRedundant;return s.ruleName,"Redundant input, expecting EOF but found: "+u.image},buildNoViableAltMessage:function(s){var u=s.expectedPathsPerAlt,a=s.actual;s.previous;var o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=r.first(a).image,m=`
|
|
70
|
+
but found: '`+l+"'";if(o)return h+o+m;var p=r.reduce(u,function(d,y){return d.concat(y)},[]),E=r.map(p,function(d){return"["+r.map(d,function(y){return e.tokenLabel(y)}).join(", ")+"]"}),T=r.map(E,function(d,y){return" "+(y+1)+". "+d}),f=`one of these possible Token sequences:
|
|
55
71
|
`+T.join(`
|
|
56
|
-
`);return h+f+
|
|
57
|
-
but found: '`+l+"'";if(o)return h+o+
|
|
58
|
-
`+("<"+
|
|
59
|
-
inside top level rule: ->`+s.name+"<-";return a}},n.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(s,u){function a(f){return f instanceof
|
|
72
|
+
`);return h+f+m},buildEarlyExitMessage:function(s){var u=s.expectedIterationPaths,a=s.actual,o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=r.first(a).image,m=`
|
|
73
|
+
but found: '`+l+"'";if(o)return h+o+m;var p=r.map(u,function(T){return"["+r.map(T,function(f){return e.tokenLabel(f)}).join(",")+"]"}),E=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
74
|
+
`+("<"+p.join(" ,")+">");return h+E+m}},Object.freeze(n.defaultParserErrorProvider),n.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(s,u){var a="Invalid grammar, reference to a rule which is not defined: ->"+u.nonTerminalName+`<-
|
|
75
|
+
inside top level rule: ->`+s.name+"<-";return a}},n.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(s,u){function a(f){return f instanceof i.Terminal?f.terminalType.name:f instanceof i.NonTerminal?f.nonTerminalName:""}var o=s.name,h=r.first(u),l=h.idx,m=c.getProductionDslName(h),p=a(h),E=l>0,T="->"+m+(E?l:"")+"<- "+(p?"with argument: ->"+p+"<-":"")+`
|
|
60
76
|
appears more than once (`+u.length+" times) in the top level rule: ->"+o+`<-.
|
|
61
77
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
62
78
|
`;return T=T.replace(/[ \t]+/g," "),T=T.replace(/\s\s+/g,`
|
|
@@ -64,11 +80,11 @@ inside top level rule: ->`+s.name+"<-";return a}},n.defaultGrammarValidatorError
|
|
|
64
80
|
`+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+s.name+`>.
|
|
65
81
|
`)+`To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
66
82
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
67
|
-
and Non-Terminal names start with a lower case letter.`;return u},buildAlternationPrefixAmbiguityError:function(s){var u=
|
|
83
|
+
and Non-Terminal names start with a lower case letter.`;return u},buildAlternationPrefixAmbiguityError:function(s){var u=r.map(s.prefixPath,function(h){return e.tokenLabel(h)}).join(", "),a=s.alternation.idx===0?"":s.alternation.idx,o="Ambiguous alternatives: <"+s.ambiguityIndices.join(" ,")+`> due to common lookahead prefix
|
|
68
84
|
`+("in <OR"+a+"> inside <"+s.topLevelRule.name+`> Rule,
|
|
69
85
|
`)+("<"+u+`> may appears as a prefix path in all these alternatives.
|
|
70
86
|
`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
71
|
-
For Further details.`;return o},buildAlternationAmbiguityError:function(s){var u=
|
|
87
|
+
For Further details.`;return o},buildAlternationAmbiguityError:function(s){var u=r.map(s.prefixPath,function(h){return e.tokenLabel(h)}).join(", "),a=s.alternation.idx===0?"":s.alternation.idx,o="Ambiguous Alternatives Detected: <"+s.ambiguityIndices.join(" ,")+"> in <OR"+a+">"+(" inside <"+s.topLevelRule.name+`> Rule,
|
|
72
88
|
`)+("<"+u+`> may appears as a prefix path in all these alternatives.
|
|
73
89
|
`);return o=o+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
74
90
|
For Further details.`,o},buildEmptyRepetitionError:function(s){var u=c.getProductionDslName(s.repetition);s.repetition.idx!==0&&(u+=s.repetition.idx);var a="The repetition <"+u+"> within Rule <"+s.topLevelRule.name+`> can never consume any tokens.
|
|
@@ -80,33 +96,33 @@ This could lead to an infinite loop.`;return a},buildTokenNameError:function(s){
|
|
|
80
96
|
`)+(`without consuming any Tokens. The grammar path that causes this is:
|
|
81
97
|
`+o+`
|
|
82
98
|
`)+` To fix this refactor your grammar to remove the left recursion.
|
|
83
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return h},buildInvalidRuleNameError:function(s){return"deprecated"},buildDuplicateRuleNameError:function(s){var u;s.topLevelRule instanceof r.Rule?u=s.topLevelRule.name:u=s.topLevelRule;var a="Duplicate definition, rule: ->"+u+"<- is already defined in the grammar: ->"+s.grammarName+"<-";return a}}}),jn=Ee(n=>{var e=n&&n.__extends||(function(){var u=function(a,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,l){h.__proto__=l}||function(h,l){for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(h[p]=l[p])},u(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(a,o);function h(){this.constructor=a}a.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.GastRefResolverVisitor=n.resolveGrammar=void 0;var t=Ye(),i=be(),r=gt();function c(u,a){var o=new s(u,a);return o.resolveRefs(),o.errors}n.resolveGrammar=c;var s=(function(u){e(a,u);function a(o,h){var l=u.call(this)||this;return l.nameToTopRule=o,l.errMsgProvider=h,l.errors=[],l}return a.prototype.resolveRefs=function(){var o=this;i.forEach(i.values(this.nameToTopRule),function(h){o.currTopLevel=h,h.accept(o)})},a.prototype.visitNonTerminal=function(o){var h=this.nameToTopRule[o.nonTerminalName];if(h)o.referencedRule=h;else{var l=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,o);this.errors.push({message:l,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:o.nonTerminalName})}},a})(r.GAstVisitor);n.GastRefResolverVisitor=s}),Lt=Ee(n=>{var e=n&&n.__extends||(function(){var f=function(d,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var b in g)Object.prototype.hasOwnProperty.call(g,b)&&(v[b]=g[b])},f(d,y)};return function(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");f(d,y);function v(){this.constructor=d}d.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.nextPossibleTokensAfter=n.possiblePathsFrom=n.NextTerminalAfterAtLeastOneSepWalker=n.NextTerminalAfterAtLeastOneWalker=n.NextTerminalAfterManySepWalker=n.NextTerminalAfterManyWalker=n.AbstractNextTerminalAfterProductionWalker=n.NextAfterTokenWalker=n.AbstractNextPossibleTokensWalker=void 0;var t=jt(),i=be(),r=nn(),c=ze(),s=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topProd=y,g.path=v,g.possibleTokTypes=[],g.nextProductionName="",g.nextProductionOccurrence=0,g.found=!1,g.isAtEndOfPath=!1,g}return d.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=i.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=i.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},d.prototype.walk=function(y,v){v===void 0&&(v=[]),this.found||f.prototype.walk.call(this,y,v)},d.prototype.walkProdRef=function(y,v,g){if(y.referencedRule.name===this.nextProductionName&&y.idx===this.nextProductionOccurrence){var b=v.concat(g);this.updateExpectedNext(),this.walk(y.referencedRule,b)}},d.prototype.updateExpectedNext=function(){i.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},d})(t.RestWalker);n.AbstractNextPossibleTokensWalker=s;var u=(function(f){e(d,f);function d(y,v){var g=f.call(this,y,v)||this;return g.path=v,g.nextTerminalName="",g.nextTerminalOccurrence=0,g.nextTerminalName=g.path.lastTok.name,g.nextTerminalOccurrence=g.path.lastTokOccurrence,g}return d.prototype.walkTerminal=function(y,v,g){if(this.isAtEndOfPath&&y.terminalType.name===this.nextTerminalName&&y.idx===this.nextTerminalOccurrence&&!this.found){var b=v.concat(g),w=new c.Alternative({definition:b});this.possibleTokTypes=r.first(w),this.found=!0}},d})(s);n.NextAfterTokenWalker=u;var a=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topRule=y,g.occurrence=v,g.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},g}return d.prototype.startWalking=function(){return this.walk(this.topRule),this.result},d})(t.RestWalker);n.AbstractNextTerminalAfterProductionWalker=a;var o=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkMany=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkMany.call(this,y,v,g)},d})(a);n.NextTerminalAfterManyWalker=o;var h=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkManySep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkManySep.call(this,y,v,g)},d})(a);n.NextTerminalAfterManySepWalker=h;var l=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOne=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOne.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneWalker=l;var p=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOneSep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOneSep.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneSepWalker=p;function m(f,d,y){y===void 0&&(y=[]),y=i.cloneArr(y);var v=[],g=0;function b(S){return S.concat(i.drop(f,g+1))}function w(S){var G=m(b(S),d,y);return v.concat(G)}for(;y.length<d&&g<f.length;){var P=f[g];if(P instanceof c.Alternative||P instanceof c.NonTerminal)return w(P.definition);if(P instanceof c.Option)v=w(P.definition);else if(P instanceof c.RepetitionMandatory){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);return w(K)}else if(P instanceof c.RepetitionMandatoryWithSeparator){var K=[new c.Alternative({definition:P.definition}),new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})];return w(K)}else if(P instanceof c.RepetitionWithSeparator){var K=P.definition.concat([new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})]);v=w(K)}else if(P instanceof c.Repetition){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);v=w(K)}else{if(P instanceof c.Alternation)return i.forEach(P.definition,function(S){i.isEmpty(S.definition)===!1&&(v=w(S.definition))}),v;if(P instanceof c.Terminal)y.push(P.terminalType);else throw Error("non exhaustive match")}g++}return v.push({partialPath:y,suffixDef:i.drop(f,g)}),v}n.possiblePathsFrom=m;function E(f,d,y,v){var g="EXIT_NONE_TERMINAL",b=[g],w="EXIT_ALTERNATIVE",P=!1,K=d.length,S=K-v-1,G=[],x=[];for(x.push({idx:-1,def:f,ruleStack:[],occurrenceStack:[]});!i.isEmpty(x);){var I=x.pop();if(I===w){P&&i.last(x).idx<=S&&x.pop();continue}var M=I.def,C=I.idx,X=I.ruleStack,q=I.occurrenceStack;if(!i.isEmpty(M)){var V=M[0];if(V===g){var $={idx:C,def:i.drop(M),ruleStack:i.dropRight(X),occurrenceStack:i.dropRight(q)};x.push($)}else if(V instanceof c.Terminal)if(C<K-1){var Z=C+1,ce=d[Z];if(y(ce,V.terminalType)){var $={idx:Z,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push($)}}else if(C===K-1)G.push({nextTokenType:V.terminalType,nextTokenOccurrence:V.idx,ruleStack:X,occurrenceStack:q}),P=!0;else throw Error("non exhaustive match");else if(V instanceof c.NonTerminal){var se=i.cloneArr(X);se.push(V.nonTerminalName);var ae=i.cloneArr(q);ae.push(V.idx);var $={idx:C,def:V.definition.concat(b,i.drop(M)),ruleStack:se,occurrenceStack:ae};x.push($)}else if(V instanceof c.Option){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var he={idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.RepetitionMandatory){var U=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push($)}else if(V instanceof c.RepetitionMandatoryWithSeparator){var W=new c.Terminal({terminalType:V.separator}),U=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push($)}else if(V instanceof c.RepetitionWithSeparator){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var W=new c.Terminal({terminalType:V.separator}),Q=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.Repetition){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var Q=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.Alternation)for(var J=V.definition.length-1;J>=0;J--){var ie=V.definition[J],ge={idx:C,def:ie.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};x.push(ge),x.push(w)}else if(V instanceof c.Alternative)x.push({idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q});else if(V instanceof c.Rule)x.push(T(V,C,X,q));else throw Error("non exhaustive match")}}return G}n.nextPossibleTokensAfter=E;function T(f,d,y,v){var g=i.cloneArr(y);g.push(f.name);var b=i.cloneArr(v);return b.push(1),{idx:d,def:f.definition,ruleStack:g,occurrenceStack:b}}}),Ot=Ee(n=>{var e=n&&n.__extends||(function(){var S=function(G,x){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,M){I.__proto__=M}||function(I,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(I[C]=M[C])},S(G,x)};return function(G,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");S(G,x);function I(){this.constructor=G}G.prototype=x===null?Object.create(x):(I.prototype=x.prototype,new I)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.areTokenCategoriesNotUsed=n.isStrictPrefixOfPath=n.containsPath=n.getLookaheadPathsForOptionalProd=n.getLookaheadPathsForOr=n.lookAheadSequenceFromAlternatives=n.buildSingleAlternativeLookaheadFunction=n.buildAlternativesLookAheadFunc=n.buildLookaheadFuncForOptionalProd=n.buildLookaheadFuncForOr=n.getProdType=n.PROD_TYPE=void 0;var t=be(),i=Lt(),r=jt(),c=yt(),s=ze(),u=gt(),a;(function(S){S[S.OPTION=0]="OPTION",S[S.REPETITION=1]="REPETITION",S[S.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",S[S.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",S[S.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",S[S.ALTERNATION=5]="ALTERNATION"})(a=n.PROD_TYPE||(n.PROD_TYPE={}));function o(S){if(S instanceof s.Option)return a.OPTION;if(S instanceof s.Repetition)return a.REPETITION;if(S instanceof s.RepetitionMandatory)return a.REPETITION_MANDATORY;if(S instanceof s.RepetitionMandatoryWithSeparator)return a.REPETITION_MANDATORY_WITH_SEPARATOR;if(S instanceof s.RepetitionWithSeparator)return a.REPETITION_WITH_SEPARATOR;if(S instanceof s.Alternation)return a.ALTERNATION;throw Error("non exhaustive match")}n.getProdType=o;function h(S,G,x,I,M,C){var X=g(S,G,x),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X,I,q,M)}n.buildLookaheadFuncForOr=h;function l(S,G,x,I,M,C){var X=b(S,G,M,x),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X[0],q,I)}n.buildLookaheadFuncForOptionalProd=l;function p(S,G,x,I){var M=S.length,C=t.every(S,function(V){return t.every(V,function($){return $.length===1})});if(G)return function(V){for(var $=t.map(V,function(Q){return Q.GATE}),Z=0;Z<M;Z++){var ce=S[Z],se=ce.length,ae=$[Z];if(!(ae!==void 0&&ae.call(this)===!1))e:for(var ne=0;ne<se;ne++){for(var he=ce[ne],U=he.length,j=0;j<U;j++){var W=this.LA(j+1);if(x(W,he[j])===!1)continue e}return Z}}};if(C&&!I){var X=t.map(S,function(V){return t.flatten(V)}),q=t.reduce(X,function(V,$,Z){return t.forEach($,function(ce){t.has(V,ce.tokenTypeIdx)||(V[ce.tokenTypeIdx]=Z),t.forEach(ce.categoryMatches,function(se){t.has(V,se)||(V[se]=Z)})}),V},[]);return function(){var V=this.LA(1);return q[V.tokenTypeIdx]}}else return function(){for(var V=0;V<M;V++){var $=S[V],Z=$.length;e:for(var ce=0;ce<Z;ce++){for(var se=$[ce],ae=se.length,ne=0;ne<ae;ne++){var he=this.LA(ne+1);if(x(he,se[ne])===!1)continue e}return V}}}}n.buildAlternativesLookAheadFunc=p;function m(S,G,x){var I=t.every(S,function($){return $.length===1}),M=S.length;if(I&&!x){var C=t.flatten(S);if(C.length===1&&t.isEmpty(C[0].categoryMatches)){var X=C[0],q=X.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===q}}else{var V=t.reduce(C,function($,Z,ce){return $[Z.tokenTypeIdx]=!0,t.forEach(Z.categoryMatches,function(se){$[se]=!0}),$},[]);return function(){var $=this.LA(1);return V[$.tokenTypeIdx]===!0}}}else return function(){e:for(var $=0;$<M;$++){for(var Z=S[$],ce=Z.length,se=0;se<ce;se++){var ae=this.LA(se+1);if(G(ae,Z[se])===!1)continue e}return!0}return!1}}n.buildSingleAlternativeLookaheadFunction=m;var E=(function(S){e(G,S);function G(x,I,M){var C=S.call(this)||this;return C.topProd=x,C.targetOccurrence=I,C.targetProdType=M,C}return G.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},G.prototype.checkIsTarget=function(x,I,M,C){return x.idx===this.targetOccurrence&&this.targetProdType===I?(this.restDef=M.concat(C),!0):!1},G.prototype.walkOption=function(x,I,M){this.checkIsTarget(x,a.OPTION,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkAtLeastOne=function(x,I,M){this.checkIsTarget(x,a.REPETITION_MANDATORY,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkAtLeastOneSep=function(x,I,M){this.checkIsTarget(x,a.REPETITION_MANDATORY_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkMany=function(x,I,M){this.checkIsTarget(x,a.REPETITION,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkManySep=function(x,I,M){this.checkIsTarget(x,a.REPETITION_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,x,I,M)},G})(r.RestWalker),T=(function(S){e(G,S);function G(x,I,M){var C=S.call(this)||this;return C.targetOccurrence=x,C.targetProdType=I,C.targetRef=M,C.result=[],C}return G.prototype.checkIsTarget=function(x,I){x.idx===this.targetOccurrence&&this.targetProdType===I&&(this.targetRef===void 0||x===this.targetRef)&&(this.result=x.definition)},G.prototype.visitOption=function(x){this.checkIsTarget(x,a.OPTION)},G.prototype.visitRepetition=function(x){this.checkIsTarget(x,a.REPETITION)},G.prototype.visitRepetitionMandatory=function(x){this.checkIsTarget(x,a.REPETITION_MANDATORY)},G.prototype.visitRepetitionMandatoryWithSeparator=function(x){this.checkIsTarget(x,a.REPETITION_MANDATORY_WITH_SEPARATOR)},G.prototype.visitRepetitionWithSeparator=function(x){this.checkIsTarget(x,a.REPETITION_WITH_SEPARATOR)},G.prototype.visitAlternation=function(x){this.checkIsTarget(x,a.ALTERNATION)},G})(u.GAstVisitor);function f(S){for(var G=new Array(S),x=0;x<S;x++)G[x]=[];return G}function d(S){for(var G=[""],x=0;x<S.length;x++){for(var I=S[x],M=[],C=0;C<G.length;C++){var X=G[C];M.push(X+"_"+I.tokenTypeIdx);for(var q=0;q<I.categoryMatches.length;q++){var V="_"+I.categoryMatches[q];M.push(X+V)}}G=M}return G}function y(S,G,x){for(var I=0;I<S.length;I++)if(I!==x)for(var M=S[I],C=0;C<G.length;C++){var X=G[C];if(M[X]===!0)return!1}return!0}function v(S,G){for(var x=t.map(S,function(Z){return i.possiblePathsFrom([Z],1)}),I=f(x.length),M=t.map(x,function(Z){var ce={};return t.forEach(Z,function(se){var ae=d(se.partialPath);t.forEach(ae,function(ne){ce[ne]=!0})}),ce}),C=x,X=1;X<=G;X++){var q=C;C=f(q.length);for(var V=function(Z){for(var ce=q[Z],se=0;se<ce.length;se++){var ae=ce[se].partialPath,ne=ce[se].suffixDef,he=d(ae),U=y(M,he,Z);if(U||t.isEmpty(ne)||ae.length===G){var j=I[Z];if(w(j,ae)===!1){j.push(ae);for(var W=0;W<he.length;W++){var Q=he[W];M[Z][Q]=!0}}}else{var J=i.possiblePathsFrom(ne,X+1,ae);C[Z]=C[Z].concat(J),t.forEach(J,function(ie){var ge=d(ie.partialPath);t.forEach(ge,function(pe){M[Z][pe]=!0})})}}},$=0;$<q.length;$++)V($)}return I}n.lookAheadSequenceFromAlternatives=v;function g(S,G,x,I){var M=new T(S,a.ALTERNATION,I);return G.accept(M),v(M.result,x)}n.getLookaheadPathsForOr=g;function b(S,G,x,I){var M=new T(S,x);G.accept(M);var C=M.result,X=new E(G,S,x),q=X.startWalking(),V=new s.Alternative({definition:C}),$=new s.Alternative({definition:q});return v([V,$],I)}n.getLookaheadPathsForOptionalProd=b;function w(S,G){e:for(var x=0;x<S.length;x++){var I=S[x];if(I.length===G.length){for(var M=0;M<I.length;M++){var C=G[M],X=I[M],q=C===X||X.categoryMatchesMap[C.tokenTypeIdx]!==void 0;if(q===!1)continue e}return!0}}return!1}n.containsPath=w;function P(S,G){return S.length<G.length&&t.every(S,function(x,I){var M=G[I];return x===M||M.categoryMatchesMap[x.tokenTypeIdx]})}n.isStrictPrefixOfPath=P;function K(S){return t.every(S,function(G){return t.every(G,function(x){return t.every(x,function(I){return t.isEmpty(I.categoryMatches)})})})}n.areTokenCategoriesNotUsed=K}),on=Ee(n=>{var e=n&&n.__extends||(function(){var I=function(M,C){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,q){X.__proto__=q}||function(X,q){for(var V in q)Object.prototype.hasOwnProperty.call(q,V)&&(X[V]=q[V])},I(M,C)};return function(M,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");I(M,C);function X(){this.constructor=M}M.prototype=C===null?Object.create(C):(X.prototype=C.prototype,new X)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.checkPrefixAlternativesAmbiguities=n.validateSomeNonEmptyLookaheadPath=n.validateTooManyAlts=n.RepetionCollector=n.validateAmbiguousAlternationAlternatives=n.validateEmptyOrAlternative=n.getFirstNoneTerminal=n.validateNoLeftRecursion=n.validateRuleIsOverridden=n.validateRuleDoesNotAlreadyExist=n.OccurrenceValidationCollector=n.identifyProductionForDuplicates=n.validateGrammar=void 0;var t=be(),i=be(),r=Ye(),c=At(),s=Ot(),u=Lt(),a=ze(),o=gt();function h(I,M,C,X,q){var V=t.map(I,function(U){return l(U,X)}),$=t.map(I,function(U){return d(U,U,X)}),Z=[],ce=[],se=[];i.every($,i.isEmpty)&&(Z=i.map(I,function(U){return g(U,X)}),ce=i.map(I,function(U){return b(U,M,X)}),se=K(I,M,X));var ae=x(I,C,X),ne=i.map(I,function(U){return P(U,X)}),he=i.map(I,function(U){return T(U,I,q,X)});return t.flatten(V.concat(se,$,Z,ce,ae,ne,he))}n.validateGrammar=h;function l(I,M){var C=new E;I.accept(C);var X=C.allProductions,q=t.groupBy(X,p),V=t.pick(q,function(Z){return Z.length>1}),$=t.map(t.values(V),function(Z){var ce=t.first(Z),se=M.buildDuplicateFoundError(I,Z),ae=c.getProductionDslName(ce),ne={message:se,type:r.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:I.name,dslName:ae,occurrence:ce.idx},he=m(ce);return he&&(ne.parameter=he),ne});return $}function p(I){return c.getProductionDslName(I)+"_#_"+I.idx+"_#_"+m(I)}n.identifyProductionForDuplicates=p;function m(I){return I instanceof a.Terminal?I.terminalType.name:I instanceof a.NonTerminal?I.nonTerminalName:""}var E=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitNonTerminal=function(C){this.allProductions.push(C)},M.prototype.visitOption=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M.prototype.visitAlternation=function(C){this.allProductions.push(C)},M.prototype.visitTerminal=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.OccurrenceValidationCollector=E;function T(I,M,C,X){var q=[],V=i.reduce(M,function(Z,ce){return ce.name===I.name?Z+1:Z},0);if(V>1){var $=X.buildDuplicateRuleNameError({topLevelRule:I,grammarName:C});q.push({message:$,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:I.name})}return q}n.validateRuleDoesNotAlreadyExist=T;function f(I,M,C){var X=[],q;return t.contains(M,I)||(q="Invalid rule override, rule: ->"+I+"<- cannot be overridden in the grammar: ->"+C+"<-as it is not defined in any of the super grammars ",X.push({message:q,type:r.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:I})),X}n.validateRuleIsOverridden=f;function d(I,M,C,X){X===void 0&&(X=[]);var q=[],V=y(M.definition);if(t.isEmpty(V))return[];var $=I.name,Z=t.contains(V,I);Z&&q.push({message:C.buildLeftRecursionError({topLevelRule:I,leftRecursionPath:X}),type:r.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:$});var ce=t.difference(V,X.concat([I])),se=t.map(ce,function(ae){var ne=t.cloneArr(X);return ne.push(ae),d(I,ae,C,ne)});return q.concat(t.flatten(se))}n.validateNoLeftRecursion=d;function y(I){var M=[];if(t.isEmpty(I))return M;var C=t.first(I);if(C instanceof a.NonTerminal)M.push(C.referencedRule);else if(C instanceof a.Alternative||C instanceof a.Option||C instanceof a.RepetitionMandatory||C instanceof a.RepetitionMandatoryWithSeparator||C instanceof a.RepetitionWithSeparator||C instanceof a.Repetition)M=M.concat(y(C.definition));else if(C instanceof a.Alternation)M=t.flatten(t.map(C.definition,function($){return y($.definition)}));else if(!(C instanceof a.Terminal))throw Error("non exhaustive match");var X=c.isOptionalProd(C),q=I.length>1;if(X&&q){var V=t.drop(I);return M.concat(y(V))}else return M}n.getFirstNoneTerminal=y;var v=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.alternations=[],C}return M.prototype.visitAlternation=function(C){this.alternations.push(C)},M})(o.GAstVisitor);function g(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){var Z=t.dropRight($.definition),ce=t.map(Z,function(se,ae){var ne=u.nextPossibleTokensAfter([se],[],null,1);return t.isEmpty(ne)?{message:M.buildEmptyAlternationError({topLevelRule:I,alternation:$,emptyChoiceIdx:ae}),type:r.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:I.name,occurrence:$.idx,alternative:ae+1}:null});return V.concat(t.compact(ce))},[]);return q}n.validateEmptyOrAlternative=g;function b(I,M,C){var X=new v;I.accept(X);var q=X.alternations;q=i.reject(q,function($){return $.ignoreAmbiguities===!0});var V=t.reduce(q,function($,Z){var ce=Z.idx,se=Z.maxLookahead||M,ae=s.getLookaheadPathsForOr(ce,I,se,Z),ne=S(ae,Z,I,C),he=G(ae,Z,I,C);return $.concat(ne,he)},[]);return V}n.validateAmbiguousAlternationAlternatives=b;var w=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.RepetionCollector=w;function P(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){return $.definition.length>255&&V.push({message:M.buildTooManyAlternativesError({topLevelRule:I,alternation:$}),type:r.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:I.name,occurrence:$.idx}),V},[]);return q}n.validateTooManyAlts=P;function K(I,M,C){var X=[];return i.forEach(I,function(q){var V=new w;q.accept(V);var $=V.allProductions;i.forEach($,function(Z){var ce=s.getProdType(Z),se=Z.maxLookahead||M,ae=Z.idx,ne=s.getLookaheadPathsForOptionalProd(ae,q,ce,se),he=ne[0];if(i.isEmpty(i.flatten(he))){var U=C.buildEmptyRepetitionError({topLevelRule:q,repetition:Z});X.push({message:U,type:r.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:q.name})}})}),X}n.validateSomeNonEmptyLookaheadPath=K;function S(I,M,C,X){var q=[],V=i.reduce(I,function(Z,ce,se){return M.definition[se].ignoreAmbiguities===!0||i.forEach(ce,function(ae){var ne=[se];i.forEach(I,function(he,U){se!==U&&s.containsPath(he,ae)&&M.definition[U].ignoreAmbiguities!==!0&&ne.push(U)}),ne.length>1&&!s.containsPath(q,ae)&&(q.push(ae),Z.push({alts:ne,path:ae}))}),Z},[]),$=t.map(V,function(Z){var ce=i.map(Z.alts,function(ae){return ae+1}),se=X.buildAlternationAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:ce,prefixPath:Z.path});return{message:se,type:r.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:C.name,occurrence:M.idx,alternatives:[Z.alts]}});return $}function G(I,M,C,X){var q=[],V=i.reduce(I,function($,Z,ce){var se=i.map(Z,function(ae){return{idx:ce,path:ae}});return $.concat(se)},[]);return i.forEach(V,function($){var Z=M.definition[$.idx];if(Z.ignoreAmbiguities!==!0){var ce=$.idx,se=$.path,ae=i.findAll(V,function(he){return M.definition[he.idx].ignoreAmbiguities!==!0&&he.idx<ce&&s.isStrictPrefixOfPath(he.path,se)}),ne=i.map(ae,function(he){var U=[he.idx+1,ce+1],j=M.idx===0?"":M.idx,W=X.buildAlternationPrefixAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:U,prefixPath:he.path});return{message:W,type:r.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:C.name,occurrence:j,alternatives:U}});q=q.concat(ne)}}),q}n.checkPrefixAlternativesAmbiguities=G;function x(I,M,C){var X=[],q=i.map(M,function(V){return V.name});return i.forEach(I,function(V){var $=V.name;if(i.contains(q,$)){var Z=C.buildNamespaceConflictError(V);X.push({message:Z,type:r.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:$})}}),X}}),Vn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateGrammar=n.resolveGrammar=void 0;var e=be(),t=jn(),i=on(),r=_t();function c(u){u=e.defaults(u,{errMsgProvider:r.defaultGrammarResolverErrorProvider});var a={};return e.forEach(u.rules,function(o){a[o.name]=o}),t.resolveGrammar(a,u.errMsgProvider)}n.resolveGrammar=c;function s(u){return u=e.defaults(u,{errMsgProvider:r.defaultGrammarValidatorErrorProvider}),i.validateGrammar(u.rules,u.maxLookahead,u.tokenTypes,u.errMsgProvider,u.grammarName)}n.validateGrammar=s}),Tt=Ee(n=>{var e=n&&n.__extends||(function(){var E=function(T,f){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(d[v]=y[v])},E(T,f)};return function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");E(T,f);function d(){this.constructor=T}T.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EarlyExitException=n.NotAllInputParsedException=n.NoViableAltException=n.MismatchedTokenException=n.isRecognitionException=void 0;var t=be(),i="MismatchedTokenException",r="NoViableAltException",c="EarlyExitException",s="NotAllInputParsedException",u=[i,r,c,s];Object.freeze(u);function a(E){return t.contains(u,E.name)}n.isRecognitionException=a;var o=(function(E){e(T,E);function T(f,d){var y=this.constructor,v=E.call(this,f)||this;return v.token=d,v.resyncedTokens=[],Object.setPrototypeOf(v,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return T})(Error),h=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=i,v}return T})(o);n.MismatchedTokenException=h;var l=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=r,v}return T})(o);n.NoViableAltException=l;var p=(function(E){e(T,E);function T(f,d){var y=E.call(this,f,d)||this;return y.name=s,y}return T})(o);n.NotAllInputParsedException=p;var m=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=c,v}return T})(o);n.EarlyExitException=m}),sn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.attemptInRepetitionRecovery=n.Recoverable=n.InRuleRecoveryException=n.IN_RULE_RECOVERY_EXCEPTION=n.EOF_FOLLOW_KEY=void 0;var e=ct(),t=be(),i=Tt(),r=rn(),c=Ye();n.EOF_FOLLOW_KEY={},n.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function s(o){this.name=n.IN_RULE_RECOVERY_EXCEPTION,this.message=o}n.InRuleRecoveryException=s,s.prototype=Error.prototype;var u=(function(){function o(){}return o.prototype.initRecoverable=function(h){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(h,"recoveryEnabled")?h.recoveryEnabled:c.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=a)},o.prototype.getTokenToInsert=function(h){var l=e.createTokenInstance(h,"",NaN,NaN,NaN,NaN,NaN,NaN);return l.isInsertedInRecovery=!0,l},o.prototype.canTokenTypeBeInsertedInRecovery=function(h){return!0},o.prototype.tryInRepetitionRecovery=function(h,l,p,m){for(var E=this,T=this.findReSyncTokenType(),f=this.exportLexerState(),d=[],y=!1,v=this.LA(1),g=this.LA(1),b=function(){var w=E.LA(0),P=E.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:v,previous:w,ruleName:E.getCurrRuleFullName()}),K=new i.MismatchedTokenException(P,v,E.LA(0));K.resyncedTokens=t.dropRight(d),E.SAVE_ERROR(K)};!y;)if(this.tokenMatcher(g,m)){b();return}else if(p.call(this)){b(),h.apply(this,l);return}else this.tokenMatcher(g,T)?y=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,d));this.importLexerState(f)},o.prototype.shouldInRepetitionRecoveryBeTried=function(h,l,p){return!(p===!1||h===void 0||l===void 0||this.tokenMatcher(this.LA(1),h)||this.isBackTracking()||this.canPerformInRuleRecovery(h,this.getFollowsForInRuleRecovery(h,l)))},o.prototype.getFollowsForInRuleRecovery=function(h,l){var p=this.getCurrentGrammarPath(h,l),m=this.getNextPossibleTokenTypes(p);return m},o.prototype.tryInRuleRecovery=function(h,l){if(this.canRecoverWithSingleTokenInsertion(h,l)){var p=this.getTokenToInsert(h);return p}if(this.canRecoverWithSingleTokenDeletion(h)){var m=this.SKIP_TOKEN();return this.consumeToken(),m}throw new s("sad sad panda")},o.prototype.canPerformInRuleRecovery=function(h,l){return this.canRecoverWithSingleTokenInsertion(h,l)||this.canRecoverWithSingleTokenDeletion(h)},o.prototype.canRecoverWithSingleTokenInsertion=function(h,l){var p=this;if(!this.canTokenTypeBeInsertedInRecovery(h)||t.isEmpty(l))return!1;var m=this.LA(1),E=t.find(l,function(T){return p.tokenMatcher(m,T)})!==void 0;return E},o.prototype.canRecoverWithSingleTokenDeletion=function(h){var l=this.tokenMatcher(this.LA(2),h);return l},o.prototype.isInCurrentRuleReSyncSet=function(h){var l=this.getCurrFollowKey(),p=this.getFollowSetFromFollowKey(l);return t.contains(p,h)},o.prototype.findReSyncTokenType=function(){for(var h=this.flattenFollowSet(),l=this.LA(1),p=2;;){var m=l.tokenType;if(t.contains(h,m))return m;l=this.LA(p),p++}},o.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return n.EOF_FOLLOW_KEY;var h=this.getLastExplicitRuleShortName(),l=this.getLastExplicitRuleOccurrenceIndex(),p=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(h),idxInCallingRule:l,inRule:this.shortRuleNameToFullName(p)}},o.prototype.buildFullFollowKeyStack=function(){var h=this,l=this.RULE_STACK,p=this.RULE_OCCURRENCE_STACK;return t.map(l,function(m,E){return E===0?n.EOF_FOLLOW_KEY:{ruleName:h.shortRuleNameToFullName(m),idxInCallingRule:p[E],inRule:h.shortRuleNameToFullName(l[E-1])}})},o.prototype.flattenFollowSet=function(){var h=this,l=t.map(this.buildFullFollowKeyStack(),function(p){return h.getFollowSetFromFollowKey(p)});return t.flatten(l)},o.prototype.getFollowSetFromFollowKey=function(h){if(h===n.EOF_FOLLOW_KEY)return[e.EOF];var l=h.ruleName+h.idxInCallingRule+r.IN+h.inRule;return this.resyncFollows[l]},o.prototype.addToResyncTokens=function(h,l){return this.tokenMatcher(h,e.EOF)||l.push(h),l},o.prototype.reSyncTo=function(h){for(var l=[],p=this.LA(1);this.tokenMatcher(p,h)===!1;)p=this.SKIP_TOKEN(),this.addToResyncTokens(p,l);return t.dropRight(l)},o.prototype.attemptInRepetitionRecovery=function(h,l,p,m,E,T,f){},o.prototype.getCurrentGrammarPath=function(h,l){var p=this.getHumanReadableRuleStack(),m=t.cloneArr(this.RULE_OCCURRENCE_STACK),E={ruleStack:p,occurrenceStack:m,lastTok:h,lastTokOccurrence:l};return E},o.prototype.getHumanReadableRuleStack=function(){var h=this;return t.map(this.RULE_STACK,function(l){return h.shortRuleNameToFullName(l)})},o})();n.Recoverable=u;function a(o,h,l,p,m,E,T){var f=this.getKeyForAutomaticLookahead(p,m),d=this.firstAfterRepMap[f];if(d===void 0){var y=this.getCurrRuleFullName(),v=this.getGAstProductions()[y],g=new E(v,m);d=g.startWalking(),this.firstAfterRepMap[f]=d}var b=d.token,w=d.occurrence,P=d.isEndOfRule;this.RULE_STACK.length===1&&P&&b===void 0&&(b=e.EOF,w=1),this.shouldInRepetitionRecoveryBeTried(b,w,T)&&this.tryInRepetitionRecovery(o,h,l,b)}n.attemptInRepetitionRecovery=a}),Vt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getKeyForAutomaticLookahead=n.AT_LEAST_ONE_SEP_IDX=n.MANY_SEP_IDX=n.AT_LEAST_ONE_IDX=n.MANY_IDX=n.OPTION_IDX=n.OR_IDX=n.BITS_FOR_ALT_IDX=n.BITS_FOR_RULE_IDX=n.BITS_FOR_OCCURRENCE_IDX=n.BITS_FOR_METHOD_TYPE=void 0,n.BITS_FOR_METHOD_TYPE=4,n.BITS_FOR_OCCURRENCE_IDX=8,n.BITS_FOR_RULE_IDX=12,n.BITS_FOR_ALT_IDX=8,n.OR_IDX=1<<n.BITS_FOR_OCCURRENCE_IDX,n.OPTION_IDX=2<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_IDX=3<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_IDX=4<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_SEP_IDX=5<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_SEP_IDX=6<<n.BITS_FOR_OCCURRENCE_IDX;function e(t,i,r){return r|i|t}n.getKeyForAutomaticLookahead=e,32-n.BITS_FOR_ALT_IDX}),zn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LooksAhead=void 0;var e=Ot(),t=be(),i=Ye(),r=Vt(),c=At(),s=(function(){function u(){}return u.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=t.has(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:i.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(a,"maxLookahead")?a.maxLookahead:i.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=t.isES2015MapSupported()?new Map:[],t.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},u.prototype.preComputeLookaheadFunctions=function(a){var o=this;t.forEach(a,function(h){o.TRACE_INIT(h.name+" Rule Lookahead",function(){var l=c.collectMethods(h),p=l.alternation,m=l.repetition,E=l.option,T=l.repetitionMandatory,f=l.repetitionMandatoryWithSeparator,d=l.repetitionWithSeparator;t.forEach(p,function(y){var v=y.idx===0?"":y.idx;o.TRACE_INIT(""+c.getProductionDslName(y)+v,function(){var g=e.buildLookaheadFuncForOr(y.idx,h,y.maxLookahead||o.maxLookahead,y.hasPredicates,o.dynamicTokensEnabled,o.lookAheadBuilderForAlternatives),b=r.getKeyForAutomaticLookahead(o.fullRuleNameToShort[h.name],r.OR_IDX,y.idx);o.setLaFuncCache(b,g)})}),t.forEach(m,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_IDX,e.PROD_TYPE.REPETITION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(E,function(y){o.computeLookaheadFunc(h,y.idx,r.OPTION_IDX,e.PROD_TYPE.OPTION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(T,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(f,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(d,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))})})})},u.prototype.computeLookaheadFunc=function(a,o,h,l,p,m){var E=this;this.TRACE_INIT(""+m+(o===0?"":o),function(){var T=e.buildLookaheadFuncForOptionalProd(o,a,p||E.maxLookahead,E.dynamicTokensEnabled,l,E.lookAheadBuilderForOptional),f=r.getKeyForAutomaticLookahead(E.fullRuleNameToShort[a.name],h,o);E.setLaFuncCache(f,T)})},u.prototype.lookAheadBuilderForOptional=function(a,o,h){return e.buildSingleAlternativeLookaheadFunction(a,o,h)},u.prototype.lookAheadBuilderForAlternatives=function(a,o,h,l){return e.buildAlternativesLookAheadFunc(a,o,h,l)},u.prototype.getKeyForAutomaticLookahead=function(a,o){var h=this.getLastExplicitRuleShortName();return r.getKeyForAutomaticLookahead(h,a,o)},u.prototype.getLaFuncFromCache=function(a){},u.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},u.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},u.prototype.setLaFuncCache=function(a,o){},u.prototype.setLaFuncCacheUsingMap=function(a,o){this.lookAheadFuncsCache.set(a,o)},u.prototype.setLaFuncUsingObj=function(a,o){this.lookAheadFuncsCache[a]=o},u})();n.LooksAhead=s}),Hn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addNoneTerminalToCst=n.addTerminalToCst=n.setNodeLocationFull=n.setNodeLocationOnlyOffset=void 0;function e(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.endOffset=s.endOffset):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset)}n.setNodeLocationOnlyOffset=e;function t(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.startColumn=s.startColumn,c.startLine=s.startLine,c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine)}n.setNodeLocationFull=t;function i(c,s,u){c.children[u]===void 0?c.children[u]=[s]:c.children[u].push(s)}n.addTerminalToCst=i;function r(c,s,u){c.children[s]===void 0?c.children[s]=[u]:c.children[s].push(u)}n.addNoneTerminalToCst=r}),an=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defineNameProp=n.functionName=n.classNameFromInstance=void 0;var e=be();function t(s){return r(s.constructor)}n.classNameFromInstance=t;var i="name";function r(s){var u=s.name;return u||"anonymous"}n.functionName=r;function c(s,u){var a=Object.getOwnPropertyDescriptor(s,i);return e.isUndefined(a)||a.configurable?(Object.defineProperty(s,i,{enumerable:!1,configurable:!0,writable:!1,value:u}),!0):!1}n.defineNameProp=c}),Wn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateRedundantMethods=n.validateMissingCstMethods=n.validateVisitor=n.CstVisitorDefinitionError=n.createBaseVisitorConstructorWithDefaults=n.createBaseSemanticVisitorConstructor=n.defaultVisit=void 0;var e=be(),t=an();function i(l,p){for(var m=e.keys(l),E=m.length,T=0;T<E;T++)for(var f=m[T],d=l[f],y=d.length,v=0;v<y;v++){var g=d[v];g.tokenTypeIdx===void 0&&this[g.name](g.children,p)}}n.defaultVisit=i;function r(l,p){var m=function(){};t.defineNameProp(m,l+"BaseSemantics");var E={visit:function(T,f){if(e.isArray(T)&&(T=T[0]),!e.isUndefined(T))return this[T.name](T.children,f)},validateVisitor:function(){var T=u(this,p);if(!e.isEmpty(T)){var f=e.map(T,function(d){return d.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
|
|
99
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return h},buildInvalidRuleNameError:function(s){return"deprecated"},buildDuplicateRuleNameError:function(s){var u;s.topLevelRule instanceof i.Rule?u=s.topLevelRule.name:u=s.topLevelRule;var a="Duplicate definition, rule: ->"+u+"<- is already defined in the grammar: ->"+s.grammarName+"<-";return a}}}),Cr=Ee(n=>{var e=n&&n.__extends||(function(){var u=function(a,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,l){h.__proto__=l}||function(h,l){for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&(h[m]=l[m])},u(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(a,o);function h(){this.constructor=a}a.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.GastRefResolverVisitor=n.resolveGrammar=void 0;var t=We(),r=Ie(),i=ct();function c(u,a){var o=new s(u,a);return o.resolveRefs(),o.errors}n.resolveGrammar=c;var s=(function(u){e(a,u);function a(o,h){var l=u.call(this)||this;return l.nameToTopRule=o,l.errMsgProvider=h,l.errors=[],l}return a.prototype.resolveRefs=function(){var o=this;r.forEach(r.values(this.nameToTopRule),function(h){o.currTopLevel=h,h.accept(o)})},a.prototype.visitNonTerminal=function(o){var h=this.nameToTopRule[o.nonTerminalName];if(h)o.referencedRule=h;else{var l=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,o);this.errors.push({message:l,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:o.nonTerminalName})}},a})(i.GAstVisitor);n.GastRefResolverVisitor=s}),mt=Ee(n=>{var e=n&&n.__extends||(function(){var f=function(d,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var b in g)Object.prototype.hasOwnProperty.call(g,b)&&(v[b]=g[b])},f(d,y)};return function(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");f(d,y);function v(){this.constructor=d}d.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.nextPossibleTokensAfter=n.possiblePathsFrom=n.NextTerminalAfterAtLeastOneSepWalker=n.NextTerminalAfterAtLeastOneWalker=n.NextTerminalAfterManySepWalker=n.NextTerminalAfterManyWalker=n.AbstractNextTerminalAfterProductionWalker=n.NextAfterTokenWalker=n.AbstractNextPossibleTokensWalker=void 0;var t=bt(),r=Ie(),i=$t(),c=Ve(),s=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topProd=y,g.path=v,g.possibleTokTypes=[],g.nextProductionName="",g.nextProductionOccurrence=0,g.found=!1,g.isAtEndOfPath=!1,g}return d.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=r.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=r.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},d.prototype.walk=function(y,v){v===void 0&&(v=[]),this.found||f.prototype.walk.call(this,y,v)},d.prototype.walkProdRef=function(y,v,g){if(y.referencedRule.name===this.nextProductionName&&y.idx===this.nextProductionOccurrence){var b=v.concat(g);this.updateExpectedNext(),this.walk(y.referencedRule,b)}},d.prototype.updateExpectedNext=function(){r.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},d})(t.RestWalker);n.AbstractNextPossibleTokensWalker=s;var u=(function(f){e(d,f);function d(y,v){var g=f.call(this,y,v)||this;return g.path=v,g.nextTerminalName="",g.nextTerminalOccurrence=0,g.nextTerminalName=g.path.lastTok.name,g.nextTerminalOccurrence=g.path.lastTokOccurrence,g}return d.prototype.walkTerminal=function(y,v,g){if(this.isAtEndOfPath&&y.terminalType.name===this.nextTerminalName&&y.idx===this.nextTerminalOccurrence&&!this.found){var b=v.concat(g),w=new c.Alternative({definition:b});this.possibleTokTypes=i.first(w),this.found=!0}},d})(s);n.NextAfterTokenWalker=u;var a=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topRule=y,g.occurrence=v,g.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},g}return d.prototype.startWalking=function(){return this.walk(this.topRule),this.result},d})(t.RestWalker);n.AbstractNextTerminalAfterProductionWalker=a;var o=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkMany=function(y,v,g){if(y.idx===this.occurrence){var b=r.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkMany.call(this,y,v,g)},d})(a);n.NextTerminalAfterManyWalker=o;var h=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkManySep=function(y,v,g){if(y.idx===this.occurrence){var b=r.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkManySep.call(this,y,v,g)},d})(a);n.NextTerminalAfterManySepWalker=h;var l=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOne=function(y,v,g){if(y.idx===this.occurrence){var b=r.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOne.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneWalker=l;var m=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOneSep=function(y,v,g){if(y.idx===this.occurrence){var b=r.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOneSep.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneSepWalker=m;function p(f,d,y){y===void 0&&(y=[]),y=r.cloneArr(y);var v=[],g=0;function b(I){return I.concat(r.drop(f,g+1))}function w(I){var G=p(b(I),d,y);return v.concat(G)}for(;y.length<d&&g<f.length;){var C=f[g];if(C instanceof c.Alternative||C instanceof c.NonTerminal)return w(C.definition);if(C instanceof c.Option)v=w(C.definition);else if(C instanceof c.RepetitionMandatory){var Y=C.definition.concat([new c.Repetition({definition:C.definition})]);return w(Y)}else if(C instanceof c.RepetitionMandatoryWithSeparator){var Y=[new c.Alternative({definition:C.definition}),new c.Repetition({definition:[new c.Terminal({terminalType:C.separator})].concat(C.definition)})];return w(Y)}else if(C instanceof c.RepetitionWithSeparator){var Y=C.definition.concat([new c.Repetition({definition:[new c.Terminal({terminalType:C.separator})].concat(C.definition)})]);v=w(Y)}else if(C instanceof c.Repetition){var Y=C.definition.concat([new c.Repetition({definition:C.definition})]);v=w(Y)}else{if(C instanceof c.Alternation)return r.forEach(C.definition,function(I){r.isEmpty(I.definition)===!1&&(v=w(I.definition))}),v;if(C instanceof c.Terminal)y.push(C.terminalType);else throw Error("non exhaustive match")}g++}return v.push({partialPath:y,suffixDef:r.drop(f,g)}),v}n.possiblePathsFrom=p;function E(f,d,y,v){var g="EXIT_NONE_TERMINAL",b=[g],w="EXIT_ALTERNATIVE",C=!1,Y=d.length,I=Y-v-1,G=[],M=[];for(M.push({idx:-1,def:f,ruleStack:[],occurrenceStack:[]});!r.isEmpty(M);){var S=M.pop();if(S===w){C&&r.last(M).idx<=I&&M.pop();continue}var P=S.def,k=S.idx,X=S.ruleStack,Q=S.occurrenceStack;if(!r.isEmpty(P)){var H=P[0];if(H===g){var $={idx:k,def:r.drop(P),ruleStack:r.dropRight(X),occurrenceStack:r.dropRight(Q)};M.push($)}else if(H instanceof c.Terminal)if(k<Y-1){var te=k+1,ae=d[te];if(y(ae,H.terminalType)){var $={idx:te,def:r.drop(P),ruleStack:X,occurrenceStack:Q};M.push($)}}else if(k===Y-1)G.push({nextTokenType:H.terminalType,nextTokenOccurrence:H.idx,ruleStack:X,occurrenceStack:Q}),C=!0;else throw Error("non exhaustive match");else if(H instanceof c.NonTerminal){var se=r.cloneArr(X);se.push(H.nonTerminalName);var ce=r.cloneArr(Q);ce.push(H.idx);var $={idx:k,def:H.definition.concat(b,r.drop(P)),ruleStack:se,occurrenceStack:ce};M.push($)}else if(H instanceof c.Option){var ne={idx:k,def:r.drop(P),ruleStack:X,occurrenceStack:Q};M.push(ne),M.push(w);var de={idx:k,def:H.definition.concat(r.drop(P)),ruleStack:X,occurrenceStack:Q};M.push(de)}else if(H instanceof c.RepetitionMandatory){var U=new c.Repetition({definition:H.definition,idx:H.idx}),j=H.definition.concat([U],r.drop(P)),$={idx:k,def:j,ruleStack:X,occurrenceStack:Q};M.push($)}else if(H instanceof c.RepetitionMandatoryWithSeparator){var W=new c.Terminal({terminalType:H.separator}),U=new c.Repetition({definition:[W].concat(H.definition),idx:H.idx}),j=H.definition.concat([U],r.drop(P)),$={idx:k,def:j,ruleStack:X,occurrenceStack:Q};M.push($)}else if(H instanceof c.RepetitionWithSeparator){var ne={idx:k,def:r.drop(P),ruleStack:X,occurrenceStack:Q};M.push(ne),M.push(w);var W=new c.Terminal({terminalType:H.separator}),q=new c.Repetition({definition:[W].concat(H.definition),idx:H.idx}),j=H.definition.concat([q],r.drop(P)),de={idx:k,def:j,ruleStack:X,occurrenceStack:Q};M.push(de)}else if(H instanceof c.Repetition){var ne={idx:k,def:r.drop(P),ruleStack:X,occurrenceStack:Q};M.push(ne),M.push(w);var q=new c.Repetition({definition:H.definition,idx:H.idx}),j=H.definition.concat([q],r.drop(P)),de={idx:k,def:j,ruleStack:X,occurrenceStack:Q};M.push(de)}else if(H instanceof c.Alternation)for(var Z=H.definition.length-1;Z>=0;Z--){var ie=H.definition[Z],ge={idx:k,def:ie.definition.concat(r.drop(P)),ruleStack:X,occurrenceStack:Q};M.push(ge),M.push(w)}else if(H instanceof c.Alternative)M.push({idx:k,def:H.definition.concat(r.drop(P)),ruleStack:X,occurrenceStack:Q});else if(H instanceof c.Rule)M.push(T(H,k,X,Q));else throw Error("non exhaustive match")}}return G}n.nextPossibleTokensAfter=E;function T(f,d,y,v){var g=r.cloneArr(y);g.push(f.name);var b=r.cloneArr(v);return b.push(1),{idx:d,def:f.definition,ruleStack:g,occurrenceStack:b}}}),yt=Ee(n=>{var e=n&&n.__extends||(function(){var I=function(G,M){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,P){S.__proto__=P}||function(S,P){for(var k in P)Object.prototype.hasOwnProperty.call(P,k)&&(S[k]=P[k])},I(G,M)};return function(G,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");I(G,M);function S(){this.constructor=G}G.prototype=M===null?Object.create(M):(S.prototype=M.prototype,new S)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.areTokenCategoriesNotUsed=n.isStrictPrefixOfPath=n.containsPath=n.getLookaheadPathsForOptionalProd=n.getLookaheadPathsForOr=n.lookAheadSequenceFromAlternatives=n.buildSingleAlternativeLookaheadFunction=n.buildAlternativesLookAheadFunc=n.buildLookaheadFuncForOptionalProd=n.buildLookaheadFuncForOr=n.getProdType=n.PROD_TYPE=void 0;var t=Ie(),r=mt(),i=bt(),c=at(),s=Ve(),u=ct(),a;(function(I){I[I.OPTION=0]="OPTION",I[I.REPETITION=1]="REPETITION",I[I.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",I[I.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",I[I.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",I[I.ALTERNATION=5]="ALTERNATION"})(a=n.PROD_TYPE||(n.PROD_TYPE={}));function o(I){if(I instanceof s.Option)return a.OPTION;if(I instanceof s.Repetition)return a.REPETITION;if(I instanceof s.RepetitionMandatory)return a.REPETITION_MANDATORY;if(I instanceof s.RepetitionMandatoryWithSeparator)return a.REPETITION_MANDATORY_WITH_SEPARATOR;if(I instanceof s.RepetitionWithSeparator)return a.REPETITION_WITH_SEPARATOR;if(I instanceof s.Alternation)return a.ALTERNATION;throw Error("non exhaustive match")}n.getProdType=o;function h(I,G,M,S,P,k){var X=g(I,G,M),Q=Y(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return k(X,S,Q,P)}n.buildLookaheadFuncForOr=h;function l(I,G,M,S,P,k){var X=b(I,G,P,M),Q=Y(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return k(X[0],Q,S)}n.buildLookaheadFuncForOptionalProd=l;function m(I,G,M,S){var P=I.length,k=t.every(I,function(H){return t.every(H,function($){return $.length===1})});if(G)return function(H){for(var $=t.map(H,function(q){return q.GATE}),te=0;te<P;te++){var ae=I[te],se=ae.length,ce=$[te];if(!(ce!==void 0&&ce.call(this)===!1))e:for(var ne=0;ne<se;ne++){for(var de=ae[ne],U=de.length,j=0;j<U;j++){var W=this.LA(j+1);if(M(W,de[j])===!1)continue e}return te}}};if(k&&!S){var X=t.map(I,function(H){return t.flatten(H)}),Q=t.reduce(X,function(H,$,te){return t.forEach($,function(ae){t.has(H,ae.tokenTypeIdx)||(H[ae.tokenTypeIdx]=te),t.forEach(ae.categoryMatches,function(se){t.has(H,se)||(H[se]=te)})}),H},[]);return function(){var H=this.LA(1);return Q[H.tokenTypeIdx]}}else return function(){for(var H=0;H<P;H++){var $=I[H],te=$.length;e:for(var ae=0;ae<te;ae++){for(var se=$[ae],ce=se.length,ne=0;ne<ce;ne++){var de=this.LA(ne+1);if(M(de,se[ne])===!1)continue e}return H}}}}n.buildAlternativesLookAheadFunc=m;function p(I,G,M){var S=t.every(I,function($){return $.length===1}),P=I.length;if(S&&!M){var k=t.flatten(I);if(k.length===1&&t.isEmpty(k[0].categoryMatches)){var X=k[0],Q=X.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===Q}}else{var H=t.reduce(k,function($,te,ae){return $[te.tokenTypeIdx]=!0,t.forEach(te.categoryMatches,function(se){$[se]=!0}),$},[]);return function(){var $=this.LA(1);return H[$.tokenTypeIdx]===!0}}}else return function(){e:for(var $=0;$<P;$++){for(var te=I[$],ae=te.length,se=0;se<ae;se++){var ce=this.LA(se+1);if(G(ce,te[se])===!1)continue e}return!0}return!1}}n.buildSingleAlternativeLookaheadFunction=p;var E=(function(I){e(G,I);function G(M,S,P){var k=I.call(this)||this;return k.topProd=M,k.targetOccurrence=S,k.targetProdType=P,k}return G.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},G.prototype.checkIsTarget=function(M,S,P,k){return M.idx===this.targetOccurrence&&this.targetProdType===S?(this.restDef=P.concat(k),!0):!1},G.prototype.walkOption=function(M,S,P){this.checkIsTarget(M,a.OPTION,S,P)||I.prototype.walkOption.call(this,M,S,P)},G.prototype.walkAtLeastOne=function(M,S,P){this.checkIsTarget(M,a.REPETITION_MANDATORY,S,P)||I.prototype.walkOption.call(this,M,S,P)},G.prototype.walkAtLeastOneSep=function(M,S,P){this.checkIsTarget(M,a.REPETITION_MANDATORY_WITH_SEPARATOR,S,P)||I.prototype.walkOption.call(this,M,S,P)},G.prototype.walkMany=function(M,S,P){this.checkIsTarget(M,a.REPETITION,S,P)||I.prototype.walkOption.call(this,M,S,P)},G.prototype.walkManySep=function(M,S,P){this.checkIsTarget(M,a.REPETITION_WITH_SEPARATOR,S,P)||I.prototype.walkOption.call(this,M,S,P)},G})(i.RestWalker),T=(function(I){e(G,I);function G(M,S,P){var k=I.call(this)||this;return k.targetOccurrence=M,k.targetProdType=S,k.targetRef=P,k.result=[],k}return G.prototype.checkIsTarget=function(M,S){M.idx===this.targetOccurrence&&this.targetProdType===S&&(this.targetRef===void 0||M===this.targetRef)&&(this.result=M.definition)},G.prototype.visitOption=function(M){this.checkIsTarget(M,a.OPTION)},G.prototype.visitRepetition=function(M){this.checkIsTarget(M,a.REPETITION)},G.prototype.visitRepetitionMandatory=function(M){this.checkIsTarget(M,a.REPETITION_MANDATORY)},G.prototype.visitRepetitionMandatoryWithSeparator=function(M){this.checkIsTarget(M,a.REPETITION_MANDATORY_WITH_SEPARATOR)},G.prototype.visitRepetitionWithSeparator=function(M){this.checkIsTarget(M,a.REPETITION_WITH_SEPARATOR)},G.prototype.visitAlternation=function(M){this.checkIsTarget(M,a.ALTERNATION)},G})(u.GAstVisitor);function f(I){for(var G=new Array(I),M=0;M<I;M++)G[M]=[];return G}function d(I){for(var G=[""],M=0;M<I.length;M++){for(var S=I[M],P=[],k=0;k<G.length;k++){var X=G[k];P.push(X+"_"+S.tokenTypeIdx);for(var Q=0;Q<S.categoryMatches.length;Q++){var H="_"+S.categoryMatches[Q];P.push(X+H)}}G=P}return G}function y(I,G,M){for(var S=0;S<I.length;S++)if(S!==M)for(var P=I[S],k=0;k<G.length;k++){var X=G[k];if(P[X]===!0)return!1}return!0}function v(I,G){for(var M=t.map(I,function(te){return r.possiblePathsFrom([te],1)}),S=f(M.length),P=t.map(M,function(te){var ae={};return t.forEach(te,function(se){var ce=d(se.partialPath);t.forEach(ce,function(ne){ae[ne]=!0})}),ae}),k=M,X=1;X<=G;X++){var Q=k;k=f(Q.length);for(var H=function(te){for(var ae=Q[te],se=0;se<ae.length;se++){var ce=ae[se].partialPath,ne=ae[se].suffixDef,de=d(ce),U=y(P,de,te);if(U||t.isEmpty(ne)||ce.length===G){var j=S[te];if(w(j,ce)===!1){j.push(ce);for(var W=0;W<de.length;W++){var q=de[W];P[te][q]=!0}}}else{var Z=r.possiblePathsFrom(ne,X+1,ce);k[te]=k[te].concat(Z),t.forEach(Z,function(ie){var ge=d(ie.partialPath);t.forEach(ge,function(me){P[te][me]=!0})})}}},$=0;$<Q.length;$++)H($)}return S}n.lookAheadSequenceFromAlternatives=v;function g(I,G,M,S){var P=new T(I,a.ALTERNATION,S);return G.accept(P),v(P.result,M)}n.getLookaheadPathsForOr=g;function b(I,G,M,S){var P=new T(I,M);G.accept(P);var k=P.result,X=new E(G,I,M),Q=X.startWalking(),H=new s.Alternative({definition:k}),$=new s.Alternative({definition:Q});return v([H,$],S)}n.getLookaheadPathsForOptionalProd=b;function w(I,G){e:for(var M=0;M<I.length;M++){var S=I[M];if(S.length===G.length){for(var P=0;P<S.length;P++){var k=G[P],X=S[P],Q=k===X||X.categoryMatchesMap[k.tokenTypeIdx]!==void 0;if(Q===!1)continue e}return!0}}return!1}n.containsPath=w;function C(I,G){return I.length<G.length&&t.every(I,function(M,S){var P=G[S];return M===P||P.categoryMatchesMap[M.tokenTypeIdx]})}n.isStrictPrefixOfPath=C;function Y(I){return t.every(I,function(G){return t.every(G,function(M){return t.every(M,function(S){return t.isEmpty(S.categoryMatches)})})})}n.areTokenCategoriesNotUsed=Y}),tn=Ee(n=>{var e=n&&n.__extends||(function(){var S=function(P,k){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Q){X.__proto__=Q}||function(X,Q){for(var H in Q)Object.prototype.hasOwnProperty.call(Q,H)&&(X[H]=Q[H])},S(P,k)};return function(P,k){if(typeof k!="function"&&k!==null)throw new TypeError("Class extends value "+String(k)+" is not a constructor or null");S(P,k);function X(){this.constructor=P}P.prototype=k===null?Object.create(k):(X.prototype=k.prototype,new X)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.checkPrefixAlternativesAmbiguities=n.validateSomeNonEmptyLookaheadPath=n.validateTooManyAlts=n.RepetionCollector=n.validateAmbiguousAlternationAlternatives=n.validateEmptyOrAlternative=n.getFirstNoneTerminal=n.validateNoLeftRecursion=n.validateRuleIsOverridden=n.validateRuleDoesNotAlreadyExist=n.OccurrenceValidationCollector=n.identifyProductionForDuplicates=n.validateGrammar=void 0;var t=Ie(),r=Ie(),i=We(),c=dt(),s=yt(),u=mt(),a=Ve(),o=ct();function h(S,P,k,X,Q){var H=t.map(S,function(U){return l(U,X)}),$=t.map(S,function(U){return d(U,U,X)}),te=[],ae=[],se=[];r.every($,r.isEmpty)&&(te=r.map(S,function(U){return g(U,X)}),ae=r.map(S,function(U){return b(U,P,X)}),se=Y(S,P,X));var ce=M(S,k,X),ne=r.map(S,function(U){return C(U,X)}),de=r.map(S,function(U){return T(U,S,Q,X)});return t.flatten(H.concat(se,$,te,ae,ce,ne,de))}n.validateGrammar=h;function l(S,P){var k=new E;S.accept(k);var X=k.allProductions,Q=t.groupBy(X,m),H=t.pick(Q,function(te){return te.length>1}),$=t.map(t.values(H),function(te){var ae=t.first(te),se=P.buildDuplicateFoundError(S,te),ce=c.getProductionDslName(ae),ne={message:se,type:i.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:S.name,dslName:ce,occurrence:ae.idx},de=p(ae);return de&&(ne.parameter=de),ne});return $}function m(S){return c.getProductionDslName(S)+"_#_"+S.idx+"_#_"+p(S)}n.identifyProductionForDuplicates=m;function p(S){return S instanceof a.Terminal?S.terminalType.name:S instanceof a.NonTerminal?S.nonTerminalName:""}var E=(function(S){e(P,S);function P(){var k=S!==null&&S.apply(this,arguments)||this;return k.allProductions=[],k}return P.prototype.visitNonTerminal=function(k){this.allProductions.push(k)},P.prototype.visitOption=function(k){this.allProductions.push(k)},P.prototype.visitRepetitionWithSeparator=function(k){this.allProductions.push(k)},P.prototype.visitRepetitionMandatory=function(k){this.allProductions.push(k)},P.prototype.visitRepetitionMandatoryWithSeparator=function(k){this.allProductions.push(k)},P.prototype.visitRepetition=function(k){this.allProductions.push(k)},P.prototype.visitAlternation=function(k){this.allProductions.push(k)},P.prototype.visitTerminal=function(k){this.allProductions.push(k)},P})(o.GAstVisitor);n.OccurrenceValidationCollector=E;function T(S,P,k,X){var Q=[],H=r.reduce(P,function(te,ae){return ae.name===S.name?te+1:te},0);if(H>1){var $=X.buildDuplicateRuleNameError({topLevelRule:S,grammarName:k});Q.push({message:$,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:S.name})}return Q}n.validateRuleDoesNotAlreadyExist=T;function f(S,P,k){var X=[],Q;return t.contains(P,S)||(Q="Invalid rule override, rule: ->"+S+"<- cannot be overridden in the grammar: ->"+k+"<-as it is not defined in any of the super grammars ",X.push({message:Q,type:i.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:S})),X}n.validateRuleIsOverridden=f;function d(S,P,k,X){X===void 0&&(X=[]);var Q=[],H=y(P.definition);if(t.isEmpty(H))return[];var $=S.name,te=t.contains(H,S);te&&Q.push({message:k.buildLeftRecursionError({topLevelRule:S,leftRecursionPath:X}),type:i.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:$});var ae=t.difference(H,X.concat([S])),se=t.map(ae,function(ce){var ne=t.cloneArr(X);return ne.push(ce),d(S,ce,k,ne)});return Q.concat(t.flatten(se))}n.validateNoLeftRecursion=d;function y(S){var P=[];if(t.isEmpty(S))return P;var k=t.first(S);if(k instanceof a.NonTerminal)P.push(k.referencedRule);else if(k instanceof a.Alternative||k instanceof a.Option||k instanceof a.RepetitionMandatory||k instanceof a.RepetitionMandatoryWithSeparator||k instanceof a.RepetitionWithSeparator||k instanceof a.Repetition)P=P.concat(y(k.definition));else if(k instanceof a.Alternation)P=t.flatten(t.map(k.definition,function($){return y($.definition)}));else if(!(k instanceof a.Terminal))throw Error("non exhaustive match");var X=c.isOptionalProd(k),Q=S.length>1;if(X&&Q){var H=t.drop(S);return P.concat(y(H))}else return P}n.getFirstNoneTerminal=y;var v=(function(S){e(P,S);function P(){var k=S!==null&&S.apply(this,arguments)||this;return k.alternations=[],k}return P.prototype.visitAlternation=function(k){this.alternations.push(k)},P})(o.GAstVisitor);function g(S,P){var k=new v;S.accept(k);var X=k.alternations,Q=t.reduce(X,function(H,$){var te=t.dropRight($.definition),ae=t.map(te,function(se,ce){var ne=u.nextPossibleTokensAfter([se],[],null,1);return t.isEmpty(ne)?{message:P.buildEmptyAlternationError({topLevelRule:S,alternation:$,emptyChoiceIdx:ce}),type:i.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:S.name,occurrence:$.idx,alternative:ce+1}:null});return H.concat(t.compact(ae))},[]);return Q}n.validateEmptyOrAlternative=g;function b(S,P,k){var X=new v;S.accept(X);var Q=X.alternations;Q=r.reject(Q,function($){return $.ignoreAmbiguities===!0});var H=t.reduce(Q,function($,te){var ae=te.idx,se=te.maxLookahead||P,ce=s.getLookaheadPathsForOr(ae,S,se,te),ne=I(ce,te,S,k),de=G(ce,te,S,k);return $.concat(ne,de)},[]);return H}n.validateAmbiguousAlternationAlternatives=b;var w=(function(S){e(P,S);function P(){var k=S!==null&&S.apply(this,arguments)||this;return k.allProductions=[],k}return P.prototype.visitRepetitionWithSeparator=function(k){this.allProductions.push(k)},P.prototype.visitRepetitionMandatory=function(k){this.allProductions.push(k)},P.prototype.visitRepetitionMandatoryWithSeparator=function(k){this.allProductions.push(k)},P.prototype.visitRepetition=function(k){this.allProductions.push(k)},P})(o.GAstVisitor);n.RepetionCollector=w;function C(S,P){var k=new v;S.accept(k);var X=k.alternations,Q=t.reduce(X,function(H,$){return $.definition.length>255&&H.push({message:P.buildTooManyAlternativesError({topLevelRule:S,alternation:$}),type:i.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:S.name,occurrence:$.idx}),H},[]);return Q}n.validateTooManyAlts=C;function Y(S,P,k){var X=[];return r.forEach(S,function(Q){var H=new w;Q.accept(H);var $=H.allProductions;r.forEach($,function(te){var ae=s.getProdType(te),se=te.maxLookahead||P,ce=te.idx,ne=s.getLookaheadPathsForOptionalProd(ce,Q,ae,se),de=ne[0];if(r.isEmpty(r.flatten(de))){var U=k.buildEmptyRepetitionError({topLevelRule:Q,repetition:te});X.push({message:U,type:i.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:Q.name})}})}),X}n.validateSomeNonEmptyLookaheadPath=Y;function I(S,P,k,X){var Q=[],H=r.reduce(S,function(te,ae,se){return P.definition[se].ignoreAmbiguities===!0||r.forEach(ae,function(ce){var ne=[se];r.forEach(S,function(de,U){se!==U&&s.containsPath(de,ce)&&P.definition[U].ignoreAmbiguities!==!0&&ne.push(U)}),ne.length>1&&!s.containsPath(Q,ce)&&(Q.push(ce),te.push({alts:ne,path:ce}))}),te},[]),$=t.map(H,function(te){var ae=r.map(te.alts,function(ce){return ce+1}),se=X.buildAlternationAmbiguityError({topLevelRule:k,alternation:P,ambiguityIndices:ae,prefixPath:te.path});return{message:se,type:i.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:k.name,occurrence:P.idx,alternatives:[te.alts]}});return $}function G(S,P,k,X){var Q=[],H=r.reduce(S,function($,te,ae){var se=r.map(te,function(ce){return{idx:ae,path:ce}});return $.concat(se)},[]);return r.forEach(H,function($){var te=P.definition[$.idx];if(te.ignoreAmbiguities!==!0){var ae=$.idx,se=$.path,ce=r.findAll(H,function(de){return P.definition[de.idx].ignoreAmbiguities!==!0&&de.idx<ae&&s.isStrictPrefixOfPath(de.path,se)}),ne=r.map(ce,function(de){var U=[de.idx+1,ae+1],j=P.idx===0?"":P.idx,W=X.buildAlternationPrefixAmbiguityError({topLevelRule:k,alternation:P,ambiguityIndices:U,prefixPath:de.path});return{message:W,type:i.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:k.name,occurrence:j,alternatives:U}});Q=Q.concat(ne)}}),Q}n.checkPrefixAlternativesAmbiguities=G;function M(S,P,k){var X=[],Q=r.map(P,function(H){return H.name});return r.forEach(S,function(H){var $=H.name;if(r.contains(Q,$)){var te=k.buildNamespaceConflictError(H);X.push({message:te,type:i.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:$})}}),X}}),Pr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateGrammar=n.resolveGrammar=void 0;var e=Ie(),t=Cr(),r=tn(),i=pt();function c(u){u=e.defaults(u,{errMsgProvider:i.defaultGrammarResolverErrorProvider});var a={};return e.forEach(u.rules,function(o){a[o.name]=o}),t.resolveGrammar(a,u.errMsgProvider)}n.resolveGrammar=c;function s(u){return u=e.defaults(u,{errMsgProvider:i.defaultGrammarValidatorErrorProvider}),r.validateGrammar(u.rules,u.maxLookahead,u.tokenTypes,u.errMsgProvider,u.grammarName)}n.validateGrammar=s}),ut=Ee(n=>{var e=n&&n.__extends||(function(){var E=function(T,f){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(d[v]=y[v])},E(T,f)};return function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");E(T,f);function d(){this.constructor=T}T.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EarlyExitException=n.NotAllInputParsedException=n.NoViableAltException=n.MismatchedTokenException=n.isRecognitionException=void 0;var t=Ie(),r="MismatchedTokenException",i="NoViableAltException",c="EarlyExitException",s="NotAllInputParsedException",u=[r,i,c,s];Object.freeze(u);function a(E){return t.contains(u,E.name)}n.isRecognitionException=a;var o=(function(E){e(T,E);function T(f,d){var y=this.constructor,v=E.call(this,f)||this;return v.token=d,v.resyncedTokens=[],Object.setPrototypeOf(v,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return T})(Error),h=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=r,v}return T})(o);n.MismatchedTokenException=h;var l=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=i,v}return T})(o);n.NoViableAltException=l;var m=(function(E){e(T,E);function T(f,d){var y=E.call(this,f,d)||this;return y.name=s,y}return T})(o);n.NotAllInputParsedException=m;var p=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=c,v}return T})(o);n.EarlyExitException=p}),nn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.attemptInRepetitionRecovery=n.Recoverable=n.InRuleRecoveryException=n.IN_RULE_RECOVERY_EXCEPTION=n.EOF_FOLLOW_KEY=void 0;var e=tt(),t=Ie(),r=ut(),i=en(),c=We();n.EOF_FOLLOW_KEY={},n.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function s(o){this.name=n.IN_RULE_RECOVERY_EXCEPTION,this.message=o}n.InRuleRecoveryException=s,s.prototype=Error.prototype;var u=(function(){function o(){}return o.prototype.initRecoverable=function(h){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(h,"recoveryEnabled")?h.recoveryEnabled:c.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=a)},o.prototype.getTokenToInsert=function(h){var l=e.createTokenInstance(h,"",NaN,NaN,NaN,NaN,NaN,NaN);return l.isInsertedInRecovery=!0,l},o.prototype.canTokenTypeBeInsertedInRecovery=function(h){return!0},o.prototype.tryInRepetitionRecovery=function(h,l,m,p){for(var E=this,T=this.findReSyncTokenType(),f=this.exportLexerState(),d=[],y=!1,v=this.LA(1),g=this.LA(1),b=function(){var w=E.LA(0),C=E.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:v,previous:w,ruleName:E.getCurrRuleFullName()}),Y=new r.MismatchedTokenException(C,v,E.LA(0));Y.resyncedTokens=t.dropRight(d),E.SAVE_ERROR(Y)};!y;)if(this.tokenMatcher(g,p)){b();return}else if(m.call(this)){b(),h.apply(this,l);return}else this.tokenMatcher(g,T)?y=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,d));this.importLexerState(f)},o.prototype.shouldInRepetitionRecoveryBeTried=function(h,l,m){return!(m===!1||h===void 0||l===void 0||this.tokenMatcher(this.LA(1),h)||this.isBackTracking()||this.canPerformInRuleRecovery(h,this.getFollowsForInRuleRecovery(h,l)))},o.prototype.getFollowsForInRuleRecovery=function(h,l){var m=this.getCurrentGrammarPath(h,l),p=this.getNextPossibleTokenTypes(m);return p},o.prototype.tryInRuleRecovery=function(h,l){if(this.canRecoverWithSingleTokenInsertion(h,l)){var m=this.getTokenToInsert(h);return m}if(this.canRecoverWithSingleTokenDeletion(h)){var p=this.SKIP_TOKEN();return this.consumeToken(),p}throw new s("sad sad panda")},o.prototype.canPerformInRuleRecovery=function(h,l){return this.canRecoverWithSingleTokenInsertion(h,l)||this.canRecoverWithSingleTokenDeletion(h)},o.prototype.canRecoverWithSingleTokenInsertion=function(h,l){var m=this;if(!this.canTokenTypeBeInsertedInRecovery(h)||t.isEmpty(l))return!1;var p=this.LA(1),E=t.find(l,function(T){return m.tokenMatcher(p,T)})!==void 0;return E},o.prototype.canRecoverWithSingleTokenDeletion=function(h){var l=this.tokenMatcher(this.LA(2),h);return l},o.prototype.isInCurrentRuleReSyncSet=function(h){var l=this.getCurrFollowKey(),m=this.getFollowSetFromFollowKey(l);return t.contains(m,h)},o.prototype.findReSyncTokenType=function(){for(var h=this.flattenFollowSet(),l=this.LA(1),m=2;;){var p=l.tokenType;if(t.contains(h,p))return p;l=this.LA(m),m++}},o.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return n.EOF_FOLLOW_KEY;var h=this.getLastExplicitRuleShortName(),l=this.getLastExplicitRuleOccurrenceIndex(),m=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(h),idxInCallingRule:l,inRule:this.shortRuleNameToFullName(m)}},o.prototype.buildFullFollowKeyStack=function(){var h=this,l=this.RULE_STACK,m=this.RULE_OCCURRENCE_STACK;return t.map(l,function(p,E){return E===0?n.EOF_FOLLOW_KEY:{ruleName:h.shortRuleNameToFullName(p),idxInCallingRule:m[E],inRule:h.shortRuleNameToFullName(l[E-1])}})},o.prototype.flattenFollowSet=function(){var h=this,l=t.map(this.buildFullFollowKeyStack(),function(m){return h.getFollowSetFromFollowKey(m)});return t.flatten(l)},o.prototype.getFollowSetFromFollowKey=function(h){if(h===n.EOF_FOLLOW_KEY)return[e.EOF];var l=h.ruleName+h.idxInCallingRule+i.IN+h.inRule;return this.resyncFollows[l]},o.prototype.addToResyncTokens=function(h,l){return this.tokenMatcher(h,e.EOF)||l.push(h),l},o.prototype.reSyncTo=function(h){for(var l=[],m=this.LA(1);this.tokenMatcher(m,h)===!1;)m=this.SKIP_TOKEN(),this.addToResyncTokens(m,l);return t.dropRight(l)},o.prototype.attemptInRepetitionRecovery=function(h,l,m,p,E,T,f){},o.prototype.getCurrentGrammarPath=function(h,l){var m=this.getHumanReadableRuleStack(),p=t.cloneArr(this.RULE_OCCURRENCE_STACK),E={ruleStack:m,occurrenceStack:p,lastTok:h,lastTokOccurrence:l};return E},o.prototype.getHumanReadableRuleStack=function(){var h=this;return t.map(this.RULE_STACK,function(l){return h.shortRuleNameToFullName(l)})},o})();n.Recoverable=u;function a(o,h,l,m,p,E,T){var f=this.getKeyForAutomaticLookahead(m,p),d=this.firstAfterRepMap[f];if(d===void 0){var y=this.getCurrRuleFullName(),v=this.getGAstProductions()[y],g=new E(v,p);d=g.startWalking(),this.firstAfterRepMap[f]=d}var b=d.token,w=d.occurrence,C=d.isEndOfRule;this.RULE_STACK.length===1&&C&&b===void 0&&(b=e.EOF,w=1),this.shouldInRepetitionRecoveryBeTried(b,w,T)&&this.tryInRepetitionRecovery(o,h,l,b)}n.attemptInRepetitionRecovery=a}),Nt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getKeyForAutomaticLookahead=n.AT_LEAST_ONE_SEP_IDX=n.MANY_SEP_IDX=n.AT_LEAST_ONE_IDX=n.MANY_IDX=n.OPTION_IDX=n.OR_IDX=n.BITS_FOR_ALT_IDX=n.BITS_FOR_RULE_IDX=n.BITS_FOR_OCCURRENCE_IDX=n.BITS_FOR_METHOD_TYPE=void 0,n.BITS_FOR_METHOD_TYPE=4,n.BITS_FOR_OCCURRENCE_IDX=8,n.BITS_FOR_RULE_IDX=12,n.BITS_FOR_ALT_IDX=8,n.OR_IDX=1<<n.BITS_FOR_OCCURRENCE_IDX,n.OPTION_IDX=2<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_IDX=3<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_IDX=4<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_SEP_IDX=5<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_SEP_IDX=6<<n.BITS_FOR_OCCURRENCE_IDX;function e(t,r,i){return i|r|t}n.getKeyForAutomaticLookahead=e,32-n.BITS_FOR_ALT_IDX}),wr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LooksAhead=void 0;var e=yt(),t=Ie(),r=We(),i=Nt(),c=dt(),s=(function(){function u(){}return u.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=t.has(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:r.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(a,"maxLookahead")?a.maxLookahead:r.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=t.isES2015MapSupported()?new Map:[],t.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},u.prototype.preComputeLookaheadFunctions=function(a){var o=this;t.forEach(a,function(h){o.TRACE_INIT(h.name+" Rule Lookahead",function(){var l=c.collectMethods(h),m=l.alternation,p=l.repetition,E=l.option,T=l.repetitionMandatory,f=l.repetitionMandatoryWithSeparator,d=l.repetitionWithSeparator;t.forEach(m,function(y){var v=y.idx===0?"":y.idx;o.TRACE_INIT(""+c.getProductionDslName(y)+v,function(){var g=e.buildLookaheadFuncForOr(y.idx,h,y.maxLookahead||o.maxLookahead,y.hasPredicates,o.dynamicTokensEnabled,o.lookAheadBuilderForAlternatives),b=i.getKeyForAutomaticLookahead(o.fullRuleNameToShort[h.name],i.OR_IDX,y.idx);o.setLaFuncCache(b,g)})}),t.forEach(p,function(y){o.computeLookaheadFunc(h,y.idx,i.MANY_IDX,e.PROD_TYPE.REPETITION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(E,function(y){o.computeLookaheadFunc(h,y.idx,i.OPTION_IDX,e.PROD_TYPE.OPTION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(T,function(y){o.computeLookaheadFunc(h,y.idx,i.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(f,function(y){o.computeLookaheadFunc(h,y.idx,i.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(d,function(y){o.computeLookaheadFunc(h,y.idx,i.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))})})})},u.prototype.computeLookaheadFunc=function(a,o,h,l,m,p){var E=this;this.TRACE_INIT(""+p+(o===0?"":o),function(){var T=e.buildLookaheadFuncForOptionalProd(o,a,m||E.maxLookahead,E.dynamicTokensEnabled,l,E.lookAheadBuilderForOptional),f=i.getKeyForAutomaticLookahead(E.fullRuleNameToShort[a.name],h,o);E.setLaFuncCache(f,T)})},u.prototype.lookAheadBuilderForOptional=function(a,o,h){return e.buildSingleAlternativeLookaheadFunction(a,o,h)},u.prototype.lookAheadBuilderForAlternatives=function(a,o,h,l){return e.buildAlternativesLookAheadFunc(a,o,h,l)},u.prototype.getKeyForAutomaticLookahead=function(a,o){var h=this.getLastExplicitRuleShortName();return i.getKeyForAutomaticLookahead(h,a,o)},u.prototype.getLaFuncFromCache=function(a){},u.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},u.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},u.prototype.setLaFuncCache=function(a,o){},u.prototype.setLaFuncCacheUsingMap=function(a,o){this.lookAheadFuncsCache.set(a,o)},u.prototype.setLaFuncUsingObj=function(a,o){this.lookAheadFuncsCache[a]=o},u})();n.LooksAhead=s}),Mr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addNoneTerminalToCst=n.addTerminalToCst=n.setNodeLocationFull=n.setNodeLocationOnlyOffset=void 0;function e(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.endOffset=s.endOffset):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset)}n.setNodeLocationOnlyOffset=e;function t(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.startColumn=s.startColumn,c.startLine=s.startLine,c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine)}n.setNodeLocationFull=t;function r(c,s,u){c.children[u]===void 0?c.children[u]=[s]:c.children[u].push(s)}n.addTerminalToCst=r;function i(c,s,u){c.children[s]===void 0?c.children[s]=[u]:c.children[s].push(u)}n.addNoneTerminalToCst=i}),rn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defineNameProp=n.functionName=n.classNameFromInstance=void 0;var e=Ie();function t(s){return i(s.constructor)}n.classNameFromInstance=t;var r="name";function i(s){var u=s.name;return u||"anonymous"}n.functionName=i;function c(s,u){var a=Object.getOwnPropertyDescriptor(s,r);return e.isUndefined(a)||a.configurable?(Object.defineProperty(s,r,{enumerable:!1,configurable:!0,writable:!1,value:u}),!0):!1}n.defineNameProp=c}),Fr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateRedundantMethods=n.validateMissingCstMethods=n.validateVisitor=n.CstVisitorDefinitionError=n.createBaseVisitorConstructorWithDefaults=n.createBaseSemanticVisitorConstructor=n.defaultVisit=void 0;var e=Ie(),t=rn();function r(l,m){for(var p=e.keys(l),E=p.length,T=0;T<E;T++)for(var f=p[T],d=l[f],y=d.length,v=0;v<y;v++){var g=d[v];g.tokenTypeIdx===void 0&&this[g.name](g.children,m)}}n.defaultVisit=r;function i(l,m){var p=function(){};t.defineNameProp(p,l+"BaseSemantics");var E={visit:function(T,f){if(e.isArray(T)&&(T=T[0]),!e.isUndefined(T))return this[T.name](T.children,f)},validateVisitor:function(){var T=u(this,m);if(!e.isEmpty(T)){var f=e.map(T,function(d){return d.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
|
|
84
100
|
`+(""+f.join(`
|
|
85
101
|
|
|
86
102
|
`).replace(/\n/g,`
|
|
87
|
-
`)))}}};return
|
|
103
|
+
`)))}}};return p.prototype=E,p.prototype.constructor=p,p._RULE_NAMES=m,p}n.createBaseSemanticVisitorConstructor=i;function c(l,m,p){var E=function(){};t.defineNameProp(E,l+"BaseSemanticsWithDefaults");var T=Object.create(p.prototype);return e.forEach(m,function(f){T[f]=r}),E.prototype=T,E.prototype.constructor=E,E}n.createBaseVisitorConstructorWithDefaults=c;var s;(function(l){l[l.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",l[l.MISSING_METHOD=1]="MISSING_METHOD"})(s=n.CstVisitorDefinitionError||(n.CstVisitorDefinitionError={}));function u(l,m){var p=a(l,m),E=h(l,m);return p.concat(E)}n.validateVisitor=u;function a(l,m){var p=e.map(m,function(E){if(!e.isFunction(l[E]))return{msg:"Missing visitor method: <"+E+"> on "+t.functionName(l.constructor)+" CST Visitor.",type:s.MISSING_METHOD,methodName:E}});return e.compact(p)}n.validateMissingCstMethods=a;var o=["constructor","visit","validateVisitor"];function h(l,m){var p=[];for(var E in l)e.isFunction(l[E])&&!e.contains(o,E)&&!e.contains(m,E)&&p.push({msg:"Redundant visitor method: <"+E+"> on "+t.functionName(l.constructor)+` CST Visitor
|
|
88
104
|
There is no Grammar Rule corresponding to this method's name.
|
|
89
|
-
`,type:s.REDUNDANT_METHOD,methodName:E});return m}n.validateRedundantMethods=h}),Kn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TreeBuilder=void 0;var e=Hn(),t=be(),i=Wn(),r=Ye(),c=(function(){function s(){}return s.prototype.initTreeBuilder=function(u){if(this.CST_STACK=[],this.outputCst=u.outputCst,this.nodeLocationTracking=t.has(u,"nodeLocationTracking")?u.nodeLocationTracking:r.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=t.NOOP,this.cstFinallyStateUpdate=t.NOOP,this.cstPostTerminal=t.NOOP,this.cstPostNonTerminal=t.NOOP,this.cstPostRule=t.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationFull,this.setNodeLocationFromNode=e.setNodeLocationFull,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=e.setNodeLocationOnlyOffset,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=t.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+u.nodeLocationTracking+'"')},s.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(u){u.location={startOffset:NaN,endOffset:NaN}},s.prototype.setInitialNodeLocationOnlyOffsetRegular=function(u){u.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},s.prototype.setInitialNodeLocationFullRecovery=function(u){u.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.setInitialNodeLocationFullRegular=function(u){var a=this.LA(1);u.location={startOffset:a.startOffset,startLine:a.startLine,startColumn:a.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.cstInvocationStateUpdate=function(u,a){var o={name:u,children:{}};this.setInitialNodeLocation(o),this.CST_STACK.push(o)},s.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},s.prototype.cstPostRuleFull=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?(o.endOffset=a.endOffset,o.endLine=a.endLine,o.endColumn=a.endColumn):(o.startOffset=NaN,o.startLine=NaN,o.startColumn=NaN)},s.prototype.cstPostRuleOnlyOffset=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?o.endOffset=a.endOffset:o.startOffset=NaN},s.prototype.cstPostTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(o,a,u),this.setNodeLocationFromToken(o.location,a)},s.prototype.cstPostNonTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(o,a,u),this.setNodeLocationFromNode(o.location,u.location)},s.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var u=i.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=u,u}return this.baseCstVisitorConstructor},s.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var u=i.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=u,u}return this.baseCstVisitorWithDefaultsConstructor},s.prototype.getLastExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-1]},s.prototype.getPreviousExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-2]},s.prototype.getLastExplicitRuleOccurrenceIndex=function(){var u=this.RULE_OCCURRENCE_STACK;return u[u.length-1]},s})();n.TreeBuilder=c}),Yn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LexerAdapter=void 0;var e=Ye(),t=(function(){function i(){}return i.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(i.prototype,"input",{get:function(){return this.tokVector},set:function(r){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=r,this.tokVectorLength=r.length},enumerable:!1,configurable:!0}),i.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):e.END_OF_FILE},i.prototype.LA=function(r){var c=this.currIdx+r;return c<0||this.tokVectorLength<=c?e.END_OF_FILE:this.tokVector[c]},i.prototype.consumeToken=function(){this.currIdx++},i.prototype.exportLexerState=function(){return this.currIdx},i.prototype.importLexerState=function(r){this.currIdx=r},i.prototype.resetLexerState=function(){this.currIdx=-1},i.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},i.prototype.getLexerPosition=function(){return this.exportLexerState()},i})();n.LexerAdapter=t}),Xn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerApi=void 0;var e=be(),t=Tt(),i=Ye(),r=_t(),c=on(),s=ze(),u=(function(){function a(){}return a.prototype.ACTION=function(o){return o.call(this)},a.prototype.consume=function(o,h,l){return this.consumeInternal(h,o,l)},a.prototype.subrule=function(o,h,l){return this.subruleInternal(h,o,l)},a.prototype.option=function(o,h){return this.optionInternal(h,o)},a.prototype.or=function(o,h){return this.orInternal(h,o)},a.prototype.many=function(o,h){return this.manyInternal(o,h)},a.prototype.atLeastOne=function(o,h){return this.atLeastOneInternal(o,h)},a.prototype.CONSUME=function(o,h){return this.consumeInternal(o,0,h)},a.prototype.CONSUME1=function(o,h){return this.consumeInternal(o,1,h)},a.prototype.CONSUME2=function(o,h){return this.consumeInternal(o,2,h)},a.prototype.CONSUME3=function(o,h){return this.consumeInternal(o,3,h)},a.prototype.CONSUME4=function(o,h){return this.consumeInternal(o,4,h)},a.prototype.CONSUME5=function(o,h){return this.consumeInternal(o,5,h)},a.prototype.CONSUME6=function(o,h){return this.consumeInternal(o,6,h)},a.prototype.CONSUME7=function(o,h){return this.consumeInternal(o,7,h)},a.prototype.CONSUME8=function(o,h){return this.consumeInternal(o,8,h)},a.prototype.CONSUME9=function(o,h){return this.consumeInternal(o,9,h)},a.prototype.SUBRULE=function(o,h){return this.subruleInternal(o,0,h)},a.prototype.SUBRULE1=function(o,h){return this.subruleInternal(o,1,h)},a.prototype.SUBRULE2=function(o,h){return this.subruleInternal(o,2,h)},a.prototype.SUBRULE3=function(o,h){return this.subruleInternal(o,3,h)},a.prototype.SUBRULE4=function(o,h){return this.subruleInternal(o,4,h)},a.prototype.SUBRULE5=function(o,h){return this.subruleInternal(o,5,h)},a.prototype.SUBRULE6=function(o,h){return this.subruleInternal(o,6,h)},a.prototype.SUBRULE7=function(o,h){return this.subruleInternal(o,7,h)},a.prototype.SUBRULE8=function(o,h){return this.subruleInternal(o,8,h)},a.prototype.SUBRULE9=function(o,h){return this.subruleInternal(o,9,h)},a.prototype.OPTION=function(o){return this.optionInternal(o,0)},a.prototype.OPTION1=function(o){return this.optionInternal(o,1)},a.prototype.OPTION2=function(o){return this.optionInternal(o,2)},a.prototype.OPTION3=function(o){return this.optionInternal(o,3)},a.prototype.OPTION4=function(o){return this.optionInternal(o,4)},a.prototype.OPTION5=function(o){return this.optionInternal(o,5)},a.prototype.OPTION6=function(o){return this.optionInternal(o,6)},a.prototype.OPTION7=function(o){return this.optionInternal(o,7)},a.prototype.OPTION8=function(o){return this.optionInternal(o,8)},a.prototype.OPTION9=function(o){return this.optionInternal(o,9)},a.prototype.OR=function(o){return this.orInternal(o,0)},a.prototype.OR1=function(o){return this.orInternal(o,1)},a.prototype.OR2=function(o){return this.orInternal(o,2)},a.prototype.OR3=function(o){return this.orInternal(o,3)},a.prototype.OR4=function(o){return this.orInternal(o,4)},a.prototype.OR5=function(o){return this.orInternal(o,5)},a.prototype.OR6=function(o){return this.orInternal(o,6)},a.prototype.OR7=function(o){return this.orInternal(o,7)},a.prototype.OR8=function(o){return this.orInternal(o,8)},a.prototype.OR9=function(o){return this.orInternal(o,9)},a.prototype.MANY=function(o){this.manyInternal(0,o)},a.prototype.MANY1=function(o){this.manyInternal(1,o)},a.prototype.MANY2=function(o){this.manyInternal(2,o)},a.prototype.MANY3=function(o){this.manyInternal(3,o)},a.prototype.MANY4=function(o){this.manyInternal(4,o)},a.prototype.MANY5=function(o){this.manyInternal(5,o)},a.prototype.MANY6=function(o){this.manyInternal(6,o)},a.prototype.MANY7=function(o){this.manyInternal(7,o)},a.prototype.MANY8=function(o){this.manyInternal(8,o)},a.prototype.MANY9=function(o){this.manyInternal(9,o)},a.prototype.MANY_SEP=function(o){this.manySepFirstInternal(0,o)},a.prototype.MANY_SEP1=function(o){this.manySepFirstInternal(1,o)},a.prototype.MANY_SEP2=function(o){this.manySepFirstInternal(2,o)},a.prototype.MANY_SEP3=function(o){this.manySepFirstInternal(3,o)},a.prototype.MANY_SEP4=function(o){this.manySepFirstInternal(4,o)},a.prototype.MANY_SEP5=function(o){this.manySepFirstInternal(5,o)},a.prototype.MANY_SEP6=function(o){this.manySepFirstInternal(6,o)},a.prototype.MANY_SEP7=function(o){this.manySepFirstInternal(7,o)},a.prototype.MANY_SEP8=function(o){this.manySepFirstInternal(8,o)},a.prototype.MANY_SEP9=function(o){this.manySepFirstInternal(9,o)},a.prototype.AT_LEAST_ONE=function(o){this.atLeastOneInternal(0,o)},a.prototype.AT_LEAST_ONE1=function(o){return this.atLeastOneInternal(1,o)},a.prototype.AT_LEAST_ONE2=function(o){this.atLeastOneInternal(2,o)},a.prototype.AT_LEAST_ONE3=function(o){this.atLeastOneInternal(3,o)},a.prototype.AT_LEAST_ONE4=function(o){this.atLeastOneInternal(4,o)},a.prototype.AT_LEAST_ONE5=function(o){this.atLeastOneInternal(5,o)},a.prototype.AT_LEAST_ONE6=function(o){this.atLeastOneInternal(6,o)},a.prototype.AT_LEAST_ONE7=function(o){this.atLeastOneInternal(7,o)},a.prototype.AT_LEAST_ONE8=function(o){this.atLeastOneInternal(8,o)},a.prototype.AT_LEAST_ONE9=function(o){this.atLeastOneInternal(9,o)},a.prototype.AT_LEAST_ONE_SEP=function(o){this.atLeastOneSepFirstInternal(0,o)},a.prototype.AT_LEAST_ONE_SEP1=function(o){this.atLeastOneSepFirstInternal(1,o)},a.prototype.AT_LEAST_ONE_SEP2=function(o){this.atLeastOneSepFirstInternal(2,o)},a.prototype.AT_LEAST_ONE_SEP3=function(o){this.atLeastOneSepFirstInternal(3,o)},a.prototype.AT_LEAST_ONE_SEP4=function(o){this.atLeastOneSepFirstInternal(4,o)},a.prototype.AT_LEAST_ONE_SEP5=function(o){this.atLeastOneSepFirstInternal(5,o)},a.prototype.AT_LEAST_ONE_SEP6=function(o){this.atLeastOneSepFirstInternal(6,o)},a.prototype.AT_LEAST_ONE_SEP7=function(o){this.atLeastOneSepFirstInternal(7,o)},a.prototype.AT_LEAST_ONE_SEP8=function(o){this.atLeastOneSepFirstInternal(8,o)},a.prototype.AT_LEAST_ONE_SEP9=function(o){this.atLeastOneSepFirstInternal(9,o)},a.prototype.RULE=function(o,h,l){if(l===void 0&&(l=i.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,o)){var p=r.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:o,grammarName:this.className}),m={message:p,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:o};this.definitionErrors.push(m)}this.definedRulesNames.push(o);var E=this.defineRule(o,h,l);return this[o]=E,E},a.prototype.OVERRIDE_RULE=function(o,h,l){l===void 0&&(l=i.DEFAULT_RULE_CONFIG);var p=[];p=p.concat(c.validateRuleIsOverridden(o,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(p);var m=this.defineRule(o,h,l);return this[o]=m,m},a.prototype.BACKTRACK=function(o,h){return function(){this.isBackTrackingStack.push(1);var l=this.saveRecogState();try{return o.apply(this,h),!0}catch(p){if(t.isRecognitionException(p))return!1;throw p}finally{this.reloadRecogState(l),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return s.serializeGrammar(e.values(this.gastProductionsCache))},a})();n.RecognizerApi=u}),qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerEngine=void 0;var e=be(),t=Vt(),i=Tt(),r=Ot(),c=Lt(),s=Ye(),u=sn(),a=ct(),o=yt(),h=an(),l=(function(){function p(){}return p.prototype.initRecognizerEngine=function(m,E){if(this.className=h.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=o.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(E,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
105
|
+
`,type:s.REDUNDANT_METHOD,methodName:E});return p}n.validateRedundantMethods=h}),Dr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TreeBuilder=void 0;var e=Mr(),t=Ie(),r=Fr(),i=We(),c=(function(){function s(){}return s.prototype.initTreeBuilder=function(u){if(this.CST_STACK=[],this.outputCst=u.outputCst,this.nodeLocationTracking=t.has(u,"nodeLocationTracking")?u.nodeLocationTracking:i.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=t.NOOP,this.cstFinallyStateUpdate=t.NOOP,this.cstPostTerminal=t.NOOP,this.cstPostNonTerminal=t.NOOP,this.cstPostRule=t.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationFull,this.setNodeLocationFromNode=e.setNodeLocationFull,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=e.setNodeLocationOnlyOffset,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=t.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+u.nodeLocationTracking+'"')},s.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(u){u.location={startOffset:NaN,endOffset:NaN}},s.prototype.setInitialNodeLocationOnlyOffsetRegular=function(u){u.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},s.prototype.setInitialNodeLocationFullRecovery=function(u){u.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.setInitialNodeLocationFullRegular=function(u){var a=this.LA(1);u.location={startOffset:a.startOffset,startLine:a.startLine,startColumn:a.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.cstInvocationStateUpdate=function(u,a){var o={name:u,children:{}};this.setInitialNodeLocation(o),this.CST_STACK.push(o)},s.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},s.prototype.cstPostRuleFull=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?(o.endOffset=a.endOffset,o.endLine=a.endLine,o.endColumn=a.endColumn):(o.startOffset=NaN,o.startLine=NaN,o.startColumn=NaN)},s.prototype.cstPostRuleOnlyOffset=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?o.endOffset=a.endOffset:o.startOffset=NaN},s.prototype.cstPostTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(o,a,u),this.setNodeLocationFromToken(o.location,a)},s.prototype.cstPostNonTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(o,a,u),this.setNodeLocationFromNode(o.location,u.location)},s.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var u=r.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=u,u}return this.baseCstVisitorConstructor},s.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var u=r.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=u,u}return this.baseCstVisitorWithDefaultsConstructor},s.prototype.getLastExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-1]},s.prototype.getPreviousExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-2]},s.prototype.getLastExplicitRuleOccurrenceIndex=function(){var u=this.RULE_OCCURRENCE_STACK;return u[u.length-1]},s})();n.TreeBuilder=c}),Ur=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LexerAdapter=void 0;var e=We(),t=(function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(i){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=i,this.tokVectorLength=i.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):e.END_OF_FILE},r.prototype.LA=function(i){var c=this.currIdx+i;return c<0||this.tokVectorLength<=c?e.END_OF_FILE:this.tokVector[c]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(i){this.currIdx=i},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r})();n.LexerAdapter=t}),Br=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerApi=void 0;var e=Ie(),t=ut(),r=We(),i=pt(),c=tn(),s=Ve(),u=(function(){function a(){}return a.prototype.ACTION=function(o){return o.call(this)},a.prototype.consume=function(o,h,l){return this.consumeInternal(h,o,l)},a.prototype.subrule=function(o,h,l){return this.subruleInternal(h,o,l)},a.prototype.option=function(o,h){return this.optionInternal(h,o)},a.prototype.or=function(o,h){return this.orInternal(h,o)},a.prototype.many=function(o,h){return this.manyInternal(o,h)},a.prototype.atLeastOne=function(o,h){return this.atLeastOneInternal(o,h)},a.prototype.CONSUME=function(o,h){return this.consumeInternal(o,0,h)},a.prototype.CONSUME1=function(o,h){return this.consumeInternal(o,1,h)},a.prototype.CONSUME2=function(o,h){return this.consumeInternal(o,2,h)},a.prototype.CONSUME3=function(o,h){return this.consumeInternal(o,3,h)},a.prototype.CONSUME4=function(o,h){return this.consumeInternal(o,4,h)},a.prototype.CONSUME5=function(o,h){return this.consumeInternal(o,5,h)},a.prototype.CONSUME6=function(o,h){return this.consumeInternal(o,6,h)},a.prototype.CONSUME7=function(o,h){return this.consumeInternal(o,7,h)},a.prototype.CONSUME8=function(o,h){return this.consumeInternal(o,8,h)},a.prototype.CONSUME9=function(o,h){return this.consumeInternal(o,9,h)},a.prototype.SUBRULE=function(o,h){return this.subruleInternal(o,0,h)},a.prototype.SUBRULE1=function(o,h){return this.subruleInternal(o,1,h)},a.prototype.SUBRULE2=function(o,h){return this.subruleInternal(o,2,h)},a.prototype.SUBRULE3=function(o,h){return this.subruleInternal(o,3,h)},a.prototype.SUBRULE4=function(o,h){return this.subruleInternal(o,4,h)},a.prototype.SUBRULE5=function(o,h){return this.subruleInternal(o,5,h)},a.prototype.SUBRULE6=function(o,h){return this.subruleInternal(o,6,h)},a.prototype.SUBRULE7=function(o,h){return this.subruleInternal(o,7,h)},a.prototype.SUBRULE8=function(o,h){return this.subruleInternal(o,8,h)},a.prototype.SUBRULE9=function(o,h){return this.subruleInternal(o,9,h)},a.prototype.OPTION=function(o){return this.optionInternal(o,0)},a.prototype.OPTION1=function(o){return this.optionInternal(o,1)},a.prototype.OPTION2=function(o){return this.optionInternal(o,2)},a.prototype.OPTION3=function(o){return this.optionInternal(o,3)},a.prototype.OPTION4=function(o){return this.optionInternal(o,4)},a.prototype.OPTION5=function(o){return this.optionInternal(o,5)},a.prototype.OPTION6=function(o){return this.optionInternal(o,6)},a.prototype.OPTION7=function(o){return this.optionInternal(o,7)},a.prototype.OPTION8=function(o){return this.optionInternal(o,8)},a.prototype.OPTION9=function(o){return this.optionInternal(o,9)},a.prototype.OR=function(o){return this.orInternal(o,0)},a.prototype.OR1=function(o){return this.orInternal(o,1)},a.prototype.OR2=function(o){return this.orInternal(o,2)},a.prototype.OR3=function(o){return this.orInternal(o,3)},a.prototype.OR4=function(o){return this.orInternal(o,4)},a.prototype.OR5=function(o){return this.orInternal(o,5)},a.prototype.OR6=function(o){return this.orInternal(o,6)},a.prototype.OR7=function(o){return this.orInternal(o,7)},a.prototype.OR8=function(o){return this.orInternal(o,8)},a.prototype.OR9=function(o){return this.orInternal(o,9)},a.prototype.MANY=function(o){this.manyInternal(0,o)},a.prototype.MANY1=function(o){this.manyInternal(1,o)},a.prototype.MANY2=function(o){this.manyInternal(2,o)},a.prototype.MANY3=function(o){this.manyInternal(3,o)},a.prototype.MANY4=function(o){this.manyInternal(4,o)},a.prototype.MANY5=function(o){this.manyInternal(5,o)},a.prototype.MANY6=function(o){this.manyInternal(6,o)},a.prototype.MANY7=function(o){this.manyInternal(7,o)},a.prototype.MANY8=function(o){this.manyInternal(8,o)},a.prototype.MANY9=function(o){this.manyInternal(9,o)},a.prototype.MANY_SEP=function(o){this.manySepFirstInternal(0,o)},a.prototype.MANY_SEP1=function(o){this.manySepFirstInternal(1,o)},a.prototype.MANY_SEP2=function(o){this.manySepFirstInternal(2,o)},a.prototype.MANY_SEP3=function(o){this.manySepFirstInternal(3,o)},a.prototype.MANY_SEP4=function(o){this.manySepFirstInternal(4,o)},a.prototype.MANY_SEP5=function(o){this.manySepFirstInternal(5,o)},a.prototype.MANY_SEP6=function(o){this.manySepFirstInternal(6,o)},a.prototype.MANY_SEP7=function(o){this.manySepFirstInternal(7,o)},a.prototype.MANY_SEP8=function(o){this.manySepFirstInternal(8,o)},a.prototype.MANY_SEP9=function(o){this.manySepFirstInternal(9,o)},a.prototype.AT_LEAST_ONE=function(o){this.atLeastOneInternal(0,o)},a.prototype.AT_LEAST_ONE1=function(o){return this.atLeastOneInternal(1,o)},a.prototype.AT_LEAST_ONE2=function(o){this.atLeastOneInternal(2,o)},a.prototype.AT_LEAST_ONE3=function(o){this.atLeastOneInternal(3,o)},a.prototype.AT_LEAST_ONE4=function(o){this.atLeastOneInternal(4,o)},a.prototype.AT_LEAST_ONE5=function(o){this.atLeastOneInternal(5,o)},a.prototype.AT_LEAST_ONE6=function(o){this.atLeastOneInternal(6,o)},a.prototype.AT_LEAST_ONE7=function(o){this.atLeastOneInternal(7,o)},a.prototype.AT_LEAST_ONE8=function(o){this.atLeastOneInternal(8,o)},a.prototype.AT_LEAST_ONE9=function(o){this.atLeastOneInternal(9,o)},a.prototype.AT_LEAST_ONE_SEP=function(o){this.atLeastOneSepFirstInternal(0,o)},a.prototype.AT_LEAST_ONE_SEP1=function(o){this.atLeastOneSepFirstInternal(1,o)},a.prototype.AT_LEAST_ONE_SEP2=function(o){this.atLeastOneSepFirstInternal(2,o)},a.prototype.AT_LEAST_ONE_SEP3=function(o){this.atLeastOneSepFirstInternal(3,o)},a.prototype.AT_LEAST_ONE_SEP4=function(o){this.atLeastOneSepFirstInternal(4,o)},a.prototype.AT_LEAST_ONE_SEP5=function(o){this.atLeastOneSepFirstInternal(5,o)},a.prototype.AT_LEAST_ONE_SEP6=function(o){this.atLeastOneSepFirstInternal(6,o)},a.prototype.AT_LEAST_ONE_SEP7=function(o){this.atLeastOneSepFirstInternal(7,o)},a.prototype.AT_LEAST_ONE_SEP8=function(o){this.atLeastOneSepFirstInternal(8,o)},a.prototype.AT_LEAST_ONE_SEP9=function(o){this.atLeastOneSepFirstInternal(9,o)},a.prototype.RULE=function(o,h,l){if(l===void 0&&(l=r.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,o)){var m=i.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:o,grammarName:this.className}),p={message:m,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:o};this.definitionErrors.push(p)}this.definedRulesNames.push(o);var E=this.defineRule(o,h,l);return this[o]=E,E},a.prototype.OVERRIDE_RULE=function(o,h,l){l===void 0&&(l=r.DEFAULT_RULE_CONFIG);var m=[];m=m.concat(c.validateRuleIsOverridden(o,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(m);var p=this.defineRule(o,h,l);return this[o]=p,p},a.prototype.BACKTRACK=function(o,h){return function(){this.isBackTrackingStack.push(1);var l=this.saveRecogState();try{return o.apply(this,h),!0}catch(m){if(t.isRecognitionException(m))return!1;throw m}finally{this.reloadRecogState(l),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return s.serializeGrammar(e.values(this.gastProductionsCache))},a})();n.RecognizerApi=u}),Gr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerEngine=void 0;var e=Ie(),t=Nt(),r=ut(),i=yt(),c=mt(),s=We(),u=nn(),a=tt(),o=at(),h=rn(),l=(function(){function m(){}return m.prototype.initRecognizerEngine=function(p,E){if(this.className=h.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=o.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(E,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
90
106
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
91
|
-
For Further details.`);if(e.isArray(
|
|
107
|
+
For Further details.`);if(e.isArray(p)){if(e.isEmpty(p))throw Error(`A Token Vocabulary cannot be empty.
|
|
92
108
|
Note that the first argument for the parser constructor
|
|
93
|
-
is no longer a Token vector (since v4.0).`);if(typeof
|
|
109
|
+
is no longer a Token vector (since v4.0).`);if(typeof p[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
94
110
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
95
|
-
For Further details.`)}if(e.isArray(
|
|
96
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var f=e.has(T,"resyncEnabled")?T.resyncEnabled:s.DEFAULT_RULE_CONFIG.resyncEnabled,d=e.has(T,"recoveryValueFunc")?T.recoveryValueFunc:s.DEFAULT_RULE_CONFIG.recoveryValueFunc,y=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[y]=m,this.fullRuleNameToShort[m]=y;function v(w){try{if(this.outputCst===!0){E.apply(this,w);var P=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(P),P}else return E.apply(this,w)}catch(K){return this.invokeRuleCatch(K,f,d)}finally{this.ruleFinallyStateUpdate()}}var g=function(w,P){return w===void 0&&(w=0),this.ruleInvocationStateUpdate(y,m,w),v.call(this,P)},b="ruleName";return g[b]=m,g.originalGrammarAction=E,g},p.prototype.invokeRuleCatch=function(m,E,T){var f=this.RULE_STACK.length===1,d=E&&!this.isBackTracking()&&this.recoveryEnabled;if(i.isRecognitionException(m)){var y=m;if(d){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(y.resyncedTokens=this.reSyncTo(v),this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}else return T();else{if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,y.partialCstResult=g}throw y}}else{if(f)return this.moveToTerminatedState(),T();throw y}}else throw m},p.prototype.optionInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OPTION_IDX,E);return this.optionInternalLogic(m,E,T)},p.prototype.optionInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(m.DEF!==void 0){if(y=m.DEF,v=m.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=m;if(d.call(this)===!0)return y.call(this)},p.prototype.atLeastOneInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,m);return this.atLeastOneInternalLogic(m,E,T)},p.prototype.atLeastOneInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;if(d.call(this)===!0)for(var b=this.doSingleRepetition(y);d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY,E.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[m,E],d,t.AT_LEAST_ONE_IDX,m,c.NextTerminalAfterAtLeastOneWalker)},p.prototype.atLeastOneSepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,m);this.atLeastOneSepFirstInternalLogic(m,E,T)},p.prototype.atLeastOneSepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterAtLeastOneSepWalker],g,t.AT_LEAST_ONE_SEP_IDX,m,c.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,E.ERR_MSG)},p.prototype.manyInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_IDX,m);return this.manyInternalLogic(m,E,T)},p.prototype.manyInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;for(var b=!0;d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);this.attemptInRepetitionRecovery(this.manyInternal,[m,E],d,t.MANY_IDX,m,c.NextTerminalAfterManyWalker,b)},p.prototype.manySepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,m);this.manySepFirstInternalLogic(m,E,T)},p.prototype.manySepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterManySepWalker],g,t.MANY_SEP_IDX,m,c.NextTerminalAfterManySepWalker)}},p.prototype.repetitionSepSecondInternal=function(m,E,T,f,d){for(;T();)this.CONSUME(E),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,E,T,f,d],T,t.AT_LEAST_ONE_SEP_IDX,m,d)},p.prototype.doSingleRepetition=function(m){var E=this.getLexerPosition();m.call(this);var T=this.getLexerPosition();return T>E},p.prototype.orInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OR_IDX,E),f=e.isArray(m)?m:m.DEF,d=this.getLaFuncFromCache(T),y=d.call(this,f);if(y!==void 0){var v=f[y];return v.ALT.call(this)}this.raiseNoAltException(E,m.ERR_MSG)},p.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var m=this.LA(1),E=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:m,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new i.NotAllInputParsedException(E,m))}},p.prototype.subruleInternal=function(m,E,T){var f;try{var d=T!==void 0?T.ARGS:void 0;return f=m.call(this,E,d),this.cstPostNonTerminal(f,T!==void 0&&T.LABEL!==void 0?T.LABEL:m.ruleName),f}catch(y){this.subruleInternalError(y,T,m.ruleName)}},p.prototype.subruleInternalError=function(m,E,T){throw i.isRecognitionException(m)&&m.partialCstResult!==void 0&&(this.cstPostNonTerminal(m.partialCstResult,E!==void 0&&E.LABEL!==void 0?E.LABEL:T),delete m.partialCstResult),m},p.prototype.consumeInternal=function(m,E,T){var f;try{var d=this.LA(1);this.tokenMatcher(d,m)===!0?(this.consumeToken(),f=d):this.consumeInternalError(m,d,T)}catch(y){f=this.consumeInternalRecovery(m,E,y)}return this.cstPostTerminal(T!==void 0&&T.LABEL!==void 0?T.LABEL:m.name,f),f},p.prototype.consumeInternalError=function(m,E,T){var f,d=this.LA(0);throw T!==void 0&&T.ERR_MSG?f=T.ERR_MSG:f=this.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:E,previous:d,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new i.MismatchedTokenException(f,E,d))},p.prototype.consumeInternalRecovery=function(m,E,T){if(this.recoveryEnabled&&T.name==="MismatchedTokenException"&&!this.isBackTracking()){var f=this.getFollowsForInRuleRecovery(m,E);try{return this.tryInRuleRecovery(m,f)}catch(d){throw d.name===u.IN_RULE_RECOVERY_EXCEPTION?T:d}}else throw T},p.prototype.saveRecogState=function(){var m=this.errors,E=e.cloneArr(this.RULE_STACK);return{errors:m,lexerState:this.exportLexerState(),RULE_STACK:E,CST_STACK:this.CST_STACK}},p.prototype.reloadRecogState=function(m){this.errors=m.errors,this.importLexerState(m.lexerState),this.RULE_STACK=m.RULE_STACK},p.prototype.ruleInvocationStateUpdate=function(m,E,T){this.RULE_OCCURRENCE_STACK.push(T),this.RULE_STACK.push(m),this.cstInvocationStateUpdate(E,m)},p.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},p.prototype.getCurrRuleFullName=function(){var m=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[m]},p.prototype.shortRuleNameToFullName=function(m){return this.shortRuleNameToFull[m]},p.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),a.EOF)},p.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},p})();n.RecognizerEngine=l}),Qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorHandler=void 0;var e=Tt(),t=be(),i=Ot(),r=Ye(),c=(function(){function s(){}return s.prototype.initErrorHandler=function(u){this._errors=[],this.errorMessageProvider=t.has(u,"errorMessageProvider")?u.errorMessageProvider:r.DEFAULT_PARSER_CONFIG.errorMessageProvider},s.prototype.SAVE_ERROR=function(u){if(e.isRecognitionException(u))return u.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(u),u;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(s.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(u){this._errors=u},enumerable:!1,configurable:!0}),s.prototype.raiseEarlyExitException=function(u,a,o){for(var h=this.getCurrRuleFullName(),l=this.getGAstProductions()[h],p=i.getLookaheadPathsForOptionalProd(u,l,a,this.maxLookahead),m=p[0],E=[],T=1;T<=this.maxLookahead;T++)E.push(this.LA(T));var f=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:m,actual:E,previous:this.LA(0),customUserDescription:o,ruleName:h});throw this.SAVE_ERROR(new e.EarlyExitException(f,this.LA(1),this.LA(0)))},s.prototype.raiseNoAltException=function(u,a){for(var o=this.getCurrRuleFullName(),h=this.getGAstProductions()[o],l=i.getLookaheadPathsForOr(u,h,this.maxLookahead),p=[],m=1;m<=this.maxLookahead;m++)p.push(this.LA(m));var E=this.LA(0),T=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:l,actual:p,previous:E,customUserDescription:a,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(T,this.LA(1),E))},s})();n.ErrorHandler=c}),Zn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ContentAssist=void 0;var e=Lt(),t=be(),i=(function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(c,s){var u=this.gastProductionsCache[c];if(t.isUndefined(u))throw Error("Rule ->"+c+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([u],s,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(c){var s=t.first(c.ruleStack),u=this.getGAstProductions(),a=u[s],o=new e.NextAfterTokenWalker(a,c).startWalking();return o},r})();n.ContentAssist=i}),Jn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GastRecorder=void 0;var e=be(),t=ze(),i=Rt(),r=yt(),c=ct(),s=Ye(),u=Vt(),a={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(a);var o=!0,h=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,l=c.createToken({name:"RECORDING_PHASE_TOKEN",pattern:i.Lexer.NA});r.augmentTokenTypes([l]);var p=c.createTokenInstance(l,`This IToken indicates the Parser is in Recording Phase
|
|
97
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(
|
|
98
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},E=(function(){function v(){}return v.prototype.initGastRecorder=function(g){this.recordingProdStack=[],this.RECORDING_PHASE=!1},v.prototype.enableRecording=function(){var g=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var b=function(
|
|
111
|
+
For Further details.`)}if(e.isArray(p))this.tokensMap=e.reduce(p,function(y,v){return y[v.name]=v,y},{});else if(e.has(p,"modes")&&e.every(e.flatten(e.values(p.modes)),o.isTokenType)){var T=e.flatten(e.values(p.modes)),f=e.uniq(T);this.tokensMap=e.reduce(f,function(y,v){return y[v.name]=v,y},{})}else if(e.isObject(p))this.tokensMap=e.cloneObj(p);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=a.EOF;var d=e.every(e.values(p),function(y){return e.isEmpty(y.categoryMatches)});this.tokenMatcher=d?o.tokenStructuredMatcherNoCategories:o.tokenStructuredMatcher,o.augmentTokenTypes(e.values(this.tokensMap))},m.prototype.defineRule=function(p,E,T){if(this.selfAnalysisDone)throw Error("Grammar rule <"+p+`> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
112
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var f=e.has(T,"resyncEnabled")?T.resyncEnabled:s.DEFAULT_RULE_CONFIG.resyncEnabled,d=e.has(T,"recoveryValueFunc")?T.recoveryValueFunc:s.DEFAULT_RULE_CONFIG.recoveryValueFunc,y=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[y]=p,this.fullRuleNameToShort[p]=y;function v(w){try{if(this.outputCst===!0){E.apply(this,w);var C=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(C),C}else return E.apply(this,w)}catch(Y){return this.invokeRuleCatch(Y,f,d)}finally{this.ruleFinallyStateUpdate()}}var g=function(w,C){return w===void 0&&(w=0),this.ruleInvocationStateUpdate(y,p,w),v.call(this,C)},b="ruleName";return g[b]=p,g.originalGrammarAction=E,g},m.prototype.invokeRuleCatch=function(p,E,T){var f=this.RULE_STACK.length===1,d=E&&!this.isBackTracking()&&this.recoveryEnabled;if(r.isRecognitionException(p)){var y=p;if(d){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(y.resyncedTokens=this.reSyncTo(v),this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}else return T();else{if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,y.partialCstResult=g}throw y}}else{if(f)return this.moveToTerminatedState(),T();throw y}}else throw p},m.prototype.optionInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.OPTION_IDX,E);return this.optionInternalLogic(p,E,T)},m.prototype.optionInternalLogic=function(p,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(p.DEF!==void 0){if(y=p.DEF,v=p.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=p;if(d.call(this)===!0)return y.call(this)},m.prototype.atLeastOneInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,p);return this.atLeastOneInternalLogic(p,E,T)},m.prototype.atLeastOneInternalLogic=function(p,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;if(d.call(this)===!0)for(var b=this.doSingleRepetition(y);d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);else throw this.raiseEarlyExitException(p,i.PROD_TYPE.REPETITION_MANDATORY,E.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[p,E],d,t.AT_LEAST_ONE_IDX,p,c.NextTerminalAfterAtLeastOneWalker)},m.prototype.atLeastOneSepFirstInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,p);this.atLeastOneSepFirstInternalLogic(p,E,T)},m.prototype.atLeastOneSepFirstInternalLogic=function(p,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,y,g,d,c.NextTerminalAfterAtLeastOneSepWalker],g,t.AT_LEAST_ONE_SEP_IDX,p,c.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(p,i.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,E.ERR_MSG)},m.prototype.manyInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.MANY_IDX,p);return this.manyInternalLogic(p,E,T)},m.prototype.manyInternalLogic=function(p,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;for(var b=!0;d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);this.attemptInRepetitionRecovery(this.manyInternal,[p,E],d,t.MANY_IDX,p,c.NextTerminalAfterManyWalker,b)},m.prototype.manySepFirstInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,p);this.manySepFirstInternalLogic(p,E,T)},m.prototype.manySepFirstInternalLogic=function(p,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,y,g,d,c.NextTerminalAfterManySepWalker],g,t.MANY_SEP_IDX,p,c.NextTerminalAfterManySepWalker)}},m.prototype.repetitionSepSecondInternal=function(p,E,T,f,d){for(;T();)this.CONSUME(E),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,E,T,f,d],T,t.AT_LEAST_ONE_SEP_IDX,p,d)},m.prototype.doSingleRepetition=function(p){var E=this.getLexerPosition();p.call(this);var T=this.getLexerPosition();return T>E},m.prototype.orInternal=function(p,E){var T=this.getKeyForAutomaticLookahead(t.OR_IDX,E),f=e.isArray(p)?p:p.DEF,d=this.getLaFuncFromCache(T),y=d.call(this,f);if(y!==void 0){var v=f[y];return v.ALT.call(this)}this.raiseNoAltException(E,p.ERR_MSG)},m.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var p=this.LA(1),E=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:p,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new r.NotAllInputParsedException(E,p))}},m.prototype.subruleInternal=function(p,E,T){var f;try{var d=T!==void 0?T.ARGS:void 0;return f=p.call(this,E,d),this.cstPostNonTerminal(f,T!==void 0&&T.LABEL!==void 0?T.LABEL:p.ruleName),f}catch(y){this.subruleInternalError(y,T,p.ruleName)}},m.prototype.subruleInternalError=function(p,E,T){throw r.isRecognitionException(p)&&p.partialCstResult!==void 0&&(this.cstPostNonTerminal(p.partialCstResult,E!==void 0&&E.LABEL!==void 0?E.LABEL:T),delete p.partialCstResult),p},m.prototype.consumeInternal=function(p,E,T){var f;try{var d=this.LA(1);this.tokenMatcher(d,p)===!0?(this.consumeToken(),f=d):this.consumeInternalError(p,d,T)}catch(y){f=this.consumeInternalRecovery(p,E,y)}return this.cstPostTerminal(T!==void 0&&T.LABEL!==void 0?T.LABEL:p.name,f),f},m.prototype.consumeInternalError=function(p,E,T){var f,d=this.LA(0);throw T!==void 0&&T.ERR_MSG?f=T.ERR_MSG:f=this.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:E,previous:d,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new r.MismatchedTokenException(f,E,d))},m.prototype.consumeInternalRecovery=function(p,E,T){if(this.recoveryEnabled&&T.name==="MismatchedTokenException"&&!this.isBackTracking()){var f=this.getFollowsForInRuleRecovery(p,E);try{return this.tryInRuleRecovery(p,f)}catch(d){throw d.name===u.IN_RULE_RECOVERY_EXCEPTION?T:d}}else throw T},m.prototype.saveRecogState=function(){var p=this.errors,E=e.cloneArr(this.RULE_STACK);return{errors:p,lexerState:this.exportLexerState(),RULE_STACK:E,CST_STACK:this.CST_STACK}},m.prototype.reloadRecogState=function(p){this.errors=p.errors,this.importLexerState(p.lexerState),this.RULE_STACK=p.RULE_STACK},m.prototype.ruleInvocationStateUpdate=function(p,E,T){this.RULE_OCCURRENCE_STACK.push(T),this.RULE_STACK.push(p),this.cstInvocationStateUpdate(E,p)},m.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},m.prototype.getCurrRuleFullName=function(){var p=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[p]},m.prototype.shortRuleNameToFullName=function(p){return this.shortRuleNameToFull[p]},m.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),a.EOF)},m.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},m})();n.RecognizerEngine=l}),jr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorHandler=void 0;var e=ut(),t=Ie(),r=yt(),i=We(),c=(function(){function s(){}return s.prototype.initErrorHandler=function(u){this._errors=[],this.errorMessageProvider=t.has(u,"errorMessageProvider")?u.errorMessageProvider:i.DEFAULT_PARSER_CONFIG.errorMessageProvider},s.prototype.SAVE_ERROR=function(u){if(e.isRecognitionException(u))return u.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(u),u;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(s.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(u){this._errors=u},enumerable:!1,configurable:!0}),s.prototype.raiseEarlyExitException=function(u,a,o){for(var h=this.getCurrRuleFullName(),l=this.getGAstProductions()[h],m=r.getLookaheadPathsForOptionalProd(u,l,a,this.maxLookahead),p=m[0],E=[],T=1;T<=this.maxLookahead;T++)E.push(this.LA(T));var f=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:p,actual:E,previous:this.LA(0),customUserDescription:o,ruleName:h});throw this.SAVE_ERROR(new e.EarlyExitException(f,this.LA(1),this.LA(0)))},s.prototype.raiseNoAltException=function(u,a){for(var o=this.getCurrRuleFullName(),h=this.getGAstProductions()[o],l=r.getLookaheadPathsForOr(u,h,this.maxLookahead),m=[],p=1;p<=this.maxLookahead;p++)m.push(this.LA(p));var E=this.LA(0),T=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:l,actual:m,previous:E,customUserDescription:a,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(T,this.LA(1),E))},s})();n.ErrorHandler=c}),Vr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ContentAssist=void 0;var e=mt(),t=Ie(),r=(function(){function i(){}return i.prototype.initContentAssist=function(){},i.prototype.computeContentAssist=function(c,s){var u=this.gastProductionsCache[c];if(t.isUndefined(u))throw Error("Rule ->"+c+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([u],s,this.tokenMatcher,this.maxLookahead)},i.prototype.getNextPossibleTokenTypes=function(c){var s=t.first(c.ruleStack),u=this.getGAstProductions(),a=u[s],o=new e.NextAfterTokenWalker(a,c).startWalking();return o},i})();n.ContentAssist=r}),zr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GastRecorder=void 0;var e=Ie(),t=Ve(),r=ht(),i=at(),c=tt(),s=We(),u=Nt(),a={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(a);var o=!0,h=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,l=c.createToken({name:"RECORDING_PHASE_TOKEN",pattern:r.Lexer.NA});i.augmentTokenTypes([l]);var m=c.createTokenInstance(l,`This IToken indicates the Parser is in Recording Phase
|
|
113
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(m);var p={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
114
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},E=(function(){function v(){}return v.prototype.initGastRecorder=function(g){this.recordingProdStack=[],this.RECORDING_PHASE=!1},v.prototype.enableRecording=function(){var g=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var b=function(C){var Y=C>0?C:"";g["CONSUME"+Y]=function(I,G){return this.consumeInternalRecord(I,C,G)},g["SUBRULE"+Y]=function(I,G){return this.subruleInternalRecord(I,C,G)},g["OPTION"+Y]=function(I){return this.optionInternalRecord(I,C)},g["OR"+Y]=function(I){return this.orInternalRecord(I,C)},g["MANY"+Y]=function(I){this.manyInternalRecord(C,I)},g["MANY_SEP"+Y]=function(I){this.manySepFirstInternalRecord(C,I)},g["AT_LEAST_ONE"+Y]=function(I){this.atLeastOneInternalRecord(C,I)},g["AT_LEAST_ONE_SEP"+Y]=function(I){this.atLeastOneSepFirstInternalRecord(C,I)}},w=0;w<10;w++)b(w);g.consume=function(C,Y,I){return this.consumeInternalRecord(Y,C,I)},g.subrule=function(C,Y,I){return this.subruleInternalRecord(Y,C,I)},g.option=function(C,Y){return this.optionInternalRecord(Y,C)},g.or=function(C,Y){return this.orInternalRecord(Y,C)},g.many=function(C,Y){this.manyInternalRecord(C,Y)},g.atLeastOne=function(C,Y){this.atLeastOneInternalRecord(C,Y)},g.ACTION=g.ACTION_RECORD,g.BACKTRACK=g.BACKTRACK_RECORD,g.LA=g.LA_RECORD})},v.prototype.disableRecording=function(){var g=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var b=0;b<10;b++){var w=b>0?b:"";delete g["CONSUME"+w],delete g["SUBRULE"+w],delete g["OPTION"+w],delete g["OR"+w],delete g["MANY"+w],delete g["MANY_SEP"+w],delete g["AT_LEAST_ONE"+w],delete g["AT_LEAST_ONE_SEP"+w]}delete g.consume,delete g.subrule,delete g.option,delete g.or,delete g.many,delete g.atLeastOne,delete g.ACTION,delete g.BACKTRACK,delete g.LA})},v.prototype.ACTION_RECORD=function(g){},v.prototype.BACKTRACK_RECORD=function(g,b){return function(){return!0}},v.prototype.LA_RECORD=function(g){return s.END_OF_FILE},v.prototype.topLevelRuleRecord=function(g,b){try{var w=new t.Rule({definition:[],name:g});return w.name=g,this.recordingProdStack.push(w),b.call(this),this.recordingProdStack.pop(),w}catch(C){if(C.KNOWN_RECORDER_ERROR!==!0)try{C.message=C.message+`
|
|
99
115
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
100
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw
|
|
101
|
-
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw
|
|
102
|
-
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw
|
|
103
|
-
`+("Idx value must be a none negative value smaller than "+(h+1)));throw g.KNOWN_RECORDER_ERROR=!0,g}}})
|
|
116
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw C}throw C}},v.prototype.optionInternalRecord=function(g,b){return T.call(this,t.Option,g,b)},v.prototype.atLeastOneInternalRecord=function(g,b){T.call(this,t.RepetitionMandatory,b,g)},v.prototype.atLeastOneSepFirstInternalRecord=function(g,b){T.call(this,t.RepetitionMandatoryWithSeparator,b,g,o)},v.prototype.manyInternalRecord=function(g,b){T.call(this,t.Repetition,b,g)},v.prototype.manySepFirstInternalRecord=function(g,b){T.call(this,t.RepetitionWithSeparator,b,g,o)},v.prototype.orInternalRecord=function(g,b){return f.call(this,g,b)},v.prototype.subruleInternalRecord=function(g,b,w){if(y(b),!g||e.has(g,"ruleName")===!1){var C=new Error("<SUBRULE"+d(b)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(g)+">")+(`
|
|
117
|
+
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw C.KNOWN_RECORDER_ERROR=!0,C}var Y=e.peek(this.recordingProdStack),I=g.ruleName,G=new t.NonTerminal({idx:b,nonTerminalName:I,referencedRule:void 0});return Y.definition.push(G),this.outputCst?p:a},v.prototype.consumeInternalRecord=function(g,b,w){if(y(b),!i.hasShortKeyProperty(g)){var C=new Error("<CONSUME"+d(b)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(g)+">")+(`
|
|
118
|
+
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw C.KNOWN_RECORDER_ERROR=!0,C}var Y=e.peek(this.recordingProdStack),I=new t.Terminal({idx:b,terminalType:g});return Y.definition.push(I),m},v})();n.GastRecorder=E;function T(v,g,b,w){w===void 0&&(w=!1),y(b);var C=e.peek(this.recordingProdStack),Y=e.isFunction(g)?g:g.DEF,I=new v({definition:[],idx:b});return w&&(I.separator=g.SEP),e.has(g,"MAX_LOOKAHEAD")&&(I.maxLookahead=g.MAX_LOOKAHEAD),this.recordingProdStack.push(I),Y.call(this),C.definition.push(I),this.recordingProdStack.pop(),a}function f(v,g){var b=this;y(g);var w=e.peek(this.recordingProdStack),C=e.isArray(v)===!1,Y=C===!1?v:v.DEF,I=new t.Alternation({definition:[],idx:g,ignoreAmbiguities:C&&v.IGNORE_AMBIGUITIES===!0});e.has(v,"MAX_LOOKAHEAD")&&(I.maxLookahead=v.MAX_LOOKAHEAD);var G=e.some(Y,function(M){return e.isFunction(M.GATE)});return I.hasPredicates=G,w.definition.push(I),e.forEach(Y,function(M){var S=new t.Alternative({definition:[]});I.definition.push(S),e.has(M,"IGNORE_AMBIGUITIES")?S.ignoreAmbiguities=M.IGNORE_AMBIGUITIES:e.has(M,"GATE")&&(S.ignoreAmbiguities=!0),b.recordingProdStack.push(S),M.ALT.call(b),b.recordingProdStack.pop()}),a}function d(v){return v===0?"":""+v}function y(v){if(v<0||v>h){var g=new Error("Invalid DSL Method idx value: <"+v+`>
|
|
119
|
+
`+("Idx value must be a none negative value smaller than "+(h+1)));throw g.KNOWN_RECORDER_ERROR=!0,g}}}),Hr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PerformanceTracer=void 0;var e=Ie(),t=We(),r=(function(){function i(){}return i.prototype.initPerformanceTracer=function(c){if(e.has(c,"traceInitPerf")){var s=c.traceInitPerf,u=typeof s=="number";this.traceInitMaxIdent=u?s:1/0,this.traceInitPerf=u?s>0:s}else this.traceInitMaxIdent=0,this.traceInitPerf=t.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},i.prototype.TRACE_INIT=function(c,s){if(this.traceInitPerf===!0){this.traceInitIndent++;var u=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(u+"--> <"+c+">");var a=e.timer(s),o=a.time,h=a.value,l=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(u+"<-- <"+c+"> time: "+o+"ms"),this.traceInitIndent--,h}else return s()},i})();n.PerformanceTracer=r}),Wr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.applyMixins=void 0;function e(t,r){r.forEach(function(i){var c=i.prototype;Object.getOwnPropertyNames(c).forEach(function(s){if(s!=="constructor"){var u=Object.getOwnPropertyDescriptor(c,s);u&&(u.get||u.set)?Object.defineProperty(t.prototype,s,u):t.prototype[s]=i.prototype[s]}})})}n.applyMixins=e}),We=Ee(n=>{var e=n&&n.__extends||(function(){var w=function(C,Y){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,G){I.__proto__=G}||function(I,G){for(var M in G)Object.prototype.hasOwnProperty.call(G,M)&&(I[M]=G[M])},w(C,Y)};return function(C,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Class extends value "+String(Y)+" is not a constructor or null");w(C,Y);function I(){this.constructor=C}C.prototype=Y===null?Object.create(Y):(I.prototype=Y.prototype,new I)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EmbeddedActionsParser=n.CstParser=n.Parser=n.EMPTY_ALT=n.ParserDefinitionErrorType=n.DEFAULT_RULE_CONFIG=n.DEFAULT_PARSER_CONFIG=n.END_OF_FILE=void 0;var t=Ie(),r=kr(),i=tt(),c=pt(),s=Pr(),u=nn(),a=wr(),o=Dr(),h=Ur(),l=Br(),m=Gr(),p=jr(),E=Vr(),T=zr(),f=Hr(),d=Wr();n.END_OF_FILE=i.createTokenInstance(i.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(n.END_OF_FILE),n.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:c.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),n.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(function(w){w[w.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",w[w.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",w[w.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",w[w.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",w[w.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",w[w.LEFT_RECURSION=5]="LEFT_RECURSION",w[w.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",w[w.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",w[w.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",w[w.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",w[w.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",w[w.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",w[w.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(n.ParserDefinitionErrorType||(n.ParserDefinitionErrorType={}));function y(w){return w===void 0&&(w=void 0),function(){return w}}n.EMPTY_ALT=y;var v=(function(){function w(C,Y){this.definitionErrors=[],this.selfAnalysisDone=!1;var I=this;if(I.initErrorHandler(Y),I.initLexerAdapter(),I.initLooksAhead(Y),I.initRecognizerEngine(C,Y),I.initRecoverable(Y),I.initTreeBuilder(Y),I.initContentAssist(),I.initGastRecorder(Y),I.initPerformanceTracer(Y),t.has(Y,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
104
120
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
105
121
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
106
|
-
For further details.`);this.skipValidations=t.has(
|
|
107
|
-
`+
|
|
122
|
+
For further details.`);this.skipValidations=t.has(Y,"skipValidations")?Y.skipValidations:n.DEFAULT_PARSER_CONFIG.skipValidations}return w.performSelfAnalysis=function(C){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},w.prototype.performSelfAnalysis=function(){var C=this;this.TRACE_INIT("performSelfAnalysis",function(){var Y;C.selfAnalysisDone=!0;var I=C.className;C.TRACE_INIT("toFastProps",function(){t.toFastProperties(C)}),C.TRACE_INIT("Grammar Recording",function(){try{C.enableRecording(),t.forEach(C.definedRulesNames,function(M){var S=C[M],P=S.originalGrammarAction,k=void 0;C.TRACE_INIT(M+" Rule",function(){k=C.topLevelRuleRecord(M,P)}),C.gastProductionsCache[M]=k})}finally{C.disableRecording()}});var G=[];if(C.TRACE_INIT("Grammar Resolving",function(){G=s.resolveGrammar({rules:t.values(C.gastProductionsCache)}),C.definitionErrors=C.definitionErrors.concat(G)}),C.TRACE_INIT("Grammar Validations",function(){if(t.isEmpty(G)&&C.skipValidations===!1){var M=s.validateGrammar({rules:t.values(C.gastProductionsCache),maxLookahead:C.maxLookahead,tokenTypes:t.values(C.tokensMap),errMsgProvider:c.defaultGrammarValidatorErrorProvider,grammarName:I});C.definitionErrors=C.definitionErrors.concat(M)}}),t.isEmpty(C.definitionErrors)&&(C.recoveryEnabled&&C.TRACE_INIT("computeAllProdsFollows",function(){var M=r.computeAllProdsFollows(t.values(C.gastProductionsCache));C.resyncFollows=M}),C.TRACE_INIT("ComputeLookaheadFunctions",function(){C.preComputeLookaheadFunctions(t.values(C.gastProductionsCache))})),!w.DEFER_DEFINITION_ERRORS_HANDLING&&!t.isEmpty(C.definitionErrors))throw Y=t.map(C.definitionErrors,function(M){return M.message}),new Error(`Parser Definition Errors detected:
|
|
123
|
+
`+Y.join(`
|
|
108
124
|
-------------------------------
|
|
109
|
-
`))})},w.DEFER_DEFINITION_ERRORS_HANDLING=!1,w})();n.Parser=v,d.applyMixins(v,[u.Recoverable,a.LooksAhead,o.TreeBuilder,h.LexerAdapter,
|
|
125
|
+
`))})},w.DEFER_DEFINITION_ERRORS_HANDLING=!1,w})();n.Parser=v,d.applyMixins(v,[u.Recoverable,a.LooksAhead,o.TreeBuilder,h.LexerAdapter,m.RecognizerEngine,l.RecognizerApi,p.ErrorHandler,E.ContentAssist,T.GastRecorder,f.PerformanceTracer]);var g=(function(w){e(C,w);function C(Y,I){I===void 0&&(I=n.DEFAULT_PARSER_CONFIG);var G=this,M=t.cloneObj(I);return M.outputCst=!0,G=w.call(this,Y,M)||this,G}return C})(v);n.CstParser=g;var b=(function(w){e(C,w);function C(Y,I){I===void 0&&(I=n.DEFAULT_PARSER_CONFIG);var G=this,M=t.cloneObj(I);return M.outputCst=!1,G=w.call(this,Y,M)||this,G}return C})(v);n.EmbeddedActionsParser=b}),Kr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSyntaxDiagramsCode=void 0;var e=Qt();function t(r,i){var c=i===void 0?{}:i,s=c.resourceBase,u=s===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/":s,a=c.css,o=a===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/diagrams.css":a,h=`
|
|
110
126
|
<!-- This is a generated file -->
|
|
111
127
|
<!DOCTYPE html>
|
|
112
128
|
<meta charset="utf-8">
|
|
@@ -118,39 +134,23 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
|
|
|
118
134
|
|
|
119
135
|
`,l=`
|
|
120
136
|
<link rel='stylesheet' href='`+o+`'>
|
|
121
|
-
`,
|
|
137
|
+
`,m=`
|
|
122
138
|
<script src='`+u+`vendor/railroad-diagrams.js'><\/script>
|
|
123
139
|
<script src='`+u+`src/diagrams_builder.js'><\/script>
|
|
124
140
|
<script src='`+u+`src/diagrams_behavior.js'><\/script>
|
|
125
141
|
<script src='`+u+`src/main.js'><\/script>
|
|
126
|
-
`,
|
|
142
|
+
`,p=`
|
|
127
143
|
<div id="diagrams" align="center"></div>
|
|
128
144
|
`,E=`
|
|
129
145
|
<script>
|
|
130
|
-
window.serializedGrammar = `+JSON.stringify(
|
|
146
|
+
window.serializedGrammar = `+JSON.stringify(r,null," ")+`;
|
|
131
147
|
<\/script>
|
|
132
148
|
`,T=`
|
|
133
149
|
<script>
|
|
134
150
|
var diagramsDiv = document.getElementById("diagrams");
|
|
135
151
|
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
|
|
136
152
|
<\/script>
|
|
137
|
-
`;return h+l+p+
|
|
153
|
+
`;return h+l+m+p+E+T}n.createSyntaxDiagramsCode=t}),Yr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Parser=n.createSyntaxDiagramsCode=n.clearCache=n.GAstVisitor=n.serializeProduction=n.serializeGrammar=n.Terminal=n.Rule=n.RepetitionWithSeparator=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Repetition=n.Option=n.NonTerminal=n.Alternative=n.Alternation=n.defaultLexerErrorProvider=n.NoViableAltException=n.NotAllInputParsedException=n.MismatchedTokenException=n.isRecognitionException=n.EarlyExitException=n.defaultParserErrorProvider=n.tokenName=n.tokenMatcher=n.tokenLabel=n.EOF=n.createTokenInstance=n.createToken=n.LexerDefinitionErrorType=n.Lexer=n.EMPTY_ALT=n.ParserDefinitionErrorType=n.EmbeddedActionsParser=n.CstParser=n.VERSION=void 0;var e=Qt();Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return e.VERSION}});var t=We();Object.defineProperty(n,"CstParser",{enumerable:!0,get:function(){return t.CstParser}}),Object.defineProperty(n,"EmbeddedActionsParser",{enumerable:!0,get:function(){return t.EmbeddedActionsParser}}),Object.defineProperty(n,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return t.ParserDefinitionErrorType}}),Object.defineProperty(n,"EMPTY_ALT",{enumerable:!0,get:function(){return t.EMPTY_ALT}});var r=ht();Object.defineProperty(n,"Lexer",{enumerable:!0,get:function(){return r.Lexer}}),Object.defineProperty(n,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return r.LexerDefinitionErrorType}});var i=tt();Object.defineProperty(n,"createToken",{enumerable:!0,get:function(){return i.createToken}}),Object.defineProperty(n,"createTokenInstance",{enumerable:!0,get:function(){return i.createTokenInstance}}),Object.defineProperty(n,"EOF",{enumerable:!0,get:function(){return i.EOF}}),Object.defineProperty(n,"tokenLabel",{enumerable:!0,get:function(){return i.tokenLabel}}),Object.defineProperty(n,"tokenMatcher",{enumerable:!0,get:function(){return i.tokenMatcher}}),Object.defineProperty(n,"tokenName",{enumerable:!0,get:function(){return i.tokenName}});var c=pt();Object.defineProperty(n,"defaultParserErrorProvider",{enumerable:!0,get:function(){return c.defaultParserErrorProvider}});var s=ut();Object.defineProperty(n,"EarlyExitException",{enumerable:!0,get:function(){return s.EarlyExitException}}),Object.defineProperty(n,"isRecognitionException",{enumerable:!0,get:function(){return s.isRecognitionException}}),Object.defineProperty(n,"MismatchedTokenException",{enumerable:!0,get:function(){return s.MismatchedTokenException}}),Object.defineProperty(n,"NotAllInputParsedException",{enumerable:!0,get:function(){return s.NotAllInputParsedException}}),Object.defineProperty(n,"NoViableAltException",{enumerable:!0,get:function(){return s.NoViableAltException}});var u=Jt();Object.defineProperty(n,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return u.defaultLexerErrorProvider}});var a=Ve();Object.defineProperty(n,"Alternation",{enumerable:!0,get:function(){return a.Alternation}}),Object.defineProperty(n,"Alternative",{enumerable:!0,get:function(){return a.Alternative}}),Object.defineProperty(n,"NonTerminal",{enumerable:!0,get:function(){return a.NonTerminal}}),Object.defineProperty(n,"Option",{enumerable:!0,get:function(){return a.Option}}),Object.defineProperty(n,"Repetition",{enumerable:!0,get:function(){return a.Repetition}}),Object.defineProperty(n,"RepetitionMandatory",{enumerable:!0,get:function(){return a.RepetitionMandatory}}),Object.defineProperty(n,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return a.RepetitionMandatoryWithSeparator}}),Object.defineProperty(n,"RepetitionWithSeparator",{enumerable:!0,get:function(){return a.RepetitionWithSeparator}}),Object.defineProperty(n,"Rule",{enumerable:!0,get:function(){return a.Rule}}),Object.defineProperty(n,"Terminal",{enumerable:!0,get:function(){return a.Terminal}});var o=Ve();Object.defineProperty(n,"serializeGrammar",{enumerable:!0,get:function(){return o.serializeGrammar}}),Object.defineProperty(n,"serializeProduction",{enumerable:!0,get:function(){return o.serializeProduction}});var h=ct();Object.defineProperty(n,"GAstVisitor",{enumerable:!0,get:function(){return h.GAstVisitor}});function l(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
|
|
138
154
|
It performs no action other than printing this message.
|
|
139
|
-
Please avoid using it as it will be completely removed in the future`)}n.clearCache=l;var
|
|
140
|
-
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return E})();n.Parser=m});const dt=nr();class rr extends A.Loader{constructor(e){super(e)}load(e,t,i,r){const c=this,s=c.path===""?A.LoaderUtils.extractUrlBase(e):c.path,u=new A.FileLoader(c.manager);u.setPath(c.path),u.setRequestHeader(c.requestHeader),u.setWithCredentials(c.withCredentials),u.load(e,function(a){try{t(c.parse(a,s))}catch(o){r?r(o):console.error(o),c.manager.itemError(e)}},i,r)}parse(e,t){const i={};function r(L){const R=c(),_=new ir(R.tokens),N=new sr(R.tokenVocabulary),O=s(N.getBaseCstVisitorConstructor()),k=_.lex(L);N.input=k.tokens;const F=N.vrml();if(N.errors.length>0)throw console.error(N.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return O.visit(F)}function c(){const L=dt.createToken,R=L({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),_=L({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]([^\0-\x20\x22\x27\x23\x2b\x2c\x2e\x5b\x5d\x5c\x7b\x7d])*/,longer_alt:R}),N=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],O=L({name:"Version",pattern:/#VRML.*/,longer_alt:_}),k=L({name:"NodeName",pattern:new RegExp(N.join("|")),longer_alt:_}),F=L({name:"DEF",pattern:/DEF/,longer_alt:_}),B=L({name:"USE",pattern:/USE/,longer_alt:_}),H=L({name:"ROUTE",pattern:/ROUTE/,longer_alt:_}),ee=L({name:"TO",pattern:/TO/,longer_alt:_}),re=L({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),ye=L({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),Se=L({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Fe=L({name:"TrueLiteral",pattern:/TRUE/}),Ne=L({name:"FalseLiteral",pattern:/FALSE/}),Te=L({name:"NullLiteral",pattern:/NULL/}),ve=L({name:"LSquare",pattern:/\[/}),xe=L({name:"RSquare",pattern:/]/}),Ce=L({name:"LCurly",pattern:/{/}),Le=L({name:"RCurly",pattern:/}/}),Me=L({name:"Comment",pattern:/#.*/,group:dt.Lexer.SKIPPED}),Be=[L({name:"WhiteSpace",pattern:/[ ,\s]/,group:dt.Lexer.SKIPPED}),k,F,B,H,ee,Fe,Ne,Te,O,_,R,re,ye,Se,ve,xe,Ce,Le,Me],Ge={};for(let _e=0,ue=Be.length;_e<ue;_e++){const le=Be[_e];Ge[le.name]=le}return{tokens:Be,tokenVocabulary:Ge}}function s(L){class R extends L{constructor(){super(),this.validateVisitor()}vrml(O){const k={version:this.visit(O.version),nodes:[],routes:[]};for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];k.nodes.push(this.visit(H))}if(O.route)for(let F=0,B=O.route.length;F<B;F++){const H=O.route[F];k.routes.push(this.visit(H))}return k}version(O){return O.Version[0].image}node(O){const k={name:O.NodeName[0].image,fields:[]};if(O.field)for(let F=0,B=O.field.length;F<B;F++){const H=O.field[F];k.fields.push(this.visit(H))}return O.def&&(k.DEF=this.visit(O.def[0])),k}field(O){const k={name:O.Identifier[0].image,type:null,values:null};let F;return O.singleFieldValue&&(F=this.visit(O.singleFieldValue[0])),O.multiFieldValue&&(F=this.visit(O.multiFieldValue[0])),k.type=F.type,k.values=F.values,k}def(O){return(O.Identifier||O.NodeName)[0].image}use(O){return{USE:(O.Identifier||O.NodeName)[0].image}}singleFieldValue(O){return _(this,O)}multiFieldValue(O){return _(this,O)}route(O){return{FROM:O.RouteIdentifier[0].image,TO:O.RouteIdentifier[1].image}}}function _(N,O){const k={type:null,values:[]};if(O.node){k.type="node";for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];k.values.push(N.visit(H))}}if(O.use){k.type="use";for(let F=0,B=O.use.length;F<B;F++){const H=O.use[F];k.values.push(N.visit(H))}}if(O.StringLiteral){k.type="string";for(let F=0,B=O.StringLiteral.length;F<B;F++){const H=O.StringLiteral[F];k.values.push(H.image.replace(/'|"/g,""))}}if(O.NumberLiteral){k.type="number";for(let F=0,B=O.NumberLiteral.length;F<B;F++){const H=O.NumberLiteral[F];k.values.push(parseFloat(H.image))}}if(O.HexLiteral){k.type="hex";for(let F=0,B=O.HexLiteral.length;F<B;F++){const H=O.HexLiteral[F];k.values.push(H.image)}}if(O.TrueLiteral){k.type="boolean";for(let F=0,B=O.TrueLiteral.length;F<B;F++)O.TrueLiteral[F].image==="TRUE"&&k.values.push(!0)}if(O.FalseLiteral){k.type="boolean";for(let F=0,B=O.FalseLiteral.length;F<B;F++)O.FalseLiteral[F].image==="FALSE"&&k.values.push(!1)}return O.NullLiteral&&(k.type="null",O.NullLiteral.forEach(function(){k.values.push(null)})),k}return new R}function u(L){const R=L.nodes,_=new A.Scene;for(let N=0,O=R.length;N<O;N++){const k=R[N];a(k)}for(let N=0,O=R.length;N<O;N++){const k=R[N],F=o(k);F instanceof A.Object3D&&_.add(F),k.name==="WorldInfo"&&(_.userData.worldInfo=F)}return _}function a(L){L.DEF&&(i[L.DEF]=L);const R=L.fields;for(let _=0,N=R.length;_<N;_++){const O=R[_];if(O.type==="node"){const k=O.values;for(let F=0,B=k.length;F<B;F++)a(k[F])}}}function o(L){return L.USE?q(L.USE):(L.build!==void 0||(L.build=h(L)),L.build)}function h(L){const R=L.name;let _;switch(R){case"Anchor":case"Group":case"Transform":case"Collision":_=l(L);break;case"Background":_=p(L);break;case"Shape":_=m(L);break;case"Appearance":_=E(L);break;case"Material":_=T(L);break;case"ImageTexture":_=v(L);break;case"PixelTexture":_=y(L);break;case"TextureTransform":_=g(L);break;case"IndexedFaceSet":_=P(L);break;case"IndexedLineSet":_=K(L);break;case"PointSet":_=S(L);break;case"Box":_=G(L);break;case"Cone":_=x(L);break;case"Cylinder":_=I(L);break;case"Sphere":_=M(L);break;case"ElevationGrid":_=C(L);break;case"Extrusion":_=X(L);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":_=b(L);break;case"WorldInfo":_=w(L);break;case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",R);break}return _!==void 0&&L.DEF!==void 0&&_.hasOwnProperty("name")===!0&&(_.name=L.DEF),_}function l(L){const R=new A.Group,_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":V(B,R);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const H=new A.Vector3(B[0],B[1],B[2]).normalize(),ee=B[3];R.quaternion.setFromAxisAngle(H,ee);break;case"scale":R.scale.set(B[0],B[1],B[2]);break;case"scaleOrientation":break;case"translation":R.position.set(B[0],B[1],B[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function p(L){const R=new A.Group;let _,N,O,k;const F=L.fields;for(let H=0,ee=F.length;H<ee;H++){const re=F[H],ye=re.name,Se=re.values;switch(ye){case"groundAngle":_=Se;break;case"groundColor":N=Se;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":O=Se;break;case"skyColor":k=Se;break;default:console.warn("THREE.VRMLLoader: Unknown field:",ye);break}}const B=1e4;if(k){const H=new A.SphereGeometry(B,32,16),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,depthWrite:!1,depthTest:!1});k.length>3?(z(H,B,O,D(k),!0),ee.vertexColors=!0):ee.color.setRGB(k[0],k[1],k[2],A.SRGBColorSpace);const re=new A.Mesh(H,ee);R.add(re)}if(N&&N.length>0){const H=new A.SphereGeometry(B,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});z(H,B,_,D(N),!1);const re=new A.Mesh(H,ee);R.add(re)}return R.renderOrder=-1/0,R}function m(L){const R=L.fields;let _=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0}),N;for(let k=0,F=R.length;k<F;k++){const B=R[k],H=B.name,ee=B.values;switch(H){case"appearance":ee[0]!==null&&(_=o(ee[0]));break;case"geometry":ee[0]!==null&&(N=o(ee[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}let O;if(N&&N.attributes.position){const k=N._type;if(k==="points"){const F=new A.PointsMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.Points(N,F)}else if(k==="line"){const F=new A.LineBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.LineSegments(N,F)}else N._solid!==void 0&&(_.side=N._solid?A.FrontSide:A.DoubleSide),N.attributes.color!==void 0&&(_.vertexColors=!0),O=new A.Mesh(N,_)}else O=new A.Object3D,O.visible=!1;return O}function E(L){let R=new A.MeshPhongMaterial,_;const N=L.fields;for(let O=0,k=N.length;O<k;O++){const F=N[O],B=F.name,H=F.values;switch(B){case"material":if(H[0]!==null){const re=o(H[0]);re.diffuseColor&&R.color.copy(re.diffuseColor),re.emissiveColor&&R.emissive.copy(re.emissiveColor),re.shininess&&(R.shininess=re.shininess),re.specularColor&&R.specular.copy(re.specularColor),re.transparency&&(R.opacity=1-re.transparency),re.transparency>0&&(R.transparent=!0)}else R=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const ee=H[0];ee!==null&&(ee.name==="ImageTexture"||ee.name==="PixelTexture")&&(R.map=o(ee));break;case"textureTransform":H[0]!==null&&(_=o(H[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",B);break}}if(R.map){if(R.map.__type){switch(R.map.__type){case Xe.INTENSITY_ALPHA:R.opacity=1;break;case Xe.RGB:R.color.set(16777215);break;case Xe.RGBA:R.color.set(16777215),R.opacity=1;break}delete R.map.__type}_&&(R.map.center.copy(_.center),R.map.rotation=_.rotation,R.map.repeat.copy(_.scale),R.map.offset.copy(_.translation))}return R}function T(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"ambientIntensity":break;case"diffuseColor":R.diffuseColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"emissiveColor":R.emissiveColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"shininess":R.shininess=B[0];break;case"specularColor":R.specularColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"transparency":R.transparency=B[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function f(L,R,_){let N;switch(R){case Xe.INTENSITY:N=parseInt(L),_.r=N,_.g=N,_.b=N,_.a=1;break;case Xe.INTENSITY_ALPHA:N=parseInt("0x"+L.substring(2,4)),_.r=N,_.g=N,_.b=N,_.a=parseInt("0x"+L.substring(4,6));break;case Xe.RGB:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=1;break;case Xe.RGBA:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=parseInt("0x"+L.substring(8,10));break}}function d(L){let R;switch(L){case 1:R=Xe.INTENSITY;break;case 2:R=Xe.INTENSITY_ALPHA;break;case 3:R=Xe.RGB;break;case 4:R=Xe.RGBA;break}return R}function y(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let k=0,F=O.length;k<F;k++){const B=O[k],H=B.name,ee=B.values;switch(H){case"image":const re=ee[0],ye=ee[1],Se=ee[2],Fe=d(Se),Ne=new Uint8Array(4*re*ye),Te={r:0,g:0,b:0,a:0};for(let ve=3,xe=0,Ce=ee.length;ve<Ce;ve++,xe++){f(ee[ve],Fe,Te);const Le=xe*4;Ne[Le+0]=Te.r,Ne[Le+1]=Te.g,Ne[Le+2]=Te.b,Ne[Le+3]=Te.a}R=new A.DataTexture(Ne,re,ye),R.colorSpace=A.SRGBColorSpace,R.needsUpdate=!0,R.__type=Fe;break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N),R}function v(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let k=0,F=O.length;k<F;k++){const B=O[k],H=B.name,ee=B.values;switch(H){case"url":const re=ee[0];re&&(R=te.load(re));break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N,R.colorSpace=A.SRGBColorSpace),R}function g(L){const R={center:new A.Vector2,rotation:new A.Vector2,scale:new A.Vector2,translation:new A.Vector2},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"center":R.center.set(B[0],B[1]);break;case"rotation":R.rotation=B[0];break;case"scale":R.scale.set(B[0],B[1]);break;case"translation":R.translation.set(B[0],B[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function b(L){return L.fields[0].values}function w(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"title":R.title=B[0];break;case"info":R.info=B;break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function P(L){let R,_,N,O,k=!0,F=!0,B=0,H,ee,re,ye,Se=!0,Fe=!0;const Ne=L.fields;for(let ke=0,Be=Ne.length;ke<Be;ke++){const Ge=Ne[ke],_e=Ge.name,ue=Ge.values;switch(_e){case"color":const le=ue[0];le!==null&&(R=o(le));break;case"coord":const oe=ue[0];oe!==null&&(_=o(oe));break;case"normal":const fe=ue[0];fe!==null&&(N=o(fe));break;case"texCoord":const me=ue[0];me!==null&&(O=o(me));break;case"ccw":k=ue[0];break;case"colorIndex":H=ue;break;case"colorPerVertex":Se=ue[0];break;case"convex":break;case"coordIndex":ee=ue;break;case"creaseAngle":B=ue[0];break;case"normalIndex":re=ue;break;case"normalPerVertex":Fe=ue[0];break;case"solid":F=ue[0];break;case"texCoordIndex":ye=ue;break;default:console.warn("THREE.VRMLLoader: Unknown field:",_e);break}}if(ee===void 0)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new A.BufferGeometry;const Te=$(ee,k);let ve,xe,Ce;if(R){if(Se===!0)if(H&&H.length>0){const ke=$(H,k);ve=J(Te,ke,R,3)}else ve=pe(Te,new A.Float32BufferAttribute(R,3));else if(H&&H.length>0){const ke=ce(R,H),Be=Z(ke,ee);ve=ie(Te,Be)}else{const ke=Z(R,ee);ve=ie(Te,ke)}Y(ve)}if(N)if(Fe===!0)if(re&&re.length>0){const ke=$(re,k);xe=J(Te,ke,N,3)}else xe=pe(Te,new A.Float32BufferAttribute(N,3));else if(re&&re.length>0){const ke=ce(N,re),Be=Z(ke,ee);xe=ie(Te,Be)}else{const ke=Z(N,ee);xe=ie(Te,ke)}else xe=He(Te,_,B);if(O)if(ye&&ye.length>0){const ke=$(ye,k);Ce=J(Te,ke,O,2)}else Ce=pe(Te,new A.Float32BufferAttribute(O,2));const Le=new A.BufferGeometry,Me=pe(Te,new A.Float32BufferAttribute(_,3));return Le.setAttribute("position",Me),Le.setAttribute("normal",xe),ve&&Le.setAttribute("color",ve),Ce&&Le.setAttribute("uv",Ce),Le._solid=F,Le._type="mesh",Le}function K(L){let R,_,N,O,k=!0;const F=L.fields;for(let ye=0,Se=F.length;ye<Se;ye++){const Fe=F[ye],Ne=Fe.name,Te=Fe.values;switch(Ne){case"color":const ve=Te[0];ve!==null&&(R=o(ve));break;case"coord":const xe=Te[0];xe!==null&&(_=o(xe));break;case"colorIndex":N=Te;break;case"colorPerVertex":k=Te[0];break;case"coordIndex":O=Te;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Ne);break}}let B;const H=se(O);if(R){if(k===!0)if(N.length>0){const ye=se(N);B=J(H,ye,R,3)}else B=pe(H,new A.Float32BufferAttribute(R,3));else if(N.length>0){const ye=ce(R,N),Se=ae(ye,O);B=ge(H,Se)}else{const ye=ae(R,O);B=ge(H,ye)}Y(B)}const ee=new A.BufferGeometry,re=pe(H,new A.Float32BufferAttribute(_,3));return ee.setAttribute("position",re),B&&ee.setAttribute("color",B),ee._type="line",ee}function S(L){let R,_;const N=L.fields;for(let k=0,F=N.length;k<F;k++){const B=N[k],H=B.name,ee=B.values;switch(H){case"color":const re=ee[0];re!==null&&(R=o(re));break;case"coord":const ye=ee[0];ye!==null&&(_=o(ye));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}const O=new A.BufferGeometry;if(O.setAttribute("position",new A.Float32BufferAttribute(_,3)),R){const k=new A.Float32BufferAttribute(R,3);Y(k),O.setAttribute("color",k)}return O._type="points",O}function G(L){const R=new A.Vector3(2,2,2),_=L.fields;for(let O=0,k=_.length;O<k;O++){const F=_[O],B=F.name,H=F.values;B==="size"?(R.x=H[0],R.y=H[1],R.z=H[2]):console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.BoxGeometry(R.x,R.y,R.z)}function x(L){let R=1,_=2,N=!1;const O=L.fields;for(let F=0,B=O.length;F<B;F++){const H=O[F],ee=H.name,re=H.values;switch(ee){case"bottom":N=!re[0];break;case"bottomRadius":R=re[0];break;case"height":_=re[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",ee);break}}return new A.ConeGeometry(R,_,16,1,N)}function I(L){let R=1,_=2;const N=L.fields;for(let k=0,F=N.length;k<F;k++){const B=N[k],H=B.name,ee=B.values;switch(H){case"bottom":break;case"radius":R=ee[0];break;case"height":_=ee[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return new A.CylinderGeometry(R,R,_,16,1)}function M(L){let R=1;const _=L.fields;for(let O=0,k=_.length;O<k;O++){const F=_[O],B=F.name,H=F.values;B==="radius"?R=H[0]:console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.SphereGeometry(R,16,16)}function C(L){let R,_,N,O,k=!0,F=!0,B=!0,H=!0,ee=0,re=2,ye=2,Se=1,Fe=1;const Ne=L.fields;for(let ue=0,le=Ne.length;ue<le;ue++){const oe=Ne[ue],fe=oe.name,me=oe.values;switch(fe){case"color":const we=me[0];we!==null&&(R=o(we));break;case"normal":const $e=me[0];$e!==null&&(_=o($e));break;case"texCoord":const et=me[0];et!==null&&(N=o(et));break;case"height":O=me;break;case"ccw":H=me[0];break;case"colorPerVertex":k=me[0];break;case"creaseAngle":ee=me[0];break;case"normalPerVertex":F=me[0];break;case"solid":B=me[0];break;case"xDimension":re=me[0];break;case"xSpacing":Se=me[0];break;case"zDimension":ye=me[0];break;case"zSpacing":Fe=me[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",fe);break}}const Te=[],ve=[],xe=[],Ce=[];for(let ue=0;ue<ye;ue++)for(let le=0;le<re;le++){const oe=ue*re+le,fe=Se*ue,me=O[oe],we=Fe*le;if(Te.push(fe,me,we),R&&k===!0){const $e=R[oe*3+0],et=R[oe*3+1],St=R[oe*3+2];xe.push($e,et,St)}if(_&&F===!0){const $e=_[oe*3+0],et=_[oe*3+1],St=_[oe*3+2];ve.push($e,et,St)}if(N){const $e=N[oe*2+0],et=N[oe*2+1];Ce.push($e,et)}else Ce.push(ue/(re-1),le/(ye-1))}const Le=[];for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*re,fe=ue+(le+1)*re,me=ue+1+(le+1)*re,we=ue+1+le*re;H===!0?(Le.push(oe,me,fe),Le.push(me,oe,we)):(Le.push(oe,fe,me),Le.push(me,we,oe))}const Me=pe(Le,new A.Float32BufferAttribute(Te,3)),ke=pe(Le,new A.Float32BufferAttribute(Ce,2));let Be,Ge;if(R){if(k===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=R[oe*3+0],me=R[oe*3+1],we=R[oe*3+2];xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we)}Be=new A.Float32BufferAttribute(xe,3)}else Be=pe(Le,new A.Float32BufferAttribute(xe,3));Y(Be)}if(_)if(F===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=_[oe*3+0],me=_[oe*3+1],we=_[oe*3+2];ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we)}Ge=new A.Float32BufferAttribute(ve,3)}else Ge=pe(Le,new A.Float32BufferAttribute(ve,3));else Ge=He(Le,Te,ee);const _e=new A.BufferGeometry;return _e.setAttribute("position",Me),_e.setAttribute("normal",Ge),_e.setAttribute("uv",ke),Be&&_e.setAttribute("color",Be),_e._solid=B,_e._type="mesh",_e}function X(L){let R=[1,1,1,-1,-1,-1,-1,1,1,1],_=[0,0,0,0,1,0],N,O,k=!0,F=!0,B=0,H=!0,ee=!0;const re=L.fields;for(let _e=0,ue=re.length;_e<ue;_e++){const le=re[_e],oe=le.name,fe=le.values;switch(oe){case"beginCap":k=fe[0];break;case"ccw":F=fe[0];break;case"convex":break;case"creaseAngle":B=fe[0];break;case"crossSection":R=fe;break;case"endCap":H=fe[0];break;case"orientation":O=fe;break;case"scale":N=fe;break;case"solid":ee=fe[0];break;case"spine":_=fe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",oe);break}}const ye=R[0]===R[R.length-2]&&R[1]===R[R.length-1],Se=[],Fe=new A.Vector3,Ne=new A.Vector3,Te=new A.Vector3,ve=new A.Vector3,xe=new A.Quaternion;for(let _e=0,ue=0,le=0,oe=_.length;_e<oe;_e+=3,ue+=2,le+=4){Fe.fromArray(_,_e),Ne.x=N?N[ue+0]:1,Ne.y=1,Ne.z=N?N[ue+1]:1,Te.x=O?O[le+0]:0,Te.y=O?O[le+1]:0,Te.z=O?O[le+2]:1;const fe=O?O[le+3]:0;for(let me=0,we=R.length;me<we;me+=2)ve.x=R[me+0],ve.y=0,ve.z=R[me+1],ve.multiply(Ne),xe.setFromAxisAngle(Te,fe),ve.applyQuaternion(xe),ve.add(Fe),Se.push(ve.x,ve.y,ve.z)}const Ce=[],Le=_.length/3,Me=R.length/2;for(let _e=0;_e<Le-1;_e++)for(let ue=0;ue<Me-1;ue++){const le=ue+_e*Me;let oe=ue+1+_e*Me;const fe=ue+(_e+1)*Me;let me=ue+1+(_e+1)*Me;ue===Me-2&&ye===!0&&(oe=_e*Me,me=(_e+1)*Me),F===!0?(Ce.push(le,oe,fe),Ce.push(fe,oe,me)):(Ce.push(le,fe,oe),Ce.push(fe,me,oe))}if(k===!0||H===!0){const _e=[];for(let oe=0,fe=R.length;oe<fe;oe+=2)_e.push(new A.Vector2(R[oe],R[oe+1]));const ue=A.ShapeUtils.triangulateShape(_e,[]),le=[];for(let oe=0,fe=ue.length;oe<fe;oe++){const me=ue[oe];le.push(me[0],me[1],me[2])}if(k===!0)for(let oe=0,fe=le.length;oe<fe;oe+=3)F===!0?Ce.push(le[oe+0],le[oe+1],le[oe+2]):Ce.push(le[oe+0],le[oe+2],le[oe+1]);if(H===!0){const oe=Me*(Le-1);for(let fe=0,me=le.length;fe<me;fe+=3)F===!0?Ce.push(oe+le[fe+0],oe+le[fe+2],oe+le[fe+1]):Ce.push(oe+le[fe+0],oe+le[fe+1],oe+le[fe+2])}}const ke=pe(Ce,new A.Float32BufferAttribute(Se,3)),Be=He(Ce,Se,B),Ge=new A.BufferGeometry;return Ge.setAttribute("position",ke),Ge.setAttribute("normal",Be),Ge._solid=ee,Ge._type="mesh",Ge}function q(L){const R=i[L],_=o(R);return _.isObject3D||_.isMaterial?_.clone():_}function V(L,R){for(let _=0,N=L.length;_<N;_++){const O=o(L[_]);O instanceof A.Object3D&&R.add(O)}}function $(L,R){const _=[];let N=0;for(let O=0,k=L.length;O<k;O++){const F=L[N],B=L[O+(R?1:2)],H=L[O+(R?2:1)];_.push(F,B,H),(L[O+3]===-1||O+3>=k)&&(O+=3,N=O+1)}return _}function Z(L,R){const _=[];let N=0;for(let O=0,k=R.length;O<k;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+3]===-1||O+3>=k)&&(O+=3,N++)}return _}function ce(L,R){const _=[];for(let N=0,O=R.length;N<O;N++){const F=R[N]*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee)}return _}function se(L){const R=[];for(let _=0,N=L.length;_<N;_++){const O=L[_],k=L[_+1];R.push(O,k),(L[_+2]===-1||_+2>=N)&&(_+=2)}return R}function ae(L,R){const _=[];let N=0;for(let O=0,k=R.length;O<k;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+2]===-1||O+2>=k)&&(O+=2,N++)}return _}const ne=new A.Vector3,he=new A.Vector3,U=new A.Vector3,j=new A.Vector2,W=new A.Vector2,Q=new A.Vector2;function J(L,R,_,N){const O=[];for(let k=0,F=L.length;k<F;k+=3){const B=R[k],H=R[k+1],ee=R[k+2];N===2?(j.fromArray(_,B*N),W.fromArray(_,H*N),Q.fromArray(_,ee*N),O.push(j.x,j.y),O.push(W.x,W.y),O.push(Q.x,Q.y)):(ne.fromArray(_,B*N),he.fromArray(_,H*N),U.fromArray(_,ee*N),O.push(ne.x,ne.y,ne.z),O.push(he.x,he.y,he.z),O.push(U.x,U.y,U.z))}return new A.Float32BufferAttribute(O,N)}function ie(L,R){const _=[];for(let N=0,O=0,k=L.length;N<k;N+=3,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function ge(L,R){const _=[];for(let N=0,O=0,k=L.length;N<k;N+=2,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function pe(L,R){const _=R.array,N=R.itemSize,O=new _.constructor(L.length*N);let k=0,F=0;for(let B=0,H=L.length;B<H;B++){k=L[B]*N;for(let ee=0;ee<N;ee++)O[F++]=_[k++]}return new A.Float32BufferAttribute(O,N)}const Oe=new A.Vector3,Ue=new A.Vector3;function He(L,R,_){const N=[],O={};for(let F=0,B=L.length;F<B;F+=3){const H=L[F],ee=L[F+1],re=L[F+2],ye=new ar(H,ee,re);ne.fromArray(R,H*3),he.fromArray(R,ee*3),U.fromArray(R,re*3),Ue.subVectors(U,he),Oe.subVectors(ne,he),Ue.cross(Oe),Ue.normalize(),ye.normal.copy(Ue),O[H]===void 0&&(O[H]=[]),O[ee]===void 0&&(O[ee]=[]),O[re]===void 0&&(O[re]=[]),O[H].push(ye.normal),O[ee].push(ye.normal),O[re].push(ye.normal),N.push(ye)}const k=[];for(let F=0,B=N.length;F<B;F++){const H=N[F],ee=De(O[H.a],H.normal,_),re=De(O[H.b],H.normal,_),ye=De(O[H.c],H.normal,_);ne.fromArray(R,H.a*3),he.fromArray(R,H.b*3),U.fromArray(R,H.c*3),k.push(ee.x,ee.y,ee.z),k.push(re.x,re.y,re.z),k.push(ye.x,ye.y,ye.z)}return new A.Float32BufferAttribute(k,3)}function De(L,R,_){const N=new A.Vector3;if(_===0)N.copy(R);else for(let O=0,k=L.length;O<k;O++)L[O].angleTo(R)<_&&N.add(L[O]);return N.normalize()}function D(L){const R=[];for(let _=0,N=L.length;_<N;_+=3)R.push(new A.Color(L[_],L[_+1],L[_+2]));return R}function Y(L){const R=new A.Color;for(let _=0;_<L.count;_++)R.fromBufferAttribute(L,_),A.ColorManagement.colorSpaceToWorking(R,A.SRGBColorSpace),L.setXYZ(_,R.r,R.g,R.b)}function z(L,R,_,N,O){const k=[],F=O===!0?0:Math.PI;for(let Se=0,Fe=N.length;Se<Fe;Se++){let Ne=Se===0?0:_[Se-1];Ne=O===!0?Ne:F-Ne;const Te=new A.Vector3;Te.setFromSphericalCoords(R,Ne,0),k.push(Te)}const B=L.index,H=L.attributes.position,ee=new A.BufferAttribute(new Float32Array(L.attributes.position.count*3),3),re=new A.Vector3,ye=new A.Color;for(let Se=0;Se<B.count;Se++){const Fe=B.getX(Se);re.fromBufferAttribute(H,Fe);let Ne,Te,ve=1;for(let Le=1;Le<k.length;Le++){Ne=Le-1,Te=Le;const Me=k[Ne],ke=k[Te];if(O===!0){if(re.y<=Me.y&&re.y>ke.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-ke.y);break}}else if(re.y>=Me.y&&re.y<ke.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-ke.y);break}}const xe=N[Ne],Ce=N[Te];ye.copy(xe).lerp(Ce,ve),A.ColorManagement.colorSpaceToWorking(ye,A.SRGBColorSpace),ee.setXYZ(Fe,ye.r,ye.g,ye.b)}L.setAttribute("color",ee)}const te=new A.TextureLoader(this.manager);if(te.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const de=r(e);return u(de)}}class ir{constructor(e){this.lexer=new dt.Lexer(e)}lex(e){const t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}}const or=dt.CstParser;class sr extends or{constructor(e){super(e);const t=this,i=e.Version,r=e.LCurly,c=e.RCurly,s=e.LSquare,u=e.RSquare,a=e.Identifier,o=e.RouteIdentifier,h=e.StringLiteral,l=e.HexLiteral,p=e.NumberLiteral,m=e.TrueLiteral,E=e.FalseLiteral,T=e.NullLiteral,f=e.DEF,d=e.USE,y=e.ROUTE,v=e.TO,g=e.NodeName;t.RULE("vrml",function(){t.SUBRULE(t.version),t.AT_LEAST_ONE(function(){t.SUBRULE(t.node)}),t.MANY(function(){t.SUBRULE(t.route)})}),t.RULE("version",function(){t.CONSUME(i)}),t.RULE("node",function(){t.OPTION(function(){t.SUBRULE(t.def)}),t.CONSUME(g),t.CONSUME(r),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(c)}),t.RULE("field",function(){t.CONSUME(a),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(f),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("use",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("singleFieldValue",function(){t.AT_LEAST_ONE(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(m)}},{ALT:function(){t.CONSUME(E)}},{ALT:function(){t.CONSUME(T)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(s),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(T)}}])}),t.CONSUME(u)}),t.RULE("route",function(){t.CONSUME(y),t.CONSUME(o),t.CONSUME(v),t.CONSUME2(o)}),this.performSelfAnalysis()}}class ar{constructor(e,t,i){this.a=e,this.b=t,this.c=i,this.normal=new A.Vector3}}const Xe={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};function cr(n){const e=at.RAPIER,t=n.parameters;if(n.type==="RoundedBoxGeometry"){const i=t.width!==void 0?t.width/2:.5,r=t.height!==void 0?t.height/2:.5,c=t.depth!==void 0?t.depth/2:.5,s=t.radius!==void 0?t.radius:.1;return e.ColliderDesc.roundCuboid(i-s,r-s,c-s,s)}else if(n.type==="BoxGeometry"){const i=t.width!==void 0?t.width/2:.5,r=t.height!==void 0?t.height/2:.5,c=t.depth!==void 0?t.depth/2:.5;return e.ColliderDesc.cuboid(i,r,c)}else if(n.type==="SphereGeometry"||n.type==="IcosahedronGeometry"){const i=t.radius!==void 0?t.radius:1;return e.ColliderDesc.ball(i)}else if(n.type==="CylinderGeometry"){const i=t.radiusBottom!==void 0?t.radiusBottom:.5,r=t.height!==void 0?t.height:.5;return e.ColliderDesc.cylinder(r/2,i)}else if(n.type==="CapsuleGeometry"){const i=t.radius!==void 0?t.radius:.5,r=t.height!==void 0?t.height:.5;return e.ColliderDesc.capsule(r/2,i)}else if(n.type==="BufferGeometry"){const i=[],r=new A.Vector3,c=n.getAttribute("position");for(let u=0;u<c.count;u++)r.fromBufferAttribute(c,u),i.push(r.x,r.y,r.z);const s=n.getIndex()===null?Uint32Array.from(Array(parseInt(i.length/3)).keys()):n.getIndex().array;return e.ColliderDesc.trimesh(i,s)}return console.error("RapierPhysics: Unsupported geometry type:",n.type),null}let vt;async function ur(n,e){return vt||(vt=new rr),vt.manager.setURLModifier(i=>(i.startsWith("./")&&(i=i.substring(2)),URL.createObjectURL(Fn(n,i)))),await vt.loadAsync(e)}function zt(n){return n.isMesh===!0}class lr{object;option;constructor(e,t){this.object=e,this.option=t}}let ot;class at{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!at.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),at.RAPIER=e,ot=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOption(e)&&(t=e.timestep);const i=new ot.World(e.gravity);return new fr(i,t)}isRapierWorldOption(e){return"enableCCD"in e&&"timestep"in e}}class fr{world;timestep;constructor(e,t){this.world=e,this.timestep=t,this.world.integrationParameters.dt=this.timestep}add(e){Yt(e)&&e.addOneself(this)}remove(e){Yt(e)&&e.removeOneself(this)}update(e){const t=Math.ceil(e/this.timestep);for(let i=0;i<t;i++)this.world.step()}}class cn extends lr{}function Yt(n){return"addOneself"in n&&"removeOneself"in n}class hr extends cn{bodyDesc;body;colliderDescs=[];colliders=[];constructor(e,t){switch(super(e,t),t.rigidBody){case"dynamic":this.bodyDesc=ot.RigidBodyDesc.dynamic();break;case"kinematic":this.bodyDesc=ot.RigidBodyDesc.kinematicPositionBased();break;case"fixed":this.bodyDesc=ot.RigidBodyDesc.fixed();break}this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.object.object.traverse(i=>{if(zt(i)){let r=cr(i.geometry);if(r)this.colliderDescs.push(r);else{switch(t.meshCollider){case"tri_mesh":r=dr(i,1);break;case"convex_hull":r=pr(i,1);break}r&&(r.setRestitution(t.restitution).setFriction(t.friction),this.colliderDescs.push(r))}}})}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const i=this.body.rotation();e.rot.set(i.x,i.y,i.z,i.w),e.object.quaternion.set(i.x,i.y,i.z,i.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{this.colliders.push(e.world.createCollider(t,this.body))})}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1)})}forceSetLoc(e){this.body&&this.body.setTranslation(e,!0)}forceSetQuat(e){console.log("GAHA:",e),this.body&&this.body.setRotation(e,!0)}forceSetScale(e){}}function dr(n,e){const t=[];return n.traverse(i=>{if(zt(i)){const r=i;r.updateWorldMatrix(!0,!0);const c=r.geometry.clone();c.applyMatrix4(r.matrixWorld);const s=c.attributes.position.array;let u=c.index?c.index.array:null;if(u)u instanceof Uint32Array||(u=new Uint32Array(u));else{const a=c.attributes.position.count;u=new Uint32Array(a);for(let o=0;o<a;o++)u[o]=o}if(s instanceof Float32Array){const a=ot.ColliderDesc.trimesh(s,u);a.setMass(e).setFriction(.8).setRestitution(.8),t.push(a)}}}),t}function pr(n,e){const t=[];return n.traverse(i=>{if(zt(i)){const r=i;r.updateWorldMatrix(!0,!0);const c=r.geometry.clone();c.applyMatrix4(r.matrixWorld);const s=c.attributes.position.array;if(s instanceof Float32Array){const u=ot.ColliderDesc.convexHull(s);u&&(u.setMass(e).setFriction(.8).setRestitution(.8),t.push(u))}}}),t}class lt{scene;objects;static physics=new at;physicsWorld=null;physicsDt=1/60;static async initPhysics(){await lt.physics.init()}constructor(){this.scene=new Ie.Scene,this.objects=[],lt.physics.isInitialized&&(this.physicsWorld=lt.physics.createWorld({gravity:{x:0,y:-9.81,z:0},timestep:this.physicsDt}))}add(e){if(this.scene.add(e.object),this.objects.push(e),e.scene=this,e.controlMode==="physics")if(this.physicsWorld){if(!e.physics){const t=e.getPhysicsOption();e.initPhysics(t)}e.physics&&this.physicsWorld.add(e.physics)}else console.log("物理エンジンを初期化してない状態で、物理エンジンを必要とするObjectA3が追加されました。")}remove(e){this.scene.remove(e.object);{const t=this.objects.indexOf(e);this.objects[t]=this.objects[this.objects.length-1],this.objects.pop()}e.scene=null,e.controlMode==="physics"&&this.physicsWorld&&e.physics&&this.physicsWorld.remove(e.physics)}update(e){this.physicsWorld&&this.physicsWorld.update(e);for(const t of this.objects)t.controlMode!=="manual"&&t.update(e)}}class je{_x;_y;_z;get x(){return this._x}get y(){return this._y}get z(){return this._z}constructor(e,t,i){typeof e=="number"?(this._x=e,this._y=t,this._z=i):typeof e>"u"?this._x=this._y=this._z=0:(this._x=e.x,this._y=e.y,this._z=e.z)}set(e,t,i){return typeof e=="number"?(this._x=e,this._y=t,this._z=i):(this._x=e.x,this._y=e.y,this._z=e.z),this}add(e){return this._x+=e.x,this._y+=e.y,this._z+=e.z,this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z}}class st{_x;_y;_z;_w;get x(){return this._x}get y(){return this._y}get z(){return this._z}get w(){return this._w}constructor(e,t,i,r){typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):typeof e>"u"?(this._x=this._y=this._z=0,this._w=1):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w)}set(e,t,i,r){return typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w),this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.z+i*t.w}slerp(e,t,i){if(i<0||i>1){console.log("Quat.slerp(): t must be in [0,1]");return}const r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(r<.9995){const c=Math.acos(r),s=Math.sin((1-i)*c)/Math.sin(c),u=Math.sin(i*c)/Math.sin(c);this._x=s*e.x+u*t.x,this._y=s*e.y+u*t.y,this._z=s*e.z+u*t.z,this._w=s*e.w+u*t.w}else{this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.w+i*t.w;const c=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);c<1e-4?(console.log("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/c,this._y*=1/c,this._z*=1/c,this._w*=1/c)}}}class rt{_loc=new je(0,0,0);_rot=new st(0,0,0,1);_scale=new je(1,1,1);object;controlMode="manual";scene=null;physics=null;balloon=null;interpolation=null;constructor(e){this.object=this.initObject(e)}setControlMode(e){this.controlMode=e,e==="interpolated"&&!this.interpolation&&(this.interpolation=new yr(this)),e==="physics"&&!this.physics&&this.initPhysics(this.getPhysicsOption())}update(e){switch(this.controlMode){case"manual":break;case"interpolated":this.interpolation&&this.interpolation.interpolate(this,e);break;case"physics":this.physics&&this.physics.synchronize(this);break;case"user":console.log('"user"モードを使う場合は自分でupdateメソッドをオーバーライドして実装して下さい。');break}}getPhysicsOption(){return{rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",friction:.5,restitution:.5}}initPhysics(e){this.physics=new hr(this,e),this.controlMode="physics"}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new mr(e)}get location(){return this._loc}setLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setLoc(this,r);break;case"physics":break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}forceSetLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetLoc(this,r);break;case"physics":this.physics&&this.physics.forceSetLoc(r);break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}get rot(){return this._rot}setQuat(e,t,i,r){const c=new st;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setQuat(this,c);break;case"physics":break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}forceSetQuat(e,t,i,r){const c=new st;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetQuat(this,c);break;case"physics":this.physics&&this.physics.forceSetQuat(c);break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}get scale(){return this._scale}setScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setScale(this,r);break;case"physics":break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}forceSetScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetScale(this,r);break;case"physics":this.physics&&this.physics.forceSetScale(r);break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}contains(e){let t=!1;return this.object.traverse(i=>{i==e&&(t=!0)}),t}}class mr{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class yr{firstLoc;firstRot;firstScale;nowLoc;nowRot;nowScale;lastLoc;lastRot;lastScale;nowTime;duration;constructor(e){this.firstLoc=new je(e.location),this.firstRot=new st(e.rot),this.firstScale=new je(e.scale),this.nowLoc=new je(e.location),this.nowRot=new st(e.rot),this.nowScale=new je(e.scale),this.lastLoc=new je(e.location),this.lastRot=new st(e.rot),this.lastScale=new je(e.scale),this.nowTime=0,this.duration=1}setLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=0}forceSetLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=1}setQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=0}forceSetQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=1}setScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=0}forceSetScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=1}smoothstep(e){return e*e*(3-2*e)}interpolate(e,t){this.nowTime+=t,this.nowTime>this.duration&&(this.nowTime=this.duration);const i=this.nowTime/this.duration,r=this.smoothstep(i);this.nowLoc.lerp(this.firstLoc,this.lastLoc,r),this.nowRot.slerp(this.firstRot,this.lastRot,r),this.nowScale.lerp(this.firstScale,this.lastScale,r),e.location.set(this.nowLoc),e.object.position.set(this.nowLoc.x,this.nowLoc.y,this.nowLoc.z),e.rot.set(this.nowRot),e.object.quaternion.set(this.nowRot.x,this.nowRot.y,this.nowRot.z,this.nowRot.w),e.scale.set(this.nowScale),e.object.scale.set(this.nowScale.x,this.nowScale.y,this.nowScale.z)}}class un extends rt{}class Ht{scene;camera;constructor(e){this.scene=new lt,this.camera=e,this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3)}replaceScene(e){this.scene.scene.remove(this.camera.object),e.scene.add(this.camera.object);const t=this.scene;return this.scene=e,t}updateScene(e){this.scene.update(e)}}class mt extends un{camera;headLight;constructor(e){super(e),this.camera=e,this.headLight=new Ie.SpotLight(16777215,1,0,Math.PI/3,0,0),this.headLight.rotation.x=3.14/2,this.object.add(this.camera),this.object.add(this.headLight)}initObject(){return new Ie.Object3D}getHeadLight(){return this.headLight}setAspect(e){gr(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}}function gr(n){return n.isPerspectiveCamera===!0}class ln extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;constructor(e){super(),e||(e={}),e.camera||(e.camera=new Ie.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new mt(e.camera);this.base=new Ht(t),this.scene=this.base.scene,this.camera=this.base.camera;const i={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new Ie.WebGLRenderer(i),"opaque"in e&&this.renderer.setClearAlpha(0),this.clock=new Ie.Clock,this.style="display: block; background: rgba(0,0,0,0);",this.renderer.domElement.style="display: block; width: 100%; height: 100%; margin: 0; padding: 0;",this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();Tr(this.camera3js)&&(this.camera3js.aspect=e/t),this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js)};myMouseClickedListener=e=>{if(this.camera instanceof mt){const t=new Ie.Raycaster,i=new Ie.Vector2,r=e.target.getBoundingClientRect(),c=e.clientX-r.left,s=e.clientY-r.top;i.x=2*(c/r.width)-1,i.y=-2*(s/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-canvas",ln);function Tr(n){return n.isPerspectiveCamera===!0}const Er=`
|
|
141
|
-
position: absolute;
|
|
142
|
-
top: 100px;
|
|
143
|
-
left: 100px;
|
|
144
|
-
/* width: 300px; */
|
|
145
|
-
border: 1px solid #555;
|
|
146
|
-
background: white;
|
|
147
|
-
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.3);
|
|
148
|
-
`,vr=`
|
|
149
|
-
background: #444;
|
|
150
|
-
color: white;
|
|
151
|
-
padding: 8px;
|
|
152
|
-
cursor: move;
|
|
153
|
-
user-select: none; /* 文字選択を防ぐ */
|
|
154
|
-
`;class fn extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;isDragging=!1;offsetX=0;offsetY=0;constructor(e,t){super(),this.camera3js=new Ie.PerspectiveCamera(75,e/t,.1,1e3);const i=new mt(this.camera3js);this.base=new Ht(i),this.scene=this.base.scene,this.camera=this.base.camera,this.renderer=new Ie.WebGLRenderer,this.clock=new Ie.Clock,this.camera3js.aspect=e/t,this.renderer.setSize(e,t),this.style=Er,document.body?document.body.appendChild(this):document.addEventListener("DOMContentLoaded",()=>{document.body.append(this)},{once:!0});const r=document.createElement("div");r.textContent="A3Window",r.style=vr,this.appendChild(r),r.addEventListener("mousedown",this.mouseDownListener),document.addEventListener("mousemove",this.mouseMoveListener),document.addEventListener("mouseup",this.mouseUpListener),this.renderer.domElement.style=`display: block; width: ${e}px; height: ${t}px; margin: 0; padding: 0;`,this.renderer.domElement.width=e,this.renderer.domElement.width=t,this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();this.camera3js.aspect=e/t,this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}mouseDownListener=e=>{this.isDragging=!0,this.offsetX=e.clientX-this.offsetLeft,this.offsetY=e.clientY-this.offsetTop};mouseMoveListener=e=>{this.isDragging&&(this.style.left=e.clientX-this.offsetX+"px",this.style.top=e.clientY-this.offsetY+"px")};mouseUpListener=()=>{this.isDragging=!1};replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.scene&&(this.scene.update(e),this.renderer.render(this.scene.scene,this.camera3js))};myMouseClickedListener=e=>{if(this.camera instanceof mt){const t=new Ie.Raycaster,i=new Ie.Vector2,r=e.target.getBoundingClientRect(),c=e.clientX-r.left,s=e.clientY-r.top;i.x=2*(c/r.width)-1,i.y=-2*(s/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-window",fn);class Rr extends rt{constructor(e){super(),e&&e.physics?this.setControlMode("physics"):this.setControlMode("user")}initObject(){const e=new Ie.BoxGeometry,t=new Ie.MeshStandardMaterial({color:65280});return new Ie.Mesh(e,t)}initPhysics(e){this.physics=new Ar(this,e)}update(e){this.controlMode==="physics"?super.update(e):this.controlMode==="interpolated"?super.update(e):(this.object.rotation.x+=e,this.object.rotation.y+=e,this.object.rotation.z+=e)}}class Ar extends cn{bodyDesc;body=null;colliderDesc;collider=null;constructor(e,t){super(e,t),this.bodyDesc=at.RAPIER.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.colliderDesc=at.RAPIER.ColliderDesc.cuboid(.5,.5,.5),this.colliderDesc.setRestitution(.3).setFriction(.6)}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const i=this.body.rotation();e.rot.set(i.x,i.y,i.z,i.w),e.object.quaternion.set(i.x,i.y,i.z,i.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.collider=e.world.createCollider(this.colliderDesc,this.body)}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.collider&&e.world.removeCollider(this.collider,!1)}forceSetLoc(e){this.body&&this.body.setTranslation(e,!0)}forceSetQuat(e){this.body&&this.body.setRotation(e,!0)}forceSetScale(e){}}class _r{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,i="ltr"){const r=[],c=Lr(e,t,this.data,i);for(let s=0,u=c.length;s<u;s++)r.push(...c[s].toShapes());return r}}function Lr(n,e,t,i){const r=Array.from(n),c=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*c,u=[];let a=0,o=0;(i=="rtl"||i=="tb")&&r.reverse();for(let h=0;h<r.length;h++){const l=r[h];if(l===`
|
|
155
|
-
`)a=0,o-=s;else{const p=Or(l,c,a,o,t);i=="tb"?(a=0,o+=t.ascender*c):a+=p.offsetX,u.push(p.path)}}return u}function Or(n,e,t,i,r){const c=r.glyphs[n]||r.glyphs["?"];if(!c){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const s=new A.ShapePath;let u,a,o,h,l,p,m,E;if(c.o){const T=c._cachedOutline||(c._cachedOutline=c.o.split(" "));for(let f=0,d=T.length;f<d;)switch(T[f++]){case"m":u=T[f++]*e+t,a=T[f++]*e+i,s.moveTo(u,a);break;case"l":u=T[f++]*e+t,a=T[f++]*e+i,s.lineTo(u,a);break;case"q":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,s.quadraticCurveTo(l,p,o,h);break;case"b":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,m=T[f++]*e+t,E=T[f++]*e+i,s.bezierCurveTo(l,p,m,E,o,h);break}}return{offsetX:c.ha*e,path:s}}class Sr extends A.ExtrudeGeometry{constructor(e,t={}){const i=t.font;if(i===void 0)super();else{const r=i.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}}function hn(n){return typeof n=="string"}var Ve=Uint8Array,ut=Uint16Array,Ir=Int32Array,dn=new Ve([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),pn=new Ve([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),br=new Ve([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mn=function(n,e){for(var t=new ut(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new Ir(t[30]),i=1;i<30;++i)for(var c=t[i];c<t[i+1];++c)r[c]=c-t[i]<<5|i;return{b:t,r}},yn=mn(dn,2),gn=yn.b,Nr=yn.r;gn[28]=258,Nr[258]=28;var xr=mn(pn,0),kr=xr.b,wt=new ut(32768);for(var Pe=0;Pe<32768;++Pe){var tt=(Pe&43690)>>1|(Pe&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,wt[Pe]=((tt&65280)>>8|(tt&255)<<8)>>1}var pt=(function(n,e,t){for(var i=n.length,r=0,c=new ut(e);r<i;++r)n[r]&&++c[n[r]-1];var s=new ut(e);for(r=1;r<e;++r)s[r]=s[r-1]+c[r-1]<<1;var u;if(t){u=new ut(1<<e);var a=15-e;for(r=0;r<i;++r)if(n[r])for(var o=r<<4|n[r],h=e-n[r],l=s[n[r]-1]++<<h,p=l|(1<<h)-1;l<=p;++l)u[wt[l]>>a]=o}else for(u=new ut(i),r=0;r<i;++r)n[r]&&(u[r]=wt[s[n[r]-1]++]>>15-n[r]);return u}),Et=new Ve(288);for(var Pe=0;Pe<144;++Pe)Et[Pe]=8;for(var Pe=144;Pe<256;++Pe)Et[Pe]=9;for(var Pe=256;Pe<280;++Pe)Et[Pe]=7;for(var Pe=280;Pe<288;++Pe)Et[Pe]=8;var Tn=new Ve(32);for(var Pe=0;Pe<32;++Pe)Tn[Pe]=5;var Cr=pt(Et,9,1),Pr=pt(Tn,5,1),It=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},qe=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},bt=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},wr=function(n){return(n+7)/8|0},Wt=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new Ve(n.subarray(e,t))},Mr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ke=function(n,e,t){var i=new Error(e||Mr[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,Ke),!t)throw i;return i},Fr=function(n,e,t,i){var r=n.length,c=i?i.length:0;if(!r||e.f&&!e.l)return t||new Ve(0);var s=!t,u=s||e.i!=2,a=e.i;s&&(t=new Ve(r*3));var o=function(ge){var pe=t.length;if(ge>pe){var Oe=new Ve(Math.max(pe*2,ge));Oe.set(t),t=Oe}},h=e.f||0,l=e.p||0,p=e.b||0,m=e.l,E=e.d,T=e.m,f=e.n,d=r*8;do{if(!m){h=qe(n,l,1);var y=qe(n,l+1,3);if(l+=3,y)if(y==1)m=Cr,E=Pr,T=9,f=5;else if(y==2){var w=qe(n,l,31)+257,P=qe(n,l+10,15)+4,K=w+qe(n,l+5,31)+1;l+=14;for(var S=new Ve(K),G=new Ve(19),x=0;x<P;++x)G[br[x]]=qe(n,l+x*3,7);l+=P*3;for(var I=It(G),M=(1<<I)-1,C=pt(G,I,1),x=0;x<K;){var X=C[qe(n,l,M)];l+=X&15;var v=X>>4;if(v<16)S[x++]=v;else{var q=0,V=0;for(v==16?(V=3+qe(n,l,3),l+=2,q=S[x-1]):v==17?(V=3+qe(n,l,7),l+=3):v==18&&(V=11+qe(n,l,127),l+=7);V--;)S[x++]=q}}var $=S.subarray(0,w),Z=S.subarray(w);T=It($),f=It(Z),m=pt($,T,1),E=pt(Z,f,1)}else Ke(1);else{var v=wr(l)+4,g=n[v-4]|n[v-3]<<8,b=v+g;if(b>r){a&&Ke(0);break}u&&o(p+g),t.set(n.subarray(v,b),p),e.b=p+=g,e.p=l=b*8,e.f=h;continue}if(l>d){a&&Ke(0);break}}u&&o(p+131072);for(var ce=(1<<T)-1,se=(1<<f)-1,ae=l;;ae=l){var q=m[bt(n,l)&ce],ne=q>>4;if(l+=q&15,l>d){a&&Ke(0);break}if(q||Ke(2),ne<256)t[p++]=ne;else if(ne==256){ae=l,m=null;break}else{var he=ne-254;if(ne>264){var x=ne-257,U=dn[x];he=qe(n,l,(1<<U)-1)+gn[x],l+=U}var j=E[bt(n,l)&se],W=j>>4;j||Ke(3),l+=j&15;var Z=kr[W];if(W>3){var U=pn[W];Z+=bt(n,l)&(1<<U)-1,l+=U}if(l>d){a&&Ke(0);break}u&&o(p+131072);var Q=p+he;if(p<Z){var J=c-Z,ie=Math.min(Z,Q);for(J+p<0&&Ke(3);p<ie;++p)t[p]=i[J+p]}for(;p<Q;++p)t[p]=t[p-Z]}}e.l=m,e.p=ae,e.b=p,e.f=h,m&&(h=1,e.m=T,e.d=E,e.n=f)}while(!h);return p!=t.length&&s?Wt(t,0,p):t.subarray(0,p)},Dr=new Ve(0),Je=function(n,e){return n[e]|n[e+1]<<8},Qe=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Nt=function(n,e){return Qe(n,e)+Qe(n,e+4)*4294967296};function Ur(n,e){return Fr(n,{i:2},e&&e.out,e&&e.dictionary)}var Mt=typeof TextDecoder<"u"&&new TextDecoder,Br=0;try{Mt.decode(Dr,{stream:!0}),Br=1}catch{}var Gr=function(n){for(var e="",t=0;;){var i=n[t++],r=(i>127)+(i>223)+(i>239);if(t+r>n.length)return{s:e,r:Wt(n,t-1)};r?r==3?(i=((i&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?e+=String.fromCharCode((i&31)<<6|n[t++]&63):e+=String.fromCharCode((i&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(i)}};function En(n,e){if(e){for(var t="",i=0;i<n.length;i+=16384)t+=String.fromCharCode.apply(null,n.subarray(i,i+16384));return t}else{if(Mt)return Mt.decode(n);var r=Gr(n),c=r.s,t=r.r;return t.length&&Ke(8),c}}var jr=function(n,e){return e+30+Je(n,e+26)+Je(n,e+28)},Vr=function(n,e,t){var i=Je(n,e+28),r=En(n.subarray(e+46,e+46+i),!(Je(n,e+8)&2048)),c=e+46+i,s=Qe(n,e+20),u=t&&s==4294967295?zr(n,c):[s,Qe(n,e+24),Qe(n,e+42)],a=u[0],o=u[1],h=u[2];return[Je(n,e+10),a,o,r,c+Je(n,e+30)+Je(n,e+32),h]},zr=function(n,e){for(;Je(n,e)!=1;e+=4+Je(n,e+2));return[Nt(n,e+12),Nt(n,e+4),Nt(n,e+20)]};function Hr(n,e){for(var t={},i=n.length-22;Qe(n,i)!=101010256;--i)(!i||n.length-i>65558)&&Ke(13);var r=Je(n,i+8);if(!r)return{};var c=Qe(n,i+16),s=c==4294967295||r==65535;if(s){var u=Qe(n,i-12);s=Qe(n,u)==101075792,s&&(r=Qe(n,u+32),c=Qe(n,u+48))}for(var a=0;a<r;++a){var o=Vr(n,c,s),h=o[0],l=o[1],p=o[2],m=o[3],E=o[4],T=o[5],f=jr(n,T);c=E,h?h==8?t[m]=Ur(n.subarray(f,f+l),{out:new Ve(p)}):Ke(14,"unknown compression type "+h):t[m]=Wt(n,f,f+l)}return t}let Ft=null;async function Wr(n){const e=n.substring(0,n.length-4),t=new Ie.FileLoader;t.setResponseType("arraybuffer");const i=await t.loadAsync(n),r=Hr(new Uint8Array(i)),c=En(new Uint8Array(r[e].buffer));Ft=new _r(JSON.parse(c))}class Kr extends rt{initObject(e){let t;if(hn(e)?t=e:t="ERROR",Ft==null){const i=new Ie.BoxGeometry,r=new Ie.MeshStandardMaterial({color:16711680});return new Ie.Mesh(i,r)}else{const i={font:Ft,size:1,depth:.5,curveSegments:12},r=new Sr(t,i);r.center();const c=new Ie.MeshStandardMaterial({color:65280});return new Ie.Mesh(r,c)}}}function Xt(n,e){if(e===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===A.TriangleFanDrawMode||e===A.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const s=[],u=n.getAttribute("position");if(u!==void 0){for(let a=0;a<u.count;a++)s.push(a);n.setIndex(s),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(e===A.TriangleFanDrawMode)for(let s=1;s<=i;s++)r.push(t.getX(0)),r.push(t.getX(s)),r.push(t.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(r.push(t.getX(s)),r.push(t.getX(s+1)),r.push(t.getX(s+2))):(r.push(t.getX(s+2)),r.push(t.getX(s+1)),r.push(t.getX(s)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=n.clone();return c.setIndex(r),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class Yr extends A.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Jr(t)}),this.register(function(t){return new $r(t)}),this.register(function(t){return new ci(t)}),this.register(function(t){return new ui(t)}),this.register(function(t){return new li(t)}),this.register(function(t){return new ti(t)}),this.register(function(t){return new ni(t)}),this.register(function(t){return new ri(t)}),this.register(function(t){return new ii(t)}),this.register(function(t){return new Zr(t)}),this.register(function(t){return new oi(t)}),this.register(function(t){return new ei(t)}),this.register(function(t){return new ai(t)}),this.register(function(t){return new si(t)}),this.register(function(t){return new qr(t)}),this.register(function(t){return new fi(t)}),this.register(function(t){return new hi(t)})}load(e,t,i,r){const c=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const o=A.LoaderUtils.extractUrlBase(e);s=A.LoaderUtils.resolveURL(o,this.path)}else s=A.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const u=function(o){r?r(o):console.error(o),c.manager.itemError(e),c.manager.itemEnd(e)},a=new A.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{c.parse(o,s,function(h){t(h),c.manager.itemEnd(e)},u)}catch(h){u(h)}},i,u)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let c;const s={},u={},a=new TextDecoder;if(typeof e=="string")c=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===vn){try{s[Re.KHR_BINARY_GLTF]=new di(e)}catch(l){r&&r(l);return}c=JSON.parse(s[Re.KHR_BINARY_GLTF].content)}else c=JSON.parse(a.decode(e));else c=e;if(c.asset===void 0||c.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const o=new Si(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const l=this.pluginCallbacks[h](o);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),u[l.name]=l,s[l.name]=!0}if(c.extensionsUsed)for(let h=0;h<c.extensionsUsed.length;++h){const l=c.extensionsUsed[h],p=c.extensionsRequired||[];switch(l){case Re.KHR_MATERIALS_UNLIT:s[l]=new Qr;break;case Re.KHR_DRACO_MESH_COMPRESSION:s[l]=new pi(c,this.dracoLoader);break;case Re.KHR_TEXTURE_TRANSFORM:s[l]=new mi;break;case Re.KHR_MESH_QUANTIZATION:s[l]=new yi;break;default:p.indexOf(l)>=0&&u[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}o.setExtensions(s),o.setPlugins(u),o.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,c){i.parse(e,t,r,c)})}}function Xr(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class qr{constructor(e){this.parser=e,this.name=Re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const c=t[i];c.extensions&&c.extensions[this.name]&&c.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,c.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const c=t.json,a=((c.extensions&&c.extensions[this.name]||{}).lights||[])[e];let o;const h=new A.Color(16777215);a.color!==void 0&&h.setRGB(a.color[0],a.color[1],a.color[2],A.LinearSRGBColorSpace);const l=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new A.DirectionalLight(h),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new A.PointLight(h),o.distance=l;break;case"spot":o=new A.SpotLight(h),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),Ze(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),r=Promise.resolve(o),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,c=i.json.nodes[e],u=(c.extensions&&c.extensions[this.name]||{}).light;return u===void 0?null:this._loadLight(u).then(function(a){return i._getNodeRef(t.cache,u,a)})}}class Qr{constructor(){this.name=Re.KHR_MATERIALS_UNLIT}getMaterialType(){return A.MeshBasicMaterial}extendParams(e,t,i){const r=[];e.color=new A.Color(1,1,1),e.opacity=1;const c=t.pbrMetallicRoughness;if(c){if(Array.isArray(c.baseColorFactor)){const s=c.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],A.LinearSRGBColorSpace),e.opacity=s[3]}c.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",c.baseColorTexture,A.SRGBColorSpace))}return Promise.all(r)}}class Zr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name].emissiveStrength;return c!==void 0&&(t.emissiveIntensity=c),Promise.resolve()}}class Jr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(c.push(i.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const u=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new A.Vector2(u,u)}return Promise.all(c)}}class $r{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.dispersion=c.dispersion!==void 0?c.dispersion:0,Promise.resolve()}}class ei{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(c)}}class ti{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[];t.sheenColor=new A.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=r.extensions[this.name];if(s.sheenColorFactor!==void 0){const u=s.sheenColorFactor;t.sheenColor.setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&c.push(i.assignTexture(t,"sheenColorMap",s.sheenColorTexture,A.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(c)}}class ni{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&c.push(i.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(c)}}class ri{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&c.push(i.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const u=s.attenuationColor||[1,1,1];return t.attenuationColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),Promise.all(c)}}class ii{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.ior=c.ior!==void 0?c.ior:1.5,Promise.resolve()}}class oi{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&c.push(i.assignTexture(t,"specularIntensityMap",s.specularTexture));const u=s.specularColorFactor||[1,1,1];return t.specularColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&c.push(i.assignTexture(t,"specularColorMap",s.specularColorTexture,A.SRGBColorSpace)),Promise.all(c)}}class si{constructor(e){this.parser=e,this.name=Re.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&c.push(i.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(c)}}class ai{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&c.push(i.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(c)}}class ci{constructor(e){this.parser=e,this.name=Re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const c=r.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,c.source,s)}}class ui{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class li{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class fi{constructor(e){this.name=Re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],c=this.parser.getDependency("buffer",r.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return c.then(function(u){const a=r.byteOffset||0,o=r.byteLength||0,h=r.count,l=r.byteStride,p=new Uint8Array(u,a,o);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(h,l,p,r.mode,r.filter).then(function(m){return m.buffer}):s.ready.then(function(){const m=new ArrayBuffer(h*l);return s.decodeGltfBuffer(new Uint8Array(m),h,l,p,r.mode,r.filter),m})})}else return null}}class hi{constructor(e){this.name=Re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const o of r.primitives)if(o.mode!==We.TRIANGLES&&o.mode!==We.TRIANGLE_STRIP&&o.mode!==We.TRIANGLE_FAN&&o.mode!==void 0)return null;const s=i.extensions[this.name].attributes,u=[],a={};for(const o in s)u.push(this.parser.getDependency("accessor",s[o]).then(h=>(a[o]=h,a[o])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(o=>{const h=o.pop(),l=h.isGroup?h.children:[h],p=o[0].count,m=[];for(const E of l){const T=new A.Matrix4,f=new A.Vector3,d=new A.Quaternion,y=new A.Vector3(1,1,1),v=new A.InstancedMesh(E.geometry,E.material,p);for(let g=0;g<p;g++)a.TRANSLATION&&f.fromBufferAttribute(a.TRANSLATION,g),a.ROTATION&&d.fromBufferAttribute(a.ROTATION,g),a.SCALE&&y.fromBufferAttribute(a.SCALE,g),v.setMatrixAt(g,T.compose(f,d,y));for(const g in a)if(g==="_COLOR_0"){const b=a[g];v.instanceColor=new A.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&E.geometry.setAttribute(g,a[g]);A.Object3D.prototype.copy.call(v,E),this.parser.assignFinalMaterial(v),m.push(v)}return h.isGroup?(h.clear(),h.add(...m),h):m[0]}))}}const vn="glTF",ht=12,qt={JSON:1313821514,BIN:5130562};class di{constructor(e){this.name=Re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ht),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==vn)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-ht,c=new DataView(e,ht);let s=0;for(;s<r;){const u=c.getUint32(s,!0);s+=4;const a=c.getUint32(s,!0);if(s+=4,a===qt.JSON){const o=new Uint8Array(e,ht+s,u);this.content=i.decode(o)}else if(a===qt.BIN){const o=ht+s;this.body=e.slice(o,o+u)}s+=u}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pi{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,c=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,u={},a={},o={};for(const h in s){const l=Dt[h]||h.toLowerCase();u[l]=s[h]}for(const h in e.attributes){const l=Dt[h]||h.toLowerCase();if(s[h]!==void 0){const p=i.accessors[e.attributes[h]],m=ft[p.componentType];o[l]=m.name,a[l]=p.normalized===!0}}return t.getDependency("bufferView",c).then(function(h){return new Promise(function(l,p){r.decodeDracoFile(h,function(m){for(const E in m.attributes){const T=m.attributes[E],f=a[E];f!==void 0&&(T.normalized=f)}l(m)},u,o,A.LinearSRGBColorSpace,p)})})}}class mi{constructor(){this.name=Re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class yi{constructor(){this.name=Re.KHR_MESH_QUANTIZATION}}class Rn extends A.Interpolant{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,c=e*r*3+r;for(let s=0;s!==r;s++)t[s]=i[c+s];return t}interpolate_(e,t,i,r){const c=this.resultBuffer,s=this.sampleValues,u=this.valueSize,a=u*2,o=u*3,h=r-t,l=(i-t)/h,p=l*l,m=p*l,E=e*o,T=E-o,f=-2*m+3*p,d=m-p,y=1-f,v=d-p+l;for(let g=0;g!==u;g++){const b=s[T+g+u],w=s[T+g+a]*h,P=s[E+g+u],K=s[E+g]*h;c[g]=y*b+v*w+f*P+d*K}return c}}const gi=new A.Quaternion;class Ti extends Rn{interpolate_(e,t,i,r){const c=super.interpolate_(e,t,i,r);return gi.fromArray(c).normalize().toArray(c),c}}const We={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ft={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qt={9728:A.NearestFilter,9729:A.LinearFilter,9984:A.NearestMipmapNearestFilter,9985:A.LinearMipmapNearestFilter,9986:A.NearestMipmapLinearFilter,9987:A.LinearMipmapLinearFilter},Zt={33071:A.ClampToEdgeWrapping,33648:A.MirroredRepeatWrapping,10497:A.RepeatWrapping},xt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Dt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},nt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ei={CUBICSPLINE:void 0,LINEAR:A.InterpolateLinear,STEP:A.InterpolateDiscrete},kt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function vi(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new A.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:A.FrontSide})),n.DefaultMaterial}function it(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Ze(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ri(n,e,t){let i=!1,r=!1,c=!1;for(let o=0,h=e.length;o<h;o++){const l=e[o];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(r=!0),l.COLOR_0!==void 0&&(c=!0),i&&r&&c)break}if(!i&&!r&&!c)return Promise.resolve(n);const s=[],u=[],a=[];for(let o=0,h=e.length;o<h;o++){const l=e[o];if(i){const p=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):n.attributes.position;s.push(p)}if(r){const p=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):n.attributes.normal;u.push(p)}if(c){const p=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):n.attributes.color;a.push(p)}}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a)]).then(function(o){const h=o[0],l=o[1],p=o[2];return i&&(n.morphAttributes.position=h),r&&(n.morphAttributes.normal=l),c&&(n.morphAttributes.color=p),n.morphTargetsRelative=!0,n})}function Ai(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function _i(n){let e;const t=n.extensions&&n.extensions[Re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ct(t.attributes):e=n.indices+":"+Ct(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Ct(n.targets[i]);return e}function Ct(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function Ut(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Li(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Oi=new A.Matrix4;class Si{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Xr,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,c=!1,s=-1;if(typeof navigator<"u"){const u=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(u)===!0;const a=u.match(/Version\/(\d+)/);r=i&&a?parseInt(a[1],10):-1,c=u.indexOf("Firefox")>-1,s=c?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||c&&s<98?this.textureLoader=new A.TextureLoader(this.options.manager):this.textureLoader=new A.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new A.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,c=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const u={scene:s[0][r.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:r.asset,parser:i,userData:{}};return it(c,u,r),Ze(u,r),Promise.all(i._invokeAll(function(a){return a.afterRoot&&a.afterRoot(u)})).then(function(){for(const a of u.scenes)a.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,c=t.length;r<c;r++){const s=t[r].joints;for(let u=0,a=s.length;u<a;u++)e[s[u]].isBone=!0}for(let r=0,c=e.length;r<c;r++){const s=e[r];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),c=(s,u)=>{const a=this.associations.get(s);a!=null&&this.associations.set(u,a);for(const[o,h]of s.children.entries())c(h,u.children[o])};return c(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const c=e(t[r]);c&&i.push(c)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(c){return c.loadNode&&c.loadNode(t)});break;case"mesh":r=this._invokeOne(function(c){return c.loadMesh&&c.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(c){return c.loadBufferView&&c.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(c){return c.loadMaterial&&c.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(c){return c.loadTexture&&c.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(c){return c.loadAnimation&&c.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(c){return c!=this&&c.getDependency&&c.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(c,s){return i.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Re.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(c,s){i.load(A.LoaderUtils.resolveURL(t.uri,r.path),c,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,c=t.byteOffset||0;return i.slice(c,c+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const s=xt[r.type],u=ft[r.componentType],a=r.normalized===!0,o=new u(r.count*s);return Promise.resolve(new A.BufferAttribute(o,s,a))}const c=[];return r.bufferView!==void 0?c.push(this.getDependency("bufferView",r.bufferView)):c.push(null),r.sparse!==void 0&&(c.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),c.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(c).then(function(s){const u=s[0],a=xt[r.type],o=ft[r.componentType],h=o.BYTES_PER_ELEMENT,l=h*a,p=r.byteOffset||0,m=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,E=r.normalized===!0;let T,f;if(m&&m!==l){const d=Math.floor(p/m),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+d+":"+r.count;let v=t.cache.get(y);v||(T=new o(u,d*m,r.count*m/h),v=new A.InterleavedBuffer(T,m/h),t.cache.add(y,v)),f=new A.InterleavedBufferAttribute(v,a,p%m/h,E)}else u===null?T=new o(r.count*a):T=new o(u,p,r.count*a),f=new A.BufferAttribute(T,a,E);if(r.sparse!==void 0){const d=xt.SCALAR,y=ft[r.sparse.indices.componentType],v=r.sparse.indices.byteOffset||0,g=r.sparse.values.byteOffset||0,b=new y(s[1],v,r.sparse.count*d),w=new o(s[2],g,r.sparse.count*a);u!==null&&(f=new A.BufferAttribute(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let P=0,K=b.length;P<K;P++){const S=b[P];if(f.setX(S,w[P*a]),a>=2&&f.setY(S,w[P*a+1]),a>=3&&f.setZ(S,w[P*a+2]),a>=4&&f.setW(S,w[P*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=E}return f})}loadTexture(e){const t=this.json,i=this.options,c=t.textures[e].source,s=t.images[c];let u=this.textureLoader;if(s.uri){const a=i.manager.getHandler(s.uri);a!==null&&(u=a)}return this.loadTextureImage(e,c,u)}loadTextureImage(e,t,i){const r=this,c=this.json,s=c.textures[e],u=c.images[t],a=(u.uri||u.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const o=this.loadImageSource(t,i).then(function(h){h.flipY=!1,h.name=s.name||u.name||"",h.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(h.name=u.uri);const p=(c.samplers||{})[s.sampler]||{};return h.magFilter=Qt[p.magFilter]||A.LinearFilter,h.minFilter=Qt[p.minFilter]||A.LinearMipmapLinearFilter,h.wrapS=Zt[p.wrapS]||A.RepeatWrapping,h.wrapT=Zt[p.wrapT]||A.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==A.NearestFilter&&h.minFilter!==A.LinearFilter,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[a]=o,o}loadImageSource(e,t){const i=this,r=this.json,c=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const s=r.images[e],u=self.URL||self.webkitURL;let a=s.uri||"",o=!1;if(s.bufferView!==void 0)a=i.getDependency("bufferView",s.bufferView).then(function(l){o=!0;const p=new Blob([l],{type:s.mimeType});return a=u.createObjectURL(p),a});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(l){return new Promise(function(p,m){let E=p;t.isImageBitmapLoader===!0&&(E=function(T){const f=new A.Texture(T);f.needsUpdate=!0,p(f)}),t.load(A.LoaderUtils.resolveURL(l,c.path),E,void 0,m)})}).then(function(l){return o===!0&&u.revokeObjectURL(a),Ze(l,s),l.userData.mimeType=s.mimeType||Li(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),l});return this.sourceCache[e]=h,h}assignTexture(e,t,i,r){const c=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),c.extensions[Re.KHR_TEXTURE_TRANSFORM]){const u=i.extensions!==void 0?i.extensions[Re.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const a=c.associations.get(s);s=c.extensions[Re.KHR_TEXTURE_TRANSFORM].extendTexture(s,u),c.associations.set(s,a)}}return r!==void 0&&(s.colorSpace=r),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,c=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.PointsMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,a.sizeAttenuation=!1,this.cache.add(u,a)),i=a}else if(e.isLine){const u="LineBasicMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.LineBasicMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,this.cache.add(u,a)),i=a}if(r||c||s){let u="ClonedMaterial:"+i.uuid+":";r&&(u+="derivative-tangents:"),c&&(u+="vertex-colors:"),s&&(u+="flat-shading:");let a=this.cache.get(u);a||(a=i.clone(),c&&(a.vertexColors=!0),s&&(a.flatShading=!0),r&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(u,a),this.associations.set(a,this.associations.get(i))),i=a}e.material=i}getMaterialType(){return A.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,r=this.extensions,c=i.materials[e];let s;const u={},a=c.extensions||{},o=[];if(a[Re.KHR_MATERIALS_UNLIT]){const l=r[Re.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),o.push(l.extendParams(u,c,t))}else{const l=c.pbrMetallicRoughness||{};if(u.color=new A.Color(1,1,1),u.opacity=1,Array.isArray(l.baseColorFactor)){const p=l.baseColorFactor;u.color.setRGB(p[0],p[1],p[2],A.LinearSRGBColorSpace),u.opacity=p[3]}l.baseColorTexture!==void 0&&o.push(t.assignTexture(u,"map",l.baseColorTexture,A.SRGBColorSpace)),u.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,u.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(o.push(t.assignTexture(u,"metalnessMap",l.metallicRoughnessTexture)),o.push(t.assignTexture(u,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,u)})))}c.doubleSided===!0&&(u.side=A.DoubleSide);const h=c.alphaMode||kt.OPAQUE;if(h===kt.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,h===kt.MASK&&(u.alphaTest=c.alphaCutoff!==void 0?c.alphaCutoff:.5)),c.normalTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"normalMap",c.normalTexture)),u.normalScale=new A.Vector2(1,1),c.normalTexture.scale!==void 0)){const l=c.normalTexture.scale;u.normalScale.set(l,l)}if(c.occlusionTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"aoMap",c.occlusionTexture)),c.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=c.occlusionTexture.strength)),c.emissiveFactor!==void 0&&s!==A.MeshBasicMaterial){const l=c.emissiveFactor;u.emissive=new A.Color().setRGB(l[0],l[1],l[2],A.LinearSRGBColorSpace)}return c.emissiveTexture!==void 0&&s!==A.MeshBasicMaterial&&o.push(t.assignTexture(u,"emissiveMap",c.emissiveTexture,A.SRGBColorSpace)),Promise.all(o).then(function(){const l=new s(u);return c.name&&(l.name=c.name),Ze(l,c),t.associations.set(l,{materials:e}),c.extensions&&it(r,l,c),l})}createUniqueName(e){const t=A.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function c(u){return i[Re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(a){return Jt(a,u,t)})}const s=[];for(let u=0,a=e.length;u<a;u++){const o=e[u],h=_i(o),l=r[h];if(l)s.push(l.promise);else{let p;o.extensions&&o.extensions[Re.KHR_DRACO_MESH_COMPRESSION]?p=c(o):p=Jt(new A.BufferGeometry,o,t),r[h]={primitive:o,promise:p},s.push(p)}}return Promise.all(s)}loadMesh(e){const t=this,i=this.json,r=this.extensions,c=i.meshes[e],s=c.primitives,u=[];for(let a=0,o=s.length;a<o;a++){const h=s[a].material===void 0?vi(this.cache):this.getDependency("material",s[a].material);u.push(h)}return u.push(t.loadGeometries(s)),Promise.all(u).then(function(a){const o=a.slice(0,a.length-1),h=a[a.length-1],l=[];for(let m=0,E=h.length;m<E;m++){const T=h[m],f=s[m];let d;const y=o[m];if(f.mode===We.TRIANGLES||f.mode===We.TRIANGLE_STRIP||f.mode===We.TRIANGLE_FAN||f.mode===void 0)d=c.isSkinnedMesh===!0?new A.SkinnedMesh(T,y):new A.Mesh(T,y),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),f.mode===We.TRIANGLE_STRIP?d.geometry=Xt(d.geometry,A.TriangleStripDrawMode):f.mode===We.TRIANGLE_FAN&&(d.geometry=Xt(d.geometry,A.TriangleFanDrawMode));else if(f.mode===We.LINES)d=new A.LineSegments(T,y);else if(f.mode===We.LINE_STRIP)d=new A.Line(T,y);else if(f.mode===We.LINE_LOOP)d=new A.LineLoop(T,y);else if(f.mode===We.POINTS)d=new A.Points(T,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(d.geometry.morphAttributes).length>0&&Ai(d,c),d.name=t.createUniqueName(c.name||"mesh_"+e),Ze(d,c),f.extensions&&it(r,d,f),t.assignFinalMaterial(d),l.push(d)}for(let m=0,E=l.length;m<E;m++)t.associations.set(l[m],{meshes:e,primitives:m});if(l.length===1)return c.extensions&&it(r,l[0],c),l[0];const p=new A.Group;c.extensions&&it(r,p,c),t.associations.set(p,{meshes:e});for(let m=0,E=l.length;m<E;m++)p.add(l[m]);return p})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new A.PerspectiveCamera(A.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new A.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Ze(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,c=t.joints.length;r<c;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const c=r.pop(),s=r,u=[],a=[];for(let o=0,h=s.length;o<h;o++){const l=s[o];if(l){u.push(l);const p=new A.Matrix4;c!==null&&p.fromArray(c.array,o*16),a.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new A.Skeleton(u,a)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],c=r.name?r.name:"animation_"+e,s=[],u=[],a=[],o=[],h=[];for(let l=0,p=r.channels.length;l<p;l++){const m=r.channels[l],E=r.samplers[m.sampler],T=m.target,f=T.node,d=r.parameters!==void 0?r.parameters[E.input]:E.input,y=r.parameters!==void 0?r.parameters[E.output]:E.output;T.node!==void 0&&(s.push(this.getDependency("node",f)),u.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",y)),o.push(E),h.push(T))}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a),Promise.all(o),Promise.all(h)]).then(function(l){const p=l[0],m=l[1],E=l[2],T=l[3],f=l[4],d=[];for(let v=0,g=p.length;v<g;v++){const b=p[v],w=m[v],P=E[v],K=T[v],S=f[v];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const G=i._createAnimationTracks(b,w,P,K,S);if(G)for(let x=0;x<G.length;x++)d.push(G[x])}const y=new A.AnimationClip(c,void 0,d);return Ze(y,r),y})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(c){const s=i._getNodeRef(i.meshCache,r.mesh,c);return r.weights!==void 0&&s.traverse(function(u){if(u.isMesh)for(let a=0,o=r.weights.length;a<o;a++)u.morphTargetInfluences[a]=r.weights[a]}),s})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],c=i._loadNodeShallow(e),s=[],u=r.children||[];for(let o=0,h=u.length;o<h;o++)s.push(i.getDependency("node",u[o]));const a=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([c,Promise.all(s),a]).then(function(o){const h=o[0],l=o[1],p=o[2];p!==null&&h.traverse(function(m){m.isSkinnedMesh&&m.bind(p,Oi)});for(let m=0,E=l.length;m<E;m++)h.add(l[m]);return h})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const c=t.nodes[e],s=c.name?r.createUniqueName(c.name):"",u=[],a=r._invokeOne(function(o){return o.createNodeMesh&&o.createNodeMesh(e)});return a&&u.push(a),c.camera!==void 0&&u.push(r.getDependency("camera",c.camera).then(function(o){return r._getNodeRef(r.cameraCache,c.camera,o)})),r._invokeAll(function(o){return o.createNodeAttachment&&o.createNodeAttachment(e)}).forEach(function(o){u.push(o)}),this.nodeCache[e]=Promise.all(u).then(function(o){let h;if(c.isBone===!0?h=new A.Bone:o.length>1?h=new A.Group:o.length===1?h=o[0]:h=new A.Object3D,h!==o[0])for(let l=0,p=o.length;l<p;l++)h.add(o[l]);if(c.name&&(h.userData.name=c.name,h.name=s),Ze(h,c),c.extensions&&it(i,h,c),c.matrix!==void 0){const l=new A.Matrix4;l.fromArray(c.matrix),h.applyMatrix4(l)}else c.translation!==void 0&&h.position.fromArray(c.translation),c.rotation!==void 0&&h.quaternion.fromArray(c.rotation),c.scale!==void 0&&h.scale.fromArray(c.scale);if(!r.associations.has(h))r.associations.set(h,{});else if(c.mesh!==void 0&&r.meshCache.refs[c.mesh]>1){const l=r.associations.get(h);r.associations.set(h,{...l})}return r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,c=new A.Group;i.name&&(c.name=r.createUniqueName(i.name)),Ze(c,i),i.extensions&&it(t,c,i);const s=i.nodes||[],u=[];for(let a=0,o=s.length;a<o;a++)u.push(r.getDependency("node",s[a]));return Promise.all(u).then(function(a){for(let h=0,l=a.length;h<l;h++)c.add(a[h]);const o=h=>{const l=new Map;for(const[p,m]of r.associations)(p instanceof A.Material||p instanceof A.Texture)&&l.set(p,m);return h.traverse(p=>{const m=r.associations.get(p);m!=null&&l.set(p,m)}),l};return r.associations=o(c),c})}_createAnimationTracks(e,t,i,r,c){const s=[],u=e.name?e.name:e.uuid,a=[];nt[c.path]===nt.weights?e.traverse(function(p){p.morphTargetInfluences&&a.push(p.name?p.name:p.uuid)}):a.push(u);let o;switch(nt[c.path]){case nt.weights:o=A.NumberKeyframeTrack;break;case nt.rotation:o=A.QuaternionKeyframeTrack;break;case nt.translation:case nt.scale:o=A.VectorKeyframeTrack;break;default:i.itemSize===1?o=A.NumberKeyframeTrack:o=A.VectorKeyframeTrack;break}const h=r.interpolation!==void 0?Ei[r.interpolation]:A.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let p=0,m=a.length;p<m;p++){const E=new o(a[p]+"."+nt[c.path],t.array,l,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),s.push(E)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=Ut(t.constructor),r=new Float32Array(t.length);for(let c=0,s=t.length;c<s;c++)r[c]=t[c]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof A.QuaternionKeyframeTrack?Ti:Rn;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ii(n,e,t){const i=e.attributes,r=new A.Box3;if(i.POSITION!==void 0){const u=t.json.accessors[i.POSITION],a=u.min,o=u.max;if(a!==void 0&&o!==void 0){if(r.set(new A.Vector3(a[0],a[1],a[2]),new A.Vector3(o[0],o[1],o[2])),u.normalized){const h=Ut(ft[u.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const c=e.targets;if(c!==void 0){const u=new A.Vector3,a=new A.Vector3;for(let o=0,h=c.length;o<h;o++){const l=c[o];if(l.POSITION!==void 0){const p=t.json.accessors[l.POSITION],m=p.min,E=p.max;if(m!==void 0&&E!==void 0){if(a.setX(Math.max(Math.abs(m[0]),Math.abs(E[0]))),a.setY(Math.max(Math.abs(m[1]),Math.abs(E[1]))),a.setZ(Math.max(Math.abs(m[2]),Math.abs(E[2]))),p.normalized){const T=Ut(ft[p.componentType]);a.multiplyScalar(T)}u.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(u)}n.boundingBox=r;const s=new A.Sphere;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=s}function Jt(n,e,t){const i=e.attributes,r=[];function c(s,u){return t.getDependency("accessor",s).then(function(a){n.setAttribute(u,a)})}for(const s in i){const u=Dt[s]||s.toLowerCase();u in n.attributes||r.push(c(i[s],u))}if(e.indices!==void 0&&!n.index){const s=t.getDependency("accessor",e.indices).then(function(u){n.setIndex(u)});r.push(s)}return A.ColorManagement.workingColorSpace!==A.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${A.ColorManagement.workingColorSpace}" not supported.`),Ze(n,e),Ii(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?Ri(n,e.targets,t):n})}const Pt=new WeakMap;class bi extends A.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const c=new A.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,s=>{this.parse(s,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,A.SRGBColorSpace,i).catch(i)}decodeDracoFile(e,t,i,r,c=A.LinearSRGBColorSpace,s=()=>{}){const u={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:c};return this.decodeGeometry(e,u).then(t).catch(s)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Pt.has(e)){const a=Pt.get(e);if(a.key===i)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const c=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(c,s).then(a=>(r=a,new Promise((o,h)=>{r._callbacks[c]={resolve:o,reject:h},r.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return u.catch(()=>!0).then(()=>{r&&c&&this._releaseTask(r,c)}),Pt.set(e,{key:i,promise:u}),u}_createGeometry(e){const t=new A.BufferGeometry;e.index&&t.setIndex(new A.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const{name:r,array:c,itemSize:s,stride:u,vertexColorSpace:a}=e.attributes[i];let o;if(s===u)o=new A.BufferAttribute(c,s);else{const h=new A.InterleavedBuffer(c,u);o=new A.InterleavedBufferAttribute(h,s,0)}r==="color"&&(this._assignVertexColorSpace(o,a),o.normalized=!(c instanceof Float32Array)),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==A.SRGBColorSpace)return;const i=new A.Color;for(let r=0,c=e.count;r<c;r++)i.fromBufferAttribute(e,r),A.ColorManagement.colorSpaceToWorking(i,A.SRGBColorSpace),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new A.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,c)=>{i.load(e,r,void 0,c)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const c=Ni.toString(),s=["/* draco decoder */",r,"","/* worker */",c.substring(c.indexOf("{")+1,c.lastIndexOf("}"))].join(`
|
|
156
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(c){const s=c.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,c){return r._taskLoad>c._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ni(){let n,e;onmessage=function(s){const u=s.data;switch(u.type){case"init":n=u.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(l){h({draco:l})},DracoDecoderModule(n)});break;case"decode":const a=u.buffer,o=u.taskConfig;e.then(h=>{const l=h.draco,p=new l.Decoder;try{const m=t(l,p,new Int8Array(a),o),E=m.attributes.map(T=>T.array.buffer);m.index&&E.push(m.index.array.buffer),self.postMessage({type:"decode",id:u.id,geometry:m},E)}catch(m){console.error(m),self.postMessage({type:"error",id:u.id,error:m.message})}finally{l.destroy(p)}});break}};function t(s,u,a,o){const h=o.attributeIDs,l=o.attributeTypes;let p,m;const E=u.GetEncodedGeometryType(a);if(E===s.TRIANGULAR_MESH)p=new s.Mesh,m=u.DecodeArrayToMesh(a,a.byteLength,p);else if(E===s.POINT_CLOUD)p=new s.PointCloud,m=u.DecodeArrayToPointCloud(a,a.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const T={index:null,attributes:[]};for(const f in h){const d=self[l[f]];let y,v;if(o.useUniqueIDs)v=h[f],y=u.GetAttributeByUniqueId(p,v);else{if(v=u.GetAttributeId(p,s[h[f]]),v===-1)continue;y=u.GetAttribute(p,v)}const g=r(s,u,p,f,d,y);f==="color"&&(g.vertexColorSpace=o.vertexColorSpace),T.attributes.push(g)}return E===s.TRIANGULAR_MESH&&(T.index=i(s,u,p)),s.destroy(p),T}function i(s,u,a){const h=a.num_faces()*3,l=h*4,p=s._malloc(l);u.GetTrianglesUInt32Array(a,l,p);const m=new Uint32Array(s.HEAPF32.buffer,p,h).slice();return s._free(p),{array:m,itemSize:1}}function r(s,u,a,o,h,l){const p=a.num_points(),m=l.num_components(),E=c(s,h),T=m*h.BYTES_PER_ELEMENT,f=Math.ceil(T/4)*4,d=f/h.BYTES_PER_ELEMENT,y=p*T,v=p*f,g=s._malloc(y);u.GetAttributeDataArrayForAllPoints(a,l,E,y,g);const b=new h(s.HEAPF32.buffer,g,y/h.BYTES_PER_ELEMENT);let w;if(T===f)w=b.slice();else{w=new h(v/h.BYTES_PER_ELEMENT);let P=0;for(let K=0,S=b.length;K<S;K++){for(let G=0;G<m;G++)w[P+G]=b[K*m+G];P+=d}}return s._free(g),{name:o,count:p,itemSize:m,array:w,stride:d}}function c(s,u){switch(u){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}function xi(n){return"morphTargetDictionary"in n&&n.morphTargetDictionary!==void 0&&"morphTargetInfluences"in n&&Array.isArray(n.morphTargetInfluences)}const An=new Yr,_n=new bi;_n.setDecoderPath("/examples/jsm/libs/draco/");An.setDRACOLoader(_n);class ki extends rt{ready;model=null;constructor(e){super(),this.ready=this.asyncInit(e),this.setControlMode("user")}initObject(){return new Ie.Object3D}async asyncInit(e){if(hn(e)){const t=await An.loadAsync(e),i=new Ie.AnimationMixer(t.scene),r={};console.log(`File: ${e}`),console.log(" actions:");for(let s=0;s<t.animations.length;s++){const u=t.animations[s],a=i.clipAction(u);r[u.name]=a,console.log(` ${u.name}`)}console.log(" morphs:");const c={};t.scene.traverse(s=>{if(xi(s)){const{morphTargetDictionary:u,morphTargetInfluences:a}=s;Object.keys(u).forEach(o=>{const h=s.name+"."+o,l=u[o];c[h]={array:a,idx:l},console.log(` ${h}`)})}}),this.model={gltf:t,mixer:i,actions:r,morphs:c},this.object.add(this.model.gltf.scene)}else{const t=new Ie.BoxGeometry,i=new Ie.MeshStandardMaterial({color:16711680}),r=new Ie.Mesh(t,i);this.object.add(r)}return this}action(e){if(this.model){this.model.mixer.stopAllAction();const t=this.model.actions[e];t&&t.play()}}morph(e,t){if(this.model&&e in this.model.morphs){const{array:i,idx:r}=this.model.morphs[e];i[r]=t}}update(e){this.model&&this.model.mixer.update(e)}}class Ci extends rt{ready;constructor(e){super(),this.ready=this.asyncInit(e)}initObject(){return new Ie.Object3D}async asyncInit(e){const t=await Mn(e),i=await ur(t,"axis.wrl");return this.object.add(i),this}}class Pi extends rt{constructor(e){super(e)}initObject(e){return e}}class wi extends rt{constructor(...e){super(e)}initObject(e){const t=e.filter(a=>typeof a=="number"),i=e.filter(a=>typeof a=="string"),r=new Ie.BoxGeometry(...t),c=i.length>0?i[0]:"rgb(128,128,128)",s=new Ie.MeshStandardMaterial({color:c});return new Ie.Mesh(r,s)}}exports.Acerola3D=Ci;exports.Box=wi;exports.Camera=un;exports.Canvas=ln;exports.GLTFA3=ki;exports.GeneralCamera=mt;exports.ObjectA3=rt;exports.Quat=st;exports.Scene=lt;exports.Test=Rr;exports.Text3D=Kr;exports.ThreeJS=Pi;exports.Vec3=je;exports.ViewBase=Ht;exports.Window=fn;exports.asyncSleep=wn;exports.initFont=Wr;exports.times2=Pn;
|
|
155
|
+
Please avoid using it as it will be completely removed in the future`)}n.clearCache=l;var m=Kr();Object.defineProperty(n,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return m.createSyntaxDiagramsCode}});var p=(function(){function E(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
|
|
156
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return E})();n.Parser=p});const ot=Yr();class Xr extends A.Loader{constructor(e){super(e)}load(e,t,r,i){const c=this,s=c.path===""?A.LoaderUtils.extractUrlBase(e):c.path,u=new A.FileLoader(c.manager);u.setPath(c.path),u.setRequestHeader(c.requestHeader),u.setWithCredentials(c.withCredentials),u.load(e,function(a){try{t(c.parse(a,s))}catch(o){i?i(o):console.error(o),c.manager.itemError(e)}},r,i)}parse(e,t){const r={};function i(O){const R=c(),_=new qr(R.tokens),N=new Zr(R.tokenVocabulary),L=s(N.getBaseCstVisitorConstructor()),x=_.lex(O);N.input=x.tokens;const F=N.vrml();if(N.errors.length>0)throw console.error(N.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return L.visit(F)}function c(){const O=ot.createToken,R=O({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),_=O({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]([^\0-\x20\x22\x27\x23\x2b\x2c\x2e\x5b\x5d\x5c\x7b\x7d])*/,longer_alt:R}),N=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],L=O({name:"Version",pattern:/#VRML.*/,longer_alt:_}),x=O({name:"NodeName",pattern:new RegExp(N.join("|")),longer_alt:_}),F=O({name:"DEF",pattern:/DEF/,longer_alt:_}),B=O({name:"USE",pattern:/USE/,longer_alt:_}),z=O({name:"ROUTE",pattern:/ROUTE/,longer_alt:_}),J=O({name:"TO",pattern:/TO/,longer_alt:_}),re=O({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),ye=O({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),Se=O({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Me=O({name:"TrueLiteral",pattern:/TRUE/}),be=O({name:"FalseLiteral",pattern:/FALSE/}),Te=O({name:"NullLiteral",pattern:/NULL/}),ve=O({name:"LSquare",pattern:/\[/}),Ne=O({name:"RSquare",pattern:/]/}),Ce=O({name:"LCurly",pattern:/{/}),Le=O({name:"RCurly",pattern:/}/}),we=O({name:"Comment",pattern:/#.*/,group:ot.Lexer.SKIPPED}),Ue=[O({name:"WhiteSpace",pattern:/[ ,\s]/,group:ot.Lexer.SKIPPED}),x,F,B,z,J,Me,be,Te,L,_,R,re,ye,Se,ve,Ne,Ce,Le,we],Be={};for(let Oe=0,ue=Ue.length;Oe<ue;Oe++){const le=Ue[Oe];Be[le.name]=le}return{tokens:Ue,tokenVocabulary:Be}}function s(O){class R extends O{constructor(){super(),this.validateVisitor()}vrml(L){const x={version:this.visit(L.version),nodes:[],routes:[]};for(let F=0,B=L.node.length;F<B;F++){const z=L.node[F];x.nodes.push(this.visit(z))}if(L.route)for(let F=0,B=L.route.length;F<B;F++){const z=L.route[F];x.routes.push(this.visit(z))}return x}version(L){return L.Version[0].image}node(L){const x={name:L.NodeName[0].image,fields:[]};if(L.field)for(let F=0,B=L.field.length;F<B;F++){const z=L.field[F];x.fields.push(this.visit(z))}return L.def&&(x.DEF=this.visit(L.def[0])),x}field(L){const x={name:L.Identifier[0].image,type:null,values:null};let F;return L.singleFieldValue&&(F=this.visit(L.singleFieldValue[0])),L.multiFieldValue&&(F=this.visit(L.multiFieldValue[0])),x.type=F.type,x.values=F.values,x}def(L){return(L.Identifier||L.NodeName)[0].image}use(L){return{USE:(L.Identifier||L.NodeName)[0].image}}singleFieldValue(L){return _(this,L)}multiFieldValue(L){return _(this,L)}route(L){return{FROM:L.RouteIdentifier[0].image,TO:L.RouteIdentifier[1].image}}}function _(N,L){const x={type:null,values:[]};if(L.node){x.type="node";for(let F=0,B=L.node.length;F<B;F++){const z=L.node[F];x.values.push(N.visit(z))}}if(L.use){x.type="use";for(let F=0,B=L.use.length;F<B;F++){const z=L.use[F];x.values.push(N.visit(z))}}if(L.StringLiteral){x.type="string";for(let F=0,B=L.StringLiteral.length;F<B;F++){const z=L.StringLiteral[F];x.values.push(z.image.replace(/'|"/g,""))}}if(L.NumberLiteral){x.type="number";for(let F=0,B=L.NumberLiteral.length;F<B;F++){const z=L.NumberLiteral[F];x.values.push(parseFloat(z.image))}}if(L.HexLiteral){x.type="hex";for(let F=0,B=L.HexLiteral.length;F<B;F++){const z=L.HexLiteral[F];x.values.push(z.image)}}if(L.TrueLiteral){x.type="boolean";for(let F=0,B=L.TrueLiteral.length;F<B;F++)L.TrueLiteral[F].image==="TRUE"&&x.values.push(!0)}if(L.FalseLiteral){x.type="boolean";for(let F=0,B=L.FalseLiteral.length;F<B;F++)L.FalseLiteral[F].image==="FALSE"&&x.values.push(!1)}return L.NullLiteral&&(x.type="null",L.NullLiteral.forEach(function(){x.values.push(null)})),x}return new R}function u(O){const R=O.nodes,_=new A.Scene;for(let N=0,L=R.length;N<L;N++){const x=R[N];a(x)}for(let N=0,L=R.length;N<L;N++){const x=R[N],F=o(x);F instanceof A.Object3D&&_.add(F),x.name==="WorldInfo"&&(_.userData.worldInfo=F)}return _}function a(O){O.DEF&&(r[O.DEF]=O);const R=O.fields;for(let _=0,N=R.length;_<N;_++){const L=R[_];if(L.type==="node"){const x=L.values;for(let F=0,B=x.length;F<B;F++)a(x[F])}}}function o(O){return O.USE?Q(O.USE):(O.build!==void 0||(O.build=h(O)),O.build)}function h(O){const R=O.name;let _;switch(R){case"Anchor":case"Group":case"Transform":case"Collision":_=l(O);break;case"Background":_=m(O);break;case"Shape":_=p(O);break;case"Appearance":_=E(O);break;case"Material":_=T(O);break;case"ImageTexture":_=v(O);break;case"PixelTexture":_=y(O);break;case"TextureTransform":_=g(O);break;case"IndexedFaceSet":_=C(O);break;case"IndexedLineSet":_=Y(O);break;case"PointSet":_=I(O);break;case"Box":_=G(O);break;case"Cone":_=M(O);break;case"Cylinder":_=S(O);break;case"Sphere":_=P(O);break;case"ElevationGrid":_=k(O);break;case"Extrusion":_=X(O);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":_=b(O);break;case"WorldInfo":_=w(O);break;case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",R);break}return _!==void 0&&O.DEF!==void 0&&_.hasOwnProperty("name")===!0&&(_.name=O.DEF),_}function l(O){const R=new A.Group,_=O.fields;for(let N=0,L=_.length;N<L;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":H(B,R);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const z=new A.Vector3(B[0],B[1],B[2]).normalize(),J=B[3];R.quaternion.setFromAxisAngle(z,J);break;case"scale":R.scale.set(B[0],B[1],B[2]);break;case"scaleOrientation":break;case"translation":R.position.set(B[0],B[1],B[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function m(O){const R=new A.Group;let _,N,L,x;const F=O.fields;for(let z=0,J=F.length;z<J;z++){const re=F[z],ye=re.name,Se=re.values;switch(ye){case"groundAngle":_=Se;break;case"groundColor":N=Se;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":L=Se;break;case"skyColor":x=Se;break;default:console.warn("THREE.VRMLLoader: Unknown field:",ye);break}}const B=1e4;if(x){const z=new A.SphereGeometry(B,32,16),J=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,depthWrite:!1,depthTest:!1});x.length>3?(V(z,B,L,D(x),!0),J.vertexColors=!0):J.color.setRGB(x[0],x[1],x[2],A.SRGBColorSpace);const re=new A.Mesh(z,J);R.add(re)}if(N&&N.length>0){const z=new A.SphereGeometry(B,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),J=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});V(z,B,_,D(N),!1);const re=new A.Mesh(z,J);R.add(re)}return R.renderOrder=-1/0,R}function p(O){const R=O.fields;let _=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0}),N;for(let x=0,F=R.length;x<F;x++){const B=R[x],z=B.name,J=B.values;switch(z){case"appearance":J[0]!==null&&(_=o(J[0]));break;case"geometry":J[0]!==null&&(N=o(J[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",z);break}}let L;if(N&&N.attributes.position){const x=N._type;if(x==="points"){const F=new A.PointsMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),L=new A.Points(N,F)}else if(x==="line"){const F=new A.LineBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),L=new A.LineSegments(N,F)}else N._solid!==void 0&&(_.side=N._solid?A.FrontSide:A.DoubleSide),N.attributes.color!==void 0&&(_.vertexColors=!0),L=new A.Mesh(N,_)}else L=new A.Object3D,L.visible=!1;return L}function E(O){let R=new A.MeshPhongMaterial,_;const N=O.fields;for(let L=0,x=N.length;L<x;L++){const F=N[L],B=F.name,z=F.values;switch(B){case"material":if(z[0]!==null){const re=o(z[0]);re.diffuseColor&&R.color.copy(re.diffuseColor),re.emissiveColor&&R.emissive.copy(re.emissiveColor),re.shininess&&(R.shininess=re.shininess),re.specularColor&&R.specular.copy(re.specularColor),re.transparency&&(R.opacity=1-re.transparency),re.transparency>0&&(R.transparent=!0)}else R=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const J=z[0];J!==null&&(J.name==="ImageTexture"||J.name==="PixelTexture")&&(R.map=o(J));break;case"textureTransform":z[0]!==null&&(_=o(z[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",B);break}}if(R.map){if(R.map.__type){switch(R.map.__type){case Ke.INTENSITY_ALPHA:R.opacity=1;break;case Ke.RGB:R.color.set(16777215);break;case Ke.RGBA:R.color.set(16777215),R.opacity=1;break}delete R.map.__type}_&&(R.map.center.copy(_.center),R.map.rotation=_.rotation,R.map.repeat.copy(_.scale),R.map.offset.copy(_.translation))}return R}function T(O){const R={},_=O.fields;for(let N=0,L=_.length;N<L;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"ambientIntensity":break;case"diffuseColor":R.diffuseColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"emissiveColor":R.emissiveColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"shininess":R.shininess=B[0];break;case"specularColor":R.specularColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"transparency":R.transparency=B[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function f(O,R,_){let N;switch(R){case Ke.INTENSITY:N=parseInt(O),_.r=N,_.g=N,_.b=N,_.a=1;break;case Ke.INTENSITY_ALPHA:N=parseInt("0x"+O.substring(2,4)),_.r=N,_.g=N,_.b=N,_.a=parseInt("0x"+O.substring(4,6));break;case Ke.RGB:_.r=parseInt("0x"+O.substring(2,4)),_.g=parseInt("0x"+O.substring(4,6)),_.b=parseInt("0x"+O.substring(6,8)),_.a=1;break;case Ke.RGBA:_.r=parseInt("0x"+O.substring(2,4)),_.g=parseInt("0x"+O.substring(4,6)),_.b=parseInt("0x"+O.substring(6,8)),_.a=parseInt("0x"+O.substring(8,10));break}}function d(O){let R;switch(O){case 1:R=Ke.INTENSITY;break;case 2:R=Ke.INTENSITY_ALPHA;break;case 3:R=Ke.RGB;break;case 4:R=Ke.RGBA;break}return R}function y(O){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const L=O.fields;for(let x=0,F=L.length;x<F;x++){const B=L[x],z=B.name,J=B.values;switch(z){case"image":const re=J[0],ye=J[1],Se=J[2],Me=d(Se),be=new Uint8Array(4*re*ye),Te={r:0,g:0,b:0,a:0};for(let ve=3,Ne=0,Ce=J.length;ve<Ce;ve++,Ne++){f(J[ve],Me,Te);const Le=Ne*4;be[Le+0]=Te.r,be[Le+1]=Te.g,be[Le+2]=Te.b,be[Le+3]=Te.a}R=new A.DataTexture(be,re,ye),R.colorSpace=A.SRGBColorSpace,R.needsUpdate=!0,R.__type=Me;break;case"repeatS":J[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":J[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",z);break}}return R&&(R.wrapS=_,R.wrapT=N),R}function v(O){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const L=O.fields;for(let x=0,F=L.length;x<F;x++){const B=L[x],z=B.name,J=B.values;switch(z){case"url":const re=J[0];re&&(R=ee.load(re));break;case"repeatS":J[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":J[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",z);break}}return R&&(R.wrapS=_,R.wrapT=N,R.colorSpace=A.SRGBColorSpace),R}function g(O){const R={center:new A.Vector2,rotation:new A.Vector2,scale:new A.Vector2,translation:new A.Vector2},_=O.fields;for(let N=0,L=_.length;N<L;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"center":R.center.set(B[0],B[1]);break;case"rotation":R.rotation=B[0];break;case"scale":R.scale.set(B[0],B[1]);break;case"translation":R.translation.set(B[0],B[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function b(O){return O.fields[0].values}function w(O){const R={},_=O.fields;for(let N=0,L=_.length;N<L;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"title":R.title=B[0];break;case"info":R.info=B;break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function C(O){let R,_,N,L,x=!0,F=!0,B=0,z,J,re,ye,Se=!0,Me=!0;const be=O.fields;for(let ke=0,Ue=be.length;ke<Ue;ke++){const Be=be[ke],Oe=Be.name,ue=Be.values;switch(Oe){case"color":const le=ue[0];le!==null&&(R=o(le));break;case"coord":const oe=ue[0];oe!==null&&(_=o(oe));break;case"normal":const fe=ue[0];fe!==null&&(N=o(fe));break;case"texCoord":const pe=ue[0];pe!==null&&(L=o(pe));break;case"ccw":x=ue[0];break;case"colorIndex":z=ue;break;case"colorPerVertex":Se=ue[0];break;case"convex":break;case"coordIndex":J=ue;break;case"creaseAngle":B=ue[0];break;case"normalIndex":re=ue;break;case"normalPerVertex":Me=ue[0];break;case"solid":F=ue[0];break;case"texCoordIndex":ye=ue;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Oe);break}}if(J===void 0)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new A.BufferGeometry;const Te=$(J,x);let ve,Ne,Ce;if(R){if(Se===!0)if(z&&z.length>0){const ke=$(z,x);ve=Z(Te,ke,R,3)}else ve=me(Te,new A.Float32BufferAttribute(R,3));else if(z&&z.length>0){const ke=ae(R,z),Ue=te(ke,J);ve=ie(Te,Ue)}else{const ke=te(R,J);ve=ie(Te,ke)}K(ve)}if(N)if(Me===!0)if(re&&re.length>0){const ke=$(re,x);Ne=Z(Te,ke,N,3)}else Ne=me(Te,new A.Float32BufferAttribute(N,3));else if(re&&re.length>0){const ke=ae(N,re),Ue=te(ke,J);Ne=ie(Te,Ue)}else{const ke=te(N,J);Ne=ie(Te,ke)}else Ne=ze(Te,_,B);if(L)if(ye&&ye.length>0){const ke=$(ye,x);Ce=Z(Te,ke,L,2)}else Ce=me(Te,new A.Float32BufferAttribute(L,2));const Le=new A.BufferGeometry,we=me(Te,new A.Float32BufferAttribute(_,3));return Le.setAttribute("position",we),Le.setAttribute("normal",Ne),ve&&Le.setAttribute("color",ve),Ce&&Le.setAttribute("uv",Ce),Le._solid=F,Le._type="mesh",Le}function Y(O){let R,_,N,L,x=!0;const F=O.fields;for(let ye=0,Se=F.length;ye<Se;ye++){const Me=F[ye],be=Me.name,Te=Me.values;switch(be){case"color":const ve=Te[0];ve!==null&&(R=o(ve));break;case"coord":const Ne=Te[0];Ne!==null&&(_=o(Ne));break;case"colorIndex":N=Te;break;case"colorPerVertex":x=Te[0];break;case"coordIndex":L=Te;break;default:console.warn("THREE.VRMLLoader: Unknown field:",be);break}}let B;const z=se(L);if(R){if(x===!0)if(N.length>0){const ye=se(N);B=Z(z,ye,R,3)}else B=me(z,new A.Float32BufferAttribute(R,3));else if(N.length>0){const ye=ae(R,N),Se=ce(ye,L);B=ge(z,Se)}else{const ye=ce(R,L);B=ge(z,ye)}K(B)}const J=new A.BufferGeometry,re=me(z,new A.Float32BufferAttribute(_,3));return J.setAttribute("position",re),B&&J.setAttribute("color",B),J._type="line",J}function I(O){let R,_;const N=O.fields;for(let x=0,F=N.length;x<F;x++){const B=N[x],z=B.name,J=B.values;switch(z){case"color":const re=J[0];re!==null&&(R=o(re));break;case"coord":const ye=J[0];ye!==null&&(_=o(ye));break;default:console.warn("THREE.VRMLLoader: Unknown field:",z);break}}const L=new A.BufferGeometry;if(L.setAttribute("position",new A.Float32BufferAttribute(_,3)),R){const x=new A.Float32BufferAttribute(R,3);K(x),L.setAttribute("color",x)}return L._type="points",L}function G(O){const R=new A.Vector3(2,2,2),_=O.fields;for(let L=0,x=_.length;L<x;L++){const F=_[L],B=F.name,z=F.values;B==="size"?(R.x=z[0],R.y=z[1],R.z=z[2]):console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.BoxGeometry(R.x,R.y,R.z)}function M(O){let R=1,_=2,N=!1;const L=O.fields;for(let F=0,B=L.length;F<B;F++){const z=L[F],J=z.name,re=z.values;switch(J){case"bottom":N=!re[0];break;case"bottomRadius":R=re[0];break;case"height":_=re[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",J);break}}return new A.ConeGeometry(R,_,16,1,N)}function S(O){let R=1,_=2;const N=O.fields;for(let x=0,F=N.length;x<F;x++){const B=N[x],z=B.name,J=B.values;switch(z){case"bottom":break;case"radius":R=J[0];break;case"height":_=J[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",z);break}}return new A.CylinderGeometry(R,R,_,16,1)}function P(O){let R=1;const _=O.fields;for(let L=0,x=_.length;L<x;L++){const F=_[L],B=F.name,z=F.values;B==="radius"?R=z[0]:console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.SphereGeometry(R,16,16)}function k(O){let R,_,N,L,x=!0,F=!0,B=!0,z=!0,J=0,re=2,ye=2,Se=1,Me=1;const be=O.fields;for(let ue=0,le=be.length;ue<le;ue++){const oe=be[ue],fe=oe.name,pe=oe.values;switch(fe){case"color":const Pe=pe[0];Pe!==null&&(R=o(Pe));break;case"normal":const qe=pe[0];qe!==null&&(_=o(qe));break;case"texCoord":const Qe=pe[0];Qe!==null&&(N=o(Qe));break;case"height":L=pe;break;case"ccw":z=pe[0];break;case"colorPerVertex":x=pe[0];break;case"creaseAngle":J=pe[0];break;case"normalPerVertex":F=pe[0];break;case"solid":B=pe[0];break;case"xDimension":re=pe[0];break;case"xSpacing":Se=pe[0];break;case"zDimension":ye=pe[0];break;case"zSpacing":Me=pe[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",fe);break}}const Te=[],ve=[],Ne=[],Ce=[];for(let ue=0;ue<ye;ue++)for(let le=0;le<re;le++){const oe=ue*re+le,fe=Se*ue,pe=L[oe],Pe=Me*le;if(Te.push(fe,pe,Pe),R&&x===!0){const qe=R[oe*3+0],Qe=R[oe*3+1],gt=R[oe*3+2];Ne.push(qe,Qe,gt)}if(_&&F===!0){const qe=_[oe*3+0],Qe=_[oe*3+1],gt=_[oe*3+2];ve.push(qe,Qe,gt)}if(N){const qe=N[oe*2+0],Qe=N[oe*2+1];Ce.push(qe,Qe)}else Ce.push(ue/(re-1),le/(ye-1))}const Le=[];for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*re,fe=ue+(le+1)*re,pe=ue+1+(le+1)*re,Pe=ue+1+le*re;z===!0?(Le.push(oe,pe,fe),Le.push(pe,oe,Pe)):(Le.push(oe,fe,pe),Le.push(pe,Pe,oe))}const we=me(Le,new A.Float32BufferAttribute(Te,3)),ke=me(Le,new A.Float32BufferAttribute(Ce,2));let Ue,Be;if(R){if(x===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=R[oe*3+0],pe=R[oe*3+1],Pe=R[oe*3+2];Ne.push(fe,pe,Pe),Ne.push(fe,pe,Pe),Ne.push(fe,pe,Pe),Ne.push(fe,pe,Pe),Ne.push(fe,pe,Pe),Ne.push(fe,pe,Pe)}Ue=new A.Float32BufferAttribute(Ne,3)}else Ue=me(Le,new A.Float32BufferAttribute(Ne,3));K(Ue)}if(_)if(F===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=_[oe*3+0],pe=_[oe*3+1],Pe=_[oe*3+2];ve.push(fe,pe,Pe),ve.push(fe,pe,Pe),ve.push(fe,pe,Pe),ve.push(fe,pe,Pe),ve.push(fe,pe,Pe),ve.push(fe,pe,Pe)}Be=new A.Float32BufferAttribute(ve,3)}else Be=me(Le,new A.Float32BufferAttribute(ve,3));else Be=ze(Le,Te,J);const Oe=new A.BufferGeometry;return Oe.setAttribute("position",we),Oe.setAttribute("normal",Be),Oe.setAttribute("uv",ke),Ue&&Oe.setAttribute("color",Ue),Oe._solid=B,Oe._type="mesh",Oe}function X(O){let R=[1,1,1,-1,-1,-1,-1,1,1,1],_=[0,0,0,0,1,0],N,L,x=!0,F=!0,B=0,z=!0,J=!0;const re=O.fields;for(let Oe=0,ue=re.length;Oe<ue;Oe++){const le=re[Oe],oe=le.name,fe=le.values;switch(oe){case"beginCap":x=fe[0];break;case"ccw":F=fe[0];break;case"convex":break;case"creaseAngle":B=fe[0];break;case"crossSection":R=fe;break;case"endCap":z=fe[0];break;case"orientation":L=fe;break;case"scale":N=fe;break;case"solid":J=fe[0];break;case"spine":_=fe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",oe);break}}const ye=R[0]===R[R.length-2]&&R[1]===R[R.length-1],Se=[],Me=new A.Vector3,be=new A.Vector3,Te=new A.Vector3,ve=new A.Vector3,Ne=new A.Quaternion;for(let Oe=0,ue=0,le=0,oe=_.length;Oe<oe;Oe+=3,ue+=2,le+=4){Me.fromArray(_,Oe),be.x=N?N[ue+0]:1,be.y=1,be.z=N?N[ue+1]:1,Te.x=L?L[le+0]:0,Te.y=L?L[le+1]:0,Te.z=L?L[le+2]:1;const fe=L?L[le+3]:0;for(let pe=0,Pe=R.length;pe<Pe;pe+=2)ve.x=R[pe+0],ve.y=0,ve.z=R[pe+1],ve.multiply(be),Ne.setFromAxisAngle(Te,fe),ve.applyQuaternion(Ne),ve.add(Me),Se.push(ve.x,ve.y,ve.z)}const Ce=[],Le=_.length/3,we=R.length/2;for(let Oe=0;Oe<Le-1;Oe++)for(let ue=0;ue<we-1;ue++){const le=ue+Oe*we;let oe=ue+1+Oe*we;const fe=ue+(Oe+1)*we;let pe=ue+1+(Oe+1)*we;ue===we-2&&ye===!0&&(oe=Oe*we,pe=(Oe+1)*we),F===!0?(Ce.push(le,oe,fe),Ce.push(fe,oe,pe)):(Ce.push(le,fe,oe),Ce.push(fe,pe,oe))}if(x===!0||z===!0){const Oe=[];for(let oe=0,fe=R.length;oe<fe;oe+=2)Oe.push(new A.Vector2(R[oe],R[oe+1]));const ue=A.ShapeUtils.triangulateShape(Oe,[]),le=[];for(let oe=0,fe=ue.length;oe<fe;oe++){const pe=ue[oe];le.push(pe[0],pe[1],pe[2])}if(x===!0)for(let oe=0,fe=le.length;oe<fe;oe+=3)F===!0?Ce.push(le[oe+0],le[oe+1],le[oe+2]):Ce.push(le[oe+0],le[oe+2],le[oe+1]);if(z===!0){const oe=we*(Le-1);for(let fe=0,pe=le.length;fe<pe;fe+=3)F===!0?Ce.push(oe+le[fe+0],oe+le[fe+2],oe+le[fe+1]):Ce.push(oe+le[fe+0],oe+le[fe+1],oe+le[fe+2])}}const ke=me(Ce,new A.Float32BufferAttribute(Se,3)),Ue=ze(Ce,Se,B),Be=new A.BufferGeometry;return Be.setAttribute("position",ke),Be.setAttribute("normal",Ue),Be._solid=J,Be._type="mesh",Be}function Q(O){const R=r[O],_=o(R);return _.isObject3D||_.isMaterial?_.clone():_}function H(O,R){for(let _=0,N=O.length;_<N;_++){const L=o(O[_]);L instanceof A.Object3D&&R.add(L)}}function $(O,R){const _=[];let N=0;for(let L=0,x=O.length;L<x;L++){const F=O[N],B=O[L+(R?1:2)],z=O[L+(R?2:1)];_.push(F,B,z),(O[L+3]===-1||L+3>=x)&&(L+=3,N=L+1)}return _}function te(O,R){const _=[];let N=0;for(let L=0,x=R.length;L<x;L++){const F=N*3,B=O[F],z=O[F+1],J=O[F+2];_.push(B,z,J),(R[L+3]===-1||L+3>=x)&&(L+=3,N++)}return _}function ae(O,R){const _=[];for(let N=0,L=R.length;N<L;N++){const F=R[N]*3,B=O[F],z=O[F+1],J=O[F+2];_.push(B,z,J)}return _}function se(O){const R=[];for(let _=0,N=O.length;_<N;_++){const L=O[_],x=O[_+1];R.push(L,x),(O[_+2]===-1||_+2>=N)&&(_+=2)}return R}function ce(O,R){const _=[];let N=0;for(let L=0,x=R.length;L<x;L++){const F=N*3,B=O[F],z=O[F+1],J=O[F+2];_.push(B,z,J),(R[L+2]===-1||L+2>=x)&&(L+=2,N++)}return _}const ne=new A.Vector3,de=new A.Vector3,U=new A.Vector3,j=new A.Vector2,W=new A.Vector2,q=new A.Vector2;function Z(O,R,_,N){const L=[];for(let x=0,F=O.length;x<F;x+=3){const B=R[x],z=R[x+1],J=R[x+2];N===2?(j.fromArray(_,B*N),W.fromArray(_,z*N),q.fromArray(_,J*N),L.push(j.x,j.y),L.push(W.x,W.y),L.push(q.x,q.y)):(ne.fromArray(_,B*N),de.fromArray(_,z*N),U.fromArray(_,J*N),L.push(ne.x,ne.y,ne.z),L.push(de.x,de.y,de.z),L.push(U.x,U.y,U.z))}return new A.Float32BufferAttribute(L,N)}function ie(O,R){const _=[];for(let N=0,L=0,x=O.length;N<x;N+=3,L++)ne.fromArray(R,L*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function ge(O,R){const _=[];for(let N=0,L=0,x=O.length;N<x;N+=2,L++)ne.fromArray(R,L*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function me(O,R){const _=R.array,N=R.itemSize,L=new _.constructor(O.length*N);let x=0,F=0;for(let B=0,z=O.length;B<z;B++){x=O[B]*N;for(let J=0;J<N;J++)L[F++]=_[x++]}return new A.Float32BufferAttribute(L,N)}const xe=new A.Vector3,De=new A.Vector3;function ze(O,R,_){const N=[],L={};for(let F=0,B=O.length;F<B;F+=3){const z=O[F],J=O[F+1],re=O[F+2],ye=new Jr(z,J,re);ne.fromArray(R,z*3),de.fromArray(R,J*3),U.fromArray(R,re*3),De.subVectors(U,de),xe.subVectors(ne,de),De.cross(xe),De.normalize(),ye.normal.copy(De),L[z]===void 0&&(L[z]=[]),L[J]===void 0&&(L[J]=[]),L[re]===void 0&&(L[re]=[]),L[z].push(ye.normal),L[J].push(ye.normal),L[re].push(ye.normal),N.push(ye)}const x=[];for(let F=0,B=N.length;F<B;F++){const z=N[F],J=Fe(L[z.a],z.normal,_),re=Fe(L[z.b],z.normal,_),ye=Fe(L[z.c],z.normal,_);ne.fromArray(R,z.a*3),de.fromArray(R,z.b*3),U.fromArray(R,z.c*3),x.push(J.x,J.y,J.z),x.push(re.x,re.y,re.z),x.push(ye.x,ye.y,ye.z)}return new A.Float32BufferAttribute(x,3)}function Fe(O,R,_){const N=new A.Vector3;if(_===0)N.copy(R);else for(let L=0,x=O.length;L<x;L++)O[L].angleTo(R)<_&&N.add(O[L]);return N.normalize()}function D(O){const R=[];for(let _=0,N=O.length;_<N;_+=3)R.push(new A.Color(O[_],O[_+1],O[_+2]));return R}function K(O){const R=new A.Color;for(let _=0;_<O.count;_++)R.fromBufferAttribute(O,_),A.ColorManagement.colorSpaceToWorking(R,A.SRGBColorSpace),O.setXYZ(_,R.r,R.g,R.b)}function V(O,R,_,N,L){const x=[],F=L===!0?0:Math.PI;for(let Se=0,Me=N.length;Se<Me;Se++){let be=Se===0?0:_[Se-1];be=L===!0?be:F-be;const Te=new A.Vector3;Te.setFromSphericalCoords(R,be,0),x.push(Te)}const B=O.index,z=O.attributes.position,J=new A.BufferAttribute(new Float32Array(O.attributes.position.count*3),3),re=new A.Vector3,ye=new A.Color;for(let Se=0;Se<B.count;Se++){const Me=B.getX(Se);re.fromBufferAttribute(z,Me);let be,Te,ve=1;for(let Le=1;Le<x.length;Le++){be=Le-1,Te=Le;const we=x[be],ke=x[Te];if(L===!0){if(re.y<=we.y&&re.y>ke.y){ve=Math.abs(we.y-re.y)/Math.abs(we.y-ke.y);break}}else if(re.y>=we.y&&re.y<ke.y){ve=Math.abs(we.y-re.y)/Math.abs(we.y-ke.y);break}}const Ne=N[be],Ce=N[Te];ye.copy(Ne).lerp(Ce,ve),A.ColorManagement.colorSpaceToWorking(ye,A.SRGBColorSpace),J.setXYZ(Me,ye.r,ye.g,ye.b)}O.setAttribute("color",J)}const ee=new A.TextureLoader(this.manager);if(ee.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const he=i(e);return u(he)}}class qr{constructor(e){this.lexer=new ot.Lexer(e)}lex(e){const t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}}const Qr=ot.CstParser;class Zr extends Qr{constructor(e){super(e);const t=this,r=e.Version,i=e.LCurly,c=e.RCurly,s=e.LSquare,u=e.RSquare,a=e.Identifier,o=e.RouteIdentifier,h=e.StringLiteral,l=e.HexLiteral,m=e.NumberLiteral,p=e.TrueLiteral,E=e.FalseLiteral,T=e.NullLiteral,f=e.DEF,d=e.USE,y=e.ROUTE,v=e.TO,g=e.NodeName;t.RULE("vrml",function(){t.SUBRULE(t.version),t.AT_LEAST_ONE(function(){t.SUBRULE(t.node)}),t.MANY(function(){t.SUBRULE(t.route)})}),t.RULE("version",function(){t.CONSUME(r)}),t.RULE("node",function(){t.OPTION(function(){t.SUBRULE(t.def)}),t.CONSUME(g),t.CONSUME(i),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(c)}),t.RULE("field",function(){t.CONSUME(a),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(f),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("use",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("singleFieldValue",function(){t.AT_LEAST_ONE(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(m)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(E)}},{ALT:function(){t.CONSUME(T)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(s),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(m)}},{ALT:function(){t.CONSUME(T)}}])}),t.CONSUME(u)}),t.RULE("route",function(){t.CONSUME(y),t.CONSUME(o),t.CONSUME(v),t.CONSUME2(o)}),this.performSelfAnalysis()}}class Jr{constructor(e,t,r){this.a=e,this.b=t,this.c=r,this.normal=new A.Vector3}}const Ke={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};let lt;async function $r(n,e){return lt||(lt=new Xr),lt.manager.setURLModifier(r=>(r.startsWith("./")&&(r=r.substring(2)),URL.createObjectURL(Gn(n,r)))),await lt.loadAsync(e)}class ei extends Xe{ready;constructor(e){super(),this.ready=this.asyncInit(e)}initObject(){return new Ae.Object3D}async asyncInit(e){const t=await Wt(e),r=await $r(t,"axis.wrl");return this.object.add(r),this}}class ti extends Xe{constructor(e){super(e)}initObject(e){return e}}class ni extends Xe{constructor(...e){super(e)}initObject(e){const t=e.filter(a=>typeof a=="number"),r=e.filter(a=>typeof a=="string"),i=new Ae.BoxGeometry(...t),c=r.length>0?r[0]:"rgb(128,128,128)",s=new Ae.MeshStandardMaterial({color:c});return new Ae.Mesh(i,s)}}class ri extends Xe{constructor(...e){super(e)}initObject(e){const t=e.filter(a=>typeof a=="number"),r=e.filter(a=>typeof a=="string"),i=new Ae.SphereGeometry(...t),c=r.length>0?r[0]:"rgb(128,128,128)",s=new Ae.MeshStandardMaterial({color:c});return new Ae.Mesh(i,s)}}exports.Acerola3D=ei;exports.Box=ni;exports.Camera=jt;exports.Canvas=Vt;exports.GLTFA3=Nr;exports.GeneralCamera=st;exports.ObjectA3=Xe;exports.Quat=$e;exports.RapierPhysicsEngine=et;exports.Scene=nt;exports.Sphere=ri;exports.Test=kn;exports.Text3D=Hn;exports.ThreeJS=ti;exports.Vec3=je;exports.ViewBase=Lt;exports.Window=zt;exports.asyncSleep=Un;exports.initFont=zn;exports.times2=Dn;
|