a3js 0.0.25 → 0.0.27

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 CHANGED
@@ -1,4 +1,6 @@
1
- "use strict";var Nn=Object.create;var Gt=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var kn=Object.getOwnPropertyNames;var Cn=Object.getPrototypeOf,Mn=Object.prototype.hasOwnProperty;var Pn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of kn(e))!Mn.call(n,r)&&r!==t&&Gt(n,r,{get:()=>e[r],enumerable:!(i=wn(e,r))||i.enumerable});return n};var Dn=(n,e,t)=>(t=n!=null?Nn(Cn(n)):{},Pn(e||!n||!n.__esModule?Gt(t,"default",{value:n,enumerable:!0}):t,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("three"),$t=require("fflate");function Fn(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 se=Fn(R);function en(n){return typeof n=="string"}function Mt(n){return n.isMesh===!0}function Un(n){return n.type==="RoundedBoxGeometry"}function jn(n){return n.type==="BoxGeometry"}function Bn(n){return n.type==="SphereGeometry"}function Gn(n){return n.type==="IcosahedronGeometry"}function zn(n){return n.type==="CylinderGeometry"}function Vn(n){return n.type==="CapsuleGeometry"}function Hn(n){return n.isBone===!0}function Wn(n){return n.isPerspectiveCamera===!0}class ke{_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)}clone(){return new ke(this)}normalize(){const e=this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w,t=Math.sqrt(e);return t!==0?(this._x/=t,this._y/=t,this._z/=t,this._w/=t):console.warn("Quat.normalize."),this}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this}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}mul(e,t,i,r){const a=new ke(this),o=new ke;return typeof e=="number"?o.set(e,t,i,r):o.set(e),this._x=a.w*o.x+a.x*o.w+a.y*o.z-a.z*o.y,this._y=a.w*o.y-a.x*o.z+a.y*o.w+a.z*o.x,this._z=a.w*o.z+a.x*o.y-a.y*o.x+a.z*o.w,this._w=a.w*o.w-a.x*o.x-a.y*o.y-a.z*o.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,this._w=(1-i)*e.w+i*t.w}slerp(e,t,i){if(i<0||i>1){console.warn("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 a=Math.acos(r),o=Math.sin((1-i)*a)/Math.sin(a),u=Math.sin(i*a)/Math.sin(a);this._x=o*e.x+u*t.x,this._y=o*e.y+u*t.y,this._z=o*e.z+u*t.z,this._w=o*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 a=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);a<1e-4?(console.warn("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/a,this._y*=1/a,this._z*=1/a,this._w*=1/a)}}}function ct(n,e,t){t.normalize();const i=e.clone().sub(n).normalize(),r=new Ae().cross(i,t).normalize(),a=new Ae().cross(r,i),o=r.x,u=a.x,c=-i.x,s=r.y,f=a.y,h=-i.y,g=r.z,p=a.z,T=-i.z,m=o+f+T;if(m>0){const l=Math.sqrt(m+1)*2;return new ke((p-h)/l,(c-g)/l,(s-u)/l,.25*l)}else if(o>f&&o>T){const l=Math.sqrt(1+o-f-T)*2;return new ke(.25*l,(u+s)/l,(c+g)/l,(p-h)/l)}else if(f>T){const l=Math.sqrt(1+f-o-T)*2;return new ke((u+s)/l,.25*l,(h+p)/l,(c-g)/l)}else{const l=Math.sqrt(1+T-o-f)*2;return new ke((c+g)/l,(h+p)/l,.25*l,(s-u)/l)}}function tn(n,e="XYZ"){const t=new ke(0,0,0,1);for(let i=0;i<3;i++)switch(e.charAt(i)){case"X":t.mul(new ke(Math.sin(n.x),0,0,Math.cos(n.x)));break;case"Y":t.mul(new ke(0,Math.sin(n.y),0,Math.cos(n.y)));break;case"Z":t.mul(new ke(0,0,Math.sin(n.z),Math.cos(n.z)));break}return t}class Ae{_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)}clone(){return new Ae(this)}normalize(){const e=this._x*this._x+this._y*this._y+this._z*this._z,t=Math.sqrt(e);return t!==0?(this._x/=t,this._y/=t,this._z/=t):console.warn("Vec3.normalize."),this}negate(){return this._x*=-1,this._y*=-1,this._z*=-1,this}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._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,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}sub(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}scale(e){return this._x*=e,this._y*=e,this._z*=e,this}cross(e,t){return this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this}apply(e,t,i,r){const a=new ke;typeof e=="number"?a.set(e,t,i,r):a.set(e);const o=new ke(this._x,this._y,this._z,0),u=new ke(a).conjugate();return a.mul(o).mul(u),this._x=a.x,this._y=a.y,this._z=a.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 tt{objectA3;object3D;interpolation;billboard;constructor(e){this.objectA3=e,this.object3D=e?.object}setObject(e){this.objectA3=e,this.object3D=e.object}detachObject(e){this.objectA3=void 0,this.object3D=void 0}enableInterpolation(e){e&&!this.interpolation&&this.object3D?this.interpolation=new Kn(this.object3D):!e&&this.interpolation&&(this.interpolation=void 0)}enableBillboard(e){e&&this.billboard?this.billboard.setTarget(e.object):e&&!this.billboard&&this.objectA3?this.billboard=new Yn(this.objectA3,e.object):this.billboard=void 0}update(e){this.interpolation&&this.interpolation.update(e),this.billboard&&this.billboard.update()}setLocation(e){this.interpolation?this.interpolation.setLocation(e):this.object3D?.position.set(e.x,e.y,e.z),this.billboard&&this.billboard.update()}setLocationNow(e){this.interpolation?this.interpolation.setLocationNow(e):this.object3D?.position.set(e.x,e.y,e.z),this.billboard&&this.billboard.update()}setQuat(e){this.billboard||(this.interpolation?this.interpolation.setQuat(e):this.object3D?.quaternion.set(e.x,e.y,e.z,e.w))}setQuatNow(e){this.billboard||(this.interpolation?this.interpolation.setQuatNow(e):this.object3D?.quaternion.set(e.x,e.y,e.z,e.w))}setScale(e){this.interpolation?this.interpolation.setScale(e):this.object3D?.scale.set(e.x,e.y,e.z)}setScaleNow(e){this.interpolation?this.interpolation.setScaleNow(e):this.object3D?.scale.set(e.x,e.y,e.z)}controlMotion(...e){}setPause(e){}setTime(e){}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}}class Kn{obj;firstLoc;firstRot;firstScale;nowLoc;nowRot;nowScale;lastLoc;lastRot;lastScale;nowTime;duration;constructor(e){this.obj=e,this.firstLoc=new Ae(e.position),this.firstRot=new ke(e.quaternion),this.firstScale=new Ae(e.scale),this.nowLoc=new Ae(e.position),this.nowRot=new ke(e.quaternion),this.nowScale=new Ae(e.scale),this.lastLoc=new Ae(e.position),this.lastRot=new ke(e.quaternion),this.lastScale=new Ae(e.scale),this.nowTime=0,this.duration=1}setLocation(e){this.firstLoc.set(this.obj.position),this.firstRot.set(this.obj.quaternion),this.firstScale.set(this.obj.scale),this.lastLoc.set(e),this.nowTime=0}setLocationNow(e){this.setLocation(e),this.nowTime=1}setQuat(e){this.firstLoc.set(this.obj.position),this.firstRot.set(this.obj.quaternion),this.firstScale.set(this.obj.scale),this.lastRot.set(e),this.nowTime=0}setQuatNow(e){this.setQuat(e),this.nowTime=1}setScale(e){this.firstLoc.set(this.obj.position),this.firstRot.set(this.obj.quaternion),this.firstScale.set(this.obj.scale),this.lastScale.set(e),this.nowTime=0}setScaleNow(e){this.setScale(e),this.nowTime=1}smoothstep(e){return e*e*(3-2*e)}update(e){this.nowTime+=e,this.nowTime>this.duration&&(this.nowTime=this.duration);const t=this.nowTime/this.duration,i=this.smoothstep(t);this.nowLoc.lerp(this.firstLoc,this.lastLoc,i),this.nowRot.slerp(this.firstRot,this.lastRot,i),this.nowScale.lerp(this.firstScale,this.lastScale,i),this.obj.position.set(this.nowLoc.x,this.nowLoc.y,this.nowLoc.z),this.obj.quaternion.set(this.nowRot.x,this.nowRot.y,this.nowRot.z,this.nowRot.w),this.obj.scale.set(this.nowScale.x,this.nowScale.y,this.nowScale.z)}}class Yn{up;obj;target;tmpObjLoc=new Ae;tmpTargetLoc=new Ae;constructor(e,t){this.up=new Ae,e.upVector?this.up.set(e.upVector):this.up.set(je.defaultUpVector),this.obj=e.object,this.target=t}setTarget(e){this.target=e}update(){this.tmpObjLoc.set(this.obj.position),this.tmpTargetLoc.set(this.target.position);const e=ct(this.tmpObjLoc,this.tmpTargetLoc,this.up);this.obj.quaternion.set(e.x,e.y,e.z,e.w)}}const nn={rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1};class rn extends tt{}let Ve;const xt=new Map;class lt{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!lt.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),lt.RAPIER=e,Ve=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOption(e)&&(t=e.timestep);const i=new Ve.World(e.gravity);return new Xn(i,t)}isRapierWorldOption(e){return"timestep"in e}}class Xn{world;timestep;collisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new Ve.EventQueue(!0),this.world.integrationParameters.dt=this.timestep}add(e){e instanceof zt&&e.addOneselfToPhysics(this)}remove(e){e instanceof zt&&e.removeOneselfFromPhysics(this)}update(e){const t=Math.ceil(e/this.timestep);for(let i=0;i<t;i++)this.world.step(this.collisionEventQueue)}getCollisions(){const e=[];return this.collisionEventQueue.drainCollisionEvents((t,i,r)=>{const a=xt.get(t),o=xt.get(i);a&&o&&e.push({objectA:a,partOfA:t,objectB:o,partOfB:i,started:r})}),e}}class zt extends rn{}class qn extends rn{bodyDesc;body;colliderDescs;colliders;completeOption;constructor(e,t={}){super(e),this.colliderDescs=[],this.colliders=[],this.completeOption={...nn,...t}}setObject(e){super.setObject(e),this.bodyDesc=void 0,this.body=void 0,this.colliderDescs=[],this.colliders=[],this.myInitialize(e)}detachObject(e){this.bodyDesc=void 0,this.body=void 0,this.colliderDescs=[],this.colliders=[]}myInitialize(e){const t=this.completeOption;switch(t.rigidBody){case"dynamic":this.bodyDesc=Ve.RigidBodyDesc.dynamic();break;case"kinematic":this.bodyDesc=Ve.RigidBodyDesc.kinematicPositionBased();break;case"fixed":this.bodyDesc=Ve.RigidBodyDesc.fixed();break}this.bodyDesc.setTranslation(e.object.position.x,e.object.position.y,e.object.position.z),this.bodyDesc.setRotation({x:e.object.quaternion.x,y:e.object.quaternion.y,z:e.object.quaternion.z,w:e.object.quaternion.w});const i=[];e.object.traverse(a=>{if(Mt(a)){const o=Jn(a.geometry),u=t.membership<<16|t.filter;if(o)o.colliderDesc.setCollisionGroups(u),t.collisionDetection&&o.colliderDesc.setActiveEvents(Ve.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(o.colliderDesc),o.colliderDesc.setRestitution(t.restitution).setFriction(t.friction),i.push(o.volume);else{let c,s;switch(t.meshCollider){case"tri_mesh":c=Qn(a),s=Vt(a.geometry);break;case"convex_hull":c=Zn(a),s=Vt(a.geometry);break}c&&(c.setCollisionGroups(u),t.collisionDetection&&c.setActiveEvents(Ve.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(c),i.push(s))}}});let r=i.reduce((a,o)=>a+o,0);for(let a=0;a<this.colliderDescs.length;a++)this.colliderDescs[a].setRestitution(t.restitution),this.colliderDescs[a].setFriction(t.friction),this.colliderDescs[a].setMass(t.mass*(i[a]/r))}update(e){if(this.body){const t=this.body.translation();this.object3D?.position.set(t.x,t.y,t.z);const i=this.body.rotation();this.object3D?.quaternion.set(i.x,i.y,i.z,i.w)}}setLocation(e){}setLocationNow(e){this.body&&this.body.setTranslation(e,!0)}setQuat(e){}setQuatNow(e){this.body&&this.body.setRotation(e,!0)}setScale(e){}setScaleNow(e){}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc)),this.colliderDescs.forEach(t=>{const i=e.world.createCollider(t,this.body);this.colliders.push(i),this.objectA3&&xt.set(i.handle,this.objectA3)})}removeOneselfFromPhysics(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1)})}}function Qn(n){let e=null;if(Mt(n)){const t=n;t.updateWorldMatrix(!0,!0);const i=t.geometry.clone();i.applyMatrix4(t.matrixWorld);const r=i.attributes.position.array;let a=i.index?i.index.array:null;if(a)a instanceof Uint32Array||(a=new Uint32Array(a));else{const o=i.attributes.position.count;a=new Uint32Array(o);for(let u=0;u<o;u++)a[u]=u}r instanceof Float32Array&&(e=Ve.ColliderDesc.trimesh(r,a))}return e}function Zn(n){let e=null;if(Mt(n)){const t=n;t.updateWorldMatrix(!0,!0);const i=t.geometry.clone();i.applyMatrix4(t.matrixWorld);const r=i.attributes.position.array;r instanceof Float32Array&&(e=Ve.ColliderDesc.convexHull(r))}return e}function Vt(n){const e=n.attributes.position;if(!e)throw new Error("position attribute not found");const t=n.index,i=e.array;let r=0;const a=new se.Vector3,o=new se.Vector3,u=new se.Vector3;if(t){const c=t.array;for(let s=0;s<c.length;s+=3){const f=c[s]*3,h=c[s+1]*3,g=c[s+2]*3;a.set(i[f],i[f+1],i[f+2]),o.set(i[h],i[h+1],i[h+2]),u.set(i[g],i[g+1],i[g+2]),r+=a.dot(o.clone().cross(u))}}else for(let c=0;c<i.length;c+=9)a.set(i[c],i[c+1],i[c+2]),o.set(i[c+3],i[c+4],i[c+5]),u.set(i[c+6],i[c+7],i[c+8]),r+=a.dot(o.clone().cross(u));return Math.abs(r)/6}function Jn(n){if(Un(n)){const e=n.parameters,t=typeof e?.width=="number"?e.width/2:.5,i=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5,a=.1;return{colliderDesc:Ve.ColliderDesc.roundCuboid(t-a,i-a,r-a,a),volume:2*t*2*i*2*r}}else if(jn(n)){const e=n.parameters,t=typeof e?.width=="number"?e.width/2:.5,i=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5;return{colliderDesc:Ve.ColliderDesc.cuboid(t,i,r),volume:2*t*2*i*2*r}}else if(Bn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:Ve.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(Gn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:Ve.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(zn(n)){const e=n.parameters,t=typeof e?.radiusBottom=="number"?e.radiusBottom:.5,i=typeof e?.height=="number"?e.height:.5;return{colliderDesc:Ve.ColliderDesc.cylinder(i/2,t),volume:Math.PI*t*t*i}}else if(Vn(n)){const e=n.parameters,t=typeof e?.radius=="number"?e.radius:.5,i=typeof e?.height=="number"?e.height:.5;return{colliderDesc:Ve.ColliderDesc.capsule(i/2,t),volume:4/3*Math.PI*t*t*t+Math.PI*t*t*i}}return null}const It=new lt;async function $n(){await It.init()}class on{scene;objects;physicsWorld=null;physicsDt=1/60;collisionListener;constructor(){this.scene=new se.Scene,this.objects=[],It.isInitialized&&(this.physicsWorld=It.createWorld({gravity:{x:0,y:-9.81,z:0},timestep:this.physicsDt}))}add(e){this.scene.add(e.object),this.objects.push(e),e.scene=this,this.physicsWorld&&e.motion.addOneselfToPhysics(this.physicsWorld)}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,this.physicsWorld&&e.motion.removeOneselfFromPhysics(this.physicsWorld)}setCollisionListener(e){this.collisionListener=e}update(e){if(this.physicsWorld){this.physicsWorld.update(e);const t=this.physicsWorld.getCollisions();t.forEach(i=>{i.objectA.handleCollision(i.objectB,i.started,i.partOfA,i.partOfB),i.objectB.handleCollision(i.objectA,i.started,i.partOfB,i.partOfA)}),this.collisionListener&&t.length>0&&this.collisionListener(t)}for(const t of this.objects)t.update(e)}}class je{static defaultRotationOrder="XYZ";static defaultUpVector=new Ae(0,1,0);rotationOrder=null;upVector=null;object;scene=null;balloon=null;motion;parent=null;children=[];clickListener;constructor(e){this.object=this.initObject(e),this.object.traverse(t=>{t.userData.a3js={objectA3:this}}),this.motion=this.initMotion(),this.motion.setObject(this)}initMotion(e){return new tt(this)}setMotion(e){e.setObject(this),this.motion=e}detachMotion(){const e=new tt(this),t=this.motion;return t.detachObject(this),this.motion=e,e.setObject(this),t}replaceMotion(e){const t=this.motion;return t.detachObject(this),this.motion=e,e.setObject(this),t}controlMotion(...e){this.motion.controlMotion(...e)}enableInterpolation(e){this.motion.enableInterpolation(e)}initDefaultPhysics(e){const t={...nn,...e};this.motion=new qn(this,t),this.motion.setObject(this)}update(e){this.motion.update(e),this.children.forEach(t=>{t.update(e)})}add(e){if(e.scene){console.warn("ObjectA3.add(obj) is ignored.");return}if(e.parent){console.warn("ObjectA3.add(obj) is ignored.");return}this.children.push(e),e.parent=this,this.object.add(e.object)}remove(e){if(e.parent!==this){console.warn("ObjectA3.remove(obj) is ignored.");return}const t=this.children.indexOf(e);this.children.splice(t,1),e.parent=null,this.object.remove(e.object)}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new er(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,i,r){}async clicked(){this.clickListener&&await this.clickListener(this)}get locX(){return this.object.position.x}get locY(){return this.object.position.y}get locZ(){return this.object.position.z}setLocation(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e),this.motion.setLocation(r)}setLocationNow(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e),this.motion.setLocationNow(r),this.object.position.set(r.x,r.y,r.z)}get quatX(){return this.object.quaternion.x}get quatY(){return this.object.quaternion.y}get quatZ(){return this.object.quaternion.z}get quatW(){return this.object.quaternion.w}setQuat(e,t,i,r){const a=new ke;typeof e=="number"?a.set(e,t,i,r):a.set(e),this.motion.setQuat(a)}setQuatNow(e,t,i,r){const a=new ke;typeof e=="number"?a.set(e,t,i,r):a.set(e),this.motion.setQuatNow(a)}get scaleX(){return this.object.scale.x}get scaleY(){return this.object.scale.y}get scaleZ(){return this.object.scale.z}setScale(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e),this.motion.setScale(r)}setScaleNow(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e),this.motion.setScaleNow(r)}setRotation(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e),r.scale(Math.PI/360);const a=this.rotationOrder?this.rotationOrder:je.defaultRotationOrder,o=tn(r,a);this.setQuat(o)}setRotationNow(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):r.set(e);const a=this.rotationOrder?this.rotationOrder:je.defaultRotationOrder,o=new ke(0,0,0,1);for(let u=0;u<3;u++)switch(a.charAt(u)){case"X":o.mul(new ke(Math.sin(r.x),0,0,Math.cos(r.x)));break;case"Y":o.mul(new ke(0,Math.sin(r.y),0,Math.cos(r.y)));break;case"Z":o.mul(new ke(0,0,Math.sin(r.z),Math.cos(r.z)));break}this.setQuatNow(o)}lookAt(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):e instanceof je?r.set(e.locX,e.locY,e.locZ):r.set(e);const a=this.upVector?this.upVector:je.defaultUpVector,o=ct(new Ae(this.object.position),r,a);this.setQuat(o)}lookAtNow(e,t,i){const r=new Ae;typeof e=="number"?r.set(e,t,i):e instanceof je?r.set(e.locX,e.locY,e.locZ):r.set(e);const a=this.upVector?this.upVector:je.defaultUpVector,o=ct(new Ae(this.object.position),r,a);this.setQuatNow(o)}getUnitVecX(){return new Ae(1,0,0).apply(this.object.quaternion)}getUnitVecY(){return new Ae(0,1,0).apply(this.object.quaternion)}getUnitVecZ(){return new Ae(0,0,1).apply(this.object.quaternion)}}class er{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 extends je{controller;setController(e){this.controller=e}setLocation(e,t,i){typeof e=="number"?super.setLocation(e,t,i):super.setLocation(e),this.controller?.setCameraLocation(this.object.position)}}class an{view;constructor(e){this.view=e,e.setController(this)}update(e){}activate(){}deactivate(){}keyDown(e){}keyUp(e){}keyPress(e){}mouseDown(e){}mouseUp(e){}mouseMove(e){}mouseClick(e){}mouseEnter(e){}mouseLeave(e){}mouseWheel(e){}touchStart(e){}touchEnd(e){}touchMove(e){}touchCancel(e){}setCameraLocation(e){}setCameraLocationNow(e){}setCameraQuat(e){}setCameraQuatNow(e){}setCameraScale(e){}setCameraScaleNow(e){}}class cn extends an{preMouse;leftClick=!1;target;cameraLoc=new Ae(0,0,3);cameraQuat=new ke(0,0,0,1);constructor(e,t,i,r){super(e),this.preMouse={x:0,y:0},typeof t=="number"?this.target=new Ae(t,i,r):this.target=new Ae(t)}update(e){this.view.camera.setLocation(this.cameraLoc),this.view.camera.setQuat(this.cameraQuat)}mouseDown(e){e.button===0&&(this.leftClick=!0,this.preMouse.x=e.clientX,this.preMouse.y=e.clientY)}mouseMove(e){if(this.leftClick===!1)return;const t=.01,i=t*(e.clientX-this.preMouse.x),r=t*(e.clientY-this.preMouse.y),a=Math.sin(-i),o=Math.cos(-i),u=Math.sin(-r),c=Math.cos(-r),s=new Ae(1,0,0).apply(this.cameraQuat),f=new Ae(0,1,0).apply(this.cameraQuat),h=new ke(s.x*u,s.y*u,s.z*u,c),g=new ke(f.x*a,f.y*a,f.z*a,o),p=new Ae(this.cameraLoc);p.sub(this.target),p.apply(h),p.apply(g),p.add(this.target),this.cameraLoc.set(p);const T=ct(this.cameraLoc,this.target,new Ae(0,1,0));this.cameraQuat.set(T),this.preMouse.x=e.clientX,this.preMouse.y=e.clientY}mouseUp(e){e.button===0&&(this.leftClick=!1)}mouseWheel(e){const t=new Ae(this.target).sub(this.cameraLoc);e.deltaY>0?t.scale(.05):e.deltaY<0&&t.scale(-.05),this.cameraLoc.add(t)}setCameraLocation(e){this.cameraLoc.set(e)}setCameraLocationNow(e){this.cameraLoc.set(e)}}function tr(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}async function ln(n){const t=await(await fetch(n)).arrayBuffer(),i=await new Promise((r,a)=>{$t.unzip(new Uint8Array(t),(o,u)=>{o?a(o):r(u)})});return{zipUrl:n,unzipped:i}}function Pt(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n.unzipped[e])return $t.strFromU8(n.unzipped[e]);throw new Error(`readStringFromUnzippedA3(): no file at ${e}`)}function nr(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n.unzipped[e]){const t=ir(e);return new Blob([new Uint8Array(n.unzipped[e])],{type:t})}else throw new Error(`readBlobFromUnzippedA3(): no file at ${e}`)}const rr={"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 ir(n){for(const[e,t]of Object.entries(rr))if(t.test(n))return e;return"application/octet-stream"}function yt(n,e){if(!e)return n;const t={...n};for(const i in e)typeof n[i]=="object"&&typeof e[i]=="object"?t[i]=yt(n[i],e[i]):t[i]=e[i];return t}const or={type:"audio",autoplay:!1,loop:!1,volume:1,positional:{refDistance:1,maxDistance:1e3,rolloffFactor:1,directional:{coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0}}};async function sr(){try{$e.listener.context.state!=="running"&&await $e.listener.context.resume()}catch{console.warn("AudioContext resume failed. Did you call on user gesture?")}}class $e extends je{static listener=new se.AudioListener;static audioLoader=new se.AudioLoader;ready;config;sound;constructor(e,t={}){super(),this.config=yt(or,t),this.ready=this.asyncInit(e)}initObject(){return new se.Object3D}async asyncInit(e){if(this.config.type==="positional"){const t=new se.PositionalAudio($e.listener);t.setRefDistance(this.config.positional.refDistance),t.setMaxDistance(this.config.positional.maxDistance),t.setRolloffFactor(this.config.positional.rolloffFactor);const i=this.config.positional.directional;t.setDirectionalCone(i.coneInnerAngle,i.coneOuterAngle,i.coneOuterGain),t.setVolume(this.config.volume),t.setLoop(this.config.loop),this.sound=t}else{const t=new se.Audio($e.listener);t.setVolume(this.config.volume),t.setLoop(this.config.loop),this.sound=t}return this.object.add(this.sound),new Promise(t=>{$e.audioLoader.load(e,i=>{this.sound&&this.sound.setBuffer(i),t(this)})})}play(){this.sound?.play()}}class Dt{scene;camera;controller;constructor(e){this.scene=new on,this.camera=e,this.camera.setAudioListener($e.listener),this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3),this.controller=new cn(this,0,0,0),this.camera.setController(this.controller)}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),this.controller?.update(e),this.camera.update(e)}setController(e){this.controller?.deactivate(),this.controller=e,this.controller.activate(),this.camera.setController(e)}worldToScreen(e){throw new Error("ViewBaseはworldToScreen()は実装していません")}screenToWorld(e,t,i){throw new Error("ViewBaseはscreenToWorld()は実装していません")}cameraToScreen(e){throw new Error("ViewBaseはcameraToScreen()は実装していません")}screenToCamera(e,t,i){throw new Error("ViewBaseはscreenToCamera()は実装していません")}}class ut extends sn{camera;headLight;constructor(e){super(),this.camera=e,this.headLight=new se.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 se.Object3D}setAudioListener(e){this.camera.add(e)}getHeadLight(){return this.headLight}setAspect(e){Wn(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}calcNDC(e){const t=new se.Vector3(e.x,e.y,e.z);return t.project(this.camera),{x:t.x,y:t.y}}}class un extends R.Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new R.Vector2(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const rt=new R.Vector3,Ht=new R.Matrix4,Wt=new R.Matrix4,Kt=new R.Vector3,Yt=new R.Vector3;class hn{constructor(e={}){const t=this;let i,r,a,o;const u={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.sortObjects=!0,this.getSize=function(){return{width:i,height:r}},this.render=function(T,m){T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),m.parent===null&&m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),Ht.copy(m.matrixWorldInverse),Wt.multiplyMatrices(m.projectionMatrix,Ht),f(T,T,m),this.sortObjects&&p(T)},this.setSize=function(T,m){i=T,r=m,a=i/2,o=r/2,c.style.width=T+"px",c.style.height=m+"px"};function s(T){T.isCSS2DObject&&(T.element.style.display="none");for(let m=0,l=T.children.length;m<l;m++)s(T.children[m])}function f(T,m,l){if(T.visible===!1){s(T);return}if(T.isCSS2DObject){rt.setFromMatrixPosition(T.matrixWorld),rt.applyMatrix4(Wt);const d=rt.z>=-1&&rt.z<=1&&T.layers.test(l.layers)===!0,y=T.element;y.style.display=d===!0?"":"none",d===!0&&(T.onBeforeRender(t,m,l),y.style.transform="translate("+-100*T.center.x+"%,"+-100*T.center.y+"%)translate("+(rt.x*a+a)+"px,"+(-rt.y*o+o)+"px)",y.parentNode!==c&&c.appendChild(y),T.onAfterRender(t,m,l));const v={distanceToCameraSquared:h(l,T)};u.objects.set(T,v)}for(let d=0,y=T.children.length;d<y;d++)f(T.children[d],m,l)}function h(T,m){return Kt.setFromMatrixPosition(T.matrixWorld),Yt.setFromMatrixPosition(m.matrixWorld),Kt.distanceToSquared(Yt)}function g(T){const m=[];return T.traverseVisible(function(l){l.isCSS2DObject&&m.push(l)}),m}function p(T){const m=g(T).sort(function(d,y){if(d.renderOrder!==y.renderOrder)return y.renderOrder-d.renderOrder;const v=u.objects.get(d).distanceToCameraSquared,E=u.objects.get(y).distanceToCameraSquared;return v-E}),l=m.length;for(let d=0,y=m.length;d<y;d++)m[d].element.style.zIndex=l-d}}}class fn extends HTMLElement{ro;base;renderer;css2DRenderer;scene;camera;controller;camera3js;clock;_canvas;_css2DCanvas;constructor(e){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
1
+ "use strict";var ji=Object.create;var hn=Object.defineProperty;var qi=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty;var Vi=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ki(e))!Wi.call(i,n)&&n!==t&&hn(i,n,{get:()=>e[n],enumerable:!(r=qi(e,n))||r.enumerable});return i};var Yi=(i,e,t)=>(t=i!=null?ji(zi(i)):{},Vi(e||!i||!i.__esModule?hn(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("three"),Sn=require("fflate");function Ji(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const ae=Ji(m);function _n(i){return typeof i=="string"}function tn(i){return i.isMesh===!0}function Xi(i){return i.type==="RoundedBoxGeometry"}function Zi(i){return i.type==="BoxGeometry"}function $i(i){return i.type==="SphereGeometry"}function er(i){return i.type==="IcosahedronGeometry"}function tr(i){return i.type==="CylinderGeometry"}function nr(i){return i.type==="CapsuleGeometry"}function ir(i){return i.isBone===!0}function rr(i){return i.isPerspectiveCamera===!0}class ce{_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)}clone(){return new ce(this)}normalize(){const e=this._x*this._x+this._y*this._y+this._z*this._z,t=Math.sqrt(e);return t!==0?(this._x/=t,this._y/=t,this._z/=t):console.warn("Vec3.normalize."),this}negate(){return this._x*=-1,this._y*=-1,this._z*=-1,this}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._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,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}sub(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}scale(e){return this._x*=e,this._y*=e,this._z*=e,this}cross(e,t){return this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this}apply(e,t,r,n){const s=new Ce;typeof e=="number"?s.set(e,t,r,n):s.set(e);const o=new Ce(this._x,this._y,this._z,0),c=new Ce(s).conjugate();return s.mul(o).mul(c),this._x=s.x,this._y=s.y,this._z=s.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 Ce{_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,n){typeof e=="number"?(this._x=e,this._y=t,this._z=r,this._w=n):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)}clone(){return new Ce(this)}normalize(){const e=this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w,t=Math.sqrt(e);return t!==0?(this._x/=t,this._y/=t,this._z/=t,this._w/=t):console.warn("Quat.normalize."),this}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this}set(e,t,r,n){return typeof e=="number"?(this._x=e,this._y=t,this._z=r,this._w=n):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w),this}mul(e,t,r,n){const s=new Ce(this),o=new Ce;return typeof e=="number"?o.set(e,t,r,n):o.set(e),this._x=s.w*o.x+s.x*o.w+s.y*o.z-s.z*o.y,this._y=s.w*o.y-s.x*o.z+s.y*o.w+s.z*o.x,this._z=s.w*o.z+s.x*o.y-s.y*o.x+s.z*o.w,this._w=s.w*o.w-s.x*o.x-s.y*o.y-s.z*o.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,this._w=(1-r)*e.w+r*t.w}slerp(e,t,r){if(r<0||r>1){console.warn("Quat.slerp(): t must be in [0,1]");return}const n=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(n<.9995){const s=Math.acos(n),o=Math.sin((1-r)*s)/Math.sin(s),c=Math.sin(r*s)/Math.sin(s);this._x=o*e.x+c*t.x,this._y=o*e.y+c*t.y,this._z=o*e.z+c*t.z,this._w=o*e.w+c*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 s=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);s<1e-4?(console.warn("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/s,this._y*=1/s,this._z*=1/s,this._w*=1/s)}}}function st(i,e,t){t.normalize();const r=i.clone().sub(e).normalize(),n=new ce().cross(r,t).normalize(),s=new ce().cross(n,r),o=n.x,c=s.x,A=-r.x,a=n.y,f=s.y,u=-r.y,b=n.z,d=s.z,I=-r.z,g=o+f+I;if(g>0){const l=Math.sqrt(g+1)*2;return new Ce((d-u)/l,(A-b)/l,(a-c)/l,.25*l)}else if(o>f&&o>I){const l=Math.sqrt(1+o-f-I)*2;return new Ce(.25*l,(c+a)/l,(A+b)/l,(d-u)/l)}else if(f>I){const l=Math.sqrt(1+f-o-I)*2;return new Ce((c+a)/l,.25*l,(u+d)/l,(A-b)/l)}else{const l=Math.sqrt(1+I-o-f)*2;return new Ce((A+b)/l,(u+d)/l,.25*l,(a-c)/l)}}function At(i,e="XYZ"){const t=new Ce(0,0,0,1);for(let r=0;r<3;r++)switch(e.charAt(r)){case"X":t.mul(new Ce(Math.sin(i.x),0,0,Math.cos(i.x)));break;case"Y":t.mul(new Ce(0,Math.sin(i.y),0,Math.cos(i.y)));break;case"Z":t.mul(new Ce(0,0,Math.sin(i.z),Math.cos(i.z)));break}return t}class He{loc;quat;scale;constructor(){this.loc=new ce,this.quat=new Ce,this.scale=new ce(1,1,1)}set(e){if(e instanceof He)this.loc.set(e.loc),this.quat.set(e.quat),this.scale.set(e.scale);else{const t=e.trans;this.loc.set(t.loc),this.quat.set(t.quat),this.scale.set(t.scale)}return this}write(e){e instanceof xe?(e.object.position.set(this.loc.x,this.loc.y,this.loc.z),e.object.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.object.scale.set(this.scale.x,this.scale.y,this.scale.z)):(e.position.set(this.loc.x,this.loc.y,this.loc.z),e.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.scale.set(this.scale.x,this.scale.y,this.scale.z))}blend(e,t){return this.loc.lerp(this.loc,e.loc,t),this.quat.slerp(this.quat,e.quat,t),this.scale.lerp(this.scale,e.scale,t),this}clone(){const e=new He;return e.set(this),e}}const Vt={rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1};let Ge;const tt=new Map;class gt{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!gt.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),gt.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 Ln(r,t)}isRapierWorldOption(e){return"timestep"in e}}class Ln{world;timestep;collisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new Ge.EventQueue(!0),this.world.integrationParameters.dt=this.timestep}add(e){e.addOneselfToPhysics(this)}remove(e){e.removeOneselfFromPhysics(this)}update(e){const t=Math.ceil(e/this.timestep);for(let r=0;r<t;r++)this.world.step(this.collisionEventQueue)}getCollisions(){const e=[];return this.collisionEventQueue.drainCollisionEvents((t,r,n)=>{const s=tt.get(t),o=tt.get(r);s&&o&&e.push({objectA:s,partOfA:t,objectB:o,partOfB:r,started:n})}),e}}class fn{trans;objectA3;bodyDesc;body;colliderDescs;colliders;completeOption;constructor(e={}){this.completeOption={...Vt,...e},this.trans=new He,this.colliderDescs=[],this.colliders=[]}makeBodyDesc(){let e;switch(this.completeOption.rigidBody){case"dynamic":e=Ge.RigidBodyDesc.dynamic();break;case"kinematic":e=Ge.RigidBodyDesc.kinematicPositionBased();break;case"fixed":e=Ge.RigidBodyDesc.fixed();break}return e.setTranslation(this.trans.loc.x,this.trans.loc.y,this.trans.loc.z),e.setRotation({x:this.trans.quat.x,y:this.trans.quat.y,z:this.trans.quat.z,w:this.trans.quat.w}),e}configColliderDescs(){if(!this.objectA3)return;const e=this.completeOption,t=[];this.objectA3.object.traverse(n=>{if(tn(n)){const s=ar(n.geometry),o=e.membership<<16|e.filter;if(s)s.colliderDesc.setCollisionGroups(o),e.collisionDetection&&s.colliderDesc.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(s.colliderDesc),s.colliderDesc.setRestitution(e.restitution).setFriction(e.friction),t.push(s.volume);else{let c,A;switch(e.meshCollider){case"tri_mesh":c=or(n),A=dn(n.geometry);break;case"convex_hull":c=sr(n),A=dn(n.geometry);break}c&&(c.setCollisionGroups(o),e.collisionDetection&&c.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(c),t.push(A))}}});let r=t.reduce((n,s)=>n+s,0);for(let n=0;n<this.colliderDescs.length;n++)this.colliderDescs[n].setRestitution(e.restitution),this.colliderDescs[n].setFriction(e.friction),this.colliderDescs[n].setMass(e.mass*(t[n]/r))}init(e,t){this.trans.set(e),this.objectA3=t,this.colliderDescs=[],this.colliders=[],this.bodyDesc=this.makeBodyDesc(),this.configColliderDescs()}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{const r=e.world.createCollider(t,this.body);this.colliders.push(r),this.objectA3&&tt.set(r.handle,this.objectA3)}))}removeOneselfFromPhysics(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1),tt.delete(t.handle)})}setLocation(e){}setLocationNow(e){this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.trans.loc.set(e)}setQuat(e){}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.trans.quat.set(e)}setScale(e){}setScaleNow(e){}setLinvel(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}setAngvel(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}update(e){if(this.body){const t=this.body.translation();this.trans.loc.set(t.x,t.y,t.z);const r=this.body.rotation();this.trans.quat.set(r.x,r.y,r.z,r.w)}}}function or(i){let e=null;if(tn(i)){const t=i;t.updateWorldMatrix(!0,!0);const r=t.geometry.clone();r.applyMatrix4(t.matrixWorld);const n=r.attributes.position.array;let s=r.index?r.index.array:null;if(s)s instanceof Uint32Array||(s=new Uint32Array(s));else{const o=r.attributes.position.count;s=new Uint32Array(o);for(let c=0;c<o;c++)s[c]=c}n instanceof Float32Array&&(e=Ge.ColliderDesc.trimesh(n,s))}return e}function sr(i){let e=null;if(tn(i)){const t=i;t.updateWorldMatrix(!0,!0);const r=t.geometry.clone();r.applyMatrix4(t.matrixWorld);const n=r.attributes.position.array;n instanceof Float32Array&&(e=Ge.ColliderDesc.convexHull(n))}return e}function dn(i){const e=i.attributes.position;if(!e)throw new Error("position attribute not found");const t=i.index,r=e.array;let n=0;const s=new ae.Vector3,o=new ae.Vector3,c=new ae.Vector3;if(t){const A=t.array;for(let a=0;a<A.length;a+=3){const f=A[a]*3,u=A[a+1]*3,b=A[a+2]*3;s.set(r[f],r[f+1],r[f+2]),o.set(r[u],r[u+1],r[u+2]),c.set(r[b],r[b+1],r[b+2]),n+=s.dot(o.clone().cross(c))}}else for(let A=0;A<r.length;A+=9)s.set(r[A],r[A+1],r[A+2]),o.set(r[A+3],r[A+4],r[A+5]),c.set(r[A+6],r[A+7],r[A+8]),n+=s.dot(o.clone().cross(c));return Math.abs(n)/6}function ar(i){if(Xi(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,r=typeof e?.height=="number"?e.height/2:.5,n=typeof e?.depth=="number"?e.depth/2:.5,s=.1;return{colliderDesc:Ge.ColliderDesc.roundCuboid(t-s,r-s,n-s,s),volume:2*t*2*r*2*n}}else if(Zi(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,r=typeof e?.height=="number"?e.height/2:.5,n=typeof e?.depth=="number"?e.depth/2:.5;return{colliderDesc:Ge.ColliderDesc.cuboid(t,r,n),volume:2*t*2*r*2*n}}else if($i(i)){const e=i.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(er(i)){const e=i.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(tr(i)){const e=i.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(nr(i)){const e=i.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}const Yt=new gt;async function Ar(){await Yt.init()}class xn{scene;objects;avatar;physicsWorld=null;physicsDt=1/60;collisionListener;rapierLines;constructor(){this.scene=new ae.Scene,this.objects=[],Yt.isInitialized&&(this.physicsWorld=Yt.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,this.physicsWorld){e.transformMotion.addOneselfToPhysics(this.physicsWorld);for(const t of Object.values(e.poseMotions))t.addOneselfToPhysics(this.physicsWorld)}}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()}if(e.scene=void 0,this.physicsWorld){e.transformMotion.removeOneselfFromPhysics(this.physicsWorld);for(const t of Object.values(e.poseMotions))t.removeOneselfFromPhysics(this.physicsWorld)}}setAvatar(e){this.avatar=e}setCollisionListener(e){this.collisionListener=e}update(e){if(this.physicsWorld){this.physicsWorld.update(e);const t=this.physicsWorld.getCollisions();if(t.forEach(r=>{r.objectA.handleCollision(r.objectB,r.started,r.partOfA,r.partOfB),r.objectB.handleCollision(r.objectA,r.started,r.partOfB,r.partOfA)}),this.collisionListener&&t.length>0&&this.collisionListener(t),this.rapierLines&&this.physicsWorld instanceof Ln){const{vertices:r,colors:n}=this.physicsWorld.world.debugRender();this.rapierLines.geometry.setAttribute("position",new ae.BufferAttribute(r,3)),this.rapierLines.geometry.setAttribute("color",new ae.BufferAttribute(n,4))}}for(const t of this.objects)t.update(e)}rapierDebug(e){e?(this.rapierLines=new ae.LineSegments(new ae.BufferGeometry,new ae.LineBasicMaterial({vertexColors:!0})),this.scene.add(this.rapierLines)):this.rapierLines&&(this.scene.remove(this.rapierLines),this.rapierLines=void 0)}}class Et{trans;constructor(){this.trans=new He}init(e,t){this.trans.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setLocation(e){this.trans.loc.set(e)}setLocationNow(e){this.trans.loc.set(e)}setQuat(e){this.trans.quat.set(e)}setQuatNow(e){this.trans.quat.set(e)}setScale(e){this.trans.scale.set(e)}setScaleNow(e){this.trans.scale.set(e)}setLinvel(e){}setAngvel(e){}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class cr{trans;constructor(){this.trans=new He}init(e,t){this.trans.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setLocation(e){}setLocationNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinvel(e){}setAngvel(e){}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class Nn{firstTrans;trans;lastTrans;nowTime;duration;constructor(){this.firstTrans=new He,this.trans=new He,this.lastTrans=new He,this.nowTime=0,this.duration=1}init(e,t){this.firstTrans.set(e),this.trans.set(e),this.lastTrans.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setLocation(e){this.firstTrans.set(this.trans),this.lastTrans.loc.set(e),this.nowTime=0}setLocationNow(e){this.setLocation(e),this.nowTime=1}setQuat(e){this.firstTrans.set(this.trans),this.lastTrans.quat.set(e),this.nowTime=0}setQuatNow(e){this.setQuat(e),this.nowTime=1}setScale(e){this.firstTrans.set(this.trans),this.lastTrans.scale.set(e),this.nowTime=0}setScaleNow(e){this.setScale(e),this.nowTime=1}setLinvel(e){}setAngvel(e){}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}smoothstep(e){return e*e*(3-2*e)}update(e){this.nowTime+=e,this.nowTime>this.duration&&(this.nowTime=this.duration);const t=this.nowTime/this.duration,r=this.smoothstep(t);this.trans.set(this.firstTrans),this.trans.blend(this.lastTrans,r)}}const Tt=new ce,Rt=new ce;class lr extends Et{up;target;constructor(e){super(),this.up=new ce(0,1,0),this.target=e}setTarget(e){this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=xe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){Tt.set(this.trans.loc),Rt.set(this.target.trans.loc);const t=st(Tt,Rt,this.up);this.trans.quat.set(t)}}class ur extends Nn{up;target;constructor(e){super(),this.up=new ce(0,1,0),this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=xe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){super.update(e),Tt.set(this.trans.loc),Rt.set(this.target.trans.loc);const t=st(Tt,Rt,this.up);this.trans.quat.set(t)}}const hr={offset:.01,auto:!0,height:1.5,radius:.3};class Dn{trans;objectA3;completeOption;controller;bodyDesc;body;colliderDesc;collider;capsuleCenter;nextLocation;tmpV1;tmpV2;constructor(e={}){this.completeOption={...hr,...e},this.trans=new He,this.capsuleCenter=new ce,this.nextLocation=new ce,this.tmpV1=new ce,this.tmpV2=new ce}init(e,t){if(this.trans.set(e),this.completeOption.auto){const r=new ae.Box3().setFromObject(t.object),n=new ae.Vector3;r.getSize(n),this.completeOption.radius=Math.max(n.x,n.z)/2,this.completeOption.height=n.y-this.completeOption.radius*2,r.getCenter(n),this.capsuleCenter.set(n)}this.bodyDesc=Ge.RigidBodyDesc.kinematicPositionBased(),this.colliderDesc=Ge.ColliderDesc.capsule(this.completeOption.height,this.completeOption.radius),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.trans.set(t),this.bodyDesc.setRotation({x:e.quat.x,y:e.quat.y,z:e.quat.z,w:e.quat.w})}addOneselfToPhysics(e){this.controller=e.world.createCharacterController(this.completeOption.offset),this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc)),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc,this.body)),this.collider&&this.objectA3&&tt.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.body&&e.world.removeRigidBody(this.body),this.collider&&(e.world.removeCollider(this.collider,!1),tt.delete(this.collider.handle))}setLocation(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setLocationNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),e=this.tmpV1,this.body?this.body.setNextKinematicTranslation(e):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.trans.loc.set(e),this.nextLocation.set(e)}setQuat(e){this.body?this.body.setRotation(e,!1):this.bodyDesc?.setRotation(e),this.trans.loc.set(e)}setQuatNow(e){this.body?this.body.setRotation(e,!1):this.bodyDesc?.setRotation(e),this.trans.quat.set(e)}setScale(e){}setScaleNow(e){}setLinvel(e){}setAngvel(e){}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){return this.controller?this.controller.computedGrounded():!1}update(e){if(!this.body||!this.controller||!this.collider)return;this.trans.quat.set(this.body.rotation()),this.tmpV1.set(this.body.translation()),this.tmpV2.set(this.nextLocation),this.tmpV2.sub(this.tmpV1),this.controller.computeColliderMovement(this.collider,this.tmpV2);const t=this.controller.computedMovement();this.tmpV1.add(t.x,t.y,t.z),this.body.setNextKinematicTranslation(this.tmpV1),this.tmpV1.sub(this.capsuleCenter),this.trans.loc.set(this.tmpV1),this.nextLocation.set(this.tmpV1)}}const H={v0:new ce,v1:new ce,v2:new ce,v3:new ce,v4:new ce,q0:new Ce,q1:new Ce,q2:new Ce,q3:new Ce,q4:new Ce,t0:new He,t1:new He,t2:new He,t3:new He,t4:new He};function fr(i){return new Promise(e=>{setTimeout(()=>{e()},i)})}async function Fn(i){const t=await(await fetch(i)).arrayBuffer(),r=await new Promise((n,s)=>{Sn.unzip(new Uint8Array(t),(o,c)=>{o?s(o):n(c)})});return{zipUrl:i,unzipped:r}}function nn(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e])return Sn.strFromU8(i.unzipped[e]);throw new Error(`readStringFromUnzippedA3(): no file at ${e}`)}function dr(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e]){const t=gr(e);return new Blob([new Uint8Array(i.unzipped[e])],{type:t})}else throw new Error(`readBlobFromUnzippedA3(): no file at ${e}`)}const pr={"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 gr(i){for(const[e,t]of Object.entries(pr))if(t.test(i))return e;return"application/octet-stream"}function vt(i,e){if(!e)return i;const t={...i};for(const r in e)typeof i[r]=="object"&&typeof e[r]=="object"?t[r]=vt(i[r],e[r]):t[r]=e[r];return t}class xe{static defaultRotationOrder="XYZ";static defaultUpVector=new ce(0,1,0);rotationOrder;upVector;object;scene;balloon;transformMotion;poseMotions;statePoseMotion;emotePoseMotion;currentPoseMotion;parent;children=[];clickListener;skeletons;bones;morphs;morphsOverwrite;constructor(e){this.skeletons=[],this.bones={},this.morphs={},this.morphsOverwrite=!1,this.object=this.initObject(e),this.object.traverse(t=>{t.userData.a3js={objectA3:this}}),this.transformMotion=this.initTransformMotion(e),this.poseMotions=this.initPoseMotions(e)}initTransformMotion(e){return new Et}setTransformMotion(e){H.t0.set(this.transformMotion.trans),e.init(H.t0,this),this.transformMotion=e}getTransformMotion(){return this.transformMotion}setTransformMotionMode(e,t){if(e==="Default")this.setTransformMotion(new Et);else if(e==="Interpolation")this.setTransformMotion(new Nn);else if(e==="Billboard")this.setTransformMotion(new lr(t));else if(e==="InterpolationBillboard")this.setTransformMotion(new ur(t));else if(e==="SimplePhysics"){const r={...Vt,...t};this.setTransformMotion(new fn(r))}}initPoseMotions(e){return{}}setPoseMotions(e){this.poseMotions=e}getPoseMotions(){return this.poseMotions}getPoseMotion(e){return this.poseMotions[e]}addPoseMotion(e,t){this.poseMotions[e]=t}removePoseMotion(e){const t=this.poseMotions[e];return delete this.poseMotions[e],t}getPoseMotionNames(){return Object.keys(this.poseMotions)}setState(e){const t=this.poseMotions[e];t&&(this.statePoseMotion=t,this.currentPoseMotion?.cleanup3D(this),this.statePoseMotion.prepare3D(this),this.statePoseMotion.playCount=0,this.statePoseMotion.time=0,this.currentPoseMotion=this.statePoseMotion)}setEmote(e){this.emotePoseMotion=this.poseMotions[e],this.emotePoseMotion&&(this.currentPoseMotion?.cleanup3D(this),this.emotePoseMotion.prepare3D(this),this.emotePoseMotion.playCount=0,this.emotePoseMotion.time=0,this.currentPoseMotion=this.emotePoseMotion)}setMorphsOverwrite(e){this.morphsOverwrite=e}morph(e,t){if(e in this.morphs){const{array:r,idx:n}=this.morphs[e];r[n]=t}}getMorphNames(){return Object.keys(this.morphs)}initSimplePhysics(e){const t={...Vt,...e};this.setTransformMotion(new fn(t)),this.poseMotions={}}pose={};update(e){this.transformMotion.update(e),this.transformMotion.trans.write(this);let t;if(this.emotePoseMotion&&this.emotePoseMotion.playCount<=0?(t=this.emotePoseMotion.update(e),this.emotePoseMotion.playCount>0&&(this.emotePoseMotion.cleanup3D(this),this.emotePoseMotion=void 0,this.statePoseMotion&&this.statePoseMotion.prepare3D(this))):this.statePoseMotion&&(t=this.statePoseMotion.update(e)),t&&this.bones)for(const[r,n]of Object.entries(t)){const s=this.bones[r];if(s&&(n.loc&&s.position.set(n.loc.x,n.loc.y,n.loc.z),n.quat&&s.quaternion.set(n.quat.x,n.quat.y,n.quat.z,n.quat.w),n.scale&&s.scale.set(n.scale.x,n.scale.y,n.scale.z)),!this.morphsOverwrite&&n.morphs){for(const o of n.morphs)for(const c of Object.keys(this.morphs))if(c.startsWith(o.name)){const{array:A}=this.morphs[c];for(let a=0;a<A.length;a++)A[a]=o.vals[a];break}}}this.object.updateMatrixWorld(!0),this.skeletons.forEach(r=>{r.update()}),this.children.forEach(r=>{r.update(e)})}add(e){if(e.scene){console.warn("ObjectA3.add(obj) is ignored.");return}if(e.parent){console.warn("ObjectA3.add(obj) is ignored.");return}this.children.push(e),e.parent=this,this.object.add(e.object)}remove(e){if(e.parent!==this){console.warn("ObjectA3.remove(obj) is ignored.");return}const t=this.children.indexOf(e);this.children.splice(t,1),e.parent=void 0,this.object.remove(e.object)}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new Er(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,r,n){}async clicked(){this.clickListener&&await this.clickListener(this)}get trans(){return this.transformMotion.trans.clone()}get loc(){return this.trans.loc}setLocation(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setLocation(H.v0)}setLocationNow(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setLocationNow(H.v0)}get quat(){return this.trans.quat}setQuat(e,t,r,n){typeof e=="number"?H.q0.set(e,t,r,n):H.q0.set(e),this.transformMotion.setQuat(H.q0)}setQuatNow(e,t,r,n){typeof e=="number"?H.q0.set(e,t,r,n):H.q0.set(e),this.transformMotion.setQuatNow(H.q0)}get scale(){return this.trans.scale}setScale(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setScale(H.v0)}setScaleNow(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setScaleNow(H.v0)}setRotation(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):n.set(e),n.scale(Math.PI/360);const s=this.rotationOrder?this.rotationOrder:xe.defaultRotationOrder,o=At(n,s);this.setQuat(o)}setRotationNow(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):n.set(e);const s=this.rotationOrder?this.rotationOrder:xe.defaultRotationOrder,o=new Ce(0,0,0,1);for(let c=0;c<3;c++)switch(s.charAt(c)){case"X":o.mul(new Ce(Math.sin(n.x),0,0,Math.cos(n.x)));break;case"Y":o.mul(new Ce(0,Math.sin(n.y),0,Math.cos(n.y)));break;case"Z":o.mul(new Ce(0,0,Math.sin(n.z),Math.cos(n.z)));break}this.setQuatNow(o)}lookAt(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):e instanceof xe?n.set(e.loc):n.set(e);const s=this.upVector?this.upVector:xe.defaultUpVector,o=st(this.loc,n,s);this.setQuat(o)}lookAtNow(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):e instanceof xe?n.set(e.loc):n.set(e);const s=this.upVector?this.upVector:xe.defaultUpVector,o=st(this.loc,n,s);this.setQuatNow(o)}getUnitVecX(){return new ce(1,0,0).apply(this.object.quaternion)}getUnitVecY(){return new ce(0,1,0).apply(this.object.quaternion)}getUnitVecZ(){return new ce(0,0,1).apply(this.object.quaternion)}addLocation(e,t,r){const n=new ce;n.set(this.loc),typeof e=="number"?n.add(e,t,r):n.add(e),this.setLocation(n)}addLocationNow(e,t,r){const n=new ce;n.set(this.loc),typeof e=="number"?n.add(e,t,r):n.add(e),this.setLocationNow(n)}mulQuat(e,t,r,n){const s=new Ce;s.set(this.quat),typeof e=="number"?s.mul(e,t,r,n):s.mul(e),this.setQuat(s)}mulQuatNow(e,t,r,n){const s=new Ce;s.set(this.quat),typeof e=="number"?s.mul(e,t,r,n):s.mul(e),this.setQuatNow(s)}mulRotation(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),H.v0.scale(Math.PI/360);const n=this.rotationOrder?this.rotationOrder:xe.defaultRotationOrder,s=At(H.v0,n);H.q0.set(this.quat),H.q0.mul(s),this.setQuat(H.q0)}mulRotationNow(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),H.v0.scale(Math.PI/360);const n=this.rotationOrder?this.rotationOrder:xe.defaultRotationOrder,s=At(H.v0,n);H.q0.set(this.quat),H.q0.mul(s),this.setQuatNow(H.q0)}mulScale(e,t,r){H.v0.set(this.scale),typeof e=="number"?H.v0.set(H.v0.x*e,H.v0.y*t,H.v0.z*r):H.v0.set(H.v0.x*e.x,H.v0.y*e.y,H.v0.z*e.z),this.setScale(H.v0)}mulScaleNow(e,t,r){H.v0.set(this.scale),typeof e=="number"?H.v0.set(H.v0.x*e,H.v0.y*t,H.v0.z*r):H.v0.set(H.v0.x*e.x,H.v0.y*e.y,H.v0.z*e.z),this.setScaleNow(H.v0)}moveForward(e){H.v0.set(this.getUnitVecZ()),H.v0.scale(e),this.addLocation(H.v0)}moveForwardNow(e){H.v0.set(this.getUnitVecZ()),H.v0.scale(e),this.addLocationNow(H.v0)}moveBackward(e){H.v0.set(this.getUnitVecZ()),H.v0.scale(-e),this.addLocation(H.v0)}moveBackwardNow(e){H.v0.set(this.getUnitVecZ()),H.v0.scale(-e),this.addLocationNow(H.v0)}moveRight(e){H.v0.set(this.getUnitVecX()),H.v0.scale(-e),this.addLocation(H.v0)}moveRightNow(e){H.v0.set(this.getUnitVecX()),H.v0.scale(-e),this.addLocationNow(H.v0)}moveLeft(e){H.v0.set(this.getUnitVecX()),H.v0.scale(e),this.addLocation(H.v0)}moveLeftNow(e){H.v0.set(this.getUnitVecX()),H.v0.scale(e),this.addLocationNow(H.v0)}moveUp(e){H.v0.set(this.getUnitVecY()),H.v0.scale(e),this.addLocation(H.v0)}moveUpNow(e){H.v0.set(this.getUnitVecY()),H.v0.scale(e),this.addLocationNow(H.v0)}moveDown(e){H.v0.set(this.getUnitVecY()),H.v0.scale(-e),this.addLocation(H.v0)}moveDownNow(e){H.v0.set(this.getUnitVecY()),H.v0.scale(-e),this.addLocationNow(H.v0)}turnUp(e){this.mulRotation(-e,0,0)}turnUpNow(e){this.mulRotationNow(-e,0,0)}turnDown(e){this.mulRotation(e,0,0)}turnDownNow(e){this.mulRotationNow(e,0,0)}turnRight(e){this.mulRotation(0,-e,0)}turnRightNow(e){this.mulRotationNow(0,-e,0)}turnLeft(e){this.mulRotation(0,e,0)}turnLeftNow(e){this.mulRotationNow(0,e,0)}rollRight(e){this.mulRotation(0,0,e)}rollRightNow(e){this.mulRotationNow(0,0,e)}rollLeft(e){this.mulRotation(0,0,-e)}rollLeftNow(e){this.mulRotationNow(0,0,-e)}setLinvel(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setLinvel(H.v0)}setAngvel(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.setAngvel(H.v0)}resetForce(){this.transformMotion.resetForce()}addForce(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.addForce(H.v0)}addForceAtPoint(e,t,r,n,s,o){if(typeof e=="number")if(typeof t=="number")H.v0.set(e,t,r),H.v1.set(n,s,o);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else H.v0.set(e),H.v1.set(t);this.transformMotion.addForceAtPoint(H.v0,H.v1)}resetTorque(){this.transformMotion.resetTorque()}addTorque(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.addTorque(H.v0)}applyImpulse(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.applyImpulse(H.v0)}applyImpulseAtPoint(e,t,r,n,s,o){if(typeof e=="number")if(typeof t=="number")H.v0.set(e,t,r),H.v1.set(n,s,o);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else H.v0.set(e),H.v1.set(t);this.transformMotion.applyImpulseAtPoint(H.v0,H.v1)}applyTorqueImpulse(e,t,r){typeof e=="number"?H.v0.set(e,t,r):H.v0.set(e),this.transformMotion.applyTorqueImpulse(H.v0)}isGrounded(){return this.transformMotion instanceof Dn?this.transformMotion.isGrounded():this.loc.y<=0}}class Er{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 Mn extends xe{controller;setController(e){this.controller=e}setLocation(e,t,r){const n=new ce;typeof e=="number"?(super.setLocation(e,t,r),n.set(e,t,r)):(super.setLocation(e),n.set(e)),this.controller?.setCameraLocation(n)}lookAt(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):e instanceof xe?n.set(e.loc):n.set(e);const s=this.upVector?this.upVector:xe.defaultUpVector,o=st(this.loc,n,s);o.mul(new Ce(s.x,s.y,s.z,0)),this.setQuat(o)}lookAtNow(e,t,r){const n=new ce;typeof e=="number"?n.set(e,t,r):e instanceof xe?n.set(e.loc):n.set(e);const s=this.upVector?this.upVector:xe.defaultUpVector,o=st(this.loc,n,s);o.mul(new Ce(s.x,s.y,s.z,0)),this.setQuatNow(o)}}class Qt{view;constructor(){}setView(e){this.view=e}update(e){}activate(){}deactivate(){}keyDown(e){}keyUp(e){}keyPress(e){}mouseDown(e){}mouseUp(e){}mouseMove(e){}mouseClick(e){}mouseEnter(e){}mouseLeave(e){}mouseWheel(e){}touchStart(e){}touchEnd(e){}touchMove(e){}touchCancel(e){}setCameraLocation(e){}setCameraLocationNow(e){}setCameraQuat(e){}setCameraQuatNow(e){}setCameraScale(e){}setCameraScaleNow(e){}}class On extends Qt{preMouse;leftClick=!1;rightClick=!1;target;cameraLoc=new ce(0,0,3);cameraQuat=new Ce(0,0,0,1);constructor(e,t,r){super(),this.preMouse={x:0,y:0},typeof e=="number"?this.target=new ce(e,t,r):this.target=new ce(e)}update(e){this.view&&(this.view.camera.setLocation(this.cameraLoc),this.view.camera.setQuat(this.cameraQuat))}mouseDown(e){e.button===0?(this.leftClick=!0,this.preMouse.x=e.clientX,this.preMouse.y=e.clientY):e.button===2&&(this.rightClick=!0,this.preMouse.x=e.clientX,this.preMouse.y=e.clientY)}mouseMove(e){if(this.view){if(this.leftClick){const r=.01*(e.clientX-this.preMouse.x),n=.01*(e.clientY-this.preMouse.y),s=Math.sin(-r),o=Math.cos(-r),c=Math.sin(-n),A=Math.cos(-n),a=new ce(1,0,0).apply(this.cameraQuat),f=new ce(0,1,0).apply(this.cameraQuat),u=new Ce(a.x*c,a.y*c,a.z*c,A),b=new Ce(f.x*s,f.y*s,f.z*s,o),d=new ce(this.cameraLoc);d.sub(this.target),d.apply(u),d.apply(b),d.add(this.target),this.cameraLoc.set(d);const I=st(this.cameraLoc,this.target,new ce(0,1,0));I.mul(new Ce(0,1,0,0)),this.cameraQuat.set(I),this.preMouse.x=e.clientX,this.preMouse.y=e.clientY}else if(this.rightClick){H.v0.set(this.target),H.v0.sub(this.view.camera.loc);const r=.005*H.v0.length(),n=r*(e.clientX-this.preMouse.x),s=r*(e.clientY-this.preMouse.y);this.view.camera.moveRight(n),this.view.camera.moveUp(s);const o=this.view.camera.getUnitVecX(),c=this.view.camera.getUnitVecY();o.scale(-n),c.scale(s),this.target.add(o),this.target.add(c),this.preMouse.x=e.clientX,this.preMouse.y=e.clientY}}}mouseUp(e){e.button===0?this.leftClick=!1:e.button===2&&(this.rightClick=!1)}mouseWheel(e){const t=new ce(this.target).sub(this.cameraLoc);e.deltaY>0?t.scale(.05):e.deltaY<0&&t.scale(-.05),this.cameraLoc.add(t)}setCameraLocation(e){this.cameraLoc.set(e)}setCameraLocationNow(e){this.cameraLoc.set(e)}}class Ir extends Qt{_offset;constructor(){super(),this._offset=new ce(0,5,-10)}update(e){if(!this.view||!this.view.scene.avatar)return;const t=new He;t.set(this.view.scene.avatar),H.v0.set(this._offset),H.v0.apply(t.quat),H.v0.add(t.loc),this.view.camera.setLocationNow(H.v0),this.view.camera.lookAt(this.view.scene.avatar)}}class mr extends Qt{_keyW;_keyA;_keyS;_keyD;_keyLeft;_keyRight;_keySpace;_offset;_avatarNextLoc;_avatarNextQuat;_velY;constructor(){super(),this._keyW=this._keyA=this._keyS=this._keyD=!1,this._keyLeft=this._keyRight=!1,this._keySpace=!1,this._offset=new ce(0,5,-10),this._avatarNextLoc=new ce,this._avatarNextQuat=new Ce,this._velY=0}keyDown(e){e.code==="KeyW"?this._keyW=!0:e.code==="KeyA"?this._keyA=!0:e.code==="KeyS"?this._keyS=!0:e.code==="KeyD"?this._keyD=!0:e.code==="ArrowLeft"?this._keyLeft=!0:e.code==="ArrowRight"?this._keyRight=!0:e.code==="Space"&&(this._keySpace=!0)}keyUp(e){e.code==="KeyW"?this._keyW=!1:e.code==="KeyA"?this._keyA=!1:e.code==="KeyS"?this._keyS=!1:e.code==="KeyD"?this._keyD=!1:e.code==="ArrowLeft"?this._keyLeft=!1:e.code==="ArrowRight"?this._keyRight=!1:e.code==="Space"&&(this._keySpace=!1)}update(e){if(!this.view||!this.view.scene.avatar)return;const t=this.view.scene.avatar,r=new He;r.set(t);const n=t.getUnitVecZ().scale(.1),s=t.getUnitVecX().scale(.1);H.v0.set(this._offset),H.v0.apply(r.quat),H.v0.add(r.loc),this.view.camera.setLocationNow(H.v0),this.view.camera.lookAt(r.loc),this._avatarNextLoc.set(r.loc),this._avatarNextQuat.set(r.quat),this._keyW&&this._avatarNextLoc.add(n),this._keyA&&this._avatarNextLoc.add(s),this._keyS&&this._avatarNextLoc.sub(n),this._keyD&&this._avatarNextLoc.sub(s),this._velY+=-9.8*e*.1,t.isGrounded()&&(this._velY=0,this._keySpace&&(this._velY=.5)),this._avatarNextLoc.add(0,this._velY,0),this._keyLeft&&this._avatarNextQuat.mul(At(new ce(0,.01,0))),this._keyRight&&this._avatarNextQuat.mul(At(new ce(0,-.01,0))),t.setLocationNow(this._avatarNextLoc),t.setQuat(this._avatarNextQuat)}}const br={type:"audio",autoplay:!1,loop:!1,volume:1,positional:{refDistance:1,maxDistance:1e3,rolloffFactor:1,directional:{coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0}}};async function Cr(){try{ot.listener.context.state!=="running"&&await ot.listener.context.resume()}catch{console.warn("AudioContext resume failed. Did you call on user gesture?")}}class ot extends xe{static listener=new ae.AudioListener;static audioLoader=new ae.AudioLoader;ready;config;sound;constructor(e,t={}){super(),this.config=vt(br,t),this.ready=this.asyncInit(e)}initObject(){return new ae.Object3D}async asyncInit(e){if(this.config.type==="positional"){const t=new ae.PositionalAudio(ot.listener);t.setRefDistance(this.config.positional.refDistance),t.setMaxDistance(this.config.positional.maxDistance),t.setRolloffFactor(this.config.positional.rolloffFactor);const r=this.config.positional.directional;t.setDirectionalCone(r.coneInnerAngle,r.coneOuterAngle,r.coneOuterGain),t.setVolume(this.config.volume),t.setLoop(this.config.loop),this.sound=t}else{const t=new ae.Audio(ot.listener);t.setVolume(this.config.volume),t.setLoop(this.config.loop),this.sound=t}return this.object.add(this.sound),new Promise(t=>{ot.audioLoader.load(e,r=>{this.sound&&this.sound.setBuffer(r),t(this)})})}play(){this.sound?.play()}}class Pn{scene;camera;controller;constructor(e){this.scene=new xn,this.camera=e,this.camera.setAudioListener(ot.listener),this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3),this.controller=new On(0,0,0),this.controller.setView(this),this.controller.activate(),this.camera.setController(this.controller)}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),this.controller?.update(e),this.camera.update(e)}setController(e){this.controller.deactivate(),this.controller=e,this.controller.setView(this),this.controller.activate(),this.camera.setController(e)}worldToScreen(e){throw new Error("ViewBaseはworldToScreen()は実装していません")}screenToWorld(e,t,r){throw new Error("ViewBaseはscreenToWorld()は実装していません")}cameraToScreen(e){throw new Error("ViewBaseはcameraToScreen()は実装していません")}screenToCamera(e,t,r){throw new Error("ViewBaseはscreenToCamera()は実装していません")}async waitForRender(){throw new Error("ViewBaseはwaitForRender()は実装していません")}}class It extends Mn{camera;headLight;constructor(e){super(),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}setAudioListener(e){this.camera.add(e)}getHeadLight(){return this.headLight}setAspect(e){rr(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}calcNDC(e){const t=new ae.Vector3(e.x,e.y,e.z);return t.project(this.camera),{x:t.x,y:t.y}}}class Gn extends m.Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new m.Vector2(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const lt=new m.Vector3,pn=new m.Matrix4,gn=new m.Matrix4,En=new m.Vector3,In=new m.Vector3;class Un{constructor(e={}){const t=this;let r,n,s,o;const c={objects:new WeakMap},A=e.element!==void 0?e.element:document.createElement("div");A.style.overflow="hidden",this.domElement=A,this.sortObjects=!0,this.getSize=function(){return{width:r,height:n}},this.render=function(I,g){I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),g.parent===null&&g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),pn.copy(g.matrixWorldInverse),gn.multiplyMatrices(g.projectionMatrix,pn),f(I,I,g),this.sortObjects&&d(I)},this.setSize=function(I,g){r=I,n=g,s=r/2,o=n/2,A.style.width=I+"px",A.style.height=g+"px"};function a(I){I.isCSS2DObject&&(I.element.style.display="none");for(let g=0,l=I.children.length;g<l;g++)a(I.children[g])}function f(I,g,l){if(I.visible===!1){a(I);return}if(I.isCSS2DObject){lt.setFromMatrixPosition(I.matrixWorld),lt.applyMatrix4(gn);const h=lt.z>=-1&&lt.z<=1&&I.layers.test(l.layers)===!0,p=I.element;p.style.display=h===!0?"":"none",h===!0&&(I.onBeforeRender(t,g,l),p.style.transform="translate("+-100*I.center.x+"%,"+-100*I.center.y+"%)translate("+(lt.x*s+s)+"px,"+(-lt.y*o+o)+"px)",p.parentNode!==A&&A.appendChild(p),I.onAfterRender(t,g,l));const C={distanceToCameraSquared:u(l,I)};c.objects.set(I,C)}for(let h=0,p=I.children.length;h<p;h++)f(I.children[h],g,l)}function u(I,g){return En.setFromMatrixPosition(I.matrixWorld),In.setFromMatrixPosition(g.matrixWorld),En.distanceToSquared(In)}function b(I){const g=[];return I.traverseVisible(function(l){l.isCSS2DObject&&g.push(l)}),g}function d(I){const g=b(I).sort(function(h,p){if(h.renderOrder!==p.renderOrder)return p.renderOrder-h.renderOrder;const C=c.objects.get(h).distanceToCameraSquared,E=c.objects.get(p).distanceToCameraSquared;return C-E}),l=g.length;for(let h=0,p=g.length;h<p;h++)g[h].element.style.zIndex=l-h}}}function mn(i,e){if(e===m.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===m.TriangleFanDrawMode||e===m.TriangleStripDrawMode){let t=i.getIndex();if(t===null){const o=[],c=i.getAttribute("position");if(c!==void 0){for(let A=0;A<c.count;A++)o.push(A);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const r=t.count-2,n=[];if(e===m.TriangleFanDrawMode)for(let o=1;o<=r;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=i.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class Hn extends m.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new wr(t)}),this.register(function(t){return new vr(t)}),this.register(function(t){return new Fr(t)}),this.register(function(t){return new Mr(t)}),this.register(function(t){return new Or(t)}),this.register(function(t){return new kr(t)}),this.register(function(t){return new Sr(t)}),this.register(function(t){return new _r(t)}),this.register(function(t){return new Lr(t)}),this.register(function(t){return new Rr(t)}),this.register(function(t){return new xr(t)}),this.register(function(t){return new Qr(t)}),this.register(function(t){return new Dr(t)}),this.register(function(t){return new Nr(t)}),this.register(function(t){return new Br(t)}),this.register(function(t){return new Pr(t)}),this.register(function(t){return new Gr(t)})}load(e,t,r,n){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const a=m.LoaderUtils.extractUrlBase(e);o=m.LoaderUtils.resolveURL(a,this.path)}else o=m.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const c=function(a){n?n(a):console.error(a),s.manager.itemError(e),s.manager.itemEnd(e)},A=new m.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(a){try{s.parse(a,o,function(f){t(f),s.manager.itemEnd(e)},c)}catch(f){c(f)}},r,c)}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,n){let s;const o={},c={},A=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(A.decode(new Uint8Array(e,0,4))===jn){try{o[Re.KHR_BINARY_GLTF]=new Ur(e)}catch(u){n&&n(u);return}s=JSON.parse(o[Re.KHR_BINARY_GLTF].content)}else s=JSON.parse(A.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const a=new eo(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const u=this.pluginCallbacks[f](a);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[u.name]=u,o[u.name]=!0}if(s.extensionsUsed)for(let f=0;f<s.extensionsUsed.length;++f){const u=s.extensionsUsed[f],b=s.extensionsRequired||[];switch(u){case Re.KHR_MATERIALS_UNLIT:o[u]=new Tr;break;case Re.KHR_DRACO_MESH_COMPRESSION:o[u]=new Hr(s,this.dracoLoader);break;case Re.KHR_TEXTURE_TRANSFORM:o[u]=new jr;break;case Re.KHR_MESH_QUANTIZATION:o[u]=new qr;break;default:b.indexOf(u)>=0&&c[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}a.setExtensions(o),a.setPlugins(c),a.parse(r,n)}parseAsync(e,t){const r=this;return new Promise(function(n,s){r.parse(e,t,n,s)})}}function yr(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}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 Br{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,n=t.length;r<n;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let n=t.cache.get(r);if(n)return n;const s=t.json,A=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let a;const f=new m.Color(16777215);A.color!==void 0&&f.setRGB(A.color[0],A.color[1],A.color[2],m.LinearSRGBColorSpace);const u=A.range!==void 0?A.range:0;switch(A.type){case"directional":a=new m.DirectionalLight(f),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new m.PointLight(f),a.distance=u;break;case"spot":a=new m.SpotLight(f),a.distance=u,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,a.angle=A.spot.outerConeAngle,a.penumbra=1-A.spot.innerConeAngle/A.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+A.type)}return a.position.set(0,0,0),$e(a,A),A.intensity!==void 0&&(a.intensity=A.intensity),a.name=t.createUniqueName(A.name||"light_"+e),n=Promise.resolve(a),t.cache.add(r,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],c=(s.extensions&&s.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(A){return r._getNodeRef(t.cache,c,A)})}}class Tr{constructor(){this.name=Re.KHR_MATERIALS_UNLIT}getMaterialType(){return m.MeshBasicMaterial}extendParams(e,t,r){const n=[];e.color=new m.Color(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],m.LinearSRGBColorSpace),e.opacity=o[3]}s.baseColorTexture!==void 0&&n.push(r.assignTexture(e,"map",s.baseColorTexture,m.SRGBColorSpace))}return Promise.all(n)}}class Rr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class wr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(r.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const c=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new m.Vector2(c,c)}return Promise.all(s)}}class vr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class Qr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(r.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class kr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new m.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const c=o.sheenColorFactor;t.sheenColor.setRGB(c[0],c[1],c[2],m.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(r.assignTexture(t,"sheenColorMap",o.sheenColorTexture,m.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class Sr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(r.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class _r{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(r.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const c=o.attenuationColor||[1,1,1];return t.attenuationColor=new m.Color().setRGB(c[0],c[1],c[2],m.LinearSRGBColorSpace),Promise.all(s)}}class Lr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class xr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(r.assignTexture(t,"specularIntensityMap",o.specularTexture));const c=o.specularColorFactor||[1,1,1];return t.specularColor=new m.Color().setRGB(c[0],c[1],c[2],m.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&s.push(r.assignTexture(t,"specularColorMap",o.specularColorTexture,m.SRGBColorSpace)),Promise.all(s)}}class Nr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(r.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class Dr{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:m.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(r.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class Fr{constructor(e){this.parser=e,this.name=Re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,n=r.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){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,s.source,o)}}class Mr{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,r=this.parser,n=r.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],c=n.images[o.source];let A=r.textureLoader;if(c.uri){const a=r.options.manager.getHandler(c.uri);a!==null&&(A=a)}return r.loadTextureImage(e,o.source,A)}}class Or{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,r=this.parser,n=r.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],c=n.images[o.source];let A=r.textureLoader;if(c.uri){const a=r.options.manager.getHandler(c.uri);a!==null&&(A=a)}return r.loadTextureImage(e,o.source,A)}}class Pr{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 n=r.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 s.then(function(c){const A=n.byteOffset||0,a=n.byteLength||0,f=n.count,u=n.byteStride,b=new Uint8Array(c,A,a);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(f,u,b,n.mode,n.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(f*u);return o.decodeGltfBuffer(new Uint8Array(d),f,u,b,n.mode,n.filter),d})})}else return null}}class Gr{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 n=t.meshes[r.mesh];for(const a of n.primitives)if(a.mode!==Ye.TRIANGLES&&a.mode!==Ye.TRIANGLE_STRIP&&a.mode!==Ye.TRIANGLE_FAN&&a.mode!==void 0)return null;const o=r.extensions[this.name].attributes,c=[],A={};for(const a in o)c.push(this.parser.getDependency("accessor",o[a]).then(f=>(A[a]=f,A[a])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(a=>{const f=a.pop(),u=f.isGroup?f.children:[f],b=a[0].count,d=[];for(const I of u){const g=new m.Matrix4,l=new m.Vector3,h=new m.Quaternion,p=new m.Vector3(1,1,1),C=new m.InstancedMesh(I.geometry,I.material,b);for(let E=0;E<b;E++)A.TRANSLATION&&l.fromBufferAttribute(A.TRANSLATION,E),A.ROTATION&&h.fromBufferAttribute(A.ROTATION,E),A.SCALE&&p.fromBufferAttribute(A.SCALE,E),C.setMatrixAt(E,g.compose(l,h,p));for(const E in A)if(E==="_COLOR_0"){const B=A[E];C.instanceColor=new m.InstancedBufferAttribute(B.array,B.itemSize,B.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&I.geometry.setAttribute(E,A[E]);m.Object3D.prototype.copy.call(C,I),this.parser.assignFinalMaterial(C),d.push(C)}return f.isGroup?(f.clear(),f.add(...d),f):d[0]}))}}const jn="glTF",ft=12,bn={JSON:1313821514,BIN:5130562};class Ur{constructor(e){this.name=Re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ft),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!==jn)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-ft,s=new DataView(e,ft);let o=0;for(;o<n;){const c=s.getUint32(o,!0);o+=4;const A=s.getUint32(o,!0);if(o+=4,A===bn.JSON){const a=new Uint8Array(e,ft+o,c);this.content=r.decode(a)}else if(A===bn.BIN){const a=ft+o;this.body=e.slice(a,a+c)}o+=c}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,n=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,c={},A={},a={};for(const f in o){const u=Jt[f]||f.toLowerCase();c[u]=o[f]}for(const f in e.attributes){const u=Jt[f]||f.toLowerCase();if(o[f]!==void 0){const b=r.accessors[e.attributes[f]],d=ht[b.componentType];a[u]=d.name,A[u]=b.normalized===!0}}return t.getDependency("bufferView",s).then(function(f){return new Promise(function(u,b){n.decodeDracoFile(f,function(d){for(const I in d.attributes){const g=d.attributes[I],l=A[I];l!==void 0&&(g.normalized=l)}u(d)},c,a,m.LinearSRGBColorSpace,b)})})}}class jr{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 qr{constructor(){this.name=Re.KHR_MESH_QUANTIZATION}}class qn extends m.Interpolant{constructor(e,t,r,n){super(e,t,r,n)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n*3+n;for(let o=0;o!==n;o++)t[o]=r[s+o];return t}interpolate_(e,t,r,n){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,A=c*2,a=c*3,f=n-t,u=(r-t)/f,b=u*u,d=b*u,I=e*a,g=I-a,l=-2*d+3*b,h=d-b,p=1-l,C=h-b+u;for(let E=0;E!==c;E++){const B=o[g+E+c],Q=o[g+E+A]*f,S=o[I+E+c],U=o[I+E]*f;s[E]=p*B+C*Q+l*S+h*U}return s}}const Kr=new m.Quaternion;class zr extends qn{interpolate_(e,t,r,n){const s=super.interpolate_(e,t,r,n);return Kr.fromArray(s).normalize().toArray(s),s}}const Ye={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ht={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Cn={9728:m.NearestFilter,9729:m.LinearFilter,9984:m.NearestMipmapNearestFilter,9985:m.LinearMipmapNearestFilter,9986:m.NearestMipmapLinearFilter,9987:m.LinearMipmapLinearFilter},yn={33071:m.ClampToEdgeWrapping,33648:m.MirroredRepeatWrapping,10497:m.RepeatWrapping},Dt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jt={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"},rt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Wr={CUBICSPLINE:void 0,LINEAR:m.InterpolateLinear,STEP:m.InterpolateDiscrete},Ft={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Vr(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new m.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m.FrontSide})),i.DefaultMaterial}function at(i,e,t){for(const r in t.extensions)i[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function $e(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Yr(i,e,t){let r=!1,n=!1,s=!1;for(let a=0,f=e.length;a<f;a++){const u=e[a];if(u.POSITION!==void 0&&(r=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(s=!0),r&&n&&s)break}if(!r&&!n&&!s)return Promise.resolve(i);const o=[],c=[],A=[];for(let a=0,f=e.length;a<f;a++){const u=e[a];if(r){const b=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;o.push(b)}if(n){const b=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;c.push(b)}if(s){const b=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;A.push(b)}}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(A)]).then(function(a){const f=a[0],u=a[1],b=a[2];return r&&(i.morphAttributes.position=f),n&&(i.morphAttributes.normal=u),s&&(i.morphAttributes.color=b),i.morphTargetsRelative=!0,i})}function Jr(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,r=e.weights.length;t<r;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let r=0,n=t.length;r<n;r++)i.morphTargetDictionary[t[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Xr(i){let e;const t=i.extensions&&i.extensions[Re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Mt(t.attributes):e=i.indices+":"+Mt(i.attributes)+":"+i.mode,i.targets!==void 0)for(let r=0,n=i.targets.length;r<n;r++)e+=":"+Mt(i.targets[r]);return e}function Mt(i){let e="";const t=Object.keys(i).sort();for(let r=0,n=t.length;r<n;r++)e+=t[r]+":"+i[t[r]]+";";return e}function Xt(i){switch(i){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 Zr(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const $r=new m.Matrix4;class eo{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new yr,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,n=-1,s=!1,o=-1;if(typeof navigator<"u"){const c=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(c)===!0;const A=c.match(/Version\/(\d+)/);n=r&&A?parseInt(A[1],10):-1,s=c.indexOf("Firefox")>-1,o=s?c.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&n<17||s&&o<98?this.textureLoader=new m.TextureLoader(this.options.manager):this.textureLoader=new m.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new m.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,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const c={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:r,userData:{}};return at(s,c,n),$e(c,n),Promise.all(r._invokeAll(function(A){return A.afterRoot&&A.afterRoot(c)})).then(function(){for(const A of c.scenes)A.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let n=0,s=t.length;n<s;n++){const o=t[n].joints;for(let c=0,A=o.length;c<A;c++)e[o[c]].isBone=!0}for(let n=0,s=e.length;n<s;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(r[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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 n=r.clone(),s=(o,c)=>{const A=this.associations.get(o);A!=null&&this.associations.set(c,A);for(const[a,f]of o.children.entries())s(f,c.children[a])};return s(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const n=e(t[r]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let n=0;n<t.length;n++){const s=e(t[n]);s&&r.push(s)}return r}getDependency(e,t){const r=e+":"+t;let n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(r,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(s,o){return r.getDependency(e,o)})),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 n=this.options;return new Promise(function(s,o){r.load(m.LoaderUtils.resolveURL(t.uri,n.path),s,void 0,function(){o(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 n=t.byteLength||0,s=t.byteOffset||0;return r.slice(s,s+n)})}loadAccessor(e){const t=this,r=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=Dt[n.type],c=ht[n.componentType],A=n.normalized===!0,a=new c(n.count*o);return Promise.resolve(new m.BufferAttribute(a,o,A))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(o){const c=o[0],A=Dt[n.type],a=ht[n.componentType],f=a.BYTES_PER_ELEMENT,u=f*A,b=n.byteOffset||0,d=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,I=n.normalized===!0;let g,l;if(d&&d!==u){const h=Math.floor(b/d),p="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+h+":"+n.count;let C=t.cache.get(p);C||(g=new a(c,h*d,n.count*d/f),C=new m.InterleavedBuffer(g,d/f),t.cache.add(p,C)),l=new m.InterleavedBufferAttribute(C,A,b%d/f,I)}else c===null?g=new a(n.count*A):g=new a(c,b,n.count*A),l=new m.BufferAttribute(g,A,I);if(n.sparse!==void 0){const h=Dt.SCALAR,p=ht[n.sparse.indices.componentType],C=n.sparse.indices.byteOffset||0,E=n.sparse.values.byteOffset||0,B=new p(o[1],C,n.sparse.count*h),Q=new a(o[2],E,n.sparse.count*A);c!==null&&(l=new m.BufferAttribute(l.array.slice(),l.itemSize,l.normalized)),l.normalized=!1;for(let S=0,U=B.length;S<U;S++){const v=B[S];if(l.setX(v,Q[S*A]),A>=2&&l.setY(v,Q[S*A+1]),A>=3&&l.setZ(v,Q[S*A+2]),A>=4&&l.setW(v,Q[S*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}l.normalized=I}return l})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let c=this.textureLoader;if(o.uri){const A=r.manager.getHandler(o.uri);A!==null&&(c=A)}return this.loadTextureImage(e,s,c)}loadTextureImage(e,t,r){const n=this,s=this.json,o=s.textures[e],c=s.images[t],A=(c.uri||c.bufferView)+":"+o.sampler;if(this.textureCache[A])return this.textureCache[A];const a=this.loadImageSource(t,r).then(function(f){f.flipY=!1,f.name=o.name||c.name||"",f.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(f.name=c.uri);const b=(s.samplers||{})[o.sampler]||{};return f.magFilter=Cn[b.magFilter]||m.LinearFilter,f.minFilter=Cn[b.minFilter]||m.LinearMipmapLinearFilter,f.wrapS=yn[b.wrapS]||m.RepeatWrapping,f.wrapT=yn[b.wrapT]||m.RepeatWrapping,f.generateMipmaps=!f.isCompressedTexture&&f.minFilter!==m.NearestFilter&&f.minFilter!==m.LinearFilter,n.associations.set(f,{textures:e}),f}).catch(function(){return null});return this.textureCache[A]=a,a}loadImageSource(e,t){const r=this,n=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=n.images[e],c=self.URL||self.webkitURL;let A=o.uri||"",a=!1;if(o.bufferView!==void 0)A=r.getDependency("bufferView",o.bufferView).then(function(u){a=!0;const b=new Blob([u],{type:o.mimeType});return A=c.createObjectURL(b),A});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const f=Promise.resolve(A).then(function(u){return new Promise(function(b,d){let I=b;t.isImageBitmapLoader===!0&&(I=function(g){const l=new m.Texture(g);l.needsUpdate=!0,b(l)}),t.load(m.LoaderUtils.resolveURL(u,s.path),I,void 0,d)})}).then(function(u){return a===!0&&c.revokeObjectURL(A),$e(u,o),u.userData.mimeType=o.mimeType||Zr(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),u});return this.sourceCache[e]=f,f}assignTexture(e,t,r,n){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Re.KHR_TEXTURE_TRANSFORM]){const c=r.extensions!==void 0?r.extensions[Re.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const A=s.associations.get(o);o=s.extensions[Re.KHR_TEXTURE_TRANSFORM].extendTexture(o,c),s.associations.set(o,A)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const n=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+r.uuid;let A=this.cache.get(c);A||(A=new m.PointsMaterial,m.Material.prototype.copy.call(A,r),A.color.copy(r.color),A.map=r.map,A.sizeAttenuation=!1,this.cache.add(c,A)),r=A}else if(e.isLine){const c="LineBasicMaterial:"+r.uuid;let A=this.cache.get(c);A||(A=new m.LineBasicMaterial,m.Material.prototype.copy.call(A,r),A.color.copy(r.color),A.map=r.map,this.cache.add(c,A)),r=A}if(n||s||o){let c="ClonedMaterial:"+r.uuid+":";n&&(c+="derivative-tangents:"),s&&(c+="vertex-colors:"),o&&(c+="flat-shading:");let A=this.cache.get(c);A||(A=r.clone(),s&&(A.vertexColors=!0),o&&(A.flatShading=!0),n&&(A.normalScale&&(A.normalScale.y*=-1),A.clearcoatNormalScale&&(A.clearcoatNormalScale.y*=-1)),this.cache.add(c,A),this.associations.set(A,this.associations.get(r))),r=A}e.material=r}getMaterialType(){return m.MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,n=this.extensions,s=r.materials[e];let o;const c={},A=s.extensions||{},a=[];if(A[Re.KHR_MATERIALS_UNLIT]){const u=n[Re.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),a.push(u.extendParams(c,s,t))}else{const u=s.pbrMetallicRoughness||{};if(c.color=new m.Color(1,1,1),c.opacity=1,Array.isArray(u.baseColorFactor)){const b=u.baseColorFactor;c.color.setRGB(b[0],b[1],b[2],m.LinearSRGBColorSpace),c.opacity=b[3]}u.baseColorTexture!==void 0&&a.push(t.assignTexture(c,"map",u.baseColorTexture,m.SRGBColorSpace)),c.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,c.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(a.push(t.assignTexture(c,"metalnessMap",u.metallicRoughnessTexture)),a.push(t.assignTexture(c,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(b){return b.getMaterialType&&b.getMaterialType(e)}),a.push(Promise.all(this._invokeAll(function(b){return b.extendMaterialParams&&b.extendMaterialParams(e,c)})))}s.doubleSided===!0&&(c.side=m.DoubleSide);const f=s.alphaMode||Ft.OPAQUE;if(f===Ft.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,f===Ft.MASK&&(c.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==m.MeshBasicMaterial&&(a.push(t.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new m.Vector2(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;c.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==m.MeshBasicMaterial&&(a.push(t.assignTexture(c,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==m.MeshBasicMaterial){const u=s.emissiveFactor;c.emissive=new m.Color().setRGB(u[0],u[1],u[2],m.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&o!==m.MeshBasicMaterial&&a.push(t.assignTexture(c,"emissiveMap",s.emissiveTexture,m.SRGBColorSpace)),Promise.all(a).then(function(){const u=new o(c);return s.name&&(u.name=s.name),$e(u,s),t.associations.set(u,{materials:e}),s.extensions&&at(n,u,s),u})}createUniqueName(e){const t=m.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,n=this.primitiveCache;function s(c){return r[Re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(A){return Bn(A,c,t)})}const o=[];for(let c=0,A=e.length;c<A;c++){const a=e[c],f=Xr(a),u=n[f];if(u)o.push(u.promise);else{let b;a.extensions&&a.extensions[Re.KHR_DRACO_MESH_COMPRESSION]?b=s(a):b=Bn(new m.BufferGeometry,a,t),n[f]={primitive:a,promise:b},o.push(b)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,n=this.extensions,s=r.meshes[e],o=s.primitives,c=[];for(let A=0,a=o.length;A<a;A++){const f=o[A].material===void 0?Vr(this.cache):this.getDependency("material",o[A].material);c.push(f)}return c.push(t.loadGeometries(o)),Promise.all(c).then(function(A){const a=A.slice(0,A.length-1),f=A[A.length-1],u=[];for(let d=0,I=f.length;d<I;d++){const g=f[d],l=o[d];let h;const p=a[d];if(l.mode===Ye.TRIANGLES||l.mode===Ye.TRIANGLE_STRIP||l.mode===Ye.TRIANGLE_FAN||l.mode===void 0)h=s.isSkinnedMesh===!0?new m.SkinnedMesh(g,p):new m.Mesh(g,p),h.isSkinnedMesh===!0&&h.normalizeSkinWeights(),l.mode===Ye.TRIANGLE_STRIP?h.geometry=mn(h.geometry,m.TriangleStripDrawMode):l.mode===Ye.TRIANGLE_FAN&&(h.geometry=mn(h.geometry,m.TriangleFanDrawMode));else if(l.mode===Ye.LINES)h=new m.LineSegments(g,p);else if(l.mode===Ye.LINE_STRIP)h=new m.Line(g,p);else if(l.mode===Ye.LINE_LOOP)h=new m.LineLoop(g,p);else if(l.mode===Ye.POINTS)h=new m.Points(g,p);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);Object.keys(h.geometry.morphAttributes).length>0&&Jr(h,s),h.name=t.createUniqueName(s.name||"mesh_"+e),$e(h,s),l.extensions&&at(n,h,l),t.assignFinalMaterial(h),u.push(h)}for(let d=0,I=u.length;d<I;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return s.extensions&&at(n,u[0],s),u[0];const b=new m.Group;s.extensions&&at(n,b,s),t.associations.set(b,{meshes:e});for(let d=0,I=u.length;d<I;d++)b.add(u[d]);return b})}loadCamera(e){let t;const r=this.json.cameras[e],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?t=new m.PerspectiveCamera(m.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(t=new m.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),$e(t,r),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],r=[];for(let n=0,s=t.joints.length;n<s;n++)r.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){const s=n.pop(),o=n,c=[],A=[];for(let a=0,f=o.length;a<f;a++){const u=o[a];if(u){c.push(u);const b=new m.Matrix4;s!==null&&b.fromArray(s.array,a*16),A.push(b)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new m.Skeleton(c,A)})}loadAnimation(e){const t=this.json,r=this,n=t.animations[e],s=n.name?n.name:"animation_"+e,o=[],c=[],A=[],a=[],f=[];for(let u=0,b=n.channels.length;u<b;u++){const d=n.channels[u],I=n.samplers[d.sampler],g=d.target,l=g.node,h=n.parameters!==void 0?n.parameters[I.input]:I.input,p=n.parameters!==void 0?n.parameters[I.output]:I.output;g.node!==void 0&&(o.push(this.getDependency("node",l)),c.push(this.getDependency("accessor",h)),A.push(this.getDependency("accessor",p)),a.push(I),f.push(g))}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(A),Promise.all(a),Promise.all(f)]).then(function(u){const b=u[0],d=u[1],I=u[2],g=u[3],l=u[4],h=[];for(let C=0,E=b.length;C<E;C++){const B=b[C],Q=d[C],S=I[C],U=g[C],v=l[C];if(B===void 0)continue;B.updateMatrix&&B.updateMatrix();const O=r._createAnimationTracks(B,Q,S,U,v);if(O)for(let L=0;L<O.length;L++)h.push(O[L])}const p=new m.AnimationClip(s,void 0,h);return $e(p,n),p})}createNodeMesh(e){const t=this.json,r=this,n=t.nodes[e];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(s){const o=r._getNodeRef(r.meshCache,n.mesh,s);return n.weights!==void 0&&o.traverse(function(c){if(c.isMesh)for(let A=0,a=n.weights.length;A<a;A++)c.morphTargetInfluences[A]=n.weights[A]}),o})}loadNode(e){const t=this.json,r=this,n=t.nodes[e],s=r._loadNodeShallow(e),o=[],c=n.children||[];for(let a=0,f=c.length;a<f;a++)o.push(r.getDependency("node",c[a]));const A=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([s,Promise.all(o),A]).then(function(a){const f=a[0],u=a[1],b=a[2];b!==null&&f.traverse(function(d){d.isSkinnedMesh&&d.bind(b,$r)});for(let d=0,I=u.length;d<I;d++)f.add(u[d]);return f})}_loadNodeShallow(e){const t=this.json,r=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?n.createUniqueName(s.name):"",c=[],A=n._invokeOne(function(a){return a.createNodeMesh&&a.createNodeMesh(e)});return A&&c.push(A),s.camera!==void 0&&c.push(n.getDependency("camera",s.camera).then(function(a){return n._getNodeRef(n.cameraCache,s.camera,a)})),n._invokeAll(function(a){return a.createNodeAttachment&&a.createNodeAttachment(e)}).forEach(function(a){c.push(a)}),this.nodeCache[e]=Promise.all(c).then(function(a){let f;if(s.isBone===!0?f=new m.Bone:a.length>1?f=new m.Group:a.length===1?f=a[0]:f=new m.Object3D,f!==a[0])for(let u=0,b=a.length;u<b;u++)f.add(a[u]);if(s.name&&(f.userData.name=s.name,f.name=o),$e(f,s),s.extensions&&at(r,f,s),s.matrix!==void 0){const u=new m.Matrix4;u.fromArray(s.matrix),f.applyMatrix4(u)}else s.translation!==void 0&&f.position.fromArray(s.translation),s.rotation!==void 0&&f.quaternion.fromArray(s.rotation),s.scale!==void 0&&f.scale.fromArray(s.scale);if(!n.associations.has(f))n.associations.set(f,{});else if(s.mesh!==void 0&&n.meshCache.refs[s.mesh]>1){const u=n.associations.get(f);n.associations.set(f,{...u})}return n.associations.get(f).nodes=e,f}),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],n=this,s=new m.Group;r.name&&(s.name=n.createUniqueName(r.name)),$e(s,r),r.extensions&&at(t,s,r);const o=r.nodes||[],c=[];for(let A=0,a=o.length;A<a;A++)c.push(n.getDependency("node",o[A]));return Promise.all(c).then(function(A){for(let f=0,u=A.length;f<u;f++)s.add(A[f]);const a=f=>{const u=new Map;for(const[b,d]of n.associations)(b instanceof m.Material||b instanceof m.Texture)&&u.set(b,d);return f.traverse(b=>{const d=n.associations.get(b);d!=null&&u.set(b,d)}),u};return n.associations=a(s),s})}_createAnimationTracks(e,t,r,n,s){const o=[],c=e.name?e.name:e.uuid,A=[];rt[s.path]===rt.weights?e.traverse(function(b){b.morphTargetInfluences&&A.push(b.name?b.name:b.uuid)}):A.push(c);let a;switch(rt[s.path]){case rt.weights:a=m.NumberKeyframeTrack;break;case rt.rotation:a=m.QuaternionKeyframeTrack;break;case rt.translation:case rt.scale:a=m.VectorKeyframeTrack;break;default:r.itemSize===1?a=m.NumberKeyframeTrack:a=m.VectorKeyframeTrack;break}const f=n.interpolation!==void 0?Wr[n.interpolation]:m.InterpolateLinear,u=this._getArrayFromAccessor(r);for(let b=0,d=A.length;b<d;b++){const I=new a(A[b]+"."+rt[s.path],t.array,u,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(I),o.push(I)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const r=Xt(t.constructor),n=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)n[s]=t[s]*r;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const n=this instanceof m.QuaternionKeyframeTrack?zr:qn;return new n(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function to(i,e,t){const r=e.attributes,n=new m.Box3;if(r.POSITION!==void 0){const c=t.json.accessors[r.POSITION],A=c.min,a=c.max;if(A!==void 0&&a!==void 0){if(n.set(new m.Vector3(A[0],A[1],A[2]),new m.Vector3(a[0],a[1],a[2])),c.normalized){const f=Xt(ht[c.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const c=new m.Vector3,A=new m.Vector3;for(let a=0,f=s.length;a<f;a++){const u=s[a];if(u.POSITION!==void 0){const b=t.json.accessors[u.POSITION],d=b.min,I=b.max;if(d!==void 0&&I!==void 0){if(A.setX(Math.max(Math.abs(d[0]),Math.abs(I[0]))),A.setY(Math.max(Math.abs(d[1]),Math.abs(I[1]))),A.setZ(Math.max(Math.abs(d[2]),Math.abs(I[2]))),b.normalized){const g=Xt(ht[b.componentType]);A.multiplyScalar(g)}c.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(c)}i.boundingBox=n;const o=new m.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,i.boundingSphere=o}function Bn(i,e,t){const r=e.attributes,n=[];function s(o,c){return t.getDependency("accessor",o).then(function(A){i.setAttribute(c,A)})}for(const o in r){const c=Jt[o]||o.toLowerCase();c in i.attributes||n.push(s(r[o],c))}if(e.indices!==void 0&&!i.index){const o=t.getDependency("accessor",e.indices).then(function(c){i.setIndex(c)});n.push(o)}return m.ColorManagement.workingColorSpace!==m.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${m.ColorManagement.workingColorSpace}" not supported.`),$e(i,e),to(i,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Yr(i,e.targets,t):i})}const Ot=new WeakMap;class no extends m.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,n){const s=new m.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,n)},r,n)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,m.SRGBColorSpace,r).catch(r)}decodeDracoFile(e,t,r,n,s=m.LinearSRGBColorSpace,o=()=>{}){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:s};return this.decodeGeometry(e,c).then(t).catch(o)}decodeGeometry(e,t){const r=JSON.stringify(t);if(Ot.has(e)){const A=Ot.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 n;const s=this.workerNextTaskID++,o=e.byteLength,c=this._getWorker(s,o).then(A=>(n=A,new Promise((a,f)=>{n._callbacks[s]={resolve:a,reject:f},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(A=>this._createGeometry(A.geometry));return c.catch(()=>!0).then(()=>{n&&s&&this._releaseTask(n,s)}),Ot.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new m.BufferGeometry;e.index&&t.setIndex(new m.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const{name:n,array:s,itemSize:o,stride:c,vertexColorSpace:A}=e.attributes[r];let a;if(o===c)a=new m.BufferAttribute(s,o);else{const f=new m.InterleavedBuffer(s,c);a=new m.InterleavedBufferAttribute(f,o,0)}n==="color"&&(this._assignVertexColorSpace(a,A),a.normalized=!(s instanceof Float32Array)),t.setAttribute(n,a)}return t}_assignVertexColorSpace(e,t){if(t!==m.SRGBColorSpace)return;const r=new m.Color;for(let n=0,s=e.count;n<s;n++)r.fromBufferAttribute(e,n),m.ColorManagement.colorSpaceToWorking(r,m.SRGBColorSpace),e.setXYZ(n,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new m.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((n,s)=>{r.load(e,n,void 0,s)})}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 n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const s=io.toString(),o=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
2
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){const o=s.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._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 io(){let i,e;onmessage=function(o){const c=o.data;switch(c.type){case"init":i=c.decoderConfig,e=new Promise(function(f){i.onModuleLoaded=function(u){f({draco:u})},DracoDecoderModule(i)});break;case"decode":const A=c.buffer,a=c.taskConfig;e.then(f=>{const u=f.draco,b=new u.Decoder;try{const d=t(u,b,new Int8Array(A),a),I=d.attributes.map(g=>g.array.buffer);d.index&&I.push(d.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:d},I)}catch(d){console.error(d),self.postMessage({type:"error",id:c.id,error:d.message})}finally{u.destroy(b)}});break}};function t(o,c,A,a){const f=a.attributeIDs,u=a.attributeTypes;let b,d;const I=c.GetEncodedGeometryType(A);if(I===o.TRIANGULAR_MESH)b=new o.Mesh,d=c.DecodeArrayToMesh(A,A.byteLength,b);else if(I===o.POINT_CLOUD)b=new o.PointCloud,d=c.DecodeArrayToPointCloud(A,A.byteLength,b);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||b.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const g={index:null,attributes:[]};for(const l in f){const h=self[u[l]];let p,C;if(a.useUniqueIDs)C=f[l],p=c.GetAttributeByUniqueId(b,C);else{if(C=c.GetAttributeId(b,o[f[l]]),C===-1)continue;p=c.GetAttribute(b,C)}const E=n(o,c,b,l,h,p);l==="color"&&(E.vertexColorSpace=a.vertexColorSpace),g.attributes.push(E)}return I===o.TRIANGULAR_MESH&&(g.index=r(o,c,b)),o.destroy(b),g}function r(o,c,A){const f=A.num_faces()*3,u=f*4,b=o._malloc(u);c.GetTrianglesUInt32Array(A,u,b);const d=new Uint32Array(o.HEAPF32.buffer,b,f).slice();return o._free(b),{array:d,itemSize:1}}function n(o,c,A,a,f,u){const b=A.num_points(),d=u.num_components(),I=s(o,f),g=d*f.BYTES_PER_ELEMENT,l=Math.ceil(g/4)*4,h=l/f.BYTES_PER_ELEMENT,p=b*g,C=b*l,E=o._malloc(p);c.GetAttributeDataArrayForAllPoints(A,u,I,p,E);const B=new f(o.HEAPF32.buffer,E,p/f.BYTES_PER_ELEMENT);let Q;if(g===l)Q=B.slice();else{Q=new f(C/f.BYTES_PER_ELEMENT);let S=0;for(let U=0,v=B.length;U<v;U++){for(let O=0;O<d;O++)Q[S+O]=B[U*d+O];S+=h}}return o._free(E),{name:a,count:b,itemSize:d,array:Q,stride:h}}function s(o,c){switch(c){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}class ro{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:n,msg:s,transfer:o}=this.queue.shift();this.workersResolve[e]=n,this.workers[e].postMessage(s,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(r=>{const n=this._getIdleWorker();n!==-1?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=r,this.workers[n].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const oo=0,Tn=2,so=1,Rn=2,ao=0,Ao=1,co=10,lo=0,Kn=9,zn=15,Wn=16,Vn=22,Yn=37,Jn=43,Xn=76,Zn=83,$n=97,ei=100,ti=103,ni=109,ii=122,ri=123,oi=131,si=132,ai=133,Ai=134,ci=137,li=138,ui=139,hi=140,fi=141,di=142,pi=145,gi=146,Ei=148,Ii=152,Zt=153,uo=154,$t=155,ho=156,mi=157,bi=158,Ci=165,yi=166,Bi=1000054e3,Ti=1000054001,Ri=1000054004,wi=1000054005,rn=1000066e3,vi=1000066004;class dt{constructor(e,t,r,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}const ze=[171,75,84,88,32,50,48,187,13,10,26,10];function wn(i){return new TextDecoder().decode(i)}function fo(i){const e=new Uint8Array(i.buffer,i.byteOffset,ze.length);if(e[0]!==ze[0]||e[1]!==ze[1]||e[2]!==ze[2]||e[3]!==ze[3]||e[4]!==ze[4]||e[5]!==ze[5]||e[6]!==ze[6]||e[7]!==ze[7]||e[8]!==ze[8]||e[9]!==ze[9]||e[10]!==ze[10]||e[11]!==ze[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},r=17*Uint32Array.BYTES_PER_ELEMENT,n=new dt(i,ze.length,r,!0);t.vkFormat=n._nextUint32(),t.typeSize=n._nextUint32(),t.pixelWidth=n._nextUint32(),t.pixelHeight=n._nextUint32(),t.pixelDepth=n._nextUint32(),t.layerCount=n._nextUint32(),t.faceCount=n._nextUint32(),t.levelCount=n._nextUint32(),t.supercompressionScheme=n._nextUint32();const s=n._nextUint32(),o=n._nextUint32(),c=n._nextUint32(),A=n._nextUint32(),a=n._nextUint64(),f=n._nextUint64(),u=3*Math.max(t.levelCount,1)*8,b=new dt(i,ze.length+r,u,!0);for(let re=0,oe=Math.max(t.levelCount,1);re<oe;re++)t.levels.push({levelData:new Uint8Array(i.buffer,i.byteOffset+b._nextUint64(),b._nextUint64()),uncompressedByteLength:b._nextUint64()});const d=new dt(i,s,o,!0);d._skip(4);const I=d._nextUint16(),g=d._nextUint16(),l=d._nextUint16(),h=d._nextUint16(),p={vendorId:I,descriptorType:g,versionNumber:l,colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},C=(h/4-6)/4;for(let re=0;re<C;re++){const oe={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&oe.channelType?(oe.sampleLower=d._nextInt32(),oe.sampleUpper=d._nextInt32()):(oe.sampleLower=d._nextUint32(),oe.sampleUpper=d._nextUint32()),p.samples[re]=oe}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(p);const E=new dt(i,c,A,!0);for(;E._offset<A;){const re=E._nextUint32(),oe=E._scan(re),te=wn(oe);if(t.keyValue[te]=E._nextUint8Array(re-oe.byteLength-1),te.match(/^ktx/i)){const he=wn(t.keyValue[te]);t.keyValue[te]=he.substring(0,he.lastIndexOf("\0"))}E._skip(re%4?4-re%4:0)}if(f<=0)return t;const B=new dt(i,a,f,!0),Q=B._nextUint16(),S=B._nextUint16(),U=B._nextUint32(),v=B._nextUint32(),O=B._nextUint32(),L=B._nextUint32(),k=[];for(let re=0,oe=Math.max(t.levelCount,1);re<oe;re++)k.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});const D=a+B._offset,_=D+U,V=_+v,J=V+O,q=new Uint8Array(i.buffer,i.byteOffset+D,U),X=new Uint8Array(i.buffer,i.byteOffset+_,v),$=new Uint8Array(i.buffer,i.byteOffset+V,O),le=new Uint8Array(i.buffer,i.byteOffset+J,L);return t.globalData={endpointCount:Q,selectorCount:S,imageDescs:k,endpointsData:q,selectorsData:X,tablesData:$,extendedData:le},t}let Pt,et,en;const Gt={env:{emscripten_notify_memory_growth:function(i){en=new Uint8Array(et.exports.memory.buffer)}}};class po{init(){return Pt||(Pt=typeof fetch<"u"?fetch("data:application/wasm;base64,"+vn).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Gt)).then(this._init):WebAssembly.instantiate(Buffer.from(vn,"base64"),Gt).then(this._init),Pt)}_init(e){et=e.instance,Gt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!et)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,n=et.exports.malloc(r);en.set(e,n),t=t||Number(et.exports.ZSTD_findDecompressedSize(n,r));const s=et.exports.malloc(t),o=et.exports.ZSTD_decompress(s,t,n,r),c=en.slice(s,s+o);return et.exports.free(n),et.exports.free(s),c}}const vn="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",go="display-p3",Eo="display-p3-linear";({...m.ColorManagement.spaces[m.SRGBColorSpace]});const Ut=new WeakMap;let Ht=0,jt;class Je extends m.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new ro,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},typeof navigator<"u"&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new m.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new m.FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const n=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,n]).then(([s,o])=>{const c=Je.BasisWorker.toString(),A=["/* constants */","let _EngineFormat = "+JSON.stringify(Je.EngineFormat),"let _EngineType = "+JSON.stringify(Je.EngineType),"let _TranscoderFormat = "+JSON.stringify(Je.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Je.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",c.substring(c.indexOf("{")+1,c.lastIndexOf("}"))].join(`
3
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([A])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const a=new Worker(this.workerSourceURL),f=this.transcoderBinary.slice(0);return a.postMessage({type:"init",config:this.workerConfig,transcoderBinary:f},[f]),a})}),Ht>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ht++}return this.transcoderPending}load(e,t,r,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new m.FileLoader(this.manager);s.setPath(this.path),s.setCrossOrigin(this.crossOrigin),s.setWithCredentials(this.withCredentials),s.setRequestHeader(this.requestHeader),s.setResponseType("arraybuffer"),s.load(e,o=>{this.parse(o,t,n)},r,n)}parse(e,t,r){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(Ut.has(e))return Ut.get(e).promise.then(t).catch(r);this._createTexture(e).then(n=>t?t(n):null).catch(r)}_createTextureFrom(e,t){const{type:r,error:n,data:{faces:s,width:o,height:c,format:A,type:a,dfdFlags:f}}=e;if(r==="error")return Promise.reject(n);let u;if(t.faceCount===6)u=new m.CompressedCubeTexture(s,A,a);else{const b=s[0].mipmaps;u=t.layerCount>1?new m.CompressedArrayTexture(b,o,c,t.layerCount,A,a):new m.CompressedTexture(b,o,c,A,a)}return u.minFilter=s[0].mipmaps.length===1?m.LinearFilter:m.LinearMipmapLinearFilter,u.magFilter=m.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=Qi(t),u.premultiplyAlpha=!!(f&so),u}async _createTexture(e,t={}){const r=fo(new Uint8Array(e)),n=r.vkFormat===rn&&r.dataFormatDescriptor[0].colorModel===167;if(!(r.vkFormat===lo||n&&!this.workerConfig.astcHDRSupported))return mo(r);const o=t,c=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])).then(A=>this._createTextureFrom(A.data,r));return Ut.set(e,{promise:c}),c}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ht--}}Je.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};Je.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25};Je.EngineFormat={RGBAFormat:m.RGBAFormat,RGBA_ASTC_4x4_Format:m.RGBA_ASTC_4x4_Format,RGB_BPTC_UNSIGNED_Format:m.RGB_BPTC_UNSIGNED_Format,RGBA_BPTC_Format:m.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:m.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:m.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:m.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:m.RGB_ETC1_Format,RGB_ETC2_Format:m.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:m.RGB_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:m.RGBA_S3TC_DXT1_Format};Je.EngineType={UnsignedByteType:m.UnsignedByteType,HalfFloatType:m.HalfFloatType,FloatType:m.FloatType};Je.BasisWorker=function(){let i,e,t;const r=_EngineFormat,n=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",function(I){const g=I.data;switch(g.type){case"init":i=g.config,c(g.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:l,buffers:h,width:p,height:C,hasAlpha:E,format:B,type:Q,dfdFlags:S}=A(g.buffer);self.postMessage({type:"transcode",id:g.id,data:{faces:l,width:p,height:C,hasAlpha:E,format:B,type:Q,dfdFlags:S}},h)}catch(l){console.error(l),self.postMessage({type:"error",id:g.id,error:l.message})}});break}});function c(I){e=new Promise(g=>{t={wasmBinary:I,onRuntimeInitialized:g},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function A(I){const g=new t.KTX2File(new Uint8Array(I));function l(){g.close(),g.delete()}if(!g.isValid())throw l(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let h;if(g.isUASTC())h=o.UASTC;else if(g.isETC1S())h=o.ETC1S;else if(g.isHDR())h=o.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const p=g.getWidth(),C=g.getHeight(),E=g.getLayers()||1,B=g.getLevels(),Q=g.getFaces(),S=g.getHasAlpha(),U=g.getDFDFlags(),{transcoderFormat:v,engineFormat:O,engineType:L}=u(h,p,C,S);if(!p||!C||!B)throw l(),new Error("THREE.KTX2Loader: Invalid texture");if(!g.startTranscoding())throw l(),new Error("THREE.KTX2Loader: .startTranscoding failed");const k=[],D=[];for(let _=0;_<Q;_++){const V=[];for(let J=0;J<B;J++){const q=[];let X,$;for(let re=0;re<E;re++){const oe=g.getImageLevelInfo(J,re,_);_===0&&J===0&&re===0&&(oe.origWidth%4!==0||oe.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),B>1?(X=oe.origWidth,$=oe.origHeight):(X=oe.width,$=oe.height);let te=new Uint8Array(g.getImageTranscodedSizeInBytes(J,re,0,v));const he=g.transcodeImage(te,J,re,_,v,0,-1,-1);if(L===n.HalfFloatType&&(te=new Uint16Array(te.buffer,te.byteOffset,te.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!he)throw l(),new Error("THREE.KTX2Loader: .transcodeImage failed.");q.push(te)}const le=d(q);V.push({data:le,width:X,height:$}),D.push(le.buffer)}k.push({mipmaps:V,width:p,height:C,format:O,type:L})}return l(),{faces:k,buffers:D,width:p,height:C,hasAlpha:S,dfdFlags:U,format:O,type:L}}const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],engineType:[n.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],engineType:[n.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[r.RGBA_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],engineType:[n.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],engineType:[n.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[r.RGB_ETC1_Format],engineType:[n.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],engineType:[n.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[r.RGB_BPTC_UNSIGNED_Format],engineType:[n.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[r.RGBAFormat,r.RGBAFormat],engineType:[n.UnsignedByteType,n.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[r.RGBAFormat],engineType:[n.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],f={[o.ETC1S]:a.filter(I=>I.basisFormat.includes(o.ETC1S)).sort((I,g)=>I.priorityETC1S-g.priorityETC1S),[o.UASTC]:a.filter(I=>I.basisFormat.includes(o.UASTC)).sort((I,g)=>I.priorityUASTC-g.priorityUASTC),[o.UASTC_HDR]:a.filter(I=>I.basisFormat.includes(o.UASTC_HDR)).sort((I,g)=>I.priorityHDR-g.priorityHDR)};function u(I,g,l,h){const p=f[I];for(let C=0;C<p.length;C++){const E=p[C];if(E.if&&!i[E.if]||!E.basisFormat.includes(I)||h&&E.transcoderFormat.length<2||E.needsPowerOfTwo&&!(b(g)&&b(l)))continue;const B=E.transcoderFormat[h?1:0],Q=E.engineFormat[h?1:0],S=E.engineType[0];return{transcoderFormat:B,engineFormat:Q,engineType:S}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function b(I){return I<=2?!0:(I&I-1)===0&&I!==0}function d(I){if(I.length===1)return I[0];let g=0;for(let p=0;p<I.length;p++){const C=I[p];g+=C.byteLength}const l=new Uint8Array(g);let h=0;for(let p=0;p<I.length;p++){const C=I[p];l.set(C,h),h+=C.byteLength}return l}};const Io=new Set([m.RGBAFormat,m.RGBFormat,m.RGFormat,m.RedFormat]),qt={[ni]:m.RGBAFormat,[ti]:m.RGFormat,[ei]:m.RedFormat,[$n]:m.RGBAFormat,[Zn]:m.RGFormat,[Xn]:m.RedFormat,[Jn]:m.RGBAFormat,[Yn]:m.RGBAFormat,[Vn]:m.RGFormat,[Wn]:m.RGFormat,[zn]:m.RedFormat,[Kn]:m.RedFormat,[ri]:m.RGBFormat,[ii]:m.RGBFormat,[Ii]:m.RGBA_ETC2_EAC_Format,[Ei]:m.RGB_ETC2_Format,[Zt]:m.R11_EAC_Format,[uo]:m.SIGNED_R11_EAC_Format,[$t]:m.RG11_EAC_Format,[ho]:m.SIGNED_RG11_EAC_Format,[rn]:m.RGBA_ASTC_4x4_Format,[bi]:m.RGBA_ASTC_4x4_Format,[mi]:m.RGBA_ASTC_4x4_Format,[vi]:m.RGBA_ASTC_6x6_Format,[yi]:m.RGBA_ASTC_6x6_Format,[Ci]:m.RGBA_ASTC_6x6_Format,[Ai]:m.RGBA_S3TC_DXT1_Format,[ai]:m.RGBA_S3TC_DXT1_Format,[si]:m.RGB_S3TC_DXT1_Format,[oi]:m.RGB_S3TC_DXT1_Format,[li]:m.RGBA_S3TC_DXT3_Format,[ci]:m.RGBA_S3TC_DXT3_Format,[hi]:m.SIGNED_RED_RGTC1_Format,[ui]:m.RED_RGTC1_Format,[di]:m.SIGNED_RED_GREEN_RGTC2_Format,[fi]:m.RED_GREEN_RGTC2_Format,[gi]:m.RGBA_BPTC_Format,[pi]:m.RGBA_BPTC_Format,[wi]:m.RGBA_PVRTC_4BPPV1_Format,[Ti]:m.RGBA_PVRTC_4BPPV1_Format,[Ri]:m.RGBA_PVRTC_2BPPV1_Format,[Bi]:m.RGBA_PVRTC_2BPPV1_Format},ut={[ni]:m.FloatType,[ti]:m.FloatType,[ei]:m.FloatType,[$n]:m.HalfFloatType,[Zn]:m.HalfFloatType,[Xn]:m.HalfFloatType,[Jn]:m.UnsignedByteType,[Yn]:m.UnsignedByteType,[Vn]:m.UnsignedByteType,[Wn]:m.UnsignedByteType,[zn]:m.UnsignedByteType,[Kn]:m.UnsignedByteType,[ri]:m.UnsignedInt5999Type,[ii]:m.UnsignedInt101111Type,[Ii]:m.UnsignedByteType,[Ei]:m.UnsignedByteType,[Zt]:m.UnsignedByteType,[Zt]:m.UnsignedByteType,[$t]:m.UnsignedByteType,[$t]:m.UnsignedByteType,[rn]:m.HalfFloatType,[bi]:m.UnsignedByteType,[mi]:m.UnsignedByteType,[vi]:m.HalfFloatType,[yi]:m.UnsignedByteType,[Ci]:m.UnsignedByteType,[Ai]:m.UnsignedByteType,[ai]:m.UnsignedByteType,[si]:m.UnsignedByteType,[oi]:m.UnsignedByteType,[li]:m.UnsignedByteType,[ci]:m.UnsignedByteType,[hi]:m.UnsignedByteType,[ui]:m.UnsignedByteType,[di]:m.UnsignedByteType,[fi]:m.UnsignedByteType,[gi]:m.UnsignedByteType,[pi]:m.UnsignedByteType,[wi]:m.UnsignedByteType,[Ti]:m.UnsignedByteType,[Ri]:m.UnsignedByteType,[Bi]:m.UnsignedByteType};async function mo(i){const{vkFormat:e}=i;if(qt[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);ut[e]===void 0&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let t;i.supercompressionScheme===Tn&&(jt||(jt=new Promise(async o=>{const c=new po;await c.init(),o(c)})),t=await jt);const r=[];for(let o=0;o<i.levels.length;o++){const c=Math.max(1,i.pixelWidth>>o),A=Math.max(1,i.pixelHeight>>o),a=i.pixelDepth?Math.max(1,i.pixelDepth>>o):0,f=i.levels[o];let u;if(i.supercompressionScheme===oo)u=f.levelData;else if(i.supercompressionScheme===Tn)u=t.decode(f.levelData,f.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let b;ut[e]===m.FloatType?b=new Float32Array(u.buffer,u.byteOffset,u.byteLength/Float32Array.BYTES_PER_ELEMENT):ut[e]===m.HalfFloatType?b=new Uint16Array(u.buffer,u.byteOffset,u.byteLength/Uint16Array.BYTES_PER_ELEMENT):ut[e]===m.UnsignedInt5999Type||ut[e]===m.UnsignedInt101111Type?b=new Uint32Array(u.buffer,u.byteOffset,u.byteLength/Uint32Array.BYTES_PER_ELEMENT):b=u,r.push({data:b,width:c,height:A,depth:a})}const n=i.levelCount===0||r.length>1;let s;if(Io.has(qt[e]))s=i.pixelDepth===0?new m.DataTexture(r[0].data,i.pixelWidth,i.pixelHeight):new m.Data3DTexture(r[0].data,i.pixelWidth,i.pixelHeight,i.pixelDepth),s.minFilter=n?m.NearestMipmapNearestFilter:m.NearestFilter,s.magFilter=m.NearestFilter,s.generateMipmaps=i.levelCount===0;else{if(i.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new m.CompressedTexture(r,i.pixelWidth,i.pixelHeight),s.minFilter=n?m.LinearMipmapLinearFilter:m.LinearFilter,s.magFilter=m.LinearFilter}return s.mipmaps=r,s.type=ut[e],s.format=qt[e],s.colorSpace=Qi(i),s.needsUpdate=!0,Promise.resolve(s)}function Qi(i){const e=i.dataFormatDescriptor[0];return e.colorPrimaries===Ao?e.transferFunction===Rn?m.SRGBColorSpace:m.LinearSRGBColorSpace:e.colorPrimaries===co?e.transferFunction===Rn?go:Eo:(e.colorPrimaries===ao||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),m.NoColorSpace)}class on{name;time;duration;isPaused;playCount;interpolants;constructor(e,t){this.name=t||e.name,this.time=0,this.duration=e.duration,this.isPaused=!1,this.playCount=0,this.interpolants={};for(const r of e.tracks){const n=r.getValueSize();let s;r.ValueTypeName==="quaternion"?s=new ae.QuaternionLinearInterpolant(r.times,r.values,n):s=new ae.LinearInterpolant(r.times,r.values,n),this.interpolants[r.name]=s}}init(e){}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}prepare3D(e){}cleanup3D(e){}setPause(e){this.isPaused=e}setTime(e){this.time=e}update(e){this.time+=e,this.time>this.duration&&(this.time-=this.duration,this.playCount++);const t={};for(const[r,n]of Object.entries(this.interpolants)){const[s,o]=r.split(".");let c=t[s];c||(c={},t[s]=c);const A=n.evaluate(this.time);if(o==="position")c.loc=new ce(A[0],A[1],A[2]);else if(o==="quaternion")c.quat=new Ce(A[0],A[1],A[2],A[3]);else if(o==="scale")c.scale=new ce(A[0],A[1],A[2]);else if(o==="morphTargetInfluences"){c.morphs||(c.morphs=[]);const a=Array.from(A);c.morphs.push({name:s,vals:a})}else console.warn(`ClipPoseMotion: update. unknown property(${o})`)}return t}}var ki=(function(){var i="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n=WebAssembly.validate(t)?c(e):c(i),s,o=WebAssembly.instantiate(n,{}).then(function(h){s=h.instance,s.exports.__wasm_call_ctors()});function c(h){for(var p=new Uint8Array(h.length),C=0;C<h.length;++C){var E=h.charCodeAt(C);p[C]=E>96?E-97:E>64?E-39:E+4}for(var B=0,C=0;C<h.length;++C)p[B++]=p[C]<60?r[p[C]]:(p[C]-60)*64+p[++C];return p.buffer.slice(0,B)}function A(h,p,C,E,B,Q,S){var U=h.exports.sbrk,v=E+3&-4,O=U(v*B),L=U(Q.length),k=new Uint8Array(h.exports.memory.buffer);k.set(Q,L);var D=p(O,E,B,L,Q.length);if(D==0&&S&&S(O,v,B),C.set(k.subarray(O,O+E*B)),U(O-U(0)),D!=0)throw new Error("Malformed buffer data: "+D)}var a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],b=0;function d(h){var p={object:new Worker(h),pending:0,requests:{}};return p.object.onmessage=function(C){var E=C.data;p.pending-=E.count,p.requests[E.id][E.action](E.value),delete p.requests[E.id]},p}function I(h){for(var p="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(n)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+l.name+";"+A.toString()+l.toString(),C=new Blob([p],{type:"text/javascript"}),E=URL.createObjectURL(C),B=u.length;B<h;++B)u[B]=d(E);for(var B=h;B<u.length;++B)u[B].object.postMessage({});u.length=h,URL.revokeObjectURL(E)}function g(h,p,C,E,B){for(var Q=u[0],S=1;S<u.length;++S)u[S].pending<Q.pending&&(Q=u[S]);return new Promise(function(U,v){var O=new Uint8Array(C),L=++b;Q.pending+=h,Q.requests[L]={resolve:U,reject:v},Q.object.postMessage({id:L,count:h,size:p,source:O,mode:E,filter:B},[O.buffer])})}function l(h){var p=h.data;if(!p.id)return self.close();self.ready.then(function(C){try{var E=new Uint8Array(p.count*p.size);A(C,C.exports[p.mode],E,p.count,p.size,p.source,C.exports[p.filter]),self.postMessage({id:p.id,count:p.count,action:"resolve",value:E},[E.buffer])}catch(B){self.postMessage({id:p.id,count:p.count,action:"reject",value:B})}})}return{ready:o,supported:!0,useWorkers:function(h){I(h)},decodeVertexBuffer:function(h,p,C,E,B){A(s,s.exports.meshopt_decodeVertexBuffer,h,p,C,E,s.exports[a[B]])},decodeIndexBuffer:function(h,p,C,E){A(s,s.exports.meshopt_decodeIndexBuffer,h,p,C,E)},decodeIndexSequence:function(h,p,C,E){A(s,s.exports.meshopt_decodeIndexSequence,h,p,C,E)},decodeGltfBuffer:function(h,p,C,E,B,Q){A(s,s.exports[f[B]],h,p,C,E,s.exports[a[Q]])},decodeGltfBufferAsync:function(h,p,C,E,B){return u.length>0?g(h,p,C,f[E],a[B]):o.then(function(){var Q=new Uint8Array(h*p);return A(s,s.exports[f[E]],Q,h,p,C,s.exports[a[B]]),Q})}}})();function bo(i){return"morphTargetDictionary"in i&&i.morphTargetDictionary!==void 0&&"morphTargetInfluences"in i&&Array.isArray(i.morphTargetInfluences)}const Co={draco:"https://unpkg.com/three@0.182/examples/jsm/libs/draco/",ktx2:"https://unpkg.com/three@0.182.0/examples/jsm/libs/basis/",meshopt:!0};function Si(i={}){const e={...Co,...i};let t=new Hn;const r=new no;if(r.setDecoderPath(e.draco),t.setDRACOLoader(r),e.renderer){const n=new Je;n.setTranscoderPath(e.ktx2),n.detectSupport(e.renderer),t.setKTX2Loader(n)}e.meshopt&&t.setMeshoptDecoder(ki),sn=t}let sn=new Hn;sn.setMeshoptDecoder(ki);class yo extends xe{ready;gltf;constructor(e){super(),this.ready=this.asyncInit(e)}initObject(){return new ae.Object3D}async asyncInit(e){if(_n(e)){this.gltf=await sn.loadAsync(e),this.bones={},this.skeletons=[],this.morphs={},this.gltf.scene.traverse(r=>{if(r.userData.a3js={objectA3:this},bo(r)){const{morphTargetDictionary:n,morphTargetInfluences:s}=r;Object.keys(n).forEach(o=>{const c=r.name+"."+o,A=n[o];this.morphs[c]={array:s,idx:A}})}r instanceof ae.Bone&&(this.bones[r.name]=r),r instanceof ae.SkinnedMesh&&this.skeletons.push(r.skeleton)});const t={};this.gltf.animations.forEach(r=>{t[r.name]=new on(r)}),this.setPoseMotions(t),this.object.add(this.gltf.scene)}else{const t=new ae.BoxGeometry,r=new ae.MeshStandardMaterial({color:16711680}),n=new ae.Mesh(t,r);this.object.add(n)}return this}}class an extends HTMLElement{ro;base;renderer;css2DRenderer;scene;camera;controller;camera3js;timer;_canvas;_css2DCanvas;constructor(e){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
2
4
  <style>
3
5
  :host {
4
6
  width: 100%;
@@ -21,7 +23,7 @@
21
23
  }
22
24
  </style>
23
25
  <slot></slog>
24
- `,e||(e={}),e.camera||(e.camera=new se.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new ut(e.camera);this.base=new Dt(t),this.scene=this.base.scene,this.camera=this.base.camera,this.controller=this.base.controller,this.clock=new se.Clock;const i={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new se.WebGLRenderer(i),this.renderer.setSize(600,300),"opaque"in e&&this.renderer.setClearAlpha(0),this._canvas=this.renderer.domElement,this._canvas.width=600,this._canvas.height=300,this.appendChild(this._canvas),this.css2DRenderer=new hn,this._css2DCanvas=this.css2DRenderer.domElement,this._css2DCanvas.style.position="absolute",this._css2DCanvas.style.top="0px",this.appendChild(this._css2DCanvas),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this._css2DCanvas.addEventListener("click",this.myMouseClickedListener),window.addEventListener("keydown",r=>{this.controller?.keyDown(r)}),window.addEventListener("keyup",r=>{this.controller?.keyUp(r)}),window.addEventListener("keypress",r=>{this.controller?.keyPress(r)}),this._css2DCanvas.addEventListener("mousedown",r=>{this.controller?.mouseDown(r)}),this._css2DCanvas.addEventListener("mouseup",r=>{this.controller?.mouseUp(r)}),this._css2DCanvas.addEventListener("mousemove",r=>{this.controller?.mouseMove(r)}),this._css2DCanvas.addEventListener("click",r=>{this.controller?.mouseClick(r)}),this._css2DCanvas.addEventListener("mouseenter",r=>{this.controller?.mouseEnter(r)}),this._css2DCanvas.addEventListener("mouseleave",r=>{this.controller?.mouseLeave(r)}),this._css2DCanvas.addEventListener("wheel",r=>{this.controller?.mouseWheel(r)}),this._css2DCanvas.addEventListener("touchstart",r=>{this.controller?.touchStart(r)}),this._css2DCanvas.addEventListener("touchmove",r=>{this.controller?.touchMove(r)}),this._css2DCanvas.addEventListener("touchend",r=>{this.controller?.touchEnd(r)}),this._css2DCanvas.addEventListener("touchcancel",r=>{this.controller?.touchCancel(r)})}connectedCallback(){this.ro=new ResizeObserver(()=>{const e=window.devicePixelRatio||1,t=Math.floor(this.clientWidth*e),i=Math.floor(this.clientHeight*e);(this._canvas.width!==t||this._canvas.height!==i)&&(this._canvas.width=t,this._canvas.height=i,ar(this.camera3js)&&(this.camera3js.aspect=t/i,this.camera3js.updateProjectionMatrix()),this.renderer.setSize(t,i),this.css2DRenderer.setSize(t,i))}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.scene=e,this.base.replaceScene(e)}setController(e){this.controller=e,this.base.setController(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),this.css2DRenderer.render(this.scene.scene,this.camera3js)};worldToScreen(e){const t=new se.Vector3(e.x,e.y,e.z);t.project(this.camera3js);const i=new se.Vector2;this.renderer.getSize(i);const r=(t.x+1)/2*i.x,a=(1-t.y)/2*i.y;return{x:r,y:a}}screenToWorld(e,t,i){const r=new se.Vector3(e/this._canvas.clientWidth*2-1,-(t/this._canvas.clientHeight)*2+1,.5);r.unproject(this.camera3js);const a=r.sub(this.camera3js.position).normalize();return this.camera3js.position.clone().add(a.multiplyScalar(i))}cameraToScreen(e){const i=new se.Vector3(e.x,e.y,e.z).applyMatrix4(this.camera3js.matrixWorld);return this.worldToScreen(i)}screenToCamera(e,t,i){const r=this.screenToWorld(e,t,i);return new se.Vector3(r.x,r.y,r.z).applyMatrix4(this.camera3js.matrixWorldInverse)}myMouseClickedListener=async e=>{if(this.camera instanceof ut){const t=new se.Raycaster,i=new se.Vector2,r=e.target.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;i.x=2*(a/r.width)-1,i.y=-2*(o/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),c=[];u.forEach(s=>{const f=s.object.userData.a3js?.objectA3;c.push({three:s.object,a3js:f})}),c.length>0&&await c[0].a3js.clicked(),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:c}}))}};alert(e,t){return new Promise(i=>{const r=document.createElement("div");r.style.cssText="position: absolute; top: 0px; width: 100%; height: 100%; display: flex; flex-direction: column;";const a=document.createElement("p");a.style.cssText="width: 80%; margin: 0 auto; color: red; text-align: center; border: 3px solid red;",a.textContent=e,r.appendChild(a);const o=document.createElement("button");o.textContent="OK!",r.appendChild(o),this.appendChild(r),o.addEventListener("click",async()=>{t&&await t(),this.removeChild(r),i()})})}}customElements.define("canvas-a3",fn);function ar(n){return n.isPerspectiveCamera===!0}class dn extends HTMLElement{_resizeObserver;_dragging=!1;_resizing=!1;_resizeDir="";_startMouseX=0;_startMouseY=0;_startLeft=0;_startTop=0;_startWidth=0;_startHeight=0;_borderSize=5;_canvas;_css2DCanvas;_titleEl=null;_titleBar=null;_closeBtn=null;base;renderer;css2DRenderer;scene;camera;controller;camera3js;clock;constructor(e=600,t=300){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
26
+ `,e||(e={}),e.camera||(e.camera=new ae.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new It(e.camera);this.base=new Pn(t),this.scene=this.base.scene,this.camera=this.base.camera,this.controller=this.base.controller,this.timer=new ae.Timer,this.timer.connect(document);const r={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new ae.WebGLRenderer(r),Si({renderer:this.renderer}),this.renderer.setSize(600,300),"opaque"in e&&this.renderer.setClearAlpha(0),this._canvas=this.renderer.domElement,this._canvas.width=600,this._canvas.height=300,this.appendChild(this._canvas),this.css2DRenderer=new Un,this._css2DCanvas=this.css2DRenderer.domElement,this._css2DCanvas.style.position="absolute",this._css2DCanvas.style.top="0px",this.appendChild(this._css2DCanvas),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this._css2DCanvas.addEventListener("click",this.myMouseClickedListener),window.addEventListener("keydown",n=>{this.controller?.keyDown(n)}),window.addEventListener("keyup",n=>{this.controller?.keyUp(n)}),window.addEventListener("keypress",n=>{this.controller?.keyPress(n)}),this._css2DCanvas.addEventListener("mousedown",n=>{this.controller?.mouseDown(n)}),this._css2DCanvas.addEventListener("mouseup",n=>{this.controller?.mouseUp(n)}),this._css2DCanvas.addEventListener("mousemove",n=>{this.controller?.mouseMove(n)}),this._css2DCanvas.addEventListener("click",n=>{this.controller?.mouseClick(n)}),this._css2DCanvas.addEventListener("mouseenter",n=>{this.controller?.mouseEnter(n)}),this._css2DCanvas.addEventListener("mouseleave",n=>{this.controller?.mouseLeave(n)}),this._css2DCanvas.addEventListener("wheel",n=>{this.controller?.mouseWheel(n)}),this._css2DCanvas.addEventListener("touchstart",n=>{this.controller?.touchStart(n)}),this._css2DCanvas.addEventListener("touchmove",n=>{this.controller?.touchMove(n)}),this._css2DCanvas.addEventListener("touchend",n=>{this.controller?.touchEnd(n)}),this._css2DCanvas.addEventListener("touchcancel",n=>{this.controller?.touchCancel(n)})}connectedCallback(){this.ro=new ResizeObserver(()=>{const e=window.devicePixelRatio||1,t=Math.floor(this.clientWidth*e),r=Math.floor(this.clientHeight*e);(this._canvas.width!==t||this._canvas.height!==r)&&(this._canvas.width=t,this._canvas.height=r,Bo(this.camera3js)&&(this.camera3js.aspect=t/r,this.camera3js.updateProjectionMatrix()),this.renderer.setSize(t,r),this.css2DRenderer.setSize(t,r))}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.scene=e,this.base.replaceScene(e)}setController(e){this.controller=e,this.base.setController(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.timer.update();const e=this.timer.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js),this.css2DRenderer.render(this.scene.scene,this.camera3js),this.waitingRenderResolves.forEach(t=>{t(e)}),this.waitingRenderResolves=[]};waitingRenderResolves=[];waitForRender(){return new Promise(e=>{this.waitingRenderResolves.push(e)})}worldToScreen(e){const t=new ae.Vector3(e.x,e.y,e.z);t.project(this.camera3js);const r=new ae.Vector2;this.renderer.getSize(r);const n=(t.x+1)/2*r.x,s=(1-t.y)/2*r.y;return{x:n,y:s}}screenToWorld(e,t,r){const n=new ae.Vector3(e/this._canvas.clientWidth*2-1,-(t/this._canvas.clientHeight)*2+1,.5);n.unproject(this.camera3js);const s=n.sub(this.camera3js.position).normalize();return new ce(this.camera3js.position.clone().add(s.multiplyScalar(r)))}cameraToScreen(e){const r=new ae.Vector3(e.x,e.y,e.z).applyMatrix4(this.camera3js.matrixWorld);return H.v0.set(r),this.worldToScreen(H.v0)}screenToCamera(e,t,r){const n=this.screenToWorld(e,t,r),s=new ae.Vector3(n.x,n.y,n.z);return n.set(s.applyMatrix4(this.camera3js.matrixWorldInverse)),n}myMouseClickedListener=async e=>{if(this.camera instanceof It){const t=new ae.Raycaster,r=new ae.Vector2,n=e.target.getBoundingClientRect(),s=e.clientX-n.left,o=e.clientY-n.top;r.x=2*(s/n.width)-1,r.y=-2*(o/n.height)+1,t.setFromCamera(r,this.camera.camera);const c=t.intersectObjects(this.scene.scene.children),A=[];c.forEach(a=>{const f=a.object.userData.a3js?.objectA3;A.push({three:a.object,a3js:f})}),A.length>0&&await A[0].a3js.clicked(),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:A}}))}};alert(e,t){return new Promise(r=>{const n=document.createElement("div");n.style.cssText="position: absolute; top: 0px; width: 100%; height: 100%; display: flex; flex-direction: column;";const s=document.createElement("p");s.style.cssText="width: 80%; margin: 0 auto; color: red; text-align: center; border: 3px solid red;",s.textContent=e,n.appendChild(s);const o=document.createElement("button");o.textContent="OK!",n.appendChild(o),this.appendChild(n),o.addEventListener("click",async()=>{t&&await t(),this.removeChild(n),r()})})}}customElements.define("canvas-a3",an);function Bo(i){return i.isPerspectiveCamera===!0}class _i extends HTMLElement{_resizeObserver;_dragging=!1;_resizing=!1;_resizeDir="";_startMouseX=0;_startMouseY=0;_startLeft=0;_startTop=0;_startWidth=0;_startHeight=0;_borderSize=5;_canvas;_css2DCanvas;_titleEl=null;_titleBar=null;_closeBtn=null;base;renderer;css2DRenderer;scene;camera;controller;camera3js;timer;constructor(e=600,t=300){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
25
27
  <style>
26
28
  :host {
27
29
  position: absolute;
@@ -66,7 +68,7 @@
66
68
  <div class="content">
67
69
  <slot></slot>
68
70
  </div>
69
- `,this.camera3js=new se.PerspectiveCamera(75,e/t,.1,1e3),this.camera3js.aspect=e/t;const i=new ut(this.camera3js);this.base=new Dt(i),this.scene=this.base.scene,this.camera=this.base.camera,this.controller=this.base.controller,this.clock=new se.Clock,this.renderer=new se.WebGLRenderer,this.renderer.setSize(e,t),this._canvas=this.renderer.domElement,this._canvas.width=e,this._canvas.width=t,this.appendChild(this._canvas),this.css2DRenderer=new hn,this.css2DRenderer.setSize(e,t),this._css2DCanvas=this.css2DRenderer.domElement,this._css2DCanvas.style.position="absolute",this._css2DCanvas.style.top="28px",this.appendChild(this._css2DCanvas),this._css2DCanvas.addEventListener("click",this.myMouseClickedListener),window.addEventListener("keydown",r=>{this.controller?.keyDown(r)}),window.addEventListener("keyup",r=>{this.controller?.keyUp(r)}),window.addEventListener("keypress",r=>{this.controller?.keyPress(r)}),this._css2DCanvas.addEventListener("mousedown",r=>{this.controller?.mouseDown(r)}),this._css2DCanvas.addEventListener("mouseup",r=>{this.controller?.mouseUp(r)}),this._css2DCanvas.addEventListener("mousemove",r=>{this.controller?.mouseMove(r)}),this._css2DCanvas.addEventListener("click",r=>{this.controller?.mouseClick(r)}),this._css2DCanvas.addEventListener("mouseenter",r=>{this.controller?.mouseEnter(r)}),this._css2DCanvas.addEventListener("mouseleave",r=>{this.controller?.mouseLeave(r)}),this._css2DCanvas.addEventListener("wheel",r=>{this.controller?.mouseWheel(r)}),this._css2DCanvas.addEventListener("touchstart",r=>{this.controller?.touchStart(r)}),this._css2DCanvas.addEventListener("touchmove",r=>{this.controller?.touchMove(r)}),this._css2DCanvas.addEventListener("touchend",r=>{this.controller?.touchEnd(r)}),this._css2DCanvas.addEventListener("touchcancel",r=>{this.controller?.touchCancel(r)}),document.body?document.body.appendChild(this):document.addEventListener("DOMContentLoaded",()=>{document.body.append(this)},{once:!0}),this.animationFrameId=requestAnimationFrame(this.renderingLoop)}_resizeCanvasToContent(){const e=this.shadowRoot.querySelector(".content");let t=e.clientWidth,i=e.clientHeight;const r=window.devicePixelRatio||1,a=Math.floor(t*r),o=Math.floor(i*r);(this._canvas.width!==a||this._canvas.height!==o)&&(this._canvas.width=a,this._canvas.height=o,this.camera3js.aspect=a/o,this.camera3js.updateProjectionMatrix(),this.renderer.setSize(a,o),this.css2DRenderer.setSize(a,o))}connectedCallback(){this._titleEl=this.shadowRoot.querySelector(".title"),this._titleEl.textContent=this.getAttribute("title")??"Window",this._titleBar=this.shadowRoot.querySelector(".titlebar"),this._closeBtn=this.shadowRoot.querySelector(".close"),this._titleBar.addEventListener("mousedown",this._onDragStart),this._closeBtn.addEventListener("click",()=>this.remove()),this.addEventListener("mousemove",this._onHover),this.addEventListener("mousedown",this._onResizeStart),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),this._resizeObserver=new ResizeObserver(()=>{this._canvas&&this._resizeCanvasToContent()});const e=this.shadowRoot.querySelector(".content");this._resizeObserver.observe(e),this._resizeCanvasToContent()}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._resizeObserver?.disconnect()}_onDragStart=e=>{this._resizeDir||(this._dragging=!0,this._startMouseX=e.clientX,this._startMouseY=e.clientY,this._startLeft=this.offsetLeft,this._startTop=this.offsetTop)};_onHover=e=>{if(this._dragging||this._resizing)return;const t=this.getBoundingClientRect(),i=e.clientX-t.left,r=e.clientY-t.top,a=this._borderSize;let o="";r<a?o+="n":r>t.height-a&&(o+="s"),i<a?o+="w":i>t.width-a&&(o+="e"),this._resizeDir=o,this.style.cursor=this._cursorFromDir(o)};_cursorFromDir(e){switch(e){case"n":return"ns-resize";case"s":return"ns-resize";case"e":return"ew-resize";case"w":return"ew-resize";case"ne":return"nesw-resize";case"sw":return"nesw-resize";case"nw":return"nwse-resize";case"se":return"nwse-resize";default:return"default"}}_onResizeStart=e=>{this._resizeDir&&(this._resizing=!0,this._startMouseX=e.clientX,this._startMouseY=e.clientY,this._startLeft=this.offsetLeft,this._startTop=this.offsetTop,this._startWidth=this.offsetWidth,this._startHeight=this.offsetHeight)};_onMouseMove=e=>{if(this._dragging&&(this.style.left=`${this._startLeft+(e.clientX-this._startMouseX)}px`,this.style.top=`${this._startTop+(e.clientY-this._startMouseY)}px`),this._resizing){const t=e.clientX-this._startMouseX,i=e.clientY-this._startMouseY;this._resizeDir.includes("e")&&(this.style.width=`${this._startWidth+t}px`),this._resizeDir.includes("s")&&(this.style.height=`${this._startHeight+i}px`),this._resizeDir.includes("w")&&(this.style.width=`${this._startWidth-t}px`,this.style.left=`${this._startLeft+t}px`),this._resizeDir.includes("n")&&(this.style.height=`${this._startHeight-i}px`,this.style.top=`${this._startTop+i}px`)}};_onMouseUp=()=>{this._dragging=!1,this._resizing=!1};replaceScene(e){return this.scene=e,this.base.replaceScene(e)}setController(e){this.controller=e,this.base.setController(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),this.css2DRenderer.render(this.scene.scene,this.camera3js)};worldToScreen(e){const t=new se.Vector3(e.x,e.y,e.z);t.project(this.camera3js);const i=new se.Vector2;this.renderer.getSize(i);const r=(t.x+1)/2*i.x,a=(1-t.y)/2*i.y;return{x:r,y:a}}screenToWorld(e,t,i){const r=new se.Vector3(e/this._canvas.clientWidth*2-1,-(t/this._canvas.clientHeight)*2+1,.5);r.unproject(this.camera3js);const a=r.sub(this.camera3js.position).normalize();return this.camera3js.position.clone().add(a.multiplyScalar(i))}cameraToScreen(e){const i=new se.Vector3(e.x,e.y,e.z).applyMatrix4(this.camera3js.matrixWorld);return this.worldToScreen(i)}screenToCamera(e,t,i){const r=this.screenToWorld(e,t,i);return new se.Vector3(r.x,r.y,r.z).applyMatrix4(this.camera3js.matrixWorldInverse)}myMouseClickedListener=async e=>{if(this.camera instanceof ut){const t=new se.Raycaster,i=new se.Vector2,r=e.target.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;i.x=2*(a/r.width)-1,i.y=-2*(o/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),c=[];u.forEach(s=>{const f=s.object.userData.a3js?.objectA3;c.push({three:s.object,a3js:f})}),c.length>0&&await c[0].a3js.clicked(),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:c}}))}};alert(e,t){return new Promise(i=>{const r=document.createElement("div");r.style.cssText="position: absolute; top: 28px; width: 100%; height: 100%; display: flex; flex-direction: column;";const a=document.createElement("p");a.style.cssText="width: 80%; margin: 0 auto; color: red; text-align: center; border: 3px solid red;",a.textContent=e,r.appendChild(a);const o=document.createElement("button");o.textContent="OK!",r.appendChild(o),this.appendChild(r),o.addEventListener("click",async()=>{t&&await t(),this.removeChild(r),i()})})}}customElements.define("window-a3",dn);const cr=`
71
+ `,this.camera3js=new ae.PerspectiveCamera(75,e/t,.1,1e3),this.camera3js.aspect=e/t;const r=new It(this.camera3js);this.base=new Pn(r),this.scene=this.base.scene,this.camera=this.base.camera,this.controller=this.base.controller,this.timer=new ae.Timer,this.timer.connect(document),this.renderer=new ae.WebGLRenderer,Si({renderer:this.renderer}),this.renderer.setSize(e,t),this._canvas=this.renderer.domElement,this._canvas.width=e,this._canvas.width=t,this.appendChild(this._canvas),this.css2DRenderer=new Un,this.css2DRenderer.setSize(e,t),this._css2DCanvas=this.css2DRenderer.domElement,this._css2DCanvas.style.position="absolute",this._css2DCanvas.style.top="28px",this.appendChild(this._css2DCanvas),this._css2DCanvas.addEventListener("click",this.myMouseClickedListener),window.addEventListener("keydown",n=>{this.controller?.keyDown(n)}),window.addEventListener("keyup",n=>{this.controller?.keyUp(n)}),window.addEventListener("keypress",n=>{this.controller?.keyPress(n)}),this._css2DCanvas.addEventListener("mousedown",n=>{this.controller?.mouseDown(n)}),this._css2DCanvas.addEventListener("mouseup",n=>{this.controller?.mouseUp(n)}),this._css2DCanvas.addEventListener("mousemove",n=>{this.controller?.mouseMove(n)}),this._css2DCanvas.addEventListener("click",n=>{this.controller?.mouseClick(n)}),this._css2DCanvas.addEventListener("mouseenter",n=>{this.controller?.mouseEnter(n)}),this._css2DCanvas.addEventListener("mouseleave",n=>{this.controller?.mouseLeave(n)}),this._css2DCanvas.addEventListener("wheel",n=>{this.controller?.mouseWheel(n)}),this._css2DCanvas.addEventListener("touchstart",n=>{this.controller?.touchStart(n)}),this._css2DCanvas.addEventListener("touchmove",n=>{this.controller?.touchMove(n)}),this._css2DCanvas.addEventListener("touchend",n=>{this.controller?.touchEnd(n)}),this._css2DCanvas.addEventListener("touchcancel",n=>{this.controller?.touchCancel(n)}),document.body?document.body.appendChild(this):document.addEventListener("DOMContentLoaded",()=>{document.body.append(this)},{once:!0}),this.animationFrameId=requestAnimationFrame(this.renderingLoop)}_resizeCanvasToContent(){const e=this.shadowRoot.querySelector(".content");let t=e.clientWidth,r=e.clientHeight;const n=window.devicePixelRatio||1,s=Math.floor(t*n),o=Math.floor(r*n);(this._canvas.width!==s||this._canvas.height!==o)&&(this._canvas.width=s,this._canvas.height=o,this.camera3js.aspect=s/o,this.camera3js.updateProjectionMatrix(),this.renderer.setSize(s,o),this.css2DRenderer.setSize(s,o))}connectedCallback(){this._titleEl=this.shadowRoot.querySelector(".title"),this._titleEl.textContent=this.getAttribute("title")??"Window",this._titleBar=this.shadowRoot.querySelector(".titlebar"),this._closeBtn=this.shadowRoot.querySelector(".close"),this._titleBar.addEventListener("mousedown",this._onDragStart),this._closeBtn.addEventListener("click",()=>this.remove()),this.addEventListener("mousemove",this._onHover),this.addEventListener("mousedown",this._onResizeStart),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),this._resizeObserver=new ResizeObserver(()=>{this._canvas&&this._resizeCanvasToContent()});const e=this.shadowRoot.querySelector(".content");this._resizeObserver.observe(e),this._resizeCanvasToContent()}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._resizeObserver?.disconnect()}_onDragStart=e=>{this._resizeDir||(this._dragging=!0,this._startMouseX=e.clientX,this._startMouseY=e.clientY,this._startLeft=this.offsetLeft,this._startTop=this.offsetTop)};_onHover=e=>{if(this._dragging||this._resizing)return;const t=this.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top,s=this._borderSize;let o="";n<s?o+="n":n>t.height-s&&(o+="s"),r<s?o+="w":r>t.width-s&&(o+="e"),this._resizeDir=o,this.style.cursor=this._cursorFromDir(o)};_cursorFromDir(e){switch(e){case"n":return"ns-resize";case"s":return"ns-resize";case"e":return"ew-resize";case"w":return"ew-resize";case"ne":return"nesw-resize";case"sw":return"nesw-resize";case"nw":return"nwse-resize";case"se":return"nwse-resize";default:return"default"}}_onResizeStart=e=>{this._resizeDir&&(this._resizing=!0,this._startMouseX=e.clientX,this._startMouseY=e.clientY,this._startLeft=this.offsetLeft,this._startTop=this.offsetTop,this._startWidth=this.offsetWidth,this._startHeight=this.offsetHeight)};_onMouseMove=e=>{if(this._dragging&&(this.style.left=`${this._startLeft+(e.clientX-this._startMouseX)}px`,this.style.top=`${this._startTop+(e.clientY-this._startMouseY)}px`),this._resizing){const t=e.clientX-this._startMouseX,r=e.clientY-this._startMouseY;this._resizeDir.includes("e")&&(this.style.width=`${this._startWidth+t}px`),this._resizeDir.includes("s")&&(this.style.height=`${this._startHeight+r}px`),this._resizeDir.includes("w")&&(this.style.width=`${this._startWidth-t}px`,this.style.left=`${this._startLeft+t}px`),this._resizeDir.includes("n")&&(this.style.height=`${this._startHeight-r}px`,this.style.top=`${this._startTop+r}px`)}};_onMouseUp=()=>{this._dragging=!1,this._resizing=!1};replaceScene(e){return this.scene=e,this.base.replaceScene(e)}setController(e){this.controller=e,this.base.setController(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.timer.update();const e=this.timer.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js),this.css2DRenderer.render(this.scene.scene,this.camera3js),this.waitingRenderResolves.forEach(t=>{t(e)}),this.waitingRenderResolves=[]};waitingRenderResolves=[];waitForRender(){return new Promise(e=>{this.waitingRenderResolves.push(e)})}worldToScreen(e){const t=new ae.Vector3(e.x,e.y,e.z);t.project(this.camera3js);const r=new ae.Vector2;this.renderer.getSize(r);const n=(t.x+1)/2*r.x,s=(1-t.y)/2*r.y;return{x:n,y:s}}screenToWorld(e,t,r){const n=new ae.Vector3(e/this._canvas.clientWidth*2-1,-(t/this._canvas.clientHeight)*2+1,.5);n.unproject(this.camera3js);const s=n.sub(this.camera3js.position).normalize();return new ce(this.camera3js.position.clone().add(s.multiplyScalar(r)))}cameraToScreen(e){const r=new ae.Vector3(e.x,e.y,e.z).applyMatrix4(this.camera3js.matrixWorld);return H.v0.set(r),this.worldToScreen(H.v0)}screenToCamera(e,t,r){const n=this.screenToWorld(e,t,r),s=new ae.Vector3(n.x,n.y,n.z);return n.set(s.applyMatrix4(this.camera3js.matrixWorldInverse)),n}myMouseClickedListener=async e=>{if(this.camera instanceof It){const t=new ae.Raycaster,r=new ae.Vector2,n=e.target.getBoundingClientRect(),s=e.clientX-n.left,o=e.clientY-n.top;r.x=2*(s/n.width)-1,r.y=-2*(o/n.height)+1,t.setFromCamera(r,this.camera.camera);const c=t.intersectObjects(this.scene.scene.children),A=[];c.forEach(a=>{const f=a.object.userData.a3js?.objectA3;A.push({three:a.object,a3js:f})}),A.length>0&&await A[0].a3js.clicked(),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:A}}))}};alert(e,t){return new Promise(r=>{const n=document.createElement("div");n.style.cssText="position: absolute; top: 28px; width: 100%; height: 100%; display: flex; flex-direction: column;";const s=document.createElement("p");s.style.cssText="width: 80%; margin: 0 auto; color: red; text-align: center; border: 3px solid red;",s.textContent=e,n.appendChild(s);const o=document.createElement("button");o.textContent="OK!",n.appendChild(o),this.appendChild(n),o.addEventListener("click",async()=>{t&&await t(),this.removeChild(n),r()})})}}customElements.define("window-a3",_i);const To=`
70
72
  color: white;
71
73
  padding: 5px 10px;
72
74
  background: rgba(0, 0, 0, 0.6);
@@ -75,117 +77,116 @@
75
77
  font-family: sans-serif;
76
78
  font-size: 14px;
77
79
  pointer-events: none; /* マウスイベントを透過させて背後の操作を邪魔しない */
78
- `,lr={testMode:!0};class ur extends je{constructor(e){super(e)}initObject(){const e=new se.BoxGeometry,t=new se.MeshStandardMaterial({color:65280}),i=new se.Mesh(e,t),r=document.createElement("div");r.textContent="Hello Box!",r.style.cssText=cr;const a=new un(r);return a.position.set(0,.8,0),i.add(a),i}initMotion(e){const t=yt(lr,e);return new hr(this,t)}}class hr extends tt{testMode=!0;constructor(e,t){super(e),this.testMode=t.testMode}update(e){this.testMode&&this.object3D?(this.object3D.rotation.x+=e,this.object3D.rotation.y+=e,this.object3D.rotation.z+=e):super.update(e)}}class fr extends R.Loader{constructor(e){super(e)}load(e,t,i,r){const a=this,o=new R.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){const c=a.parse(JSON.parse(u));t&&t(c)},i,r)}parse(e){return new pn(e)}}class pn{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,i="ltr"){const r=[],a=dr(e,t,this.data,i);for(let o=0,u=a.length;o<u;o++)r.push(...a[o].toShapes());return r}}function dr(n,e,t,i){const r=Array.from(n),a=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*a,u=[];let c=0,s=0;(i=="rtl"||i=="tb")&&r.reverse();for(let f=0;f<r.length;f++){const h=r[f];if(h===`
79
- `)c=0,s-=o;else{const g=pr(h,a,c,s,t);i=="tb"?(c=0,s+=t.ascender*a):c+=g.offsetX,u.push(g.path)}}return u}function pr(n,e,t,i,r){const a=r.glyphs[n]||r.glyphs["?"];if(!a){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const o=new R.ShapePath;let u,c,s,f,h,g,p,T;if(a.o){const m=a._cachedOutline||(a._cachedOutline=a.o.split(" "));for(let l=0,d=m.length;l<d;)switch(m[l++]){case"m":u=m[l++]*e+t,c=m[l++]*e+i,o.moveTo(u,c);break;case"l":u=m[l++]*e+t,c=m[l++]*e+i,o.lineTo(u,c);break;case"q":s=m[l++]*e+t,f=m[l++]*e+i,h=m[l++]*e+t,g=m[l++]*e+i,o.quadraticCurveTo(h,g,s,f);break;case"b":s=m[l++]*e+t,f=m[l++]*e+i,h=m[l++]*e+t,g=m[l++]*e+i,p=m[l++]*e+t,T=m[l++]*e+i,o.bezierCurveTo(h,g,p,T,s,f);break}}return{offsetX:a.ha*e,path:o}}class mr extends R.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"}}let mt=null;async function yr(n){if(n.match(/.zip$/i)){let e=n.substring(n.lastIndexOf("/"));e=e.substring(0,e.length-4);const t=await ln(n),i=Pt(t,e);mt=new pn(JSON.parse(i))}else mt=await new fr().loadAsync(n)}class gr extends je{initObject(e){let t;if(en(e)?t=e:t="ERROR",mt==null){const i=new se.BoxGeometry,r=new se.MeshStandardMaterial({color:16711680});return new se.Mesh(i,r)}else{const i={font:mt,size:1,depth:.5,curveSegments:12},r=new mr(t,i);r.center();const a=new se.MeshStandardMaterial({color:65280});return new se.Mesh(r,a)}}}function Xt(n,e){if(e===R.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===R.TriangleFanDrawMode||e===R.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const o=[],u=n.getAttribute("position");if(u!==void 0){for(let c=0;c<u.count;c++)o.push(c);n.setIndex(o),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===R.TriangleFanDrawMode)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=n.clone();return a.setIndex(r),a.clearGroups(),a}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class Tr extends R.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new _r(t)}),this.register(function(t){return new br(t)}),this.register(function(t){return new Cr(t)}),this.register(function(t){return new Mr(t)}),this.register(function(t){return new Pr(t)}),this.register(function(t){return new Sr(t)}),this.register(function(t){return new Or(t)}),this.register(function(t){return new xr(t)}),this.register(function(t){return new Ir(t)}),this.register(function(t){return new Ar(t)}),this.register(function(t){return new Nr(t)}),this.register(function(t){return new Lr(t)}),this.register(function(t){return new kr(t)}),this.register(function(t){return new wr(t)}),this.register(function(t){return new vr(t)}),this.register(function(t){return new Dr(t)}),this.register(function(t){return new Fr(t)})}load(e,t,i,r){const a=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const s=R.LoaderUtils.extractUrlBase(e);o=R.LoaderUtils.resolveURL(s,this.path)}else o=R.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const u=function(s){r?r(s):console.error(s),a.manager.itemError(e),a.manager.itemEnd(e)},c=new R.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(s){try{a.parse(s,o,function(f){t(f),a.manager.itemEnd(e)},u)}catch(f){u(f)}},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 a;const o={},u={},c=new TextDecoder;if(typeof e=="string")a=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===mn){try{o[_e.KHR_BINARY_GLTF]=new Ur(e)}catch(h){r&&r(h);return}a=JSON.parse(o[_e.KHR_BINARY_GLTF].content)}else a=JSON.parse(c.decode(e));else a=e;if(a.asset===void 0||a.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const s=new Zr(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const h=this.pluginCallbacks[f](s);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),u[h.name]=h,o[h.name]=!0}if(a.extensionsUsed)for(let f=0;f<a.extensionsUsed.length;++f){const h=a.extensionsUsed[f],g=a.extensionsRequired||[];switch(h){case _e.KHR_MATERIALS_UNLIT:o[h]=new Rr;break;case _e.KHR_DRACO_MESH_COMPRESSION:o[h]=new jr(a,this.dracoLoader);break;case _e.KHR_TEXTURE_TRANSFORM:o[h]=new Br;break;case _e.KHR_MESH_QUANTIZATION:o[h]=new Gr;break;default:g.indexOf(h)>=0&&u[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}s.setExtensions(o),s.setPlugins(u),s.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,a){i.parse(e,t,r,a)})}}function Er(){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 _e={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 vr{constructor(e){this.parser=e,this.name=_e.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 a=t[i];a.extensions&&a.extensions[this.name]&&a.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const a=t.json,c=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e];let s;const f=new R.Color(16777215);c.color!==void 0&&f.setRGB(c.color[0],c.color[1],c.color[2],R.LinearSRGBColorSpace);const h=c.range!==void 0?c.range:0;switch(c.type){case"directional":s=new R.DirectionalLight(f),s.target.position.set(0,0,-1),s.add(s.target);break;case"point":s=new R.PointLight(f),s.distance=h;break;case"spot":s=new R.SpotLight(f),s.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,s.angle=c.spot.outerConeAngle,s.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,s.target.position.set(0,0,-1),s.add(s.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return s.position.set(0,0,0),qe(s,c),c.intensity!==void 0&&(s.intensity=c.intensity),s.name=t.createUniqueName(c.name||"light_"+e),r=Promise.resolve(s),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,a=i.json.nodes[e],u=(a.extensions&&a.extensions[this.name]||{}).light;return u===void 0?null:this._loadLight(u).then(function(c){return i._getNodeRef(t.cache,u,c)})}}class Rr{constructor(){this.name=_e.KHR_MATERIALS_UNLIT}getMaterialType(){return R.MeshBasicMaterial}extendParams(e,t,i){const r=[];e.color=new R.Color(1,1,1),e.opacity=1;const a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){const o=a.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],R.LinearSRGBColorSpace),e.opacity=o[3]}a.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",a.baseColorTexture,R.SRGBColorSpace))}return Promise.all(r)}}class Ar{constructor(e){this.parser=e,this.name=_e.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 a=r.extensions[this.name].emissiveStrength;return a!==void 0&&(t.emissiveIntensity=a),Promise.resolve()}}class _r{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&a.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&a.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(a.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const u=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new R.Vector2(u,u)}return Promise.all(a)}}class br{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=r.extensions[this.name];return t.dispersion=a.dispersion!==void 0?a.dispersion:0,Promise.resolve()}}class Lr{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&a.push(i.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&a.push(i.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(a)}}class Sr{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[];t.sheenColor=new R.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];if(o.sheenColorFactor!==void 0){const u=o.sheenColorFactor;t.sheenColor.setRGB(u[0],u[1],u[2],R.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&a.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,R.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&a.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(a)}}class Or{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&a.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(a)}}class xr{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&a.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const u=o.attenuationColor||[1,1,1];return t.attenuationColor=new R.Color().setRGB(u[0],u[1],u[2],R.LinearSRGBColorSpace),Promise.all(a)}}class Ir{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=r.extensions[this.name];return t.ior=a.ior!==void 0?a.ior:1.5,Promise.resolve()}}class Nr{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&a.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));const u=o.specularColorFactor||[1,1,1];return t.specularColor=new R.Color().setRGB(u[0],u[1],u[2],R.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&a.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,R.SRGBColorSpace)),Promise.all(a)}}class wr{constructor(e){this.parser=e,this.name=_e.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&a.push(i.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(a)}}class kr{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:R.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const a=[],o=r.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&a.push(i.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(a)}}class Cr{constructor(e){this.parser=e,this.name=_e.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 a=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){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,a.source,o)}}class Mr{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,r=i.json,a=r.textures[e];if(!a.extensions||!a.extensions[t])return null;const o=a.extensions[t],u=r.images[o.source];let c=i.textureLoader;if(u.uri){const s=i.options.manager.getHandler(u.uri);s!==null&&(c=s)}return i.loadTextureImage(e,o.source,c)}}class Pr{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,r=i.json,a=r.textures[e];if(!a.extensions||!a.extensions[t])return null;const o=a.extensions[t],u=r.images[o.source];let c=i.textureLoader;if(u.uri){const s=i.options.manager.getHandler(u.uri);s!==null&&(c=s)}return i.loadTextureImage(e,o.source,c)}}class Dr{constructor(e){this.name=_e.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],a=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 a.then(function(u){const c=r.byteOffset||0,s=r.byteLength||0,f=r.count,h=r.byteStride,g=new Uint8Array(u,c,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(f,h,g,r.mode,r.filter).then(function(p){return p.buffer}):o.ready.then(function(){const p=new ArrayBuffer(f*h);return o.decodeGltfBuffer(new Uint8Array(p),f,h,g,r.mode,r.filter),p})})}else return null}}class Fr{constructor(e){this.name=_e.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 s of r.primitives)if(s.mode!==Ke.TRIANGLES&&s.mode!==Ke.TRIANGLE_STRIP&&s.mode!==Ke.TRIANGLE_FAN&&s.mode!==void 0)return null;const o=i.extensions[this.name].attributes,u=[],c={};for(const s in o)u.push(this.parser.getDependency("accessor",o[s]).then(f=>(c[s]=f,c[s])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(s=>{const f=s.pop(),h=f.isGroup?f.children:[f],g=s[0].count,p=[];for(const T of h){const m=new R.Matrix4,l=new R.Vector3,d=new R.Quaternion,y=new R.Vector3(1,1,1),v=new R.InstancedMesh(T.geometry,T.material,g);for(let E=0;E<g;E++)c.TRANSLATION&&l.fromBufferAttribute(c.TRANSLATION,E),c.ROTATION&&d.fromBufferAttribute(c.ROTATION,E),c.SCALE&&y.fromBufferAttribute(c.SCALE,E),v.setMatrixAt(E,m.compose(l,d,y));for(const E in c)if(E==="_COLOR_0"){const S=c[E];v.instanceColor=new R.InstancedBufferAttribute(S.array,S.itemSize,S.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&T.geometry.setAttribute(E,c[E]);R.Object3D.prototype.copy.call(v,T),this.parser.assignFinalMaterial(v),p.push(v)}return f.isGroup?(f.clear(),f.add(...p),f):p[0]}))}}const mn="glTF",ot=12,qt={JSON:1313821514,BIN:5130562};class Ur{constructor(e){this.name=_e.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ot),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!==mn)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-ot,a=new DataView(e,ot);let o=0;for(;o<r;){const u=a.getUint32(o,!0);o+=4;const c=a.getUint32(o,!0);if(o+=4,c===qt.JSON){const s=new Uint8Array(e,ot+o,u);this.content=i.decode(s)}else if(c===qt.BIN){const s=ot+o;this.body=e.slice(s,s+u)}o+=u}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class jr{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=_e.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,a=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,u={},c={},s={};for(const f in o){const h=Nt[f]||f.toLowerCase();u[h]=o[f]}for(const f in e.attributes){const h=Nt[f]||f.toLowerCase();if(o[f]!==void 0){const g=i.accessors[e.attributes[f]],p=it[g.componentType];s[h]=p.name,c[h]=g.normalized===!0}}return t.getDependency("bufferView",a).then(function(f){return new Promise(function(h,g){r.decodeDracoFile(f,function(p){for(const T in p.attributes){const m=p.attributes[T],l=c[T];l!==void 0&&(m.normalized=l)}h(p)},u,s,R.LinearSRGBColorSpace,g)})})}}class Br{constructor(){this.name=_e.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 Gr{constructor(){this.name=_e.KHR_MESH_QUANTIZATION}}class yn extends R.Interpolant{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,a=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[a+o];return t}interpolate_(e,t,i,r){const a=this.resultBuffer,o=this.sampleValues,u=this.valueSize,c=u*2,s=u*3,f=r-t,h=(i-t)/f,g=h*h,p=g*h,T=e*s,m=T-s,l=-2*p+3*g,d=p-g,y=1-l,v=d-g+h;for(let E=0;E!==u;E++){const S=o[m+E+u],I=o[m+E+c]*f,k=o[T+E+u],H=o[T+E]*f;a[E]=y*S+v*I+l*k+d*H}return a}}const zr=new R.Quaternion;class Vr extends yn{interpolate_(e,t,i,r){const a=super.interpolate_(e,t,i,r);return zr.fromArray(a).normalize().toArray(a),a}}const Ke={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},it={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qt={9728:R.NearestFilter,9729:R.LinearFilter,9984:R.NearestMipmapNearestFilter,9985:R.LinearMipmapNearestFilter,9986:R.NearestMipmapLinearFilter,9987:R.LinearMipmapLinearFilter},Zt={33071:R.ClampToEdgeWrapping,33648:R.MirroredRepeatWrapping,10497:R.RepeatWrapping},_t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Nt={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"},Je={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Hr={CUBICSPLINE:void 0,LINEAR:R.InterpolateLinear,STEP:R.InterpolateDiscrete},bt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Wr(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new R.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:R.FrontSide})),n.DefaultMaterial}function et(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 qe(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 Kr(n,e,t){let i=!1,r=!1,a=!1;for(let s=0,f=e.length;s<f;s++){const h=e[s];if(h.POSITION!==void 0&&(i=!0),h.NORMAL!==void 0&&(r=!0),h.COLOR_0!==void 0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(n);const o=[],u=[],c=[];for(let s=0,f=e.length;s<f;s++){const h=e[s];if(i){const g=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):n.attributes.position;o.push(g)}if(r){const g=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):n.attributes.normal;u.push(g)}if(a){const g=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):n.attributes.color;c.push(g)}}return Promise.all([Promise.all(o),Promise.all(u),Promise.all(c)]).then(function(s){const f=s[0],h=s[1],g=s[2];return i&&(n.morphAttributes.position=f),r&&(n.morphAttributes.normal=h),a&&(n.morphAttributes.color=g),n.morphTargetsRelative=!0,n})}function Yr(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 Xr(n){let e;const t=n.extensions&&n.extensions[_e.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Lt(t.attributes):e=n.indices+":"+Lt(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Lt(n.targets[i]);return e}function Lt(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 wt(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 qr(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 Qr=new R.Matrix4;class Zr{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Er,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,a=!1,o=-1;if(typeof navigator<"u"){const u=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(u)===!0;const c=u.match(/Version\/(\d+)/);r=i&&c?parseInt(c[1],10):-1,a=u.indexOf("Firefox")>-1,o=a?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||a&&o<98?this.textureLoader=new R.TextureLoader(this.options.manager):this.textureLoader=new R.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new R.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,a=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const u={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return et(a,u,r),qe(u,r),Promise.all(i._invokeAll(function(c){return c.afterRoot&&c.afterRoot(u)})).then(function(){for(const c of u.scenes)c.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,a=t.length;r<a;r++){const o=t[r].joints;for(let u=0,c=o.length;u<c;u++)e[o[u]].isBone=!0}for(let r=0,a=e.length;r<a;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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(),a=(o,u)=>{const c=this.associations.get(o);c!=null&&this.associations.set(u,c);for(const[s,f]of o.children.entries())a(f,u.children[s])};return a(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 a=e(t[r]);a&&i.push(a)}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(a){return a.loadNode&&a.loadNode(t)});break;case"mesh":r=this._invokeOne(function(a){return a.loadMesh&&a.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(a){return a.loadBufferView&&a.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(a){return a.loadMaterial&&a.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(a){return a.loadTexture&&a.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(a){return a.loadAnimation&&a.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(a){return a!=this&&a.getDependency&&a.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(a,o){return i.getDependency(e,o)})),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[_e.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(a,o){i.load(R.LoaderUtils.resolveURL(t.uri,r.path),a,void 0,function(){o(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,a=t.byteOffset||0;return i.slice(a,a+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const o=_t[r.type],u=it[r.componentType],c=r.normalized===!0,s=new u(r.count*o);return Promise.resolve(new R.BufferAttribute(s,o,c))}const a=[];return r.bufferView!==void 0?a.push(this.getDependency("bufferView",r.bufferView)):a.push(null),r.sparse!==void 0&&(a.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(a).then(function(o){const u=o[0],c=_t[r.type],s=it[r.componentType],f=s.BYTES_PER_ELEMENT,h=f*c,g=r.byteOffset||0,p=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,T=r.normalized===!0;let m,l;if(p&&p!==h){const d=Math.floor(g/p),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+d+":"+r.count;let v=t.cache.get(y);v||(m=new s(u,d*p,r.count*p/f),v=new R.InterleavedBuffer(m,p/f),t.cache.add(y,v)),l=new R.InterleavedBufferAttribute(v,c,g%p/f,T)}else u===null?m=new s(r.count*c):m=new s(u,g,r.count*c),l=new R.BufferAttribute(m,c,T);if(r.sparse!==void 0){const d=_t.SCALAR,y=it[r.sparse.indices.componentType],v=r.sparse.indices.byteOffset||0,E=r.sparse.values.byteOffset||0,S=new y(o[1],v,r.sparse.count*d),I=new s(o[2],E,r.sparse.count*c);u!==null&&(l=new R.BufferAttribute(l.array.slice(),l.itemSize,l.normalized)),l.normalized=!1;for(let k=0,H=S.length;k<H;k++){const x=S[k];if(l.setX(x,I[k*c]),c>=2&&l.setY(x,I[k*c+1]),c>=3&&l.setZ(x,I[k*c+2]),c>=4&&l.setW(x,I[k*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}l.normalized=T}return l})}loadTexture(e){const t=this.json,i=this.options,a=t.textures[e].source,o=t.images[a];let u=this.textureLoader;if(o.uri){const c=i.manager.getHandler(o.uri);c!==null&&(u=c)}return this.loadTextureImage(e,a,u)}loadTextureImage(e,t,i){const r=this,a=this.json,o=a.textures[e],u=a.images[t],c=(u.uri||u.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const s=this.loadImageSource(t,i).then(function(f){f.flipY=!1,f.name=o.name||u.name||"",f.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(f.name=u.uri);const g=(a.samplers||{})[o.sampler]||{};return f.magFilter=Qt[g.magFilter]||R.LinearFilter,f.minFilter=Qt[g.minFilter]||R.LinearMipmapLinearFilter,f.wrapS=Zt[g.wrapS]||R.RepeatWrapping,f.wrapT=Zt[g.wrapT]||R.RepeatWrapping,f.generateMipmaps=!f.isCompressedTexture&&f.minFilter!==R.NearestFilter&&f.minFilter!==R.LinearFilter,r.associations.set(f,{textures:e}),f}).catch(function(){return null});return this.textureCache[c]=s,s}loadImageSource(e,t){const i=this,r=this.json,a=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=r.images[e],u=self.URL||self.webkitURL;let c=o.uri||"",s=!1;if(o.bufferView!==void 0)c=i.getDependency("bufferView",o.bufferView).then(function(h){s=!0;const g=new Blob([h],{type:o.mimeType});return c=u.createObjectURL(g),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const f=Promise.resolve(c).then(function(h){return new Promise(function(g,p){let T=g;t.isImageBitmapLoader===!0&&(T=function(m){const l=new R.Texture(m);l.needsUpdate=!0,g(l)}),t.load(R.LoaderUtils.resolveURL(h,a.path),T,void 0,p)})}).then(function(h){return s===!0&&u.revokeObjectURL(c),qe(h,o),h.userData.mimeType=o.mimeType||qr(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),h});return this.sourceCache[e]=f,f}assignTexture(e,t,i,r){const a=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),a.extensions[_e.KHR_TEXTURE_TRANSFORM]){const u=i.extensions!==void 0?i.extensions[_e.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const c=a.associations.get(o);o=a.extensions[_e.KHR_TEXTURE_TRANSFORM].extendTexture(o,u),a.associations.set(o,c)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,a=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+i.uuid;let c=this.cache.get(u);c||(c=new R.PointsMaterial,R.Material.prototype.copy.call(c,i),c.color.copy(i.color),c.map=i.map,c.sizeAttenuation=!1,this.cache.add(u,c)),i=c}else if(e.isLine){const u="LineBasicMaterial:"+i.uuid;let c=this.cache.get(u);c||(c=new R.LineBasicMaterial,R.Material.prototype.copy.call(c,i),c.color.copy(i.color),c.map=i.map,this.cache.add(u,c)),i=c}if(r||a||o){let u="ClonedMaterial:"+i.uuid+":";r&&(u+="derivative-tangents:"),a&&(u+="vertex-colors:"),o&&(u+="flat-shading:");let c=this.cache.get(u);c||(c=i.clone(),a&&(c.vertexColors=!0),o&&(c.flatShading=!0),r&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(u,c),this.associations.set(c,this.associations.get(i))),i=c}e.material=i}getMaterialType(){return R.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,r=this.extensions,a=i.materials[e];let o;const u={},c=a.extensions||{},s=[];if(c[_e.KHR_MATERIALS_UNLIT]){const h=r[_e.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),s.push(h.extendParams(u,a,t))}else{const h=a.pbrMetallicRoughness||{};if(u.color=new R.Color(1,1,1),u.opacity=1,Array.isArray(h.baseColorFactor)){const g=h.baseColorFactor;u.color.setRGB(g[0],g[1],g[2],R.LinearSRGBColorSpace),u.opacity=g[3]}h.baseColorTexture!==void 0&&s.push(t.assignTexture(u,"map",h.baseColorTexture,R.SRGBColorSpace)),u.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,u.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(s.push(t.assignTexture(u,"metalnessMap",h.metallicRoughnessTexture)),s.push(t.assignTexture(u,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,u)})))}a.doubleSided===!0&&(u.side=R.DoubleSide);const f=a.alphaMode||bt.OPAQUE;if(f===bt.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,f===bt.MASK&&(u.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&o!==R.MeshBasicMaterial&&(s.push(t.assignTexture(u,"normalMap",a.normalTexture)),u.normalScale=new R.Vector2(1,1),a.normalTexture.scale!==void 0)){const h=a.normalTexture.scale;u.normalScale.set(h,h)}if(a.occlusionTexture!==void 0&&o!==R.MeshBasicMaterial&&(s.push(t.assignTexture(u,"aoMap",a.occlusionTexture)),a.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&o!==R.MeshBasicMaterial){const h=a.emissiveFactor;u.emissive=new R.Color().setRGB(h[0],h[1],h[2],R.LinearSRGBColorSpace)}return a.emissiveTexture!==void 0&&o!==R.MeshBasicMaterial&&s.push(t.assignTexture(u,"emissiveMap",a.emissiveTexture,R.SRGBColorSpace)),Promise.all(s).then(function(){const h=new o(u);return a.name&&(h.name=a.name),qe(h,a),t.associations.set(h,{materials:e}),a.extensions&&et(r,h,a),h})}createUniqueName(e){const t=R.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 a(u){return i[_e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(c){return Jt(c,u,t)})}const o=[];for(let u=0,c=e.length;u<c;u++){const s=e[u],f=Xr(s),h=r[f];if(h)o.push(h.promise);else{let g;s.extensions&&s.extensions[_e.KHR_DRACO_MESH_COMPRESSION]?g=a(s):g=Jt(new R.BufferGeometry,s,t),r[f]={primitive:s,promise:g},o.push(g)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,a=i.meshes[e],o=a.primitives,u=[];for(let c=0,s=o.length;c<s;c++){const f=o[c].material===void 0?Wr(this.cache):this.getDependency("material",o[c].material);u.push(f)}return u.push(t.loadGeometries(o)),Promise.all(u).then(function(c){const s=c.slice(0,c.length-1),f=c[c.length-1],h=[];for(let p=0,T=f.length;p<T;p++){const m=f[p],l=o[p];let d;const y=s[p];if(l.mode===Ke.TRIANGLES||l.mode===Ke.TRIANGLE_STRIP||l.mode===Ke.TRIANGLE_FAN||l.mode===void 0)d=a.isSkinnedMesh===!0?new R.SkinnedMesh(m,y):new R.Mesh(m,y),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),l.mode===Ke.TRIANGLE_STRIP?d.geometry=Xt(d.geometry,R.TriangleStripDrawMode):l.mode===Ke.TRIANGLE_FAN&&(d.geometry=Xt(d.geometry,R.TriangleFanDrawMode));else if(l.mode===Ke.LINES)d=new R.LineSegments(m,y);else if(l.mode===Ke.LINE_STRIP)d=new R.Line(m,y);else if(l.mode===Ke.LINE_LOOP)d=new R.LineLoop(m,y);else if(l.mode===Ke.POINTS)d=new R.Points(m,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);Object.keys(d.geometry.morphAttributes).length>0&&Yr(d,a),d.name=t.createUniqueName(a.name||"mesh_"+e),qe(d,a),l.extensions&&et(r,d,l),t.assignFinalMaterial(d),h.push(d)}for(let p=0,T=h.length;p<T;p++)t.associations.set(h[p],{meshes:e,primitives:p});if(h.length===1)return a.extensions&&et(r,h[0],a),h[0];const g=new R.Group;a.extensions&&et(r,g,a),t.associations.set(g,{meshes:e});for(let p=0,T=h.length;p<T;p++)g.add(h[p]);return g})}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 R.PerspectiveCamera(R.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new R.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),qe(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,a=t.joints.length;r<a;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 a=r.pop(),o=r,u=[],c=[];for(let s=0,f=o.length;s<f;s++){const h=o[s];if(h){u.push(h);const g=new R.Matrix4;a!==null&&g.fromArray(a.array,s*16),c.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[s])}return new R.Skeleton(u,c)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],a=r.name?r.name:"animation_"+e,o=[],u=[],c=[],s=[],f=[];for(let h=0,g=r.channels.length;h<g;h++){const p=r.channels[h],T=r.samplers[p.sampler],m=p.target,l=m.node,d=r.parameters!==void 0?r.parameters[T.input]:T.input,y=r.parameters!==void 0?r.parameters[T.output]:T.output;m.node!==void 0&&(o.push(this.getDependency("node",l)),u.push(this.getDependency("accessor",d)),c.push(this.getDependency("accessor",y)),s.push(T),f.push(m))}return Promise.all([Promise.all(o),Promise.all(u),Promise.all(c),Promise.all(s),Promise.all(f)]).then(function(h){const g=h[0],p=h[1],T=h[2],m=h[3],l=h[4],d=[];for(let v=0,E=g.length;v<E;v++){const S=g[v],I=p[v],k=T[v],H=m[v],x=l[v];if(S===void 0)continue;S.updateMatrix&&S.updateMatrix();const B=i._createAnimationTracks(S,I,k,H,x);if(B)for(let P=0;P<B.length;P++)d.push(B[P])}const y=new R.AnimationClip(a,void 0,d);return qe(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(a){const o=i._getNodeRef(i.meshCache,r.mesh,a);return r.weights!==void 0&&o.traverse(function(u){if(u.isMesh)for(let c=0,s=r.weights.length;c<s;c++)u.morphTargetInfluences[c]=r.weights[c]}),o})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],a=i._loadNodeShallow(e),o=[],u=r.children||[];for(let s=0,f=u.length;s<f;s++)o.push(i.getDependency("node",u[s]));const c=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([a,Promise.all(o),c]).then(function(s){const f=s[0],h=s[1],g=s[2];g!==null&&f.traverse(function(p){p.isSkinnedMesh&&p.bind(g,Qr)});for(let p=0,T=h.length;p<T;p++)f.add(h[p]);return f})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const a=t.nodes[e],o=a.name?r.createUniqueName(a.name):"",u=[],c=r._invokeOne(function(s){return s.createNodeMesh&&s.createNodeMesh(e)});return c&&u.push(c),a.camera!==void 0&&u.push(r.getDependency("camera",a.camera).then(function(s){return r._getNodeRef(r.cameraCache,a.camera,s)})),r._invokeAll(function(s){return s.createNodeAttachment&&s.createNodeAttachment(e)}).forEach(function(s){u.push(s)}),this.nodeCache[e]=Promise.all(u).then(function(s){let f;if(a.isBone===!0?f=new R.Bone:s.length>1?f=new R.Group:s.length===1?f=s[0]:f=new R.Object3D,f!==s[0])for(let h=0,g=s.length;h<g;h++)f.add(s[h]);if(a.name&&(f.userData.name=a.name,f.name=o),qe(f,a),a.extensions&&et(i,f,a),a.matrix!==void 0){const h=new R.Matrix4;h.fromArray(a.matrix),f.applyMatrix4(h)}else a.translation!==void 0&&f.position.fromArray(a.translation),a.rotation!==void 0&&f.quaternion.fromArray(a.rotation),a.scale!==void 0&&f.scale.fromArray(a.scale);if(!r.associations.has(f))r.associations.set(f,{});else if(a.mesh!==void 0&&r.meshCache.refs[a.mesh]>1){const h=r.associations.get(f);r.associations.set(f,{...h})}return r.associations.get(f).nodes=e,f}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,a=new R.Group;i.name&&(a.name=r.createUniqueName(i.name)),qe(a,i),i.extensions&&et(t,a,i);const o=i.nodes||[],u=[];for(let c=0,s=o.length;c<s;c++)u.push(r.getDependency("node",o[c]));return Promise.all(u).then(function(c){for(let f=0,h=c.length;f<h;f++)a.add(c[f]);const s=f=>{const h=new Map;for(const[g,p]of r.associations)(g instanceof R.Material||g instanceof R.Texture)&&h.set(g,p);return f.traverse(g=>{const p=r.associations.get(g);p!=null&&h.set(g,p)}),h};return r.associations=s(a),a})}_createAnimationTracks(e,t,i,r,a){const o=[],u=e.name?e.name:e.uuid,c=[];Je[a.path]===Je.weights?e.traverse(function(g){g.morphTargetInfluences&&c.push(g.name?g.name:g.uuid)}):c.push(u);let s;switch(Je[a.path]){case Je.weights:s=R.NumberKeyframeTrack;break;case Je.rotation:s=R.QuaternionKeyframeTrack;break;case Je.translation:case Je.scale:s=R.VectorKeyframeTrack;break;default:i.itemSize===1?s=R.NumberKeyframeTrack:s=R.VectorKeyframeTrack;break}const f=r.interpolation!==void 0?Hr[r.interpolation]:R.InterpolateLinear,h=this._getArrayFromAccessor(i);for(let g=0,p=c.length;g<p;g++){const T=new s(c[g]+"."+Je[a.path],t.array,h,f);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(T),o.push(T)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=wt(t.constructor),r=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a++)r[a]=t[a]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof R.QuaternionKeyframeTrack?Vr:yn;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Jr(n,e,t){const i=e.attributes,r=new R.Box3;if(i.POSITION!==void 0){const u=t.json.accessors[i.POSITION],c=u.min,s=u.max;if(c!==void 0&&s!==void 0){if(r.set(new R.Vector3(c[0],c[1],c[2]),new R.Vector3(s[0],s[1],s[2])),u.normalized){const f=wt(it[u.componentType]);r.min.multiplyScalar(f),r.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const a=e.targets;if(a!==void 0){const u=new R.Vector3,c=new R.Vector3;for(let s=0,f=a.length;s<f;s++){const h=a[s];if(h.POSITION!==void 0){const g=t.json.accessors[h.POSITION],p=g.min,T=g.max;if(p!==void 0&&T!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(T[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(T[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(T[2]))),g.normalized){const m=wt(it[g.componentType]);c.multiplyScalar(m)}u.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(u)}n.boundingBox=r;const o=new R.Sphere;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function Jt(n,e,t){const i=e.attributes,r=[];function a(o,u){return t.getDependency("accessor",o).then(function(c){n.setAttribute(u,c)})}for(const o in i){const u=Nt[o]||o.toLowerCase();u in n.attributes||r.push(a(i[o],u))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(u){n.setIndex(u)});r.push(o)}return R.ColorManagement.workingColorSpace!==R.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${R.ColorManagement.workingColorSpace}" not supported.`),qe(n,e),Jr(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?Kr(n,e.targets,t):n})}const St=new WeakMap;class $r extends R.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 a=new R.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,R.SRGBColorSpace,i).catch(i)}decodeDracoFile(e,t,i,r,a=R.LinearSRGBColorSpace,o=()=>{}){const u={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:a};return this.decodeGeometry(e,u).then(t).catch(o)}decodeGeometry(e,t){const i=JSON.stringify(t);if(St.has(e)){const c=St.get(e);if(c.key===i)return c.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 a=this.workerNextTaskID++,o=e.byteLength,u=this._getWorker(a,o).then(c=>(r=c,new Promise((s,f)=>{r._callbacks[a]={resolve:s,reject:f},r.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return u.catch(()=>!0).then(()=>{r&&a&&this._releaseTask(r,a)}),St.set(e,{key:i,promise:u}),u}_createGeometry(e){const t=new R.BufferGeometry;e.index&&t.setIndex(new R.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const{name:r,array:a,itemSize:o,stride:u,vertexColorSpace:c}=e.attributes[i];let s;if(o===u)s=new R.BufferAttribute(a,o);else{const f=new R.InterleavedBuffer(a,u);s=new R.InterleavedBufferAttribute(f,o,0)}r==="color"&&(this._assignVertexColorSpace(s,c),s.normalized=!(a instanceof Float32Array)),t.setAttribute(r,s)}return t}_assignVertexColorSpace(e,t){if(t!==R.SRGBColorSpace)return;const i=new R.Color;for(let r=0,a=e.count;r<a;r++)i.fromBufferAttribute(e,r),R.ColorManagement.colorSpaceToWorking(i,R.SRGBColorSpace),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new R.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,a)=>{i.load(e,r,void 0,a)})}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 a=ei.toString(),o=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
80
- `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),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(a){const o=a.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,a){return r._taskLoad>a._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 ei(){let n,e;onmessage=function(o){const u=o.data;switch(u.type){case"init":n=u.decoderConfig,e=new Promise(function(f){n.onModuleLoaded=function(h){f({draco:h})},DracoDecoderModule(n)});break;case"decode":const c=u.buffer,s=u.taskConfig;e.then(f=>{const h=f.draco,g=new h.Decoder;try{const p=t(h,g,new Int8Array(c),s),T=p.attributes.map(m=>m.array.buffer);p.index&&T.push(p.index.array.buffer),self.postMessage({type:"decode",id:u.id,geometry:p},T)}catch(p){console.error(p),self.postMessage({type:"error",id:u.id,error:p.message})}finally{h.destroy(g)}});break}};function t(o,u,c,s){const f=s.attributeIDs,h=s.attributeTypes;let g,p;const T=u.GetEncodedGeometryType(c);if(T===o.TRIANGULAR_MESH)g=new o.Mesh,p=u.DecodeArrayToMesh(c,c.byteLength,g);else if(T===o.POINT_CLOUD)g=new o.PointCloud,p=u.DecodeArrayToPointCloud(c,c.byteLength,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const m={index:null,attributes:[]};for(const l in f){const d=self[h[l]];let y,v;if(s.useUniqueIDs)v=f[l],y=u.GetAttributeByUniqueId(g,v);else{if(v=u.GetAttributeId(g,o[f[l]]),v===-1)continue;y=u.GetAttribute(g,v)}const E=r(o,u,g,l,d,y);l==="color"&&(E.vertexColorSpace=s.vertexColorSpace),m.attributes.push(E)}return T===o.TRIANGULAR_MESH&&(m.index=i(o,u,g)),o.destroy(g),m}function i(o,u,c){const f=c.num_faces()*3,h=f*4,g=o._malloc(h);u.GetTrianglesUInt32Array(c,h,g);const p=new Uint32Array(o.HEAPF32.buffer,g,f).slice();return o._free(g),{array:p,itemSize:1}}function r(o,u,c,s,f,h){const g=c.num_points(),p=h.num_components(),T=a(o,f),m=p*f.BYTES_PER_ELEMENT,l=Math.ceil(m/4)*4,d=l/f.BYTES_PER_ELEMENT,y=g*m,v=g*l,E=o._malloc(y);u.GetAttributeDataArrayForAllPoints(c,h,T,y,E);const S=new f(o.HEAPF32.buffer,E,y/f.BYTES_PER_ELEMENT);let I;if(m===l)I=S.slice();else{I=new f(v/f.BYTES_PER_ELEMENT);let k=0;for(let H=0,x=S.length;H<x;H++){for(let B=0;B<p;B++)I[k+B]=S[H*p+B];k+=d}}return o._free(E),{name:s,count:g,itemSize:p,array:I,stride:d}}function a(o,u){switch(u){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}function ti(n){return"morphTargetDictionary"in n&&n.morphTargetDictionary!==void 0&&"morphTargetInfluences"in n&&Array.isArray(n.morphTargetInfluences)}const gn=new Tr,Tn=new $r;Tn.setDecoderPath("/examples/jsm/libs/draco/");gn.setDRACOLoader(Tn);class En extends je{ready;gltf;constructor(e){super(),this.ready=this.asyncInit(e)}initObject(){return new se.Object3D}initMotion(){return new vn(this)}async asyncInit(e){if(en(e))console.log(`File: ${e}`),this.gltf=await gn.loadAsync(e),this.gltf.scene.traverse(t=>{t.userData.a3js={objectA3:this}}),this.object.add(this.gltf.scene);else{const t=new se.BoxGeometry,i=new se.MeshStandardMaterial({color:16711680}),r=new se.Mesh(t,i);this.object.add(r)}return this.motion.setObject(this),this}}class vn extends tt{isPaused;gltf;mixer;clips;actions;morphs;constructor(e){super(e),this.isPaused=!1,this.clips={},this.actions={},this.morphs={}}setObject(e){e instanceof En?(super.setObject(e),this.gltf=e.gltf,this.myInitialize(e)):console.warn("GLTFMotion can set only GLTF object.")}myInitialize(e){if(this.gltf){this.mixer=new se.AnimationMixer(this.gltf.scene),this.actions={},console.log(" actions(from model):");const t={};for(let i=0;i<this.gltf.animations.length;i++){const r=this.gltf.animations[i];t[r.name]=r,this.actions[r.name]=this.mixer.clipAction(r),console.log(` ${r.name}`)}console.log(" actions(from motion):");for(const i of Object.values(this.clips))t[i.name]=i,this.actions[i.name]=this.mixer.clipAction(i),console.log(` ${i.name}`);this.clips=t,console.log(" morphs:"),this.morphs={},this.gltf.scene.traverse(i=>{if(ti(i)){const{morphTargetDictionary:r,morphTargetInfluences:a}=i;Object.keys(r).forEach(o=>{const u=i.name+"."+o,c=r[o];this.morphs[u]={array:a,idx:c},console.log(` ${u}`)})}})}}detachObject(e){this.mixer?.stopAllAction(),this.gltf&&this.mixer?.uncacheRoot(this.gltf.scene),this.mixer=void 0,this.actions={},this.morphs={},this.gltf=void 0,this.isPaused=!1}update(e){super.update(e),this.isPaused||this.mixer?.update(e)}controlMotion(...e){if(e[0]){this.mixer?.stopAllAction();const t=this.actions[e[0]];t&&t.play()}if(e[1]){const t=e[1];if(e[2]){const i=Number(e[2]);if(t in this.morphs){const{array:r,idx:a}=this.morphs[e[1]];r[a]=i}}}}setPause(e){this.isPaused=e}setTime(e){this.mixer?.setTime(e)}}var ve=(n,e)=>()=>(e||(e={exports:{}},n(e.exports,e)),e.exports),Rn=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VERSION=void 0,n.VERSION="9.0.1"}),xe=ve((n,e)=>{var t=n&&n.__spreadArray||function(F,Y){for(var z=0,ee=Y.length,de=F.length;z<ee;z++,de++)F[de]=Y[z];return F};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(F){return F&&F.length===0}n.isEmpty=i;function r(F){return F==null?[]:Object.keys(F)}n.keys=r;function a(F){for(var Y=[],z=Object.keys(F),ee=0;ee<z.length;ee++)Y.push(F[z[ee]]);return Y}n.values=a;function o(F,Y){for(var z=[],ee=r(F),de=0;de<ee.length;de++){var be=ee[de];z.push(Y.call(null,F[be],be))}return z}n.mapValues=o;function u(F,Y){for(var z=[],ee=0;ee<F.length;ee++)z.push(Y.call(null,F[ee],ee));return z}n.map=u;function c(F){for(var Y=[],z=0;z<F.length;z++){var ee=F[z];Array.isArray(ee)?Y=Y.concat(c(ee)):Y.push(ee)}return Y}n.flatten=c;function s(F){return i(F)?void 0:F[0]}n.first=s;function f(F){var Y=F&&F.length;return Y?F[Y-1]:void 0}n.last=f;function h(F,Y){if(Array.isArray(F))for(var z=0;z<F.length;z++)Y.call(null,F[z],z);else if(Q(F))for(var ee=r(F),z=0;z<ee.length;z++){var de=ee[z],be=F[de];Y.call(null,be,de)}else throw Error("non exhaustive match")}n.forEach=h;function g(F){return typeof F=="string"}n.isString=g;function p(F){return F===void 0}n.isUndefined=p;function T(F){return F instanceof Function}n.isFunction=T;function m(F,Y){return Y===void 0&&(Y=1),F.slice(Y,F.length)}n.drop=m;function l(F,Y){return Y===void 0&&(Y=1),F.slice(0,F.length-Y)}n.dropRight=l;function d(F,Y){var z=[];if(Array.isArray(F))for(var ee=0;ee<F.length;ee++){var de=F[ee];Y.call(null,de)&&z.push(de)}return z}n.filter=d;function y(F,Y){return d(F,function(z){return!Y(z)})}n.reject=y;function v(F,Y){for(var z=Object.keys(F),ee={},de=0;de<z.length;de++){var be=z[de],b=F[be];Y(b)&&(ee[be]=b)}return ee}n.pick=v;function E(F,Y){return Q(F)?F.hasOwnProperty(Y):!1}n.has=E;function S(F,Y){return H(F,function(z){return z===Y})!==void 0}n.contains=S;function I(F){for(var Y=[],z=0;z<F.length;z++)Y.push(F[z]);return Y}n.cloneArr=I;function k(F){var Y={};for(var z in F)Object.prototype.hasOwnProperty.call(F,z)&&(Y[z]=F[z]);return Y}n.cloneObj=k;function H(F,Y){for(var z=0;z<F.length;z++){var ee=F[z];if(Y.call(null,ee))return ee}}n.find=H;function x(F,Y){for(var z=[],ee=0;ee<F.length;ee++){var de=F[ee];Y.call(null,de)&&z.push(de)}return z}n.findAll=x;function B(F,Y,z){for(var ee=Array.isArray(F),de=ee?F:a(F),be=ee?[]:r(F),b=z,A=0;A<de.length;A++)b=Y.call(null,b,de[A],ee?A:be[A]);return b}n.reduce=B;function P(F){return y(F,function(Y){return Y==null})}n.compact=P;function O(F,Y){Y===void 0&&(Y=function(ee){return ee});var z=[];return B(F,function(ee,de){var be=Y(de);return S(z,be)?ee:(z.push(be),ee.concat(de))},[])}n.uniq=O;function M(F){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];var ee=[null],de=ee.concat(Y);return Function.bind.apply(F,de)}n.partial=M;function C(F){return Array.isArray(F)}n.isArray=C;function X(F){return F instanceof RegExp}n.isRegExp=X;function Q(F){return F instanceof Object}n.isObject=Q;function W(F,Y){for(var z=0;z<F.length;z++)if(!Y(F[z],z))return!1;return!0}n.every=W;function $(F,Y){return y(F,function(z){return S(Y,z)})}n.difference=$;function te(F,Y){for(var z=0;z<F.length;z++)if(Y(F[z]))return!0;return!1}n.some=te;function ce(F,Y){for(var z=0;z<F.length;z++)if(F[z]===Y)return z;return-1}n.indexOf=ce;function ae(F,Y){var z=I(F);return z.sort(function(ee,de){return Y(ee)-Y(de)}),z}n.sortBy=ae;function le(F,Y){if(F.length!==Y.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},ee=0;ee<F.length;ee++)z[F[ee]]=Y[ee];return z}n.zipObject=le;function ne(F){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var ee=0;ee<Y.length;ee++)for(var de=Y[ee],be=r(de),b=0;b<be.length;b++){var A=be[b];F[A]=de[A]}return F}n.assign=ne;function pe(F){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var ee=0;ee<Y.length;ee++)for(var de=Y[ee],be=r(de),b=0;b<be.length;b++){var A=be[b];E(F,A)||(F[A]=de[A])}return F}n.assignNoOverwrite=pe;function U(){for(var F=[],Y=0;Y<arguments.length;Y++)F[Y]=arguments[Y];return pe.apply(void 0,t([{}],F))}n.defaults=U;function G(F,Y){var z={};return h(F,function(ee){var de=Y(ee),be=z[de];be?be.push(ee):z[de]=[ee]}),z}n.groupBy=G;function K(F,Y){for(var z=k(F),ee=r(Y),de=0;de<ee.length;de++){var be=ee[de],b=Y[be];z[be]=b}return z}n.merge=K;function q(){}n.NOOP=q;function J(F){return F}n.IDENTITY=J;function ie(F){for(var Y=[],z=0;z<F.length;z++){var ee=F[z];Y.push(ee!==void 0?ee:void 0)}return Y}n.packArray=ie;function Te(F){console&&console.error&&console.error("Error: "+F)}n.PRINT_ERROR=Te;function ye(F){console&&console.warn&&console.warn("Warning: "+F)}n.PRINT_WARNING=ye;function we(){return typeof Map=="function"}n.isES2015MapSupported=we;function Be(F){return F[F.length-1]}n.peek=Be;function We(F){var Y=new Date().getTime(),z=F(),ee=new Date().getTime(),de=ee-Y;return{time:de,value:z}}n.timer=We;function Ue(F){function Y(){}Y.prototype=F;var z=new Y;function ee(){return typeof z.bar}return ee(),ee(),F}n.toFastProperties=Ue}),Ft=ve((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(l){this.idx=l.idx,this.input=l.input,this.groupIdx=l.groupIdx},t.prototype.pattern=function(l){this.idx=0,this.input=l,this.groupIdx=0,this.consumeChar("/");var d=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:l.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":c(y,"global");break;case"i":c(y,"ignoreCase");break;case"m":c(y,"multiLine");break;case"u":c(y,"unicode");break;case"y":c(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 l=[],d=this.idx;for(l.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),l.push(this.alternative());return{type:"Disjunction",value:l,loc:this.loc(d)}},t.prototype.alternative=function(){for(var l=[],d=this.idx;this.isTerm();)l.push(this.term());return{type:"Alternative",value:l,loc:this.loc(d)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var l=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(l)};case"$":return{type:"EndAnchor",loc:this.loc(l)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(l)};case"B":return{type:"NonWordBoundary",loc:this.loc(l)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var d;switch(this.popChar()){case"=":d="Lookahead";break;case"!":d="NegativeLookahead";break}s(d);var y=this.disjunction();return this.consumeChar(")"),{type:d,value:y,loc:this.loc(l)}}f()},t.prototype.quantifier=function(l){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 E;this.isDigit()?(E=this.integerIncludingZero(),d={atLeast:v,atMost:E}):d={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(l===!0&&d===void 0)return;s(d);break}if(!(l===!0&&d===void 0))return s(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 l,d=this.idx;switch(this.peekChar()){case".":l=this.dotAll();break;case"\\":l=this.atomEscape();break;case"[":l=this.characterClass();break;case"(":l=this.group();break}return l===void 0&&this.isPatternCharacter()&&(l=this.patternCharacter()),s(l),l.loc=this.loc(d),this.isQuantifier()&&(l.quantifier=this.quantifier()),l},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o(`
81
- `),o("\r"),o("\u2028"),o("\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 l=this.positiveInteger();return{type:"GroupBackReference",value:l}},t.prototype.characterClassEscape=function(){var l,d=!1;switch(this.popChar()){case"d":l=g;break;case"D":l=g,d=!0;break;case"s":l=T;break;case"S":l=T,d=!0;break;case"w":l=p;break;case"W":l=p,d=!0;break}return s(l),{type:"Set",value:l,complement:d}},t.prototype.controlEscapeAtom=function(){var l;switch(this.popChar()){case"f":l=o("\f");break;case"n":l=o(`
82
- `);break;case"r":l=o("\r");break;case"t":l=o(" ");break;case"v":l=o("\v");break}return s(l),{type:"Character",value:l}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var l=this.popChar();if(/[a-zA-Z]/.test(l)===!1)throw Error("Invalid ");var d=l.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:d}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\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 l=this.popChar();return{type:"Character",value:o(l)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
83
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var l=this.popChar();return{type:"Character",value:o(l)}}},t.prototype.characterClass=function(){var l=[],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 E=this.classAtom(),S=E.type==="Character";if(S){if(E.value<y.value)throw Error("Range out of order in character class");l.push({from:y.value,to:E.value})}else u(y.value,l),l.push(o("-")),u(E.value,l)}else u(y.value,l)}return this.consumeChar("]"),{type:"Set",complement:d,value:l}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
84
- `: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:o("\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 l=!0;(this.consumeChar("("),this.peekChar(0))==="?"?(this.consumeChar("?"),this.consumeChar(":"),l=!1):this.groupIdx++;var d=this.disjunction();this.consumeChar(")");var y={type:"Group",capturing:l,value:d};return l&&(y.idx=this.groupIdx),y},t.prototype.positiveInteger=function(){var l=this.popChar();if(a.test(l)===!1)throw Error("Expecting a positive integer");for(;r.test(this.peekChar(0));)l+=this.popChar();return parseInt(l,10)},t.prototype.integerIncludingZero=function(){var l=this.popChar();if(r.test(l)===!1)throw Error("Expecting an integer");for(;r.test(this.peekChar(0));)l+=this.popChar();return parseInt(l,10)},t.prototype.patternCharacter=function(){var l=this.popChar();switch(l){case`
85
- `: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:o(l)}}},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 r.test(this.peekChar(0))},t.prototype.isClassAtom=function(l){switch(l===void 0&&(l=0),this.peekChar(l)){case"]":case`
80
+ `,Qn={testMode:!0};class Ro extends xe{constructor(e={}){super(e);const t={...Qn,...e};this.setTransformMotion(new kn(t))}initObject(){const e=new ae.BoxGeometry,t=new ae.MeshStandardMaterial({color:65280}),r=new ae.Mesh(e,t),n=document.createElement("div");n.textContent="Hello Box!",n.style.cssText=To;const s=new Gn(n);return s.position.set(0,.8,0),r.add(s),r}initTransformMotion(e){const t=vt(Qn,e);return new kn(t)}}class kn extends Et{testMode=!0;rot=new ce;constructor(e){super(),this.testMode=e.testMode}update(e){if(super.update(e),this.testMode){this.rot.add(e,e,e);const t=At(this.rot);this.trans.quat.set(t)}}}class wo extends m.Loader{constructor(e){super(e)}load(e,t,r,n){const s=this,o=new m.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){const A=s.parse(JSON.parse(c));t&&t(A)},r,n)}parse(e){return new Li(e)}}class Li{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,r="ltr"){const n=[],s=vo(e,t,this.data,r);for(let o=0,c=s.length;o<c;o++)n.push(...s[o].toShapes());return n}}function vo(i,e,t,r){const n=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,c=[];let A=0,a=0;(r=="rtl"||r=="tb")&&n.reverse();for(let f=0;f<n.length;f++){const u=n[f];if(u===`
81
+ `)A=0,a-=o;else{const b=Qo(u,s,A,a,t);r=="tb"?(A=0,a+=t.ascender*s):A+=b.offsetX,c.push(b.path)}}return c}function Qo(i,e,t,r,n){const s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}const o=new m.ShapePath;let c,A,a,f,u,b,d,I;if(s.o){const g=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let l=0,h=g.length;l<h;)switch(g[l++]){case"m":c=g[l++]*e+t,A=g[l++]*e+r,o.moveTo(c,A);break;case"l":c=g[l++]*e+t,A=g[l++]*e+r,o.lineTo(c,A);break;case"q":a=g[l++]*e+t,f=g[l++]*e+r,u=g[l++]*e+t,b=g[l++]*e+r,o.quadraticCurveTo(u,b,a,f);break;case"b":a=g[l++]*e+t,f=g[l++]*e+r,u=g[l++]*e+t,b=g[l++]*e+r,d=g[l++]*e+t,I=g[l++]*e+r,o.bezierCurveTo(u,b,d,I,a,f);break}}return{offsetX:s.ha*e,path:o}}class ko extends m.ExtrudeGeometry{constructor(e,t={}){const r=t.font;if(r===void 0)super();else{const n=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(n,t)}this.type="TextGeometry"}}let wt=null;async function So(i){if(i.match(/.zip$/i)){let e=i.substring(i.lastIndexOf("/"));e=e.substring(0,e.length-4);const t=await Fn(i),r=nn(t,e);wt=new Li(JSON.parse(r))}else wt=await new wo().loadAsync(i)}class _o extends xe{initObject(e){let t;if(_n(e)?t=e:t="ERROR",wt==null){const r=new ae.BoxGeometry,n=new ae.MeshStandardMaterial({color:16711680});return new ae.Mesh(r,n)}else{const r={font:wt,size:1,depth:.5,curveSegments:12},n=new ko(t,r);n.center();const s=new ae.MeshStandardMaterial({color:65280});return new ae.Mesh(n,s)}}}var Be=(i,e)=>()=>(e||(e={exports:{}},i(e.exports,e)),e.exports),xi=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.VERSION=void 0,i.VERSION="9.0.1"}),Se=Be((i,e)=>{var t=i&&i.__spreadArray||function(M,Y){for(var K=0,ie=Y.length,ge=M.length;K<ie;K++,ge++)M[ge]=Y[K];return M};Object.defineProperty(i,"__esModule",{value:!0}),i.toFastProperties=i.timer=i.peek=i.isES2015MapSupported=i.PRINT_WARNING=i.PRINT_ERROR=i.packArray=i.IDENTITY=i.NOOP=i.merge=i.groupBy=i.defaults=i.assignNoOverwrite=i.assign=i.zipObject=i.sortBy=i.indexOf=i.some=i.difference=i.every=i.isObject=i.isRegExp=i.isArray=i.partial=i.uniq=i.compact=i.reduce=i.findAll=i.find=i.cloneObj=i.cloneArr=i.contains=i.has=i.pick=i.reject=i.filter=i.dropRight=i.drop=i.isFunction=i.isUndefined=i.isString=i.forEach=i.last=i.first=i.flatten=i.map=i.mapValues=i.values=i.keys=i.isEmpty=void 0;function r(M){return M&&M.length===0}i.isEmpty=r;function n(M){return M==null?[]:Object.keys(M)}i.keys=n;function s(M){for(var Y=[],K=Object.keys(M),ie=0;ie<K.length;ie++)Y.push(M[K[ie]]);return Y}i.values=s;function o(M,Y){for(var K=[],ie=n(M),ge=0;ge<ie.length;ge++){var we=ie[ge];K.push(Y.call(null,M[we],we))}return K}i.mapValues=o;function c(M,Y){for(var K=[],ie=0;ie<M.length;ie++)K.push(Y.call(null,M[ie],ie));return K}i.map=c;function A(M){for(var Y=[],K=0;K<M.length;K++){var ie=M[K];Array.isArray(ie)?Y=Y.concat(A(ie)):Y.push(ie)}return Y}i.flatten=A;function a(M){return r(M)?void 0:M[0]}i.first=a;function f(M){var Y=M&&M.length;return Y?M[Y-1]:void 0}i.last=f;function u(M,Y){if(Array.isArray(M))for(var K=0;K<M.length;K++)Y.call(null,M[K],K);else if(J(M))for(var ie=n(M),K=0;K<ie.length;K++){var ge=ie[K],we=M[ge];Y.call(null,we,ge)}else throw Error("non exhaustive match")}i.forEach=u;function b(M){return typeof M=="string"}i.isString=b;function d(M){return M===void 0}i.isUndefined=d;function I(M){return M instanceof Function}i.isFunction=I;function g(M,Y){return Y===void 0&&(Y=1),M.slice(Y,M.length)}i.drop=g;function l(M,Y){return Y===void 0&&(Y=1),M.slice(0,M.length-Y)}i.dropRight=l;function h(M,Y){var K=[];if(Array.isArray(M))for(var ie=0;ie<M.length;ie++){var ge=M[ie];Y.call(null,ge)&&K.push(ge)}return K}i.filter=h;function p(M,Y){return h(M,function(K){return!Y(K)})}i.reject=p;function C(M,Y){for(var K=Object.keys(M),ie={},ge=0;ge<K.length;ge++){var we=K[ge],R=M[we];Y(R)&&(ie[we]=R)}return ie}i.pick=C;function E(M,Y){return J(M)?M.hasOwnProperty(Y):!1}i.has=E;function B(M,Y){return U(M,function(K){return K===Y})!==void 0}i.contains=B;function Q(M){for(var Y=[],K=0;K<M.length;K++)Y.push(M[K]);return Y}i.cloneArr=Q;function S(M){var Y={};for(var K in M)Object.prototype.hasOwnProperty.call(M,K)&&(Y[K]=M[K]);return Y}i.cloneObj=S;function U(M,Y){for(var K=0;K<M.length;K++){var ie=M[K];if(Y.call(null,ie))return ie}}i.find=U;function v(M,Y){for(var K=[],ie=0;ie<M.length;ie++){var ge=M[ie];Y.call(null,ge)&&K.push(ge)}return K}i.findAll=v;function O(M,Y,K){for(var ie=Array.isArray(M),ge=ie?M:s(M),we=ie?[]:n(M),R=K,y=0;y<ge.length;y++)R=Y.call(null,R,ge[y],ie?y:we[y]);return R}i.reduce=O;function L(M){return p(M,function(Y){return Y==null})}i.compact=L;function k(M,Y){Y===void 0&&(Y=function(ie){return ie});var K=[];return O(M,function(ie,ge){var we=Y(ge);return B(K,we)?ie:(K.push(we),ie.concat(ge))},[])}i.uniq=k;function D(M){for(var Y=[],K=1;K<arguments.length;K++)Y[K-1]=arguments[K];var ie=[null],ge=ie.concat(Y);return Function.bind.apply(M,ge)}i.partial=D;function _(M){return Array.isArray(M)}i.isArray=_;function V(M){return M instanceof RegExp}i.isRegExp=V;function J(M){return M instanceof Object}i.isObject=J;function q(M,Y){for(var K=0;K<M.length;K++)if(!Y(M[K],K))return!1;return!0}i.every=q;function X(M,Y){return p(M,function(K){return B(Y,K)})}i.difference=X;function $(M,Y){for(var K=0;K<M.length;K++)if(Y(M[K]))return!0;return!1}i.some=$;function le(M,Y){for(var K=0;K<M.length;K++)if(M[K]===Y)return K;return-1}i.indexOf=le;function re(M,Y){var K=Q(M);return K.sort(function(ie,ge){return Y(ie)-Y(ge)}),K}i.sortBy=re;function oe(M,Y){if(M.length!==Y.length)throw Error("can't zipObject with different number of keys and values!");for(var K={},ie=0;ie<M.length;ie++)K[M[ie]]=Y[ie];return K}i.zipObject=oe;function te(M){for(var Y=[],K=1;K<arguments.length;K++)Y[K-1]=arguments[K];for(var ie=0;ie<Y.length;ie++)for(var ge=Y[ie],we=n(ge),R=0;R<we.length;R++){var y=we[R];M[y]=ge[y]}return M}i.assign=te;function he(M){for(var Y=[],K=1;K<arguments.length;K++)Y[K-1]=arguments[K];for(var ie=0;ie<Y.length;ie++)for(var ge=Y[ie],we=n(ge),R=0;R<we.length;R++){var y=we[R];E(M,y)||(M[y]=ge[y])}return M}i.assignNoOverwrite=he;function P(){for(var M=[],Y=0;Y<arguments.length;Y++)M[Y]=arguments[Y];return he.apply(void 0,t([{}],M))}i.defaults=P;function j(M,Y){var K={};return u(M,function(ie){var ge=Y(ie),we=K[ge];we?we.push(ie):K[ge]=[ie]}),K}i.groupBy=j;function W(M,Y){for(var K=S(M),ie=n(Y),ge=0;ge<ie.length;ge++){var we=ie[ge],R=Y[we];K[we]=R}return K}i.merge=W;function Z(){}i.NOOP=Z;function ne(M){return M}i.IDENTITY=ne;function Ae(M){for(var Y=[],K=0;K<M.length;K++){var ie=M[K];Y.push(ie!==void 0?ie:void 0)}return Y}i.packArray=Ae;function be(M){console&&console.error&&console.error("Error: "+M)}i.PRINT_ERROR=be;function Ie(M){console&&console.warn&&console.warn("Warning: "+M)}i.PRINT_WARNING=Ie;function Ne(){return typeof Map=="function"}i.isES2015MapSupported=Ne;function je(M){return M[M.length-1]}i.peek=je;function Ve(M){var Y=new Date().getTime(),K=M(),ie=new Date().getTime(),ge=ie-Y;return{time:ge,value:K}}i.timer=Ve;function Ue(M){function Y(){}Y.prototype=M;var K=new Y;function ie(){return typeof K.bar}return ie(),ie(),M}i.toFastProperties=Ue}),An=Be((i,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:i,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(l){this.idx=l.idx,this.input=l.input,this.groupIdx=l.groupIdx},t.prototype.pattern=function(l){this.idx=0,this.input=l,this.groupIdx=0,this.consumeChar("/");var h=this.disjunction();this.consumeChar("/");for(var p={type:"Flags",loc:{begin:this.idx,end:l.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":A(p,"global");break;case"i":A(p,"ignoreCase");break;case"m":A(p,"multiLine");break;case"u":A(p,"unicode");break;case"y":A(p,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:p,value:h,loc:this.loc(0)}},t.prototype.disjunction=function(){var l=[],h=this.idx;for(l.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),l.push(this.alternative());return{type:"Disjunction",value:l,loc:this.loc(h)}},t.prototype.alternative=function(){for(var l=[],h=this.idx;this.isTerm();)l.push(this.term());return{type:"Alternative",value:l,loc:this.loc(h)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var l=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(l)};case"$":return{type:"EndAnchor",loc:this.loc(l)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(l)};case"B":return{type:"NonWordBoundary",loc:this.loc(l)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var h;switch(this.popChar()){case"=":h="Lookahead";break;case"!":h="NegativeLookahead";break}a(h);var p=this.disjunction();return this.consumeChar(")"),{type:h,value:p,loc:this.loc(l)}}f()},t.prototype.quantifier=function(l){var h,p=this.idx;switch(this.popChar()){case"*":h={atLeast:0,atMost:1/0};break;case"+":h={atLeast:1,atMost:1/0};break;case"?":h={atLeast:0,atMost:1};break;case"{":var C=this.integerIncludingZero();switch(this.popChar()){case"}":h={atLeast:C,atMost:C};break;case",":var E;this.isDigit()?(E=this.integerIncludingZero(),h={atLeast:C,atMost:E}):h={atLeast:C,atMost:1/0},this.consumeChar("}");break}if(l===!0&&h===void 0)return;a(h);break}if(!(l===!0&&h===void 0))return a(h),this.peekChar(0)==="?"?(this.consumeChar("?"),h.greedy=!1):h.greedy=!0,h.type="Quantifier",h.loc=this.loc(p),h},t.prototype.atom=function(){var l,h=this.idx;switch(this.peekChar()){case".":l=this.dotAll();break;case"\\":l=this.atomEscape();break;case"[":l=this.characterClass();break;case"(":l=this.group();break}return l===void 0&&this.isPatternCharacter()&&(l=this.patternCharacter()),a(l),l.loc=this.loc(h),this.isQuantifier()&&(l.quantifier=this.quantifier()),l},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o(`
82
+ `),o("\r"),o("\u2028"),o("\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 l=this.positiveInteger();return{type:"GroupBackReference",value:l}},t.prototype.characterClassEscape=function(){var l,h=!1;switch(this.popChar()){case"d":l=b;break;case"D":l=b,h=!0;break;case"s":l=I;break;case"S":l=I,h=!0;break;case"w":l=d;break;case"W":l=d,h=!0;break}return a(l),{type:"Set",value:l,complement:h}},t.prototype.controlEscapeAtom=function(){var l;switch(this.popChar()){case"f":l=o("\f");break;case"n":l=o(`
83
+ `);break;case"r":l=o("\r");break;case"t":l=o(" ");break;case"v":l=o("\v");break}return a(l),{type:"Character",value:l}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var l=this.popChar();if(/[a-zA-Z]/.test(l)===!1)throw Error("Invalid ");var h=l.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:h}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\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 l=this.popChar();return{type:"Character",value:o(l)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
84
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var l=this.popChar();return{type:"Character",value:o(l)}}},t.prototype.characterClass=function(){var l=[],h=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),h=!0);this.isClassAtom();){var p=this.classAtom(),C=p.type==="Character";if(C&&this.isRangeDash()){this.consumeChar("-");var E=this.classAtom(),B=E.type==="Character";if(B){if(E.value<p.value)throw Error("Range out of order in character class");l.push({from:p.value,to:E.value})}else c(p.value,l),l.push(o("-")),c(E.value,l)}else c(p.value,l)}return this.consumeChar("]"),{type:"Set",complement:h,value:l}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
85
+ `: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:o("\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 l=!0;(this.consumeChar("("),this.peekChar(0))==="?"?(this.consumeChar("?"),this.consumeChar(":"),l=!1):this.groupIdx++;var h=this.disjunction();this.consumeChar(")");var p={type:"Group",capturing:l,value:h};return l&&(p.idx=this.groupIdx),p},t.prototype.positiveInteger=function(){var l=this.popChar();if(s.test(l)===!1)throw Error("Expecting a positive integer");for(;n.test(this.peekChar(0));)l+=this.popChar();return parseInt(l,10)},t.prototype.integerIncludingZero=function(){var l=this.popChar();if(n.test(l)===!1)throw Error("Expecting an integer");for(;n.test(this.peekChar(0));)l+=this.popChar();return parseInt(l,10)},t.prototype.patternCharacter=function(){var l=this.popChar();switch(l){case`
86
+ `: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:o(l)}}},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 n.test(this.peekChar(0))},t.prototype.isClassAtom=function(l){switch(l===void 0&&(l=0),this.peekChar(l)){case"]":case`
86
87
  `: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 l=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(l)}},t.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
87
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(l){for(var d="",y=0;y<l;y++){var v=this.popChar();if(i.test(v)===!1)throw Error("Expecting a HexDecimal digits");d+=v}var E=parseInt(d,16);return{type:"Character",value:E}},t.prototype.peekChar=function(l){return l===void 0&&(l=0),this.input[this.idx+l]},t.prototype.popChar=function(){var l=this.peekChar(0);return this.consumeChar(),l},t.prototype.consumeChar=function(l){if(l!==void 0&&this.input[this.idx]!==l)throw Error("Expected: '"+l+"' 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(l){return{begin:l,end:this.idx}};var i=/[0-9a-fA-F]/,r=/[0-9]/,a=/[1-9]/;function o(l){return l.charCodeAt(0)}function u(l,d){l.length!==void 0?l.forEach(function(y){d.push(y)}):d.push(l)}function c(l,d){if(l[d]===!0)throw"duplicate flag "+d;l[d]=!0}function s(l){if(l===void 0)throw Error("Internal Error - Should never get here!")}function f(){throw Error("Internal Error - Should never get here!")}var h,g=[];for(h=o("0");h<=o("9");h++)g.push(h);var p=[o("_")].concat(g);for(h=o("a");h<=o("z");h++)p.push(h);for(h=o("A");h<=o("Z");h++)p.push(h);var T=[o(" "),o("\f"),o(`
88
- `),o("\r"),o(" "),o("\v"),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o("\u2028"),o("\u2029"),o(" "),o(" "),o(" "),o("\uFEFF")];function m(){}return m.prototype.visitChildren=function(l){for(var d in l){var y=l[d];l.hasOwnProperty(d)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(v){this.visit(v)},this))}},m.prototype.visit=function(l){switch(l.type){case"Pattern":this.visitPattern(l);break;case"Flags":this.visitFlags(l);break;case"Disjunction":this.visitDisjunction(l);break;case"Alternative":this.visitAlternative(l);break;case"StartAnchor":this.visitStartAnchor(l);break;case"EndAnchor":this.visitEndAnchor(l);break;case"WordBoundary":this.visitWordBoundary(l);break;case"NonWordBoundary":this.visitNonWordBoundary(l);break;case"Lookahead":this.visitLookahead(l);break;case"NegativeLookahead":this.visitNegativeLookahead(l);break;case"Character":this.visitCharacter(l);break;case"Set":this.visitSet(l);break;case"Group":this.visitGroup(l);break;case"GroupBackReference":this.visitGroupBackReference(l);break;case"Quantifier":this.visitQuantifier(l);break}this.visitChildren(l)},m.prototype.visitPattern=function(l){},m.prototype.visitFlags=function(l){},m.prototype.visitDisjunction=function(l){},m.prototype.visitAlternative=function(l){},m.prototype.visitStartAnchor=function(l){},m.prototype.visitEndAnchor=function(l){},m.prototype.visitWordBoundary=function(l){},m.prototype.visitNonWordBoundary=function(l){},m.prototype.visitLookahead=function(l){},m.prototype.visitNegativeLookahead=function(l){},m.prototype.visitCharacter=function(l){},m.prototype.visitSet=function(l){},m.prototype.visitGroup=function(l){},m.prototype.visitGroupBackReference=function(l){},m.prototype.visitQuantifier=function(l){},{RegExpParser:t,BaseRegExpVisitor:m,VERSION:"0.5.0"}})}),Ut=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clearRegExpParserCache=n.getRegExpAst=void 0;var e=Ft(),t={},i=new e.RegExpParser;function r(o){var u=o.toString();if(t.hasOwnProperty(u))return t[u];var c=i.pattern(u);return t[u]=c,c}n.getRegExpAst=r;function a(){t={}}n.clearRegExpParserCache=a}),ni=ve(n=>{var e=n&&n.__extends||(function(){var m=function(l,d){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,v){y.__proto__=v}||function(y,v){for(var E in v)Object.prototype.hasOwnProperty.call(v,E)&&(y[E]=v[E])},m(l,d)};return function(l,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");m(l,d);function y(){this.constructor=l}l.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=Ft(),i=xe(),r=Ut(),a=An(),o="Complement Sets are not supported for first char optimization";n.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
89
- `;function u(m,l){l===void 0&&(l=!1);try{var d=r.getRegExpAst(m),y=c(d.value,{},d.flags.ignoreCase);return y}catch(E){if(E.message===o)l&&i.PRINT_WARNING(""+n.failedOptimizationPrefixMsg+(" Unable to optimize: < "+m.toString()+` >
88
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(l){for(var h="",p=0;p<l;p++){var C=this.popChar();if(r.test(C)===!1)throw Error("Expecting a HexDecimal digits");h+=C}var E=parseInt(h,16);return{type:"Character",value:E}},t.prototype.peekChar=function(l){return l===void 0&&(l=0),this.input[this.idx+l]},t.prototype.popChar=function(){var l=this.peekChar(0);return this.consumeChar(),l},t.prototype.consumeChar=function(l){if(l!==void 0&&this.input[this.idx]!==l)throw Error("Expected: '"+l+"' 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(l){return{begin:l,end:this.idx}};var r=/[0-9a-fA-F]/,n=/[0-9]/,s=/[1-9]/;function o(l){return l.charCodeAt(0)}function c(l,h){l.length!==void 0?l.forEach(function(p){h.push(p)}):h.push(l)}function A(l,h){if(l[h]===!0)throw"duplicate flag "+h;l[h]=!0}function a(l){if(l===void 0)throw Error("Internal Error - Should never get here!")}function f(){throw Error("Internal Error - Should never get here!")}var u,b=[];for(u=o("0");u<=o("9");u++)b.push(u);var d=[o("_")].concat(b);for(u=o("a");u<=o("z");u++)d.push(u);for(u=o("A");u<=o("Z");u++)d.push(u);var I=[o(" "),o("\f"),o(`
89
+ `),o("\r"),o(" "),o("\v"),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o("\u2028"),o("\u2029"),o(" "),o(" "),o(" "),o("\uFEFF")];function g(){}return g.prototype.visitChildren=function(l){for(var h in l){var p=l[h];l.hasOwnProperty(h)&&(p.type!==void 0?this.visit(p):Array.isArray(p)&&p.forEach(function(C){this.visit(C)},this))}},g.prototype.visit=function(l){switch(l.type){case"Pattern":this.visitPattern(l);break;case"Flags":this.visitFlags(l);break;case"Disjunction":this.visitDisjunction(l);break;case"Alternative":this.visitAlternative(l);break;case"StartAnchor":this.visitStartAnchor(l);break;case"EndAnchor":this.visitEndAnchor(l);break;case"WordBoundary":this.visitWordBoundary(l);break;case"NonWordBoundary":this.visitNonWordBoundary(l);break;case"Lookahead":this.visitLookahead(l);break;case"NegativeLookahead":this.visitNegativeLookahead(l);break;case"Character":this.visitCharacter(l);break;case"Set":this.visitSet(l);break;case"Group":this.visitGroup(l);break;case"GroupBackReference":this.visitGroupBackReference(l);break;case"Quantifier":this.visitQuantifier(l);break}this.visitChildren(l)},g.prototype.visitPattern=function(l){},g.prototype.visitFlags=function(l){},g.prototype.visitDisjunction=function(l){},g.prototype.visitAlternative=function(l){},g.prototype.visitStartAnchor=function(l){},g.prototype.visitEndAnchor=function(l){},g.prototype.visitWordBoundary=function(l){},g.prototype.visitNonWordBoundary=function(l){},g.prototype.visitLookahead=function(l){},g.prototype.visitNegativeLookahead=function(l){},g.prototype.visitCharacter=function(l){},g.prototype.visitSet=function(l){},g.prototype.visitGroup=function(l){},g.prototype.visitGroupBackReference=function(l){},g.prototype.visitQuantifier=function(l){},{RegExpParser:t,BaseRegExpVisitor:g,VERSION:"0.5.0"}})}),cn=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clearRegExpParserCache=i.getRegExpAst=void 0;var e=An(),t={},r=new e.RegExpParser;function n(o){var c=o.toString();if(t.hasOwnProperty(c))return t[c];var A=r.pattern(c);return t[c]=A,A}i.getRegExpAst=n;function s(){t={}}i.clearRegExpParserCache=s}),Lo=Be(i=>{var e=i&&i.__extends||(function(){var g=function(l,h){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,C){p.__proto__=C}||function(p,C){for(var E in C)Object.prototype.hasOwnProperty.call(C,E)&&(p[E]=C[E])},g(l,h)};return function(l,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");g(l,h);function p(){this.constructor=l}l.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.canMatchCharCode=i.firstCharOptimizedIndices=i.getOptimizedStartCodesIndices=i.failedOptimizationPrefixMsg=void 0;var t=An(),r=Se(),n=cn(),s=Ni(),o="Complement Sets are not supported for first char optimization";i.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
90
+ `;function c(g,l){l===void 0&&(l=!1);try{var h=n.getRegExpAst(g),p=A(h.value,{},h.flags.ignoreCase);return p}catch(E){if(E.message===o)l&&r.PRINT_WARNING(""+i.failedOptimizationPrefixMsg+(" Unable to optimize: < "+g.toString()+` >
90
91
  `)+` Complement Sets cannot be automatically optimized.
91
92
  This will disable the lexer's first char optimizations.
92
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var v="";l&&(v=`
93
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var C="";l&&(C=`
93
94
  This will disable the lexer's first char optimizations.
94
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),i.PRINT_ERROR(n.failedOptimizationPrefixMsg+`
95
- `+(" Failed parsing: < "+m.toString()+` >
95
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),r.PRINT_ERROR(i.failedOptimizationPrefixMsg+`
96
+ `+(" Failed parsing: < "+g.toString()+` >
96
97
  `)+(" Using the regexp-to-ast library version: "+t.VERSION+`
97
- `)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}n.getOptimizedStartCodesIndices=u;function c(m,l,d){switch(m.type){case"Disjunction":for(var y=0;y<m.value.length;y++)c(m.value[y],l,d);break;case"Alternative":for(var v=m.value,y=0;y<v.length;y++){var E=v[y];switch(E.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var S=E;switch(S.type){case"Character":s(S.value,l,d);break;case"Set":if(S.complement===!0)throw Error(o);i.forEach(S.value,function(H){if(typeof H=="number")s(H,l,d);else{var x=H;if(d===!0)for(var B=x.from;B<=x.to;B++)s(B,l,d);else{for(var B=x.from;B<=x.to&&B<a.minOptimizationVal;B++)s(B,l,d);if(x.to>=a.minOptimizationVal)for(var P=x.from>=a.minOptimizationVal?x.from:a.minOptimizationVal,O=x.to,M=a.charCodeToOptimizedIndex(P),C=a.charCodeToOptimizedIndex(O),X=M;X<=C;X++)l[X]=X}}});break;case"Group":c(S.value,l,d);break;default:throw Error("Non Exhaustive Match")}var I=S.quantifier!==void 0&&S.quantifier.atLeast===0;if(S.type==="Group"&&g(S)===!1||S.type!=="Group"&&I===!1)break}break;default:throw Error("non exhaustive match!")}return i.values(l)}n.firstCharOptimizedIndices=c;function s(m,l,d){var y=a.charCodeToOptimizedIndex(m);l[y]=y,d===!0&&f(m,l)}function f(m,l){var d=String.fromCharCode(m),y=d.toUpperCase();if(y!==d){var v=a.charCodeToOptimizedIndex(y.charCodeAt(0));l[v]=v}else{var E=d.toLowerCase();if(E!==d){var v=a.charCodeToOptimizedIndex(E.charCodeAt(0));l[v]=v}}}function h(m,l){return i.find(m.value,function(d){if(typeof d=="number")return i.contains(l,d);var y=d;return i.find(l,function(v){return y.from<=v&&v<=y.to})!==void 0})}function g(m){return m.quantifier&&m.quantifier.atLeast===0?!0:m.value?i.isArray(m.value)?i.every(m.value,g):g(m.value):!1}var p=(function(m){e(l,m);function l(d){var y=m.call(this)||this;return y.targetCharCodes=d,y.found=!1,y}return l.prototype.visitChildren=function(d){if(this.found!==!0){switch(d.type){case"Lookahead":this.visitLookahead(d);return;case"NegativeLookahead":this.visitNegativeLookahead(d);return}m.prototype.visitChildren.call(this,d)}},l.prototype.visitCharacter=function(d){i.contains(this.targetCharCodes,d.value)&&(this.found=!0)},l.prototype.visitSet=function(d){d.complement?h(d,this.targetCharCodes)===void 0&&(this.found=!0):h(d,this.targetCharCodes)!==void 0&&(this.found=!0)},l})(t.BaseRegExpVisitor);function T(m,l){if(l instanceof RegExp){var d=r.getRegExpAst(l),y=new p(m);return y.visit(d),y.found}else return i.find(l,function(v){return i.contains(m,v.charCodeAt(0))})!==void 0}n.canMatchCharCode=T}),An=ve(n=>{var e=n&&n.__extends||(function(){var U=function(G,K){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(q,J){q.__proto__=J}||function(q,J){for(var ie in J)Object.prototype.hasOwnProperty.call(J,ie)&&(q[ie]=J[ie])},U(G,K)};return function(G,K){if(typeof K!="function"&&K!==null)throw new TypeError("Class extends value "+String(K)+" is not a constructor or null");U(G,K);function q(){this.constructor=G}G.prototype=K===null?Object.create(K):(q.prototype=K.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=Ft(),i=gt(),r=xe(),a=ni(),o=Ut(),u="PATTERN";n.DEFAULT_MODE="defaultMode",n.MODES="modes",n.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function c(){n.SUPPORT_STICKY=!1}n.disableSticky=c;function s(){n.SUPPORT_STICKY=!0}n.enableSticky=s;function f(U,G){G=r.defaults(G,{useSticky:n.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
98
- `],tracer:function(b,A){return A()}});var K=G.tracer;K("initCharCodeToOptimizedIndexMap",function(){pe()});var q;K("Reject Lexer.NA",function(){q=r.reject(U,function(b){return b[u]===i.Lexer.NA})});var J=!1,ie;K("Transform Patterns",function(){J=!1,ie=r.map(q,function(b){var A=b[u];if(r.isRegExp(A)){var _=A.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!A.ignoreCase?_:_.length===2&&_[0]==="\\"&&!r.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:G.useSticky?O(A):P(A)}else{if(r.isFunction(A))return J=!0,{exec:A};if(r.has(A,"exec"))return J=!0,A;if(typeof A=="string"){if(A.length===1)return A;var N=A.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),L=new RegExp(N);return G.useSticky?O(L):P(L)}else throw Error("non exhaustive match")}})});var Te,ye,we,Be,We;K("misc mapping",function(){Te=r.map(q,function(b){return b.tokenTypeIdx}),ye=r.map(q,function(b){var A=b.GROUP;if(A!==i.Lexer.SKIPPED){if(r.isString(A))return A;if(r.isUndefined(A))return!1;throw Error("non exhaustive match")}}),we=r.map(q,function(b){var A=b.LONGER_ALT;if(A){var _=r.indexOf(q,A);return _}}),Be=r.map(q,function(b){return b.PUSH_MODE}),We=r.map(q,function(b){return r.has(b,"POP_MODE")})});var Ue;K("Line Terminator Handling",function(){var b=ce(G.lineTerminatorCharacters);Ue=r.map(q,function(A){return!1}),G.positionTracking!=="onlyOffset"&&(Ue=r.map(q,function(A){if(r.has(A,"LINE_BREAKS"))return A.LINE_BREAKS;if($(A,b)===!1)return a.canMatchCharCode(b,A.PATTERN)}))});var F,Y,z,ee;K("Misc Mapping #2",function(){F=r.map(q,Q),Y=r.map(ie,W),z=r.reduce(q,function(b,A){var _=A.GROUP;return r.isString(_)&&_!==i.Lexer.SKIPPED&&(b[_]=[]),b},{}),ee=r.map(ie,function(b,A){return{pattern:ie[A],longerAlt:we[A],canLineTerminator:Ue[A],isCustom:F[A],short:Y[A],group:ye[A],push:Be[A],pop:We[A],tokenTypeIdx:Te[A],tokenType:q[A]}})});var de=!0,be=[];return G.safeMode||K("First Char Optimization",function(){be=r.reduce(q,function(b,A,_){if(typeof A.PATTERN=="string"){var N=A.PATTERN.charCodeAt(0),L=ne(N);ae(b,L,ee[_])}else if(r.isArray(A.START_CHARS_HINT)){var w;r.forEach(A.START_CHARS_HINT,function(j){var V=typeof j=="string"?j.charCodeAt(0):j,Z=ne(V);w!==Z&&(w=Z,ae(b,Z,ee[_]))})}else if(r.isRegExp(A.PATTERN))if(A.PATTERN.unicode)de=!1,G.ensureOptimizations&&r.PRINT_ERROR(""+a.failedOptimizationPrefixMsg+(" Unable to analyze < "+A.PATTERN.toString()+` > pattern.
98
+ `)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+C)}}return[]}i.getOptimizedStartCodesIndices=c;function A(g,l,h){switch(g.type){case"Disjunction":for(var p=0;p<g.value.length;p++)A(g.value[p],l,h);break;case"Alternative":for(var C=g.value,p=0;p<C.length;p++){var E=C[p];switch(E.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var B=E;switch(B.type){case"Character":a(B.value,l,h);break;case"Set":if(B.complement===!0)throw Error(o);r.forEach(B.value,function(U){if(typeof U=="number")a(U,l,h);else{var v=U;if(h===!0)for(var O=v.from;O<=v.to;O++)a(O,l,h);else{for(var O=v.from;O<=v.to&&O<s.minOptimizationVal;O++)a(O,l,h);if(v.to>=s.minOptimizationVal)for(var L=v.from>=s.minOptimizationVal?v.from:s.minOptimizationVal,k=v.to,D=s.charCodeToOptimizedIndex(L),_=s.charCodeToOptimizedIndex(k),V=D;V<=_;V++)l[V]=V}}});break;case"Group":A(B.value,l,h);break;default:throw Error("Non Exhaustive Match")}var Q=B.quantifier!==void 0&&B.quantifier.atLeast===0;if(B.type==="Group"&&b(B)===!1||B.type!=="Group"&&Q===!1)break}break;default:throw Error("non exhaustive match!")}return r.values(l)}i.firstCharOptimizedIndices=A;function a(g,l,h){var p=s.charCodeToOptimizedIndex(g);l[p]=p,h===!0&&f(g,l)}function f(g,l){var h=String.fromCharCode(g),p=h.toUpperCase();if(p!==h){var C=s.charCodeToOptimizedIndex(p.charCodeAt(0));l[C]=C}else{var E=h.toLowerCase();if(E!==h){var C=s.charCodeToOptimizedIndex(E.charCodeAt(0));l[C]=C}}}function u(g,l){return r.find(g.value,function(h){if(typeof h=="number")return r.contains(l,h);var p=h;return r.find(l,function(C){return p.from<=C&&C<=p.to})!==void 0})}function b(g){return g.quantifier&&g.quantifier.atLeast===0?!0:g.value?r.isArray(g.value)?r.every(g.value,b):b(g.value):!1}var d=(function(g){e(l,g);function l(h){var p=g.call(this)||this;return p.targetCharCodes=h,p.found=!1,p}return l.prototype.visitChildren=function(h){if(this.found!==!0){switch(h.type){case"Lookahead":this.visitLookahead(h);return;case"NegativeLookahead":this.visitNegativeLookahead(h);return}g.prototype.visitChildren.call(this,h)}},l.prototype.visitCharacter=function(h){r.contains(this.targetCharCodes,h.value)&&(this.found=!0)},l.prototype.visitSet=function(h){h.complement?u(h,this.targetCharCodes)===void 0&&(this.found=!0):u(h,this.targetCharCodes)!==void 0&&(this.found=!0)},l})(t.BaseRegExpVisitor);function I(g,l){if(l instanceof RegExp){var h=n.getRegExpAst(l),p=new d(g);return p.visit(h),p.found}else return r.find(l,function(C){return r.contains(g,C.charCodeAt(0))})!==void 0}i.canMatchCharCode=I}),Ni=Be(i=>{var e=i&&i.__extends||(function(){var P=function(j,W){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Z,ne){Z.__proto__=ne}||function(Z,ne){for(var Ae in ne)Object.prototype.hasOwnProperty.call(ne,Ae)&&(Z[Ae]=ne[Ae])},P(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");P(j,W);function Z(){this.constructor=j}j.prototype=W===null?Object.create(W):(Z.prototype=W.prototype,new Z)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.charCodeToOptimizedIndex=i.minOptimizationVal=i.buildLineBreakIssueMessage=i.LineTerminatorOptimizedTester=i.isShortPattern=i.isCustomPattern=i.cloneEmptyGroups=i.performWarningRuntimeChecks=i.performRuntimeChecks=i.addStickyFlag=i.addStartOfInput=i.findUnreachablePatterns=i.findModesThatDoNotExist=i.findInvalidGroupType=i.findDuplicatePatterns=i.findUnsupportedFlags=i.findStartOfInputAnchor=i.findEmptyMatchRegExps=i.findEndOfInputAnchor=i.findInvalidPatterns=i.findMissingPatterns=i.validatePatterns=i.analyzeTokenTypes=i.enableSticky=i.disableSticky=i.SUPPORT_STICKY=i.MODES=i.DEFAULT_MODE=void 0;var t=An(),r=kt(),n=Se(),s=Lo(),o=cn(),c="PATTERN";i.DEFAULT_MODE="defaultMode",i.MODES="modes",i.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function A(){i.SUPPORT_STICKY=!1}i.disableSticky=A;function a(){i.SUPPORT_STICKY=!0}i.enableSticky=a;function f(P,j){j=n.defaults(j,{useSticky:i.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
99
+ `],tracer:function(R,y){return y()}});var W=j.tracer;W("initCharCodeToOptimizedIndexMap",function(){he()});var Z;W("Reject Lexer.NA",function(){Z=n.reject(P,function(R){return R[c]===r.Lexer.NA})});var ne=!1,Ae;W("Transform Patterns",function(){ne=!1,Ae=n.map(Z,function(R){var y=R[c];if(n.isRegExp(y)){var T=y.source;return T.length===1&&T!=="^"&&T!=="$"&&T!=="."&&!y.ignoreCase?T:T.length===2&&T[0]==="\\"&&!n.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],T[1])?T[1]:j.useSticky?k(y):L(y)}else{if(n.isFunction(y))return ne=!0,{exec:y};if(n.has(y,"exec"))return ne=!0,y;if(typeof y=="string"){if(y.length===1)return y;var x=y.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(x);return j.useSticky?k(w):L(w)}else throw Error("non exhaustive match")}})});var be,Ie,Ne,je,Ve;W("misc mapping",function(){be=n.map(Z,function(R){return R.tokenTypeIdx}),Ie=n.map(Z,function(R){var y=R.GROUP;if(y!==r.Lexer.SKIPPED){if(n.isString(y))return y;if(n.isUndefined(y))return!1;throw Error("non exhaustive match")}}),Ne=n.map(Z,function(R){var y=R.LONGER_ALT;if(y){var T=n.indexOf(Z,y);return T}}),je=n.map(Z,function(R){return R.PUSH_MODE}),Ve=n.map(Z,function(R){return n.has(R,"POP_MODE")})});var Ue;W("Line Terminator Handling",function(){var R=le(j.lineTerminatorCharacters);Ue=n.map(Z,function(y){return!1}),j.positionTracking!=="onlyOffset"&&(Ue=n.map(Z,function(y){if(n.has(y,"LINE_BREAKS"))return y.LINE_BREAKS;if(X(y,R)===!1)return s.canMatchCharCode(R,y.PATTERN)}))});var M,Y,K,ie;W("Misc Mapping #2",function(){M=n.map(Z,J),Y=n.map(Ae,q),K=n.reduce(Z,function(R,y){var T=y.GROUP;return n.isString(T)&&T!==r.Lexer.SKIPPED&&(R[T]=[]),R},{}),ie=n.map(Ae,function(R,y){return{pattern:Ae[y],longerAlt:Ne[y],canLineTerminator:Ue[y],isCustom:M[y],short:Y[y],group:Ie[y],push:je[y],pop:Ve[y],tokenTypeIdx:be[y],tokenType:Z[y]}})});var ge=!0,we=[];return j.safeMode||W("First Char Optimization",function(){we=n.reduce(Z,function(R,y,T){if(typeof y.PATTERN=="string"){var x=y.PATTERN.charCodeAt(0),w=te(x);re(R,w,ie[T])}else if(n.isArray(y.START_CHARS_HINT)){var N;n.forEach(y.START_CHARS_HINT,function(G){var z=typeof G=="string"?G.charCodeAt(0):G,ee=te(z);N!==ee&&(N=ee,re(R,ee,ie[T]))})}else if(n.isRegExp(y.PATTERN))if(y.PATTERN.unicode)ge=!1,j.ensureOptimizations&&n.PRINT_ERROR(""+s.failedOptimizationPrefixMsg+(" Unable to analyze < "+y.PATTERN.toString()+` > pattern.
99
100
  `)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
100
101
  This will disable the lexer's first char optimizations.
101
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var D=a.getOptimizedStartCodesIndices(A.PATTERN,G.ensureOptimizations);r.isEmpty(D)&&(de=!1),r.forEach(D,function(j){ae(b,j,ee[_])})}else G.ensureOptimizations&&r.PRINT_ERROR(""+a.failedOptimizationPrefixMsg+(" TokenType: <"+A.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
102
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var F=s.getOptimizedStartCodesIndices(y.PATTERN,j.ensureOptimizations);n.isEmpty(F)&&(ge=!1),n.forEach(F,function(G){re(R,G,ie[T])})}else j.ensureOptimizations&&n.PRINT_ERROR(""+s.failedOptimizationPrefixMsg+(" TokenType: <"+y.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
102
103
  `)+` This will disable the lexer's first char optimizations.
103
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),de=!1;return b},[])}),K("ArrayPacking",function(){be=r.packArray(be)}),{emptyGroups:z,patternIdxToConfig:ee,charCodeToPatternIdxToConfig:be,hasCustom:J,canBeOptimized:de}}n.analyzeTokenTypes=f;function h(U,G){var K=[],q=p(U);K=K.concat(q.errors);var J=T(q.valid),ie=J.valid;return K=K.concat(J.errors),K=K.concat(g(ie)),K=K.concat(I(ie)),K=K.concat(k(ie,G)),K=K.concat(H(ie)),K}n.validatePatterns=h;function g(U){var G=[],K=r.filter(U,function(q){return r.isRegExp(q[u])});return G=G.concat(l(K)),G=G.concat(v(K)),G=G.concat(E(K)),G=G.concat(S(K)),G=G.concat(d(K)),G}function p(U){var G=r.filter(U,function(J){return!r.has(J,u)}),K=r.map(G,function(J){return{message:"Token Type: ->"+J.name+"<- missing static 'PATTERN' property",type:i.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[J]}}),q=r.difference(U,G);return{errors:K,valid:q}}n.findMissingPatterns=p;function T(U){var G=r.filter(U,function(J){var ie=J[u];return!r.isRegExp(ie)&&!r.isFunction(ie)&&!r.has(ie,"exec")&&!r.isString(ie)}),K=r.map(G,function(J){return{message:"Token Type: ->"+J.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:i.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[J]}}),q=r.difference(U,G);return{errors:K,valid:q}}n.findInvalidPatterns=T;var m=/[^\\][\$]/;function l(U){var G=(function(J){e(ie,J);function ie(){var Te=J!==null&&J.apply(this,arguments)||this;return Te.found=!1,Te}return ie.prototype.visitEndAnchor=function(Te){this.found=!0},ie})(t.BaseRegExpVisitor),K=r.filter(U,function(J){var ie=J[u];try{var Te=o.getRegExpAst(ie),ye=new G;return ye.visit(Te),ye.found}catch{return m.test(ie.source)}}),q=r.map(K,function(J){return{message:`Unexpected RegExp Anchor Error:
104
- Token Type: ->`+J.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
105
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:i.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[J]}});return q}n.findEndOfInputAnchor=l;function d(U){var G=r.filter(U,function(q){var J=q[u];return J.test("")}),K=r.map(G,function(q){return{message:"Token Type: ->"+q.name+"<- static 'PATTERN' must not match an empty string",type:i.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[q]}});return K}n.findEmptyMatchRegExps=d;var y=/[^\\[][\^]|^\^/;function v(U){var G=(function(J){e(ie,J);function ie(){var Te=J!==null&&J.apply(this,arguments)||this;return Te.found=!1,Te}return ie.prototype.visitStartAnchor=function(Te){this.found=!0},ie})(t.BaseRegExpVisitor),K=r.filter(U,function(J){var ie=J[u];try{var Te=o.getRegExpAst(ie),ye=new G;return ye.visit(Te),ye.found}catch{return y.test(ie.source)}}),q=r.map(K,function(J){return{message:`Unexpected RegExp Anchor Error:
106
- Token Type: ->`+J.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
107
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:i.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[J]}});return q}n.findStartOfInputAnchor=v;function E(U){var G=r.filter(U,function(q){var J=q[u];return J instanceof RegExp&&(J.multiline||J.global)}),K=r.map(G,function(q){return{message:"Token Type: ->"+q.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:i.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[q]}});return K}n.findUnsupportedFlags=E;function S(U){var G=[],K=r.map(U,function(ie){return r.reduce(U,function(Te,ye){return ie.PATTERN.source===ye.PATTERN.source&&!r.contains(G,ye)&&ye.PATTERN!==i.Lexer.NA&&(G.push(ye),Te.push(ye)),Te},[])});K=r.compact(K);var q=r.filter(K,function(ie){return ie.length>1}),J=r.map(q,function(ie){var Te=r.map(ie,function(we){return we.name}),ye=r.first(ie).PATTERN;return{message:"The same RegExp pattern ->"+ye+"<-"+("has been used in all of the following Token Types: "+Te.join(", ")+" <-"),type:i.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:ie}});return J}n.findDuplicatePatterns=S;function I(U){var G=r.filter(U,function(q){if(!r.has(q,"GROUP"))return!1;var J=q.GROUP;return J!==i.Lexer.SKIPPED&&J!==i.Lexer.NA&&!r.isString(J)}),K=r.map(G,function(q){return{message:"Token Type: ->"+q.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:i.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[q]}});return K}n.findInvalidGroupType=I;function k(U,G){var K=r.filter(U,function(J){return J.PUSH_MODE!==void 0&&!r.contains(G,J.PUSH_MODE)}),q=r.map(K,function(J){var ie="Token Type: ->"+J.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+J.PUSH_MODE+"<-which does not exist";return{message:ie,type:i.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[J]}});return q}n.findModesThatDoNotExist=k;function H(U){var G=[],K=r.reduce(U,function(q,J,ie){var Te=J.PATTERN;return Te===i.Lexer.NA||(r.isString(Te)?q.push({str:Te,idx:ie,tokenType:J}):r.isRegExp(Te)&&B(Te)&&q.push({str:Te.source,idx:ie,tokenType:J})),q},[]);return r.forEach(U,function(q,J){r.forEach(K,function(ie){var Te=ie.str,ye=ie.idx,we=ie.tokenType;if(J<ye&&x(Te,q.PATTERN)){var Be="Token: ->"+we.name+`<- can never be matched.
108
- `+("Because it appears AFTER the Token Type ->"+q.name+"<-")+`in the lexer's definition.
109
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;G.push({message:Be,type:i.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[q,we]})}})}),G}n.findUnreachablePatterns=H;function x(U,G){if(r.isRegExp(G)){var K=G.exec(U);return K!==null&&K.index===0}else{if(r.isFunction(G))return G(U,0,[],{});if(r.has(G,"exec"))return G.exec(U,0,[],{});if(typeof G=="string")return G===U;throw Error("non exhaustive match")}}function B(U){var G=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return r.find(G,function(K){return U.source.indexOf(K)!==-1})===void 0}function P(U){var G=U.ignoreCase?"i":"";return new RegExp("^(?:"+U.source+")",G)}n.addStartOfInput=P;function O(U){var G=U.ignoreCase?"iy":"y";return new RegExp(""+U.source,G)}n.addStickyFlag=O;function M(U,G,K){var q=[];return r.has(U,n.DEFAULT_MODE)||q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.DEFAULT_MODE+`> property in its definition
110
- `,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),r.has(U,n.MODES)||q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.MODES+`> property in its definition
111
- `,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),r.has(U,n.MODES)&&r.has(U,n.DEFAULT_MODE)&&!r.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
112
- `,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),r.has(U,n.MODES)&&r.forEach(U.modes,function(J,ie){r.forEach(J,function(Te,ye){r.isUndefined(Te)&&q.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+ie+"> at index: <"+ye+`>
113
- `),type:i.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),q}n.performRuntimeChecks=M;function C(U,G,K){var q=[],J=!1,ie=r.compact(r.flatten(r.mapValues(U.modes,function(we){return we}))),Te=r.reject(ie,function(we){return we[u]===i.Lexer.NA}),ye=ce(K);return G&&r.forEach(Te,function(we){var Be=$(we,ye);if(Be!==!1){var We=te(we,Be),Ue={message:We,type:Be.issue,tokenType:we};q.push(Ue)}else r.has(we,"LINE_BREAKS")?we.LINE_BREAKS===!0&&(J=!0):a.canMatchCharCode(ye,we.PATTERN)&&(J=!0)}),G&&!J&&q.push({message:`Warning: No LINE_BREAKS Found.
104
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),ge=!1;return R},[])}),W("ArrayPacking",function(){we=n.packArray(we)}),{emptyGroups:K,patternIdxToConfig:ie,charCodeToPatternIdxToConfig:we,hasCustom:ne,canBeOptimized:ge}}i.analyzeTokenTypes=f;function u(P,j){var W=[],Z=d(P);W=W.concat(Z.errors);var ne=I(Z.valid),Ae=ne.valid;return W=W.concat(ne.errors),W=W.concat(b(Ae)),W=W.concat(Q(Ae)),W=W.concat(S(Ae,j)),W=W.concat(U(Ae)),W}i.validatePatterns=u;function b(P){var j=[],W=n.filter(P,function(Z){return n.isRegExp(Z[c])});return j=j.concat(l(W)),j=j.concat(C(W)),j=j.concat(E(W)),j=j.concat(B(W)),j=j.concat(h(W)),j}function d(P){var j=n.filter(P,function(ne){return!n.has(ne,c)}),W=n.map(j,function(ne){return{message:"Token Type: ->"+ne.name+"<- missing static 'PATTERN' property",type:r.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[ne]}}),Z=n.difference(P,j);return{errors:W,valid:Z}}i.findMissingPatterns=d;function I(P){var j=n.filter(P,function(ne){var Ae=ne[c];return!n.isRegExp(Ae)&&!n.isFunction(Ae)&&!n.has(Ae,"exec")&&!n.isString(Ae)}),W=n.map(j,function(ne){return{message:"Token Type: ->"+ne.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:[ne]}}),Z=n.difference(P,j);return{errors:W,valid:Z}}i.findInvalidPatterns=I;var g=/[^\\][\$]/;function l(P){var j=(function(ne){e(Ae,ne);function Ae(){var be=ne!==null&&ne.apply(this,arguments)||this;return be.found=!1,be}return Ae.prototype.visitEndAnchor=function(be){this.found=!0},Ae})(t.BaseRegExpVisitor),W=n.filter(P,function(ne){var Ae=ne[c];try{var be=o.getRegExpAst(Ae),Ie=new j;return Ie.visit(be),Ie.found}catch{return g.test(Ae.source)}}),Z=n.map(W,function(ne){return{message:`Unexpected RegExp Anchor Error:
105
+ Token Type: ->`+ne.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
106
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[ne]}});return Z}i.findEndOfInputAnchor=l;function h(P){var j=n.filter(P,function(Z){var ne=Z[c];return ne.test("")}),W=n.map(j,function(Z){return{message:"Token Type: ->"+Z.name+"<- static 'PATTERN' must not match an empty string",type:r.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[Z]}});return W}i.findEmptyMatchRegExps=h;var p=/[^\\[][\^]|^\^/;function C(P){var j=(function(ne){e(Ae,ne);function Ae(){var be=ne!==null&&ne.apply(this,arguments)||this;return be.found=!1,be}return Ae.prototype.visitStartAnchor=function(be){this.found=!0},Ae})(t.BaseRegExpVisitor),W=n.filter(P,function(ne){var Ae=ne[c];try{var be=o.getRegExpAst(Ae),Ie=new j;return Ie.visit(be),Ie.found}catch{return p.test(Ae.source)}}),Z=n.map(W,function(ne){return{message:`Unexpected RegExp Anchor Error:
107
+ Token Type: ->`+ne.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
108
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[ne]}});return Z}i.findStartOfInputAnchor=C;function E(P){var j=n.filter(P,function(Z){var ne=Z[c];return ne instanceof RegExp&&(ne.multiline||ne.global)}),W=n.map(j,function(Z){return{message:"Token Type: ->"+Z.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:r.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[Z]}});return W}i.findUnsupportedFlags=E;function B(P){var j=[],W=n.map(P,function(Ae){return n.reduce(P,function(be,Ie){return Ae.PATTERN.source===Ie.PATTERN.source&&!n.contains(j,Ie)&&Ie.PATTERN!==r.Lexer.NA&&(j.push(Ie),be.push(Ie)),be},[])});W=n.compact(W);var Z=n.filter(W,function(Ae){return Ae.length>1}),ne=n.map(Z,function(Ae){var be=n.map(Ae,function(Ne){return Ne.name}),Ie=n.first(Ae).PATTERN;return{message:"The same RegExp pattern ->"+Ie+"<-"+("has been used in all of the following Token Types: "+be.join(", ")+" <-"),type:r.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:Ae}});return ne}i.findDuplicatePatterns=B;function Q(P){var j=n.filter(P,function(Z){if(!n.has(Z,"GROUP"))return!1;var ne=Z.GROUP;return ne!==r.Lexer.SKIPPED&&ne!==r.Lexer.NA&&!n.isString(ne)}),W=n.map(j,function(Z){return{message:"Token Type: ->"+Z.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:r.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[Z]}});return W}i.findInvalidGroupType=Q;function S(P,j){var W=n.filter(P,function(ne){return ne.PUSH_MODE!==void 0&&!n.contains(j,ne.PUSH_MODE)}),Z=n.map(W,function(ne){var Ae="Token Type: ->"+ne.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+ne.PUSH_MODE+"<-which does not exist";return{message:Ae,type:r.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[ne]}});return Z}i.findModesThatDoNotExist=S;function U(P){var j=[],W=n.reduce(P,function(Z,ne,Ae){var be=ne.PATTERN;return be===r.Lexer.NA||(n.isString(be)?Z.push({str:be,idx:Ae,tokenType:ne}):n.isRegExp(be)&&O(be)&&Z.push({str:be.source,idx:Ae,tokenType:ne})),Z},[]);return n.forEach(P,function(Z,ne){n.forEach(W,function(Ae){var be=Ae.str,Ie=Ae.idx,Ne=Ae.tokenType;if(ne<Ie&&v(be,Z.PATTERN)){var je="Token: ->"+Ne.name+`<- can never be matched.
109
+ `+("Because it appears AFTER the Token Type ->"+Z.name+"<-")+`in the lexer's definition.
110
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.push({message:je,type:r.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[Z,Ne]})}})}),j}i.findUnreachablePatterns=U;function v(P,j){if(n.isRegExp(j)){var W=j.exec(P);return W!==null&&W.index===0}else{if(n.isFunction(j))return j(P,0,[],{});if(n.has(j,"exec"))return j.exec(P,0,[],{});if(typeof j=="string")return j===P;throw Error("non exhaustive match")}}function O(P){var j=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return n.find(j,function(W){return P.source.indexOf(W)!==-1})===void 0}function L(P){var j=P.ignoreCase?"i":"";return new RegExp("^(?:"+P.source+")",j)}i.addStartOfInput=L;function k(P){var j=P.ignoreCase?"iy":"y";return new RegExp(""+P.source,j)}i.addStickyFlag=k;function D(P,j,W){var Z=[];return n.has(P,i.DEFAULT_MODE)||Z.push({message:"A MultiMode Lexer cannot be initialized without a <"+i.DEFAULT_MODE+`> property in its definition
111
+ `,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),n.has(P,i.MODES)||Z.push({message:"A MultiMode Lexer cannot be initialized without a <"+i.MODES+`> property in its definition
112
+ `,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),n.has(P,i.MODES)&&n.has(P,i.DEFAULT_MODE)&&!n.has(P.modes,P.defaultMode)&&Z.push({message:"A MultiMode Lexer cannot be initialized with a "+i.DEFAULT_MODE+": <"+P.defaultMode+`>which does not exist
113
+ `,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),n.has(P,i.MODES)&&n.forEach(P.modes,function(ne,Ae){n.forEach(ne,function(be,Ie){n.isUndefined(be)&&Z.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+Ae+"> at index: <"+Ie+`>
114
+ `),type:r.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),Z}i.performRuntimeChecks=D;function _(P,j,W){var Z=[],ne=!1,Ae=n.compact(n.flatten(n.mapValues(P.modes,function(Ne){return Ne}))),be=n.reject(Ae,function(Ne){return Ne[c]===r.Lexer.NA}),Ie=le(W);return j&&n.forEach(be,function(Ne){var je=X(Ne,Ie);if(je!==!1){var Ve=$(Ne,je),Ue={message:Ve,type:je.issue,tokenType:Ne};Z.push(Ue)}else n.has(Ne,"LINE_BREAKS")?Ne.LINE_BREAKS===!0&&(ne=!0):s.canMatchCharCode(Ie,Ne.PATTERN)&&(ne=!0)}),j&&!ne&&Z.push({message:`Warning: No LINE_BREAKS Found.
114
115
  This Lexer has been defined to track line and column information,
115
116
  But none of the Token Types can be identified as matching a line terminator.
116
117
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
117
- for details.`,type:i.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),q}n.performWarningRuntimeChecks=C;function X(U){var G={},K=r.keys(U);return r.forEach(K,function(q){var J=U[q];if(r.isArray(J))G[q]=[];else throw Error("non exhaustive match")}),G}n.cloneEmptyGroups=X;function Q(U){var G=U.PATTERN;if(r.isRegExp(G))return!1;if(r.isFunction(G)||r.has(G,"exec"))return!0;if(r.isString(G))return!1;throw Error("non exhaustive match")}n.isCustomPattern=Q;function W(U){return r.isString(U)&&U.length===1?U.charCodeAt(0):!1}n.isShortPattern=W,n.LineTerminatorOptimizedTester={test:function(U){for(var G=U.length,K=this.lastIndex;K<G;K++){var q=U.charCodeAt(K);if(q===10)return this.lastIndex=K+1,!0;if(q===13)return U.charCodeAt(K+1)===10?this.lastIndex=K+2:this.lastIndex=K+1,!0}return!1},lastIndex:0};function $(U,G){if(r.has(U,"LINE_BREAKS"))return!1;if(r.isRegExp(U.PATTERN)){try{a.canMatchCharCode(G,U.PATTERN)}catch(K){return{issue:i.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:K.message}}return!1}else{if(r.isString(U.PATTERN))return!1;if(Q(U))return{issue:i.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function te(U,G){if(G.issue===i.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
118
- `+(" The problem is in the <"+U.name+`> Token Type
119
- `)+(" Root cause: "+G.errMsg+`.
120
- `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(G.issue===i.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
121
- `+(" The problem is in the <"+U.name+`> Token Type
122
- `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}n.buildLineBreakIssueMessage=te;function ce(U){var G=r.map(U,function(K){return r.isString(K)&&K.length>0?K.charCodeAt(0):K});return G}function ae(U,G,K){U[G]===void 0?U[G]=[K]:U[G].push(K)}n.minOptimizationVal=256;var le=[];function ne(U){return U<n.minOptimizationVal?U:le[U]}n.charCodeToOptimizedIndex=ne;function pe(){if(r.isEmpty(le)){le=new Array(65536);for(var U=0;U<65536;U++)le[U]=U>255?255+~~(U/255):U}}}),ht=ve(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=xe();function t(m,l){var d=m.tokenTypeIdx;return d===l.tokenTypeIdx?!0:l.isParent===!0&&l.categoryMatchesMap[d]===!0}n.tokenStructuredMatcher=t;function i(m,l){return m.tokenTypeIdx===l.tokenTypeIdx}n.tokenStructuredMatcherNoCategories=i,n.tokenShortNameIdx=1,n.tokenIdxToClass={};function r(m){var l=a(m);o(l),c(l),u(l),e.forEach(l,function(d){d.isParent=d.categoryMatches.length>0})}n.augmentTokenTypes=r;function a(m){for(var l=e.cloneArr(m),d=m,y=!0;y;){d=e.compact(e.flatten(e.map(d,function(E){return E.CATEGORIES})));var v=e.difference(d,l);l=l.concat(v),e.isEmpty(v)?y=!1:d=v}return l}n.expandCategories=a;function o(m){e.forEach(m,function(l){f(l)||(n.tokenIdxToClass[n.tokenShortNameIdx]=l,l.tokenTypeIdx=n.tokenShortNameIdx++),h(l)&&!e.isArray(l.CATEGORIES)&&(l.CATEGORIES=[l.CATEGORIES]),h(l)||(l.CATEGORIES=[]),g(l)||(l.categoryMatches=[]),p(l)||(l.categoryMatchesMap={})})}n.assignTokenDefaultProps=o;function u(m){e.forEach(m,function(l){l.categoryMatches=[],e.forEach(l.categoryMatchesMap,function(d,y){l.categoryMatches.push(n.tokenIdxToClass[y].tokenTypeIdx)})})}n.assignCategoriesTokensProp=u;function c(m){e.forEach(m,function(l){s([],l)})}n.assignCategoriesMapProp=c;function s(m,l){e.forEach(m,function(d){l.categoryMatchesMap[d.tokenTypeIdx]=!0}),e.forEach(l.CATEGORIES,function(d){var y=m.concat(l);e.contains(y,d)||s(y,d)})}n.singleAssignCategoriesToksMap=s;function f(m){return e.has(m,"tokenTypeIdx")}n.hasShortKeyProperty=f;function h(m){return e.has(m,"CATEGORIES")}n.hasCategoriesProperty=h;function g(m){return e.has(m,"categoryMatches")}n.hasExtendingTokensTypesProperty=g;function p(m){return e.has(m,"categoryMatchesMap")}n.hasExtendingTokensTypesMapProperty=p;function T(m){return e.has(m,"tokenTypeIdx")}n.isTokenType=T}),_n=ve(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,i,r,a){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+","+(" skipped "+i+" characters.")}}}),gt=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Lexer=n.LexerDefinitionErrorType=void 0;var e=An(),t=xe(),i=ht(),r=_n(),a=Ut();(function(c){c[c.MISSING_PATTERN=0]="MISSING_PATTERN",c[c.INVALID_PATTERN=1]="INVALID_PATTERN",c[c.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",c[c.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",c[c.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",c[c.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",c[c.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",c[c.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",c[c.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",c[c.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",c[c.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",c[c.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",c[c.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",c[c.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",c[c.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",c[c.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",c[c.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(n.LexerDefinitionErrorType||(n.LexerDefinitionErrorType={}));var o={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
123
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:r.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(o);var u=(function(){function c(s,f){var h=this;if(f===void 0&&(f=o),this.lexerDefinition=s,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 f=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
124
- a boolean 2nd argument is no longer supported`);this.config=t.merge(o,f);var g=this.config.traceInitPerf;g===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof g=="number"&&(this.traceInitMaxIdent=g,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var p,T=!0;h.TRACE_INIT("Lexer Config handling",function(){if(h.config.lineTerminatorsPattern===o.lineTerminatorsPattern)h.config.lineTerminatorsPattern=e.LineTerminatorOptimizedTester;else if(h.config.lineTerminatorCharacters===o.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
125
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(f.safeMode&&f.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');h.trackStartLines=/full|onlyStart/i.test(h.config.positionTracking),h.trackEndLines=/full/i.test(h.config.positionTracking),t.isArray(s)?(p={modes:{}},p.modes[e.DEFAULT_MODE]=t.cloneArr(s),p[e.DEFAULT_MODE]=e.DEFAULT_MODE):(T=!1,p=t.cloneObj(s))}),h.config.skipValidations===!1&&(h.TRACE_INIT("performRuntimeChecks",function(){h.lexerDefinitionErrors=h.lexerDefinitionErrors.concat(e.performRuntimeChecks(p,h.trackStartLines,h.config.lineTerminatorCharacters))}),h.TRACE_INIT("performWarningRuntimeChecks",function(){h.lexerDefinitionWarning=h.lexerDefinitionWarning.concat(e.performWarningRuntimeChecks(p,h.trackStartLines,h.config.lineTerminatorCharacters))})),p.modes=p.modes?p.modes:{},t.forEach(p.modes,function(y,v){p.modes[v]=t.reject(y,function(E){return t.isUndefined(E)})});var m=t.keys(p.modes);if(t.forEach(p.modes,function(y,v){h.TRACE_INIT("Mode: <"+v+"> processing",function(){if(h.modes.push(v),h.config.skipValidations===!1&&h.TRACE_INIT("validatePatterns",function(){h.lexerDefinitionErrors=h.lexerDefinitionErrors.concat(e.validatePatterns(y,m))}),t.isEmpty(h.lexerDefinitionErrors)){i.augmentTokenTypes(y);var E;h.TRACE_INIT("analyzeTokenTypes",function(){E=e.analyzeTokenTypes(y,{lineTerminatorCharacters:h.config.lineTerminatorCharacters,positionTracking:f.positionTracking,ensureOptimizations:f.ensureOptimizations,safeMode:f.safeMode,tracer:h.TRACE_INIT.bind(h)})}),h.patternIdxToConfig[v]=E.patternIdxToConfig,h.charCodeToPatternIdxToConfig[v]=E.charCodeToPatternIdxToConfig,h.emptyGroups=t.merge(h.emptyGroups,E.emptyGroups),h.hasCustom=E.hasCustom||h.hasCustom,h.canModeBeOptimized[v]=E.canBeOptimized}})}),h.defaultMode=p.defaultMode,!t.isEmpty(h.lexerDefinitionErrors)&&!h.config.deferDefinitionErrorsHandling){var l=t.map(h.lexerDefinitionErrors,function(y){return y.message}),d=l.join(`-----------------------
118
+ for details.`,type:r.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),Z}i.performWarningRuntimeChecks=_;function V(P){var j={},W=n.keys(P);return n.forEach(W,function(Z){var ne=P[Z];if(n.isArray(ne))j[Z]=[];else throw Error("non exhaustive match")}),j}i.cloneEmptyGroups=V;function J(P){var j=P.PATTERN;if(n.isRegExp(j))return!1;if(n.isFunction(j)||n.has(j,"exec"))return!0;if(n.isString(j))return!1;throw Error("non exhaustive match")}i.isCustomPattern=J;function q(P){return n.isString(P)&&P.length===1?P.charCodeAt(0):!1}i.isShortPattern=q,i.LineTerminatorOptimizedTester={test:function(P){for(var j=P.length,W=this.lastIndex;W<j;W++){var Z=P.charCodeAt(W);if(Z===10)return this.lastIndex=W+1,!0;if(Z===13)return P.charCodeAt(W+1)===10?this.lastIndex=W+2:this.lastIndex=W+1,!0}return!1},lastIndex:0};function X(P,j){if(n.has(P,"LINE_BREAKS"))return!1;if(n.isRegExp(P.PATTERN)){try{s.canMatchCharCode(j,P.PATTERN)}catch(W){return{issue:r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:W.message}}return!1}else{if(n.isString(P.PATTERN))return!1;if(J(P))return{issue:r.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function $(P,j){if(j.issue===r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
119
+ `+(" The problem is in the <"+P.name+`> Token Type
120
+ `)+(" Root cause: "+j.errMsg+`.
121
+ `)+" 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.
122
+ `+(" The problem is in the <"+P.name+`> Token Type
123
+ `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}i.buildLineBreakIssueMessage=$;function le(P){var j=n.map(P,function(W){return n.isString(W)&&W.length>0?W.charCodeAt(0):W});return j}function re(P,j,W){P[j]===void 0?P[j]=[W]:P[j].push(W)}i.minOptimizationVal=256;var oe=[];function te(P){return P<i.minOptimizationVal?P:oe[P]}i.charCodeToOptimizedIndex=te;function he(){if(n.isEmpty(oe)){oe=new Array(65536);for(var P=0;P<65536;P++)oe[P]=P>255?255+~~(P/255):P}}}),bt=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isTokenType=i.hasExtendingTokensTypesMapProperty=i.hasExtendingTokensTypesProperty=i.hasCategoriesProperty=i.hasShortKeyProperty=i.singleAssignCategoriesToksMap=i.assignCategoriesMapProp=i.assignCategoriesTokensProp=i.assignTokenDefaultProps=i.expandCategories=i.augmentTokenTypes=i.tokenIdxToClass=i.tokenShortNameIdx=i.tokenStructuredMatcherNoCategories=i.tokenStructuredMatcher=void 0;var e=Se();function t(g,l){var h=g.tokenTypeIdx;return h===l.tokenTypeIdx?!0:l.isParent===!0&&l.categoryMatchesMap[h]===!0}i.tokenStructuredMatcher=t;function r(g,l){return g.tokenTypeIdx===l.tokenTypeIdx}i.tokenStructuredMatcherNoCategories=r,i.tokenShortNameIdx=1,i.tokenIdxToClass={};function n(g){var l=s(g);o(l),A(l),c(l),e.forEach(l,function(h){h.isParent=h.categoryMatches.length>0})}i.augmentTokenTypes=n;function s(g){for(var l=e.cloneArr(g),h=g,p=!0;p;){h=e.compact(e.flatten(e.map(h,function(E){return E.CATEGORIES})));var C=e.difference(h,l);l=l.concat(C),e.isEmpty(C)?p=!1:h=C}return l}i.expandCategories=s;function o(g){e.forEach(g,function(l){f(l)||(i.tokenIdxToClass[i.tokenShortNameIdx]=l,l.tokenTypeIdx=i.tokenShortNameIdx++),u(l)&&!e.isArray(l.CATEGORIES)&&(l.CATEGORIES=[l.CATEGORIES]),u(l)||(l.CATEGORIES=[]),b(l)||(l.categoryMatches=[]),d(l)||(l.categoryMatchesMap={})})}i.assignTokenDefaultProps=o;function c(g){e.forEach(g,function(l){l.categoryMatches=[],e.forEach(l.categoryMatchesMap,function(h,p){l.categoryMatches.push(i.tokenIdxToClass[p].tokenTypeIdx)})})}i.assignCategoriesTokensProp=c;function A(g){e.forEach(g,function(l){a([],l)})}i.assignCategoriesMapProp=A;function a(g,l){e.forEach(g,function(h){l.categoryMatchesMap[h.tokenTypeIdx]=!0}),e.forEach(l.CATEGORIES,function(h){var p=g.concat(l);e.contains(p,h)||a(p,h)})}i.singleAssignCategoriesToksMap=a;function f(g){return e.has(g,"tokenTypeIdx")}i.hasShortKeyProperty=f;function u(g){return e.has(g,"CATEGORIES")}i.hasCategoriesProperty=u;function b(g){return e.has(g,"categoryMatches")}i.hasExtendingTokensTypesProperty=b;function d(g){return e.has(g,"categoryMatchesMap")}i.hasExtendingTokensTypesMapProperty=d;function I(g){return e.has(g,"tokenTypeIdx")}i.isTokenType=I}),Di=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.defaultLexerErrorProvider=void 0,i.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,n,s){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+","+(" skipped "+r+" characters.")}}}),kt=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Lexer=i.LexerDefinitionErrorType=void 0;var e=Ni(),t=Se(),r=bt(),n=Di(),s=cn();(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"})(i.LexerDefinitionErrorType||(i.LexerDefinitionErrorType={}));var o={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
124
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:n.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(o);var c=(function(){function A(a,f){var u=this;if(f===void 0&&(f=o),this.lexerDefinition=a,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 f=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
125
+ a boolean 2nd argument is no longer supported`);this.config=t.merge(o,f);var b=this.config.traceInitPerf;b===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof b=="number"&&(this.traceInitMaxIdent=b,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var d,I=!0;u.TRACE_INIT("Lexer Config handling",function(){if(u.config.lineTerminatorsPattern===o.lineTerminatorsPattern)u.config.lineTerminatorsPattern=e.LineTerminatorOptimizedTester;else if(u.config.lineTerminatorCharacters===o.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
126
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(f.safeMode&&f.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');u.trackStartLines=/full|onlyStart/i.test(u.config.positionTracking),u.trackEndLines=/full/i.test(u.config.positionTracking),t.isArray(a)?(d={modes:{}},d.modes[e.DEFAULT_MODE]=t.cloneArr(a),d[e.DEFAULT_MODE]=e.DEFAULT_MODE):(I=!1,d=t.cloneObj(a))}),u.config.skipValidations===!1&&(u.TRACE_INIT("performRuntimeChecks",function(){u.lexerDefinitionErrors=u.lexerDefinitionErrors.concat(e.performRuntimeChecks(d,u.trackStartLines,u.config.lineTerminatorCharacters))}),u.TRACE_INIT("performWarningRuntimeChecks",function(){u.lexerDefinitionWarning=u.lexerDefinitionWarning.concat(e.performWarningRuntimeChecks(d,u.trackStartLines,u.config.lineTerminatorCharacters))})),d.modes=d.modes?d.modes:{},t.forEach(d.modes,function(p,C){d.modes[C]=t.reject(p,function(E){return t.isUndefined(E)})});var g=t.keys(d.modes);if(t.forEach(d.modes,function(p,C){u.TRACE_INIT("Mode: <"+C+"> processing",function(){if(u.modes.push(C),u.config.skipValidations===!1&&u.TRACE_INIT("validatePatterns",function(){u.lexerDefinitionErrors=u.lexerDefinitionErrors.concat(e.validatePatterns(p,g))}),t.isEmpty(u.lexerDefinitionErrors)){r.augmentTokenTypes(p);var E;u.TRACE_INIT("analyzeTokenTypes",function(){E=e.analyzeTokenTypes(p,{lineTerminatorCharacters:u.config.lineTerminatorCharacters,positionTracking:f.positionTracking,ensureOptimizations:f.ensureOptimizations,safeMode:f.safeMode,tracer:u.TRACE_INIT.bind(u)})}),u.patternIdxToConfig[C]=E.patternIdxToConfig,u.charCodeToPatternIdxToConfig[C]=E.charCodeToPatternIdxToConfig,u.emptyGroups=t.merge(u.emptyGroups,E.emptyGroups),u.hasCustom=E.hasCustom||u.hasCustom,u.canModeBeOptimized[C]=E.canBeOptimized}})}),u.defaultMode=d.defaultMode,!t.isEmpty(u.lexerDefinitionErrors)&&!u.config.deferDefinitionErrorsHandling){var l=t.map(u.lexerDefinitionErrors,function(p){return p.message}),h=l.join(`-----------------------
126
127
  `);throw new Error(`Errors detected in definition of Lexer:
127
- `+d)}t.forEach(h.lexerDefinitionWarning,function(y){t.PRINT_WARNING(y.message)}),h.TRACE_INIT("Choosing sub-methods implementations",function(){if(e.SUPPORT_STICKY?(h.chopInput=t.IDENTITY,h.match=h.matchWithTest):(h.updateLastIndex=t.NOOP,h.match=h.matchWithExec),T&&(h.handleModes=t.NOOP),h.trackStartLines===!1&&(h.computeNewColumn=t.IDENTITY),h.trackEndLines===!1&&(h.updateTokenEndLineColumnLocation=t.NOOP),/full/i.test(h.config.positionTracking))h.createTokenInstance=h.createFullToken;else if(/onlyStart/i.test(h.config.positionTracking))h.createTokenInstance=h.createStartOnlyToken;else if(/onlyOffset/i.test(h.config.positionTracking))h.createTokenInstance=h.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+h.config.positionTracking+'"');h.hasCustom?(h.addToken=h.addTokenUsingPush,h.handlePayload=h.handlePayloadWithCustom):(h.addToken=h.addTokenUsingMemberAccess,h.handlePayload=h.handlePayloadNoCustom)}),h.TRACE_INIT("Failed Optimization Warnings",function(){var y=t.reduce(h.canModeBeOptimized,function(v,E,S){return E===!1&&v.push(S),v},[]);if(f.ensureOptimizations&&!t.isEmpty(y))throw Error("Lexer Modes: < "+y.join(", ")+` > cannot be optimized.
128
+ `+h)}t.forEach(u.lexerDefinitionWarning,function(p){t.PRINT_WARNING(p.message)}),u.TRACE_INIT("Choosing sub-methods implementations",function(){if(e.SUPPORT_STICKY?(u.chopInput=t.IDENTITY,u.match=u.matchWithTest):(u.updateLastIndex=t.NOOP,u.match=u.matchWithExec),I&&(u.handleModes=t.NOOP),u.trackStartLines===!1&&(u.computeNewColumn=t.IDENTITY),u.trackEndLines===!1&&(u.updateTokenEndLineColumnLocation=t.NOOP),/full/i.test(u.config.positionTracking))u.createTokenInstance=u.createFullToken;else if(/onlyStart/i.test(u.config.positionTracking))u.createTokenInstance=u.createStartOnlyToken;else if(/onlyOffset/i.test(u.config.positionTracking))u.createTokenInstance=u.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+u.config.positionTracking+'"');u.hasCustom?(u.addToken=u.addTokenUsingPush,u.handlePayload=u.handlePayloadWithCustom):(u.addToken=u.addTokenUsingMemberAccess,u.handlePayload=u.handlePayloadNoCustom)}),u.TRACE_INIT("Failed Optimization Warnings",function(){var p=t.reduce(u.canModeBeOptimized,function(C,E,B){return E===!1&&C.push(B),C},[]);if(f.ensureOptimizations&&!t.isEmpty(p))throw Error("Lexer Modes: < "+p.join(", ")+` > cannot be optimized.
128
129
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
129
- Or inspect the console log for details on how to resolve these issues.`)}),h.TRACE_INIT("clearRegExpParserCache",function(){a.clearRegExpParserCache()}),h.TRACE_INIT("toFastProperties",function(){t.toFastProperties(h)})})}return c.prototype.tokenize=function(s,f){if(f===void 0&&(f=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var h=t.map(this.lexerDefinitionErrors,function(T){return T.message}),g=h.join(`-----------------------
130
+ Or inspect the console log for details on how to resolve these issues.`)}),u.TRACE_INIT("clearRegExpParserCache",function(){s.clearRegExpParserCache()}),u.TRACE_INIT("toFastProperties",function(){t.toFastProperties(u)})})}return A.prototype.tokenize=function(a,f){if(f===void 0&&(f=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var u=t.map(this.lexerDefinitionErrors,function(I){return I.message}),b=u.join(`-----------------------
130
131
  `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
131
- `+g)}var p=this.tokenizeInternal(s,f);return p},c.prototype.tokenizeInternal=function(s,f){var h=this,g,p,T,m,l,d,y,v,E,S,I,k,H,x,B=s,P=B.length,O=0,M=0,C=this.hasCustom?0:Math.floor(s.length/10),X=new Array(C),Q=[],W=this.trackStartLines?1:void 0,$=this.trackStartLines?1:void 0,te=e.cloneEmptyGroups(this.emptyGroups),ce=this.trackStartLines,ae=this.config.lineTerminatorsPattern,le=0,ne=[],pe=[],U=[],G=[];Object.freeze(G);var K=void 0;function q(){return ne}function J(w){var D=e.charCodeToOptimizedIndex(w),j=pe[D];return j===void 0?G:j}var ie=function(w){if(U.length===1&&w.tokenType.PUSH_MODE===void 0){var D=h.config.errorMessageProvider.buildUnableToPopLexerModeMessage(w);Q.push({offset:w.startOffset,line:w.startLine!==void 0?w.startLine:void 0,column:w.startColumn!==void 0?w.startColumn:void 0,length:w.image.length,message:D})}else{U.pop();var j=t.last(U);ne=h.patternIdxToConfig[j],pe=h.charCodeToPatternIdxToConfig[j],le=ne.length;var V=h.canModeBeOptimized[j]&&h.config.safeMode===!1;pe&&V?K=J:K=q}};function Te(w){U.push(w),pe=this.charCodeToPatternIdxToConfig[w],ne=this.patternIdxToConfig[w],le=ne.length,le=ne.length;var D=this.canModeBeOptimized[w]&&this.config.safeMode===!1;pe&&D?K=J:K=q}Te.call(this,f);for(var ye;O<P;){l=null;var we=B.charCodeAt(O),Be=K(we),We=Be.length;for(g=0;g<We;g++){ye=Be[g];var Ue=ye.pattern;d=null;var F=ye.short;if(F!==!1?we===F&&(l=Ue):ye.isCustom===!0?(x=Ue.exec(B,O,X,te),x!==null?(l=x[0],x.payload!==void 0&&(d=x.payload)):l=null):(this.updateLastIndex(Ue,O),l=this.match(Ue,s,O)),l!==null){if(m=ye.longerAlt,m!==void 0){var Y=ne[m],z=Y.pattern;y=null,Y.isCustom===!0?(x=z.exec(B,O,X,te),x!==null?(T=x[0],x.payload!==void 0&&(y=x.payload)):T=null):(this.updateLastIndex(z,O),T=this.match(z,s,O)),T&&T.length>l.length&&(l=T,d=y,ye=Y)}break}}if(l!==null){if(v=l.length,E=ye.group,E!==void 0&&(S=ye.tokenTypeIdx,I=this.createTokenInstance(l,O,S,ye.tokenType,W,$,v),this.handlePayload(I,d),E===!1?M=this.addToken(X,M,I):te[E].push(I)),s=this.chopInput(s,v),O=O+v,$=this.computeNewColumn($,v),ce===!0&&ye.canLineTerminator===!0){var ee=0,de=void 0,be=void 0;ae.lastIndex=0;do de=ae.test(l),de===!0&&(be=ae.lastIndex-1,ee++);while(de===!0);ee!==0&&(W=W+ee,$=v-be,this.updateTokenEndLineColumnLocation(I,E,be,ee,W,$,v))}this.handleModes(ye,ie,Te,I)}else{for(var b=O,A=W,_=$,N=!1;!N&&O<P;)for(B.charCodeAt(O),s=this.chopInput(s,1),O++,p=0;p<le;p++){var L=ne[p],Ue=L.pattern,F=L.short;if(F!==!1?B.charCodeAt(O)===F&&(N=!0):L.isCustom===!0?N=Ue.exec(B,O,X,te)!==null:(this.updateLastIndex(Ue,O),N=Ue.exec(s)!==null),N===!0)break}k=O-b,H=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(B,b,k,A,_),Q.push({offset:b,line:A,column:_,length:k,message:H})}}return this.hasCustom||(X.length=M),{tokens:X,groups:te,errors:Q}},c.prototype.handleModes=function(s,f,h,g){if(s.pop===!0){var p=s.push;f(g),p!==void 0&&h.call(this,p)}else s.push!==void 0&&h.call(this,s.push)},c.prototype.chopInput=function(s,f){return s.substring(f)},c.prototype.updateLastIndex=function(s,f){s.lastIndex=f},c.prototype.updateTokenEndLineColumnLocation=function(s,f,h,g,p,T,m){var l,d;f!==void 0&&(l=h===m-1,d=l?-1:0,g===1&&l===!0||(s.endLine=p+d,s.endColumn=T-1+-d))},c.prototype.computeNewColumn=function(s,f){return s+f},c.prototype.createTokenInstance=function(){for(var s=[],f=0;f<arguments.length;f++)s[f]=arguments[f];return null},c.prototype.createOffsetOnlyToken=function(s,f,h,g){return{image:s,startOffset:f,tokenTypeIdx:h,tokenType:g}},c.prototype.createStartOnlyToken=function(s,f,h,g,p,T){return{image:s,startOffset:f,startLine:p,startColumn:T,tokenTypeIdx:h,tokenType:g}},c.prototype.createFullToken=function(s,f,h,g,p,T,m){return{image:s,startOffset:f,endOffset:f+m-1,startLine:p,endLine:p,startColumn:T,endColumn:T+m-1,tokenTypeIdx:h,tokenType:g}},c.prototype.addToken=function(s,f,h){return 666},c.prototype.addTokenUsingPush=function(s,f,h){return s.push(h),f},c.prototype.addTokenUsingMemberAccess=function(s,f,h){return s[f]=h,f++,f},c.prototype.handlePayload=function(s,f){},c.prototype.handlePayloadNoCustom=function(s,f){},c.prototype.handlePayloadWithCustom=function(s,f){f!==null&&(s.payload=f)},c.prototype.match=function(s,f,h){return null},c.prototype.matchWithTest=function(s,f,h){var g=s.test(f);return g===!0?f.substring(h,s.lastIndex):null},c.prototype.matchWithExec=function(s,f){var h=s.exec(f);return h!==null?h[0]:h},c.prototype.TRACE_INIT=function(s,f){if(this.traceInitPerf===!0){this.traceInitIndent++;var h=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(h+"--> <"+s+">");var g=t.timer(f),p=g.time,T=g.value,m=p>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&m(h+"<-- <"+s+"> time: "+p+"ms"),this.traceInitIndent--,T}else return f()},c.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.",c.NA=/NOT_APPLICABLE/,c})();n.Lexer=u}),nt=ve(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=xe(),t=gt(),i=ht();function r(E){return o(E)?E.LABEL:E.name}n.tokenLabel=r;function a(E){return E.name}n.tokenName=a;function o(E){return e.isString(E.LABEL)&&E.LABEL!==""}n.hasTokenLabel=o;var u="parent",c="categories",s="label",f="group",h="push_mode",g="pop_mode",p="longer_alt",T="line_breaks",m="start_chars_hint";function l(E){return d(E)}n.createToken=l;function d(E){var S=E.pattern,I={};if(I.name=E.name,e.isUndefined(S)||(I.PATTERN=S),e.has(E,u))throw`The parent property is no longer supported.
132
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(E,c)&&(I.CATEGORIES=E[c]),i.augmentTokenTypes([I]),e.has(E,s)&&(I.LABEL=E[s]),e.has(E,f)&&(I.GROUP=E[f]),e.has(E,g)&&(I.POP_MODE=E[g]),e.has(E,h)&&(I.PUSH_MODE=E[h]),e.has(E,p)&&(I.LONGER_ALT=E[p]),e.has(E,T)&&(I.LINE_BREAKS=E[T]),e.has(E,m)&&(I.START_CHARS_HINT=E[m]),I}n.EOF=l({name:"EOF",pattern:t.Lexer.NA}),i.augmentTokenTypes([n.EOF]);function y(E,S,I,k,H,x,B,P){return{image:S,startOffset:I,endOffset:k,startLine:H,endLine:x,startColumn:B,endColumn:P,tokenTypeIdx:E.tokenTypeIdx,tokenType:E}}n.createTokenInstance=y;function v(E,S){return i.tokenStructuredMatcher(E,S)}n.tokenMatcher=v}),He=ve(n=>{var e=n&&n.__extends||(function(){var d=function(y,v){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var I in S)Object.prototype.hasOwnProperty.call(S,I)&&(E[I]=S[I])},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 E(){this.constructor=y}y.prototype=v===null?Object.create(v):(E.prototype=v.prototype,new E)}})();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=xe(),i=nt(),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 a=(function(d){e(y,d);function y(v){var E=d.call(this,[])||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}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=a;var o=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.orgText="",t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.Rule=o;var u=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.ignoreAmbiguities=!1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.Alternative=u;var c=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.Option=c;var s=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.RepetitionMandatory=s;var f=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.RepetitionMandatoryWithSeparator=f;var h=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.Repetition=h;var g=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}return y})(r);n.RepetitionWithSeparator=g;var p=(function(d){e(y,d);function y(v){var E=d.call(this,v.definition)||this;return E.idx=1,E.ignoreAmbiguities=!1,E.hasPredicates=!1,t.assign(E,t.pick(v,function(S){return S!==void 0})),E}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=p;var T=(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=T;function m(d){return t.map(d,l)}n.serializeGrammar=m;function l(d){function y(S){return t.map(S,l)}if(d instanceof a)return{type:"NonTerminal",name:d.nonTerminalName,idx:d.idx};if(d instanceof u)return{type:"Alternative",definition:y(d.definition)};if(d instanceof c)return{type:"Option",idx:d.idx,definition:y(d.definition)};if(d instanceof s)return{type:"RepetitionMandatory",idx:d.idx,definition:y(d.definition)};if(d instanceof f)return{type:"RepetitionMandatoryWithSeparator",idx:d.idx,separator:l(new T({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof g)return{type:"RepetitionWithSeparator",idx:d.idx,separator:l(new T({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof h)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 T){var v={type:"Terminal",name:d.terminalType.name,label:i.tokenLabel(d.terminalType),idx:d.idx},E=d.terminalType.PATTERN;return d.terminalType.PATTERN&&(v.pattern=t.isRegExp(E)?E.source:E),v}else{if(d instanceof o)return{type:"Rule",name:d.name,orgText:d.orgText,definition:y(d.definition)};throw Error("non exhaustive match")}}n.serializeProduction=l}),jt=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RestWalker=void 0;var e=xe(),t=He(),i=(function(){function a(){}return a.prototype.walk=function(o,u){var c=this;u===void 0&&(u=[]),e.forEach(o.definition,function(s,f){var h=e.drop(o.definition,f+1);if(s instanceof t.NonTerminal)c.walkProdRef(s,h,u);else if(s instanceof t.Terminal)c.walkTerminal(s,h,u);else if(s instanceof t.Alternative)c.walkFlat(s,h,u);else if(s instanceof t.Option)c.walkOption(s,h,u);else if(s instanceof t.RepetitionMandatory)c.walkAtLeastOne(s,h,u);else if(s instanceof t.RepetitionMandatoryWithSeparator)c.walkAtLeastOneSep(s,h,u);else if(s instanceof t.RepetitionWithSeparator)c.walkManySep(s,h,u);else if(s instanceof t.Repetition)c.walkMany(s,h,u);else if(s instanceof t.Alternation)c.walkOr(s,h,u);else throw Error("non exhaustive match")})},a.prototype.walkTerminal=function(o,u,c){},a.prototype.walkProdRef=function(o,u,c){},a.prototype.walkFlat=function(o,u,c){var s=u.concat(c);this.walk(o,s)},a.prototype.walkOption=function(o,u,c){var s=u.concat(c);this.walk(o,s)},a.prototype.walkAtLeastOne=function(o,u,c){var s=[new t.Option({definition:o.definition})].concat(u,c);this.walk(o,s)},a.prototype.walkAtLeastOneSep=function(o,u,c){var s=r(o,u,c);this.walk(o,s)},a.prototype.walkMany=function(o,u,c){var s=[new t.Option({definition:o.definition})].concat(u,c);this.walk(o,s)},a.prototype.walkManySep=function(o,u,c){var s=r(o,u,c);this.walk(o,s)},a.prototype.walkOr=function(o,u,c){var s=this,f=u.concat(c);e.forEach(o.definition,function(h){var g=new t.Alternative({definition:[h]});s.walk(g,f)})},a})();n.RestWalker=i;function r(a,o,u){var c=[new t.Option({definition:[new t.Terminal({terminalType:a.separator})].concat(a.definition)})],s=c.concat(o,u);return s}}),ft=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GAstVisitor=void 0;var e=He(),t=(function(){function i(){}return i.prototype.visit=function(r){var a=r;switch(a.constructor){case e.NonTerminal:return this.visitNonTerminal(a);case e.Alternative:return this.visitAlternative(a);case e.Option:return this.visitOption(a);case e.RepetitionMandatory:return this.visitRepetitionMandatory(a);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(a);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(a);case e.Repetition:return this.visitRepetition(a);case e.Alternation:return this.visitAlternation(a);case e.Terminal:return this.visitTerminal(a);case e.Rule:return this.visitRule(a);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}),Tt=ve(n=>{var e=n&&n.__extends||(function(){var g=function(p,T){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,l){m.__proto__=l}||function(m,l){for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(m[d]=l[d])},g(p,T)};return function(p,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");g(p,T);function m(){this.constructor=p}p.prototype=T===null?Object.create(T):(m.prototype=T.prototype,new m)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.collectMethods=n.DslMethodsCollectorVisitor=n.getProductionDslName=n.isBranchingProd=n.isOptionalProd=n.isSequenceProd=void 0;var t=xe(),i=He(),r=ft();function a(g){return g instanceof i.Alternative||g instanceof i.Option||g instanceof i.Repetition||g instanceof i.RepetitionMandatory||g instanceof i.RepetitionMandatoryWithSeparator||g instanceof i.RepetitionWithSeparator||g instanceof i.Terminal||g instanceof i.Rule}n.isSequenceProd=a;function o(g,p){p===void 0&&(p=[]);var T=g instanceof i.Option||g instanceof i.Repetition||g instanceof i.RepetitionWithSeparator;return T?!0:g instanceof i.Alternation?t.some(g.definition,function(m){return o(m,p)}):g instanceof i.NonTerminal&&t.contains(p,g)?!1:g instanceof i.AbstractProduction?(g instanceof i.NonTerminal&&p.push(g),t.every(g.definition,function(m){return o(m,p)})):!1}n.isOptionalProd=o;function u(g){return g instanceof i.Alternation}n.isBranchingProd=u;function c(g){if(g instanceof i.NonTerminal)return"SUBRULE";if(g instanceof i.Option)return"OPTION";if(g instanceof i.Alternation)return"OR";if(g instanceof i.RepetitionMandatory)return"AT_LEAST_ONE";if(g instanceof i.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(g instanceof i.RepetitionWithSeparator)return"MANY_SEP";if(g instanceof i.Repetition)return"MANY";if(g instanceof i.Terminal)return"CONSUME";throw Error("non exhaustive match")}n.getProductionDslName=c;var s=(function(g){e(p,g);function p(){var T=g!==null&&g.apply(this,arguments)||this;return T.separator="-",T.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},T}return p.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},p.prototype.visitTerminal=function(T){var m=T.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,m)||(this.dslMethods[m]=[]),this.dslMethods[m].push(T)},p.prototype.visitNonTerminal=function(T){var m=T.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,m)||(this.dslMethods[m]=[]),this.dslMethods[m].push(T)},p.prototype.visitOption=function(T){this.dslMethods.option.push(T)},p.prototype.visitRepetitionWithSeparator=function(T){this.dslMethods.repetitionWithSeparator.push(T)},p.prototype.visitRepetitionMandatory=function(T){this.dslMethods.repetitionMandatory.push(T)},p.prototype.visitRepetitionMandatoryWithSeparator=function(T){this.dslMethods.repetitionMandatoryWithSeparator.push(T)},p.prototype.visitRepetition=function(T){this.dslMethods.repetition.push(T)},p.prototype.visitAlternation=function(T){this.dslMethods.alternation.push(T)},p})(r.GAstVisitor);n.DslMethodsCollectorVisitor=s;var f=new s;function h(g){f.reset(),g.accept(f);var p=f.dslMethods;return f.reset(),p}n.collectMethods=h}),bn=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.firstForTerminal=n.firstForBranching=n.firstForSequence=n.first=void 0;var e=xe(),t=He(),i=Tt();function r(c){if(c instanceof t.NonTerminal)return r(c.referencedRule);if(c instanceof t.Terminal)return u(c);if(i.isSequenceProd(c))return a(c);if(i.isBranchingProd(c))return o(c);throw Error("non exhaustive match")}n.first=r;function a(c){for(var s=[],f=c.definition,h=0,g=f.length>h,p,T=!0;g&&T;)p=f[h],T=i.isOptionalProd(p),s=s.concat(r(p)),h=h+1,g=f.length>h;return e.uniq(s)}n.firstForSequence=a;function o(c){var s=e.map(c.definition,function(f){return r(f)});return e.uniq(e.flatten(s))}n.firstForBranching=o;function u(c){return[c.terminalType]}n.firstForTerminal=u}),Ln=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IN=void 0,n.IN="_~IN~_"}),ri=ve(n=>{var e=n&&n.__extends||(function(){var h=function(g,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,m){T.__proto__=m}||function(T,m){for(var l in m)Object.prototype.hasOwnProperty.call(m,l)&&(T[l]=m[l])},h(g,p)};return function(g,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");h(g,p);function T(){this.constructor=g}g.prototype=p===null?Object.create(p):(T.prototype=p.prototype,new T)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.buildInProdFollowPrefix=n.buildBetweenProdsFollowPrefix=n.computeAllProdsFollows=n.ResyncFollowsWalker=void 0;var t=jt(),i=bn(),r=xe(),a=Ln(),o=He(),u=(function(h){e(g,h);function g(p){var T=h.call(this)||this;return T.topProd=p,T.follows={},T}return g.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},g.prototype.walkTerminal=function(p,T,m){},g.prototype.walkProdRef=function(p,T,m){var l=s(p.referencedRule,p.idx)+this.topProd.name,d=T.concat(m),y=new o.Alternative({definition:d}),v=i.first(y);this.follows[l]=v},g})(t.RestWalker);n.ResyncFollowsWalker=u;function c(h){var g={};return r.forEach(h,function(p){var T=new u(p).startWalking();r.assign(g,T)}),g}n.computeAllProdsFollows=c;function s(h,g){return h.name+g+a.IN}n.buildBetweenProdsFollowPrefix=s;function f(h){var g=h.terminalType.name;return g+h.idx+a.IN}n.buildInProdFollowPrefix=f}),Et=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultGrammarValidatorErrorProvider=n.defaultGrammarResolverErrorProvider=n.defaultParserErrorProvider=void 0;var e=nt(),t=xe(),i=xe(),r=He(),a=Tt();n.defaultParserErrorProvider={buildMismatchTokenMessage:function(o){var u=o.expected,c=o.actual;o.previous,o.ruleName;var s=e.hasTokenLabel(u),f=s?"--> "+e.tokenLabel(u)+" <--":"token of type --> "+u.name+" <--",h="Expecting "+f+" but found --> '"+c.image+"' <--";return h},buildNotAllInputParsedMessage:function(o){var u=o.firstRedundant;return o.ruleName,"Redundant input, expecting EOF but found: "+u.image},buildNoViableAltMessage:function(o){var u=o.expectedPathsPerAlt,c=o.actual;o.previous;var s=o.customUserDescription;o.ruleName;var f="Expecting: ",h=i.first(c).image,g=`
133
- but found: '`+h+"'";if(s)return f+s+g;var p=i.reduce(u,function(d,y){return d.concat(y)},[]),T=i.map(p,function(d){return"["+i.map(d,function(y){return e.tokenLabel(y)}).join(", ")+"]"}),m=i.map(T,function(d,y){return" "+(y+1)+". "+d}),l=`one of these possible Token sequences:
134
- `+m.join(`
135
- `);return f+l+g},buildEarlyExitMessage:function(o){var u=o.expectedIterationPaths,c=o.actual,s=o.customUserDescription;o.ruleName;var f="Expecting: ",h=i.first(c).image,g=`
136
- but found: '`+h+"'";if(s)return f+s+g;var p=i.map(u,function(m){return"["+i.map(m,function(l){return e.tokenLabel(l)}).join(",")+"]"}),T=`expecting at least one iteration which starts with one of these possible Token sequences::
137
- `+("<"+p.join(" ,")+">");return f+T+g}},Object.freeze(n.defaultParserErrorProvider),n.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(o,u){var c="Invalid grammar, reference to a rule which is not defined: ->"+u.nonTerminalName+`<-
138
- inside top level rule: ->`+o.name+"<-";return c}},n.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(o,u){function c(l){return l instanceof r.Terminal?l.terminalType.name:l instanceof r.NonTerminal?l.nonTerminalName:""}var s=o.name,f=i.first(u),h=f.idx,g=a.getProductionDslName(f),p=c(f),T=h>0,m="->"+g+(T?h:"")+"<- "+(p?"with argument: ->"+p+"<-":"")+`
139
- appears more than once (`+u.length+" times) in the top level rule: ->"+s+`<-.
132
+ `+b)}var d=this.tokenizeInternal(a,f);return d},A.prototype.tokenizeInternal=function(a,f){var u=this,b,d,I,g,l,h,p,C,E,B,Q,S,U,v,O=a,L=O.length,k=0,D=0,_=this.hasCustom?0:Math.floor(a.length/10),V=new Array(_),J=[],q=this.trackStartLines?1:void 0,X=this.trackStartLines?1:void 0,$=e.cloneEmptyGroups(this.emptyGroups),le=this.trackStartLines,re=this.config.lineTerminatorsPattern,oe=0,te=[],he=[],P=[],j=[];Object.freeze(j);var W=void 0;function Z(){return te}function ne(N){var F=e.charCodeToOptimizedIndex(N),G=he[F];return G===void 0?j:G}var Ae=function(N){if(P.length===1&&N.tokenType.PUSH_MODE===void 0){var F=u.config.errorMessageProvider.buildUnableToPopLexerModeMessage(N);J.push({offset:N.startOffset,line:N.startLine!==void 0?N.startLine:void 0,column:N.startColumn!==void 0?N.startColumn:void 0,length:N.image.length,message:F})}else{P.pop();var G=t.last(P);te=u.patternIdxToConfig[G],he=u.charCodeToPatternIdxToConfig[G],oe=te.length;var z=u.canModeBeOptimized[G]&&u.config.safeMode===!1;he&&z?W=ne:W=Z}};function be(N){P.push(N),he=this.charCodeToPatternIdxToConfig[N],te=this.patternIdxToConfig[N],oe=te.length,oe=te.length;var F=this.canModeBeOptimized[N]&&this.config.safeMode===!1;he&&F?W=ne:W=Z}be.call(this,f);for(var Ie;k<L;){l=null;var Ne=O.charCodeAt(k),je=W(Ne),Ve=je.length;for(b=0;b<Ve;b++){Ie=je[b];var Ue=Ie.pattern;h=null;var M=Ie.short;if(M!==!1?Ne===M&&(l=Ue):Ie.isCustom===!0?(v=Ue.exec(O,k,V,$),v!==null?(l=v[0],v.payload!==void 0&&(h=v.payload)):l=null):(this.updateLastIndex(Ue,k),l=this.match(Ue,a,k)),l!==null){if(g=Ie.longerAlt,g!==void 0){var Y=te[g],K=Y.pattern;p=null,Y.isCustom===!0?(v=K.exec(O,k,V,$),v!==null?(I=v[0],v.payload!==void 0&&(p=v.payload)):I=null):(this.updateLastIndex(K,k),I=this.match(K,a,k)),I&&I.length>l.length&&(l=I,h=p,Ie=Y)}break}}if(l!==null){if(C=l.length,E=Ie.group,E!==void 0&&(B=Ie.tokenTypeIdx,Q=this.createTokenInstance(l,k,B,Ie.tokenType,q,X,C),this.handlePayload(Q,h),E===!1?D=this.addToken(V,D,Q):$[E].push(Q)),a=this.chopInput(a,C),k=k+C,X=this.computeNewColumn(X,C),le===!0&&Ie.canLineTerminator===!0){var ie=0,ge=void 0,we=void 0;re.lastIndex=0;do ge=re.test(l),ge===!0&&(we=re.lastIndex-1,ie++);while(ge===!0);ie!==0&&(q=q+ie,X=C-we,this.updateTokenEndLineColumnLocation(Q,E,we,ie,q,X,C))}this.handleModes(Ie,Ae,be,Q)}else{for(var R=k,y=q,T=X,x=!1;!x&&k<L;)for(O.charCodeAt(k),a=this.chopInput(a,1),k++,d=0;d<oe;d++){var w=te[d],Ue=w.pattern,M=w.short;if(M!==!1?O.charCodeAt(k)===M&&(x=!0):w.isCustom===!0?x=Ue.exec(O,k,V,$)!==null:(this.updateLastIndex(Ue,k),x=Ue.exec(a)!==null),x===!0)break}S=k-R,U=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(O,R,S,y,T),J.push({offset:R,line:y,column:T,length:S,message:U})}}return this.hasCustom||(V.length=D),{tokens:V,groups:$,errors:J}},A.prototype.handleModes=function(a,f,u,b){if(a.pop===!0){var d=a.push;f(b),d!==void 0&&u.call(this,d)}else a.push!==void 0&&u.call(this,a.push)},A.prototype.chopInput=function(a,f){return a.substring(f)},A.prototype.updateLastIndex=function(a,f){a.lastIndex=f},A.prototype.updateTokenEndLineColumnLocation=function(a,f,u,b,d,I,g){var l,h;f!==void 0&&(l=u===g-1,h=l?-1:0,b===1&&l===!0||(a.endLine=d+h,a.endColumn=I-1+-h))},A.prototype.computeNewColumn=function(a,f){return a+f},A.prototype.createTokenInstance=function(){for(var a=[],f=0;f<arguments.length;f++)a[f]=arguments[f];return null},A.prototype.createOffsetOnlyToken=function(a,f,u,b){return{image:a,startOffset:f,tokenTypeIdx:u,tokenType:b}},A.prototype.createStartOnlyToken=function(a,f,u,b,d,I){return{image:a,startOffset:f,startLine:d,startColumn:I,tokenTypeIdx:u,tokenType:b}},A.prototype.createFullToken=function(a,f,u,b,d,I,g){return{image:a,startOffset:f,endOffset:f+g-1,startLine:d,endLine:d,startColumn:I,endColumn:I+g-1,tokenTypeIdx:u,tokenType:b}},A.prototype.addToken=function(a,f,u){return 666},A.prototype.addTokenUsingPush=function(a,f,u){return a.push(u),f},A.prototype.addTokenUsingMemberAccess=function(a,f,u){return a[f]=u,f++,f},A.prototype.handlePayload=function(a,f){},A.prototype.handlePayloadNoCustom=function(a,f){},A.prototype.handlePayloadWithCustom=function(a,f){f!==null&&(a.payload=f)},A.prototype.match=function(a,f,u){return null},A.prototype.matchWithTest=function(a,f,u){var b=a.test(f);return b===!0?f.substring(u,a.lastIndex):null},A.prototype.matchWithExec=function(a,f){var u=a.exec(f);return u!==null?u[0]:u},A.prototype.TRACE_INIT=function(a,f){if(this.traceInitPerf===!0){this.traceInitIndent++;var u=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(u+"--> <"+a+">");var b=t.timer(f),d=b.time,I=b.value,g=d>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&g(u+"<-- <"+a+"> time: "+d+"ms"),this.traceInitIndent--,I}else return f()},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})();i.Lexer=c}),ct=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tokenMatcher=i.createTokenInstance=i.EOF=i.createToken=i.hasTokenLabel=i.tokenName=i.tokenLabel=void 0;var e=Se(),t=kt(),r=bt();function n(E){return o(E)?E.LABEL:E.name}i.tokenLabel=n;function s(E){return E.name}i.tokenName=s;function o(E){return e.isString(E.LABEL)&&E.LABEL!==""}i.hasTokenLabel=o;var c="parent",A="categories",a="label",f="group",u="push_mode",b="pop_mode",d="longer_alt",I="line_breaks",g="start_chars_hint";function l(E){return h(E)}i.createToken=l;function h(E){var B=E.pattern,Q={};if(Q.name=E.name,e.isUndefined(B)||(Q.PATTERN=B),e.has(E,c))throw`The parent property is no longer supported.
133
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(E,A)&&(Q.CATEGORIES=E[A]),r.augmentTokenTypes([Q]),e.has(E,a)&&(Q.LABEL=E[a]),e.has(E,f)&&(Q.GROUP=E[f]),e.has(E,b)&&(Q.POP_MODE=E[b]),e.has(E,u)&&(Q.PUSH_MODE=E[u]),e.has(E,d)&&(Q.LONGER_ALT=E[d]),e.has(E,I)&&(Q.LINE_BREAKS=E[I]),e.has(E,g)&&(Q.START_CHARS_HINT=E[g]),Q}i.EOF=l({name:"EOF",pattern:t.Lexer.NA}),r.augmentTokenTypes([i.EOF]);function p(E,B,Q,S,U,v,O,L){return{image:B,startOffset:Q,endOffset:S,startLine:U,endLine:v,startColumn:O,endColumn:L,tokenTypeIdx:E.tokenTypeIdx,tokenType:E}}i.createTokenInstance=p;function C(E,B){return r.tokenStructuredMatcher(E,B)}i.tokenMatcher=C}),We=Be(i=>{var e=i&&i.__extends||(function(){var h=function(p,C){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,B){E.__proto__=B}||function(E,B){for(var Q in B)Object.prototype.hasOwnProperty.call(B,Q)&&(E[Q]=B[Q])},h(p,C)};return function(p,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");h(p,C);function E(){this.constructor=p}p.prototype=C===null?Object.create(C):(E.prototype=C.prototype,new E)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.serializeProduction=i.serializeGrammar=i.Terminal=i.Alternation=i.RepetitionWithSeparator=i.Repetition=i.RepetitionMandatoryWithSeparator=i.RepetitionMandatory=i.Option=i.Alternative=i.Rule=i.NonTerminal=i.AbstractProduction=void 0;var t=Se(),r=ct(),n=(function(){function h(p){this._definition=p}return Object.defineProperty(h.prototype,"definition",{get:function(){return this._definition},set:function(p){this._definition=p},enumerable:!1,configurable:!0}),h.prototype.accept=function(p){p.visit(this),t.forEach(this.definition,function(C){C.accept(p)})},h})();i.AbstractProduction=n;var s=(function(h){e(p,h);function p(C){var E=h.call(this,[])||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return Object.defineProperty(p.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(C){},enumerable:!1,configurable:!0}),p.prototype.accept=function(C){C.visit(this)},p})(n);i.NonTerminal=s;var o=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.orgText="",t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.Rule=o;var c=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.ignoreAmbiguities=!1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.Alternative=c;var A=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.Option=A;var a=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.RepetitionMandatory=a;var f=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.RepetitionMandatoryWithSeparator=f;var u=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.Repetition=u;var b=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return p})(n);i.RepetitionWithSeparator=b;var d=(function(h){e(p,h);function p(C){var E=h.call(this,C.definition)||this;return E.idx=1,E.ignoreAmbiguities=!1,E.hasPredicates=!1,t.assign(E,t.pick(C,function(B){return B!==void 0})),E}return Object.defineProperty(p.prototype,"definition",{get:function(){return this._definition},set:function(C){this._definition=C},enumerable:!1,configurable:!0}),p})(n);i.Alternation=d;var I=(function(){function h(p){this.idx=1,t.assign(this,t.pick(p,function(C){return C!==void 0}))}return h.prototype.accept=function(p){p.visit(this)},h})();i.Terminal=I;function g(h){return t.map(h,l)}i.serializeGrammar=g;function l(h){function p(B){return t.map(B,l)}if(h instanceof s)return{type:"NonTerminal",name:h.nonTerminalName,idx:h.idx};if(h instanceof c)return{type:"Alternative",definition:p(h.definition)};if(h instanceof A)return{type:"Option",idx:h.idx,definition:p(h.definition)};if(h instanceof a)return{type:"RepetitionMandatory",idx:h.idx,definition:p(h.definition)};if(h instanceof f)return{type:"RepetitionMandatoryWithSeparator",idx:h.idx,separator:l(new I({terminalType:h.separator})),definition:p(h.definition)};if(h instanceof b)return{type:"RepetitionWithSeparator",idx:h.idx,separator:l(new I({terminalType:h.separator})),definition:p(h.definition)};if(h instanceof u)return{type:"Repetition",idx:h.idx,definition:p(h.definition)};if(h instanceof d)return{type:"Alternation",idx:h.idx,definition:p(h.definition)};if(h instanceof I){var C={type:"Terminal",name:h.terminalType.name,label:r.tokenLabel(h.terminalType),idx:h.idx},E=h.terminalType.PATTERN;return h.terminalType.PATTERN&&(C.pattern=t.isRegExp(E)?E.source:E),C}else{if(h instanceof o)return{type:"Rule",name:h.name,orgText:h.orgText,definition:p(h.definition)};throw Error("non exhaustive match")}}i.serializeProduction=l}),ln=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RestWalker=void 0;var e=Se(),t=We(),r=(function(){function s(){}return s.prototype.walk=function(o,c){var A=this;c===void 0&&(c=[]),e.forEach(o.definition,function(a,f){var u=e.drop(o.definition,f+1);if(a instanceof t.NonTerminal)A.walkProdRef(a,u,c);else if(a instanceof t.Terminal)A.walkTerminal(a,u,c);else if(a instanceof t.Alternative)A.walkFlat(a,u,c);else if(a instanceof t.Option)A.walkOption(a,u,c);else if(a instanceof t.RepetitionMandatory)A.walkAtLeastOne(a,u,c);else if(a instanceof t.RepetitionMandatoryWithSeparator)A.walkAtLeastOneSep(a,u,c);else if(a instanceof t.RepetitionWithSeparator)A.walkManySep(a,u,c);else if(a instanceof t.Repetition)A.walkMany(a,u,c);else if(a instanceof t.Alternation)A.walkOr(a,u,c);else throw Error("non exhaustive match")})},s.prototype.walkTerminal=function(o,c,A){},s.prototype.walkProdRef=function(o,c,A){},s.prototype.walkFlat=function(o,c,A){var a=c.concat(A);this.walk(o,a)},s.prototype.walkOption=function(o,c,A){var a=c.concat(A);this.walk(o,a)},s.prototype.walkAtLeastOne=function(o,c,A){var a=[new t.Option({definition:o.definition})].concat(c,A);this.walk(o,a)},s.prototype.walkAtLeastOneSep=function(o,c,A){var a=n(o,c,A);this.walk(o,a)},s.prototype.walkMany=function(o,c,A){var a=[new t.Option({definition:o.definition})].concat(c,A);this.walk(o,a)},s.prototype.walkManySep=function(o,c,A){var a=n(o,c,A);this.walk(o,a)},s.prototype.walkOr=function(o,c,A){var a=this,f=c.concat(A);e.forEach(o.definition,function(u){var b=new t.Alternative({definition:[u]});a.walk(b,f)})},s})();i.RestWalker=r;function n(s,o,c){var A=[new t.Option({definition:[new t.Terminal({terminalType:s.separator})].concat(s.definition)})],a=A.concat(o,c);return a}}),Ct=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GAstVisitor=void 0;var e=We(),t=(function(){function r(){}return r.prototype.visit=function(n){var s=n;switch(s.constructor){case e.NonTerminal:return this.visitNonTerminal(s);case e.Alternative:return this.visitAlternative(s);case e.Option:return this.visitOption(s);case e.RepetitionMandatory:return this.visitRepetitionMandatory(s);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(s);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(s);case e.Repetition:return this.visitRepetition(s);case e.Alternation:return this.visitAlternation(s);case e.Terminal:return this.visitTerminal(s);case e.Rule:return this.visitRule(s);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(n){},r.prototype.visitAlternative=function(n){},r.prototype.visitOption=function(n){},r.prototype.visitRepetition=function(n){},r.prototype.visitRepetitionMandatory=function(n){},r.prototype.visitRepetitionMandatoryWithSeparator=function(n){},r.prototype.visitRepetitionWithSeparator=function(n){},r.prototype.visitAlternation=function(n){},r.prototype.visitTerminal=function(n){},r.prototype.visitRule=function(n){},r})();i.GAstVisitor=t}),St=Be(i=>{var e=i&&i.__extends||(function(){var b=function(d,I){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,l){g.__proto__=l}||function(g,l){for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(g[h]=l[h])},b(d,I)};return function(d,I){if(typeof I!="function"&&I!==null)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");b(d,I);function g(){this.constructor=d}d.prototype=I===null?Object.create(I):(g.prototype=I.prototype,new g)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.collectMethods=i.DslMethodsCollectorVisitor=i.getProductionDslName=i.isBranchingProd=i.isOptionalProd=i.isSequenceProd=void 0;var t=Se(),r=We(),n=Ct();function s(b){return b instanceof r.Alternative||b instanceof r.Option||b instanceof r.Repetition||b instanceof r.RepetitionMandatory||b instanceof r.RepetitionMandatoryWithSeparator||b instanceof r.RepetitionWithSeparator||b instanceof r.Terminal||b instanceof r.Rule}i.isSequenceProd=s;function o(b,d){d===void 0&&(d=[]);var I=b instanceof r.Option||b instanceof r.Repetition||b instanceof r.RepetitionWithSeparator;return I?!0:b instanceof r.Alternation?t.some(b.definition,function(g){return o(g,d)}):b instanceof r.NonTerminal&&t.contains(d,b)?!1:b instanceof r.AbstractProduction?(b instanceof r.NonTerminal&&d.push(b),t.every(b.definition,function(g){return o(g,d)})):!1}i.isOptionalProd=o;function c(b){return b instanceof r.Alternation}i.isBranchingProd=c;function A(b){if(b instanceof r.NonTerminal)return"SUBRULE";if(b instanceof r.Option)return"OPTION";if(b instanceof r.Alternation)return"OR";if(b instanceof r.RepetitionMandatory)return"AT_LEAST_ONE";if(b instanceof r.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(b instanceof r.RepetitionWithSeparator)return"MANY_SEP";if(b instanceof r.Repetition)return"MANY";if(b instanceof r.Terminal)return"CONSUME";throw Error("non exhaustive match")}i.getProductionDslName=A;var a=(function(b){e(d,b);function d(){var I=b!==null&&b.apply(this,arguments)||this;return I.separator="-",I.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},I}return d.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},d.prototype.visitTerminal=function(I){var g=I.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,g)||(this.dslMethods[g]=[]),this.dslMethods[g].push(I)},d.prototype.visitNonTerminal=function(I){var g=I.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,g)||(this.dslMethods[g]=[]),this.dslMethods[g].push(I)},d.prototype.visitOption=function(I){this.dslMethods.option.push(I)},d.prototype.visitRepetitionWithSeparator=function(I){this.dslMethods.repetitionWithSeparator.push(I)},d.prototype.visitRepetitionMandatory=function(I){this.dslMethods.repetitionMandatory.push(I)},d.prototype.visitRepetitionMandatoryWithSeparator=function(I){this.dslMethods.repetitionMandatoryWithSeparator.push(I)},d.prototype.visitRepetition=function(I){this.dslMethods.repetition.push(I)},d.prototype.visitAlternation=function(I){this.dslMethods.alternation.push(I)},d})(n.GAstVisitor);i.DslMethodsCollectorVisitor=a;var f=new a;function u(b){f.reset(),b.accept(f);var d=f.dslMethods;return f.reset(),d}i.collectMethods=u}),Fi=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.firstForTerminal=i.firstForBranching=i.firstForSequence=i.first=void 0;var e=Se(),t=We(),r=St();function n(A){if(A instanceof t.NonTerminal)return n(A.referencedRule);if(A instanceof t.Terminal)return c(A);if(r.isSequenceProd(A))return s(A);if(r.isBranchingProd(A))return o(A);throw Error("non exhaustive match")}i.first=n;function s(A){for(var a=[],f=A.definition,u=0,b=f.length>u,d,I=!0;b&&I;)d=f[u],I=r.isOptionalProd(d),a=a.concat(n(d)),u=u+1,b=f.length>u;return e.uniq(a)}i.firstForSequence=s;function o(A){var a=e.map(A.definition,function(f){return n(f)});return e.uniq(e.flatten(a))}i.firstForBranching=o;function c(A){return[A.terminalType]}i.firstForTerminal=c}),Mi=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IN=void 0,i.IN="_~IN~_"}),xo=Be(i=>{var e=i&&i.__extends||(function(){var u=function(b,d){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,g){I.__proto__=g}||function(I,g){for(var l in g)Object.prototype.hasOwnProperty.call(g,l)&&(I[l]=g[l])},u(b,d)};return function(b,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");u(b,d);function I(){this.constructor=b}b.prototype=d===null?Object.create(d):(I.prototype=d.prototype,new I)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.buildInProdFollowPrefix=i.buildBetweenProdsFollowPrefix=i.computeAllProdsFollows=i.ResyncFollowsWalker=void 0;var t=ln(),r=Fi(),n=Se(),s=Mi(),o=We(),c=(function(u){e(b,u);function b(d){var I=u.call(this)||this;return I.topProd=d,I.follows={},I}return b.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},b.prototype.walkTerminal=function(d,I,g){},b.prototype.walkProdRef=function(d,I,g){var l=a(d.referencedRule,d.idx)+this.topProd.name,h=I.concat(g),p=new o.Alternative({definition:h}),C=r.first(p);this.follows[l]=C},b})(t.RestWalker);i.ResyncFollowsWalker=c;function A(u){var b={};return n.forEach(u,function(d){var I=new c(d).startWalking();n.assign(b,I)}),b}i.computeAllProdsFollows=A;function a(u,b){return u.name+b+s.IN}i.buildBetweenProdsFollowPrefix=a;function f(u){var b=u.terminalType.name;return b+u.idx+s.IN}i.buildInProdFollowPrefix=f}),_t=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.defaultGrammarValidatorErrorProvider=i.defaultGrammarResolverErrorProvider=i.defaultParserErrorProvider=void 0;var e=ct(),t=Se(),r=Se(),n=We(),s=St();i.defaultParserErrorProvider={buildMismatchTokenMessage:function(o){var c=o.expected,A=o.actual;o.previous,o.ruleName;var a=e.hasTokenLabel(c),f=a?"--> "+e.tokenLabel(c)+" <--":"token of type --> "+c.name+" <--",u="Expecting "+f+" but found --> '"+A.image+"' <--";return u},buildNotAllInputParsedMessage:function(o){var c=o.firstRedundant;return o.ruleName,"Redundant input, expecting EOF but found: "+c.image},buildNoViableAltMessage:function(o){var c=o.expectedPathsPerAlt,A=o.actual;o.previous;var a=o.customUserDescription;o.ruleName;var f="Expecting: ",u=r.first(A).image,b=`
134
+ but found: '`+u+"'";if(a)return f+a+b;var d=r.reduce(c,function(h,p){return h.concat(p)},[]),I=r.map(d,function(h){return"["+r.map(h,function(p){return e.tokenLabel(p)}).join(", ")+"]"}),g=r.map(I,function(h,p){return" "+(p+1)+". "+h}),l=`one of these possible Token sequences:
135
+ `+g.join(`
136
+ `);return f+l+b},buildEarlyExitMessage:function(o){var c=o.expectedIterationPaths,A=o.actual,a=o.customUserDescription;o.ruleName;var f="Expecting: ",u=r.first(A).image,b=`
137
+ but found: '`+u+"'";if(a)return f+a+b;var d=r.map(c,function(g){return"["+r.map(g,function(l){return e.tokenLabel(l)}).join(",")+"]"}),I=`expecting at least one iteration which starts with one of these possible Token sequences::
138
+ `+("<"+d.join(" ,")+">");return f+I+b}},Object.freeze(i.defaultParserErrorProvider),i.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(o,c){var A="Invalid grammar, reference to a rule which is not defined: ->"+c.nonTerminalName+`<-
139
+ inside top level rule: ->`+o.name+"<-";return A}},i.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(o,c){function A(l){return l instanceof n.Terminal?l.terminalType.name:l instanceof n.NonTerminal?l.nonTerminalName:""}var a=o.name,f=r.first(c),u=f.idx,b=s.getProductionDslName(f),d=A(f),I=u>0,g="->"+b+(I?u:"")+"<- "+(d?"with argument: ->"+d+"<-":"")+`
140
+ appears more than once (`+c.length+" times) in the top level rule: ->"+a+`<-.
140
141
  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
141
- `;return m=m.replace(/[ \t]+/g," "),m=m.replace(/\s\s+/g,`
142
- `),m},buildNamespaceConflictError:function(o){var u=`Namespace conflict found in grammar.
142
+ `;return g=g.replace(/[ \t]+/g," "),g=g.replace(/\s\s+/g,`
143
+ `),g},buildNamespaceConflictError:function(o){var c=`Namespace conflict found in grammar.
143
144
  `+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+o.name+`>.
144
145
  `)+`To resolve this make sure each Terminal and Non-Terminal names are unique
145
146
  This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
146
- and Non-Terminal names start with a lower case letter.`;return u},buildAlternationPrefixAmbiguityError:function(o){var u=i.map(o.prefixPath,function(f){return e.tokenLabel(f)}).join(", "),c=o.alternation.idx===0?"":o.alternation.idx,s="Ambiguous alternatives: <"+o.ambiguityIndices.join(" ,")+`> due to common lookahead prefix
147
- `+("in <OR"+c+"> inside <"+o.topLevelRule.name+`> Rule,
148
- `)+("<"+u+`> may appears as a prefix path in all these alternatives.
147
+ and Non-Terminal names start with a lower case letter.`;return c},buildAlternationPrefixAmbiguityError:function(o){var c=r.map(o.prefixPath,function(f){return e.tokenLabel(f)}).join(", "),A=o.alternation.idx===0?"":o.alternation.idx,a="Ambiguous alternatives: <"+o.ambiguityIndices.join(" ,")+`> due to common lookahead prefix
148
+ `+("in <OR"+A+"> inside <"+o.topLevelRule.name+`> Rule,
149
+ `)+("<"+c+`> may appears as a prefix path in all these alternatives.
149
150
  `)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
150
- For Further details.`;return s},buildAlternationAmbiguityError:function(o){var u=i.map(o.prefixPath,function(f){return e.tokenLabel(f)}).join(", "),c=o.alternation.idx===0?"":o.alternation.idx,s="Ambiguous Alternatives Detected: <"+o.ambiguityIndices.join(" ,")+"> in <OR"+c+">"+(" inside <"+o.topLevelRule.name+`> Rule,
151
- `)+("<"+u+`> may appears as a prefix path in all these alternatives.
152
- `);return s=s+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
153
- For Further details.`,s},buildEmptyRepetitionError:function(o){var u=a.getProductionDslName(o.repetition);o.repetition.idx!==0&&(u+=o.repetition.idx);var c="The repetition <"+u+"> within Rule <"+o.topLevelRule.name+`> can never consume any tokens.
154
- This could lead to an infinite loop.`;return c},buildTokenNameError:function(o){return"deprecated"},buildEmptyAlternationError:function(o){var u="Ambiguous empty alternative: <"+(o.emptyChoiceIdx+1)+">"+(" in <OR"+o.alternation.idx+"> inside <"+o.topLevelRule.name+`> Rule.
155
- `)+"Only the last alternative may be an empty alternative.";return u},buildTooManyAlternativesError:function(o){var u=`An Alternation cannot have more than 256 alternatives:
151
+ For Further details.`;return a},buildAlternationAmbiguityError:function(o){var c=r.map(o.prefixPath,function(f){return e.tokenLabel(f)}).join(", "),A=o.alternation.idx===0?"":o.alternation.idx,a="Ambiguous Alternatives Detected: <"+o.ambiguityIndices.join(" ,")+"> in <OR"+A+">"+(" inside <"+o.topLevelRule.name+`> Rule,
152
+ `)+("<"+c+`> may appears as a prefix path in all these alternatives.
153
+ `);return a=a+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
154
+ For Further details.`,a},buildEmptyRepetitionError:function(o){var c=s.getProductionDslName(o.repetition);o.repetition.idx!==0&&(c+=o.repetition.idx);var A="The repetition <"+c+"> within Rule <"+o.topLevelRule.name+`> can never consume any tokens.
155
+ This could lead to an infinite loop.`;return A},buildTokenNameError:function(o){return"deprecated"},buildEmptyAlternationError:function(o){var c="Ambiguous empty alternative: <"+(o.emptyChoiceIdx+1)+">"+(" in <OR"+o.alternation.idx+"> inside <"+o.topLevelRule.name+`> Rule.
156
+ `)+"Only the last alternative may be an empty alternative.";return c},buildTooManyAlternativesError:function(o){var c=`An Alternation cannot have more than 256 alternatives:
156
157
  `+("<OR"+o.alternation.idx+"> inside <"+o.topLevelRule.name+`> Rule.
157
- has `+(o.alternation.definition.length+1)+" alternatives.");return u},buildLeftRecursionError:function(o){var u=o.topLevelRule.name,c=t.map(o.leftRecursionPath,function(h){return h.name}),s=u+" --> "+c.concat([u]).join(" --> "),f=`Left Recursion found in grammar.
158
- `+("rule: <"+u+`> can be invoked from itself (directly or indirectly)
158
+ has `+(o.alternation.definition.length+1)+" alternatives.");return c},buildLeftRecursionError:function(o){var c=o.topLevelRule.name,A=t.map(o.leftRecursionPath,function(u){return u.name}),a=c+" --> "+A.concat([c]).join(" --> "),f=`Left Recursion found in grammar.
159
+ `+("rule: <"+c+`> can be invoked from itself (directly or indirectly)
159
160
  `)+(`without consuming any Tokens. The grammar path that causes this is:
160
- `+s+`
161
+ `+a+`
161
162
  `)+` To fix this refactor your grammar to remove the left recursion.
162
- see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return f},buildInvalidRuleNameError:function(o){return"deprecated"},buildDuplicateRuleNameError:function(o){var u;o.topLevelRule instanceof r.Rule?u=o.topLevelRule.name:u=o.topLevelRule;var c="Duplicate definition, rule: ->"+u+"<- is already defined in the grammar: ->"+o.grammarName+"<-";return c}}}),ii=ve(n=>{var e=n&&n.__extends||(function(){var u=function(c,s){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var g in h)Object.prototype.hasOwnProperty.call(h,g)&&(f[g]=h[g])},u(c,s)};return function(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");u(c,s);function f(){this.constructor=c}c.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.GastRefResolverVisitor=n.resolveGrammar=void 0;var t=Ye(),i=xe(),r=ft();function a(u,c){var s=new o(u,c);return s.resolveRefs(),s.errors}n.resolveGrammar=a;var o=(function(u){e(c,u);function c(s,f){var h=u.call(this)||this;return h.nameToTopRule=s,h.errMsgProvider=f,h.errors=[],h}return c.prototype.resolveRefs=function(){var s=this;i.forEach(i.values(this.nameToTopRule),function(f){s.currTopLevel=f,f.accept(s)})},c.prototype.visitNonTerminal=function(s){var f=this.nameToTopRule[s.nonTerminalName];if(f)s.referencedRule=f;else{var h=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,s);this.errors.push({message:h,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:s.nonTerminalName})}},c})(r.GAstVisitor);n.GastRefResolverVisitor=o}),vt=ve(n=>{var e=n&&n.__extends||(function(){var l=function(d,y){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,E){v.__proto__=E}||function(v,E){for(var S in E)Object.prototype.hasOwnProperty.call(E,S)&&(v[S]=E[S])},l(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");l(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=xe(),r=bn(),a=He(),o=(function(l){e(d,l);function d(y,v){var E=l.call(this)||this;return E.topProd=y,E.path=v,E.possibleTokTypes=[],E.nextProductionName="",E.nextProductionOccurrence=0,E.found=!1,E.isAtEndOfPath=!1,E}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||l.prototype.walk.call(this,y,v)},d.prototype.walkProdRef=function(y,v,E){if(y.referencedRule.name===this.nextProductionName&&y.idx===this.nextProductionOccurrence){var S=v.concat(E);this.updateExpectedNext(),this.walk(y.referencedRule,S)}},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=o;var u=(function(l){e(d,l);function d(y,v){var E=l.call(this,y,v)||this;return E.path=v,E.nextTerminalName="",E.nextTerminalOccurrence=0,E.nextTerminalName=E.path.lastTok.name,E.nextTerminalOccurrence=E.path.lastTokOccurrence,E}return d.prototype.walkTerminal=function(y,v,E){if(this.isAtEndOfPath&&y.terminalType.name===this.nextTerminalName&&y.idx===this.nextTerminalOccurrence&&!this.found){var S=v.concat(E),I=new a.Alternative({definition:S});this.possibleTokTypes=r.first(I),this.found=!0}},d})(o);n.NextAfterTokenWalker=u;var c=(function(l){e(d,l);function d(y,v){var E=l.call(this)||this;return E.topRule=y,E.occurrence=v,E.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},E}return d.prototype.startWalking=function(){return this.walk(this.topRule),this.result},d})(t.RestWalker);n.AbstractNextTerminalAfterProductionWalker=c;var s=(function(l){e(d,l);function d(){return l!==null&&l.apply(this,arguments)||this}return d.prototype.walkMany=function(y,v,E){if(y.idx===this.occurrence){var S=i.first(v.concat(E));this.result.isEndOfRule=S===void 0,S instanceof a.Terminal&&(this.result.token=S.terminalType,this.result.occurrence=S.idx)}else l.prototype.walkMany.call(this,y,v,E)},d})(c);n.NextTerminalAfterManyWalker=s;var f=(function(l){e(d,l);function d(){return l!==null&&l.apply(this,arguments)||this}return d.prototype.walkManySep=function(y,v,E){if(y.idx===this.occurrence){var S=i.first(v.concat(E));this.result.isEndOfRule=S===void 0,S instanceof a.Terminal&&(this.result.token=S.terminalType,this.result.occurrence=S.idx)}else l.prototype.walkManySep.call(this,y,v,E)},d})(c);n.NextTerminalAfterManySepWalker=f;var h=(function(l){e(d,l);function d(){return l!==null&&l.apply(this,arguments)||this}return d.prototype.walkAtLeastOne=function(y,v,E){if(y.idx===this.occurrence){var S=i.first(v.concat(E));this.result.isEndOfRule=S===void 0,S instanceof a.Terminal&&(this.result.token=S.terminalType,this.result.occurrence=S.idx)}else l.prototype.walkAtLeastOne.call(this,y,v,E)},d})(c);n.NextTerminalAfterAtLeastOneWalker=h;var g=(function(l){e(d,l);function d(){return l!==null&&l.apply(this,arguments)||this}return d.prototype.walkAtLeastOneSep=function(y,v,E){if(y.idx===this.occurrence){var S=i.first(v.concat(E));this.result.isEndOfRule=S===void 0,S instanceof a.Terminal&&(this.result.token=S.terminalType,this.result.occurrence=S.idx)}else l.prototype.walkAtLeastOneSep.call(this,y,v,E)},d})(c);n.NextTerminalAfterAtLeastOneSepWalker=g;function p(l,d,y){y===void 0&&(y=[]),y=i.cloneArr(y);var v=[],E=0;function S(x){return x.concat(i.drop(l,E+1))}function I(x){var B=p(S(x),d,y);return v.concat(B)}for(;y.length<d&&E<l.length;){var k=l[E];if(k instanceof a.Alternative||k instanceof a.NonTerminal)return I(k.definition);if(k instanceof a.Option)v=I(k.definition);else if(k instanceof a.RepetitionMandatory){var H=k.definition.concat([new a.Repetition({definition:k.definition})]);return I(H)}else if(k instanceof a.RepetitionMandatoryWithSeparator){var H=[new a.Alternative({definition:k.definition}),new a.Repetition({definition:[new a.Terminal({terminalType:k.separator})].concat(k.definition)})];return I(H)}else if(k instanceof a.RepetitionWithSeparator){var H=k.definition.concat([new a.Repetition({definition:[new a.Terminal({terminalType:k.separator})].concat(k.definition)})]);v=I(H)}else if(k instanceof a.Repetition){var H=k.definition.concat([new a.Repetition({definition:k.definition})]);v=I(H)}else{if(k instanceof a.Alternation)return i.forEach(k.definition,function(x){i.isEmpty(x.definition)===!1&&(v=I(x.definition))}),v;if(k instanceof a.Terminal)y.push(k.terminalType);else throw Error("non exhaustive match")}E++}return v.push({partialPath:y,suffixDef:i.drop(l,E)}),v}n.possiblePathsFrom=p;function T(l,d,y,v){var E="EXIT_NONE_TERMINAL",S=[E],I="EXIT_ALTERNATIVE",k=!1,H=d.length,x=H-v-1,B=[],P=[];for(P.push({idx:-1,def:l,ruleStack:[],occurrenceStack:[]});!i.isEmpty(P);){var O=P.pop();if(O===I){k&&i.last(P).idx<=x&&P.pop();continue}var M=O.def,C=O.idx,X=O.ruleStack,Q=O.occurrenceStack;if(!i.isEmpty(M)){var W=M[0];if(W===E){var $={idx:C,def:i.drop(M),ruleStack:i.dropRight(X),occurrenceStack:i.dropRight(Q)};P.push($)}else if(W instanceof a.Terminal)if(C<H-1){var te=C+1,ce=d[te];if(y(ce,W.terminalType)){var $={idx:te,def:i.drop(M),ruleStack:X,occurrenceStack:Q};P.push($)}}else if(C===H-1)B.push({nextTokenType:W.terminalType,nextTokenOccurrence:W.idx,ruleStack:X,occurrenceStack:Q}),k=!0;else throw Error("non exhaustive match");else if(W instanceof a.NonTerminal){var ae=i.cloneArr(X);ae.push(W.nonTerminalName);var le=i.cloneArr(Q);le.push(W.idx);var $={idx:C,def:W.definition.concat(S,i.drop(M)),ruleStack:ae,occurrenceStack:le};P.push($)}else if(W instanceof a.Option){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:Q};P.push(ne),P.push(I);var pe={idx:C,def:W.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:Q};P.push(pe)}else if(W instanceof a.RepetitionMandatory){var U=new a.Repetition({definition:W.definition,idx:W.idx}),G=W.definition.concat([U],i.drop(M)),$={idx:C,def:G,ruleStack:X,occurrenceStack:Q};P.push($)}else if(W instanceof a.RepetitionMandatoryWithSeparator){var K=new a.Terminal({terminalType:W.separator}),U=new a.Repetition({definition:[K].concat(W.definition),idx:W.idx}),G=W.definition.concat([U],i.drop(M)),$={idx:C,def:G,ruleStack:X,occurrenceStack:Q};P.push($)}else if(W instanceof a.RepetitionWithSeparator){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:Q};P.push(ne),P.push(I);var K=new a.Terminal({terminalType:W.separator}),q=new a.Repetition({definition:[K].concat(W.definition),idx:W.idx}),G=W.definition.concat([q],i.drop(M)),pe={idx:C,def:G,ruleStack:X,occurrenceStack:Q};P.push(pe)}else if(W instanceof a.Repetition){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:Q};P.push(ne),P.push(I);var q=new a.Repetition({definition:W.definition,idx:W.idx}),G=W.definition.concat([q],i.drop(M)),pe={idx:C,def:G,ruleStack:X,occurrenceStack:Q};P.push(pe)}else if(W instanceof a.Alternation)for(var J=W.definition.length-1;J>=0;J--){var ie=W.definition[J],Te={idx:C,def:ie.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:Q};P.push(Te),P.push(I)}else if(W instanceof a.Alternative)P.push({idx:C,def:W.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:Q});else if(W instanceof a.Rule)P.push(m(W,C,X,Q));else throw Error("non exhaustive match")}}return B}n.nextPossibleTokensAfter=T;function m(l,d,y,v){var E=i.cloneArr(y);E.push(l.name);var S=i.cloneArr(v);return S.push(1),{idx:d,def:l.definition,ruleStack:E,occurrenceStack:S}}}),Rt=ve(n=>{var e=n&&n.__extends||(function(){var x=function(B,P){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,M){O.__proto__=M}||function(O,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(O[C]=M[C])},x(B,P)};return function(B,P){if(typeof P!="function"&&P!==null)throw new TypeError("Class extends value "+String(P)+" is not a constructor or null");x(B,P);function O(){this.constructor=B}B.prototype=P===null?Object.create(P):(O.prototype=P.prototype,new O)}})();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=xe(),i=vt(),r=jt(),a=ht(),o=He(),u=ft(),c;(function(x){x[x.OPTION=0]="OPTION",x[x.REPETITION=1]="REPETITION",x[x.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",x[x.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",x[x.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",x[x.ALTERNATION=5]="ALTERNATION"})(c=n.PROD_TYPE||(n.PROD_TYPE={}));function s(x){if(x instanceof o.Option)return c.OPTION;if(x instanceof o.Repetition)return c.REPETITION;if(x instanceof o.RepetitionMandatory)return c.REPETITION_MANDATORY;if(x instanceof o.RepetitionMandatoryWithSeparator)return c.REPETITION_MANDATORY_WITH_SEPARATOR;if(x instanceof o.RepetitionWithSeparator)return c.REPETITION_WITH_SEPARATOR;if(x instanceof o.Alternation)return c.ALTERNATION;throw Error("non exhaustive match")}n.getProdType=s;function f(x,B,P,O,M,C){var X=E(x,B,P),Q=H(X)?a.tokenStructuredMatcherNoCategories:a.tokenStructuredMatcher;return C(X,O,Q,M)}n.buildLookaheadFuncForOr=f;function h(x,B,P,O,M,C){var X=S(x,B,M,P),Q=H(X)?a.tokenStructuredMatcherNoCategories:a.tokenStructuredMatcher;return C(X[0],Q,O)}n.buildLookaheadFuncForOptionalProd=h;function g(x,B,P,O){var M=x.length,C=t.every(x,function(W){return t.every(W,function($){return $.length===1})});if(B)return function(W){for(var $=t.map(W,function(q){return q.GATE}),te=0;te<M;te++){var ce=x[te],ae=ce.length,le=$[te];if(!(le!==void 0&&le.call(this)===!1))e:for(var ne=0;ne<ae;ne++){for(var pe=ce[ne],U=pe.length,G=0;G<U;G++){var K=this.LA(G+1);if(P(K,pe[G])===!1)continue e}return te}}};if(C&&!O){var X=t.map(x,function(W){return t.flatten(W)}),Q=t.reduce(X,function(W,$,te){return t.forEach($,function(ce){t.has(W,ce.tokenTypeIdx)||(W[ce.tokenTypeIdx]=te),t.forEach(ce.categoryMatches,function(ae){t.has(W,ae)||(W[ae]=te)})}),W},[]);return function(){var W=this.LA(1);return Q[W.tokenTypeIdx]}}else return function(){for(var W=0;W<M;W++){var $=x[W],te=$.length;e:for(var ce=0;ce<te;ce++){for(var ae=$[ce],le=ae.length,ne=0;ne<le;ne++){var pe=this.LA(ne+1);if(P(pe,ae[ne])===!1)continue e}return W}}}}n.buildAlternativesLookAheadFunc=g;function p(x,B,P){var O=t.every(x,function($){return $.length===1}),M=x.length;if(O&&!P){var C=t.flatten(x);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 W=t.reduce(C,function($,te,ce){return $[te.tokenTypeIdx]=!0,t.forEach(te.categoryMatches,function(ae){$[ae]=!0}),$},[]);return function(){var $=this.LA(1);return W[$.tokenTypeIdx]===!0}}}else return function(){e:for(var $=0;$<M;$++){for(var te=x[$],ce=te.length,ae=0;ae<ce;ae++){var le=this.LA(ae+1);if(B(le,te[ae])===!1)continue e}return!0}return!1}}n.buildSingleAlternativeLookaheadFunction=p;var T=(function(x){e(B,x);function B(P,O,M){var C=x.call(this)||this;return C.topProd=P,C.targetOccurrence=O,C.targetProdType=M,C}return B.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},B.prototype.checkIsTarget=function(P,O,M,C){return P.idx===this.targetOccurrence&&this.targetProdType===O?(this.restDef=M.concat(C),!0):!1},B.prototype.walkOption=function(P,O,M){this.checkIsTarget(P,c.OPTION,O,M)||x.prototype.walkOption.call(this,P,O,M)},B.prototype.walkAtLeastOne=function(P,O,M){this.checkIsTarget(P,c.REPETITION_MANDATORY,O,M)||x.prototype.walkOption.call(this,P,O,M)},B.prototype.walkAtLeastOneSep=function(P,O,M){this.checkIsTarget(P,c.REPETITION_MANDATORY_WITH_SEPARATOR,O,M)||x.prototype.walkOption.call(this,P,O,M)},B.prototype.walkMany=function(P,O,M){this.checkIsTarget(P,c.REPETITION,O,M)||x.prototype.walkOption.call(this,P,O,M)},B.prototype.walkManySep=function(P,O,M){this.checkIsTarget(P,c.REPETITION_WITH_SEPARATOR,O,M)||x.prototype.walkOption.call(this,P,O,M)},B})(r.RestWalker),m=(function(x){e(B,x);function B(P,O,M){var C=x.call(this)||this;return C.targetOccurrence=P,C.targetProdType=O,C.targetRef=M,C.result=[],C}return B.prototype.checkIsTarget=function(P,O){P.idx===this.targetOccurrence&&this.targetProdType===O&&(this.targetRef===void 0||P===this.targetRef)&&(this.result=P.definition)},B.prototype.visitOption=function(P){this.checkIsTarget(P,c.OPTION)},B.prototype.visitRepetition=function(P){this.checkIsTarget(P,c.REPETITION)},B.prototype.visitRepetitionMandatory=function(P){this.checkIsTarget(P,c.REPETITION_MANDATORY)},B.prototype.visitRepetitionMandatoryWithSeparator=function(P){this.checkIsTarget(P,c.REPETITION_MANDATORY_WITH_SEPARATOR)},B.prototype.visitRepetitionWithSeparator=function(P){this.checkIsTarget(P,c.REPETITION_WITH_SEPARATOR)},B.prototype.visitAlternation=function(P){this.checkIsTarget(P,c.ALTERNATION)},B})(u.GAstVisitor);function l(x){for(var B=new Array(x),P=0;P<x;P++)B[P]=[];return B}function d(x){for(var B=[""],P=0;P<x.length;P++){for(var O=x[P],M=[],C=0;C<B.length;C++){var X=B[C];M.push(X+"_"+O.tokenTypeIdx);for(var Q=0;Q<O.categoryMatches.length;Q++){var W="_"+O.categoryMatches[Q];M.push(X+W)}}B=M}return B}function y(x,B,P){for(var O=0;O<x.length;O++)if(O!==P)for(var M=x[O],C=0;C<B.length;C++){var X=B[C];if(M[X]===!0)return!1}return!0}function v(x,B){for(var P=t.map(x,function(te){return i.possiblePathsFrom([te],1)}),O=l(P.length),M=t.map(P,function(te){var ce={};return t.forEach(te,function(ae){var le=d(ae.partialPath);t.forEach(le,function(ne){ce[ne]=!0})}),ce}),C=P,X=1;X<=B;X++){var Q=C;C=l(Q.length);for(var W=function(te){for(var ce=Q[te],ae=0;ae<ce.length;ae++){var le=ce[ae].partialPath,ne=ce[ae].suffixDef,pe=d(le),U=y(M,pe,te);if(U||t.isEmpty(ne)||le.length===B){var G=O[te];if(I(G,le)===!1){G.push(le);for(var K=0;K<pe.length;K++){var q=pe[K];M[te][q]=!0}}}else{var J=i.possiblePathsFrom(ne,X+1,le);C[te]=C[te].concat(J),t.forEach(J,function(ie){var Te=d(ie.partialPath);t.forEach(Te,function(ye){M[te][ye]=!0})})}}},$=0;$<Q.length;$++)W($)}return O}n.lookAheadSequenceFromAlternatives=v;function E(x,B,P,O){var M=new m(x,c.ALTERNATION,O);return B.accept(M),v(M.result,P)}n.getLookaheadPathsForOr=E;function S(x,B,P,O){var M=new m(x,P);B.accept(M);var C=M.result,X=new T(B,x,P),Q=X.startWalking(),W=new o.Alternative({definition:C}),$=new o.Alternative({definition:Q});return v([W,$],O)}n.getLookaheadPathsForOptionalProd=S;function I(x,B){e:for(var P=0;P<x.length;P++){var O=x[P];if(O.length===B.length){for(var M=0;M<O.length;M++){var C=B[M],X=O[M],Q=C===X||X.categoryMatchesMap[C.tokenTypeIdx]!==void 0;if(Q===!1)continue e}return!0}}return!1}n.containsPath=I;function k(x,B){return x.length<B.length&&t.every(x,function(P,O){var M=B[O];return P===M||M.categoryMatchesMap[P.tokenTypeIdx]})}n.isStrictPrefixOfPath=k;function H(x){return t.every(x,function(B){return t.every(B,function(P){return t.every(P,function(O){return t.isEmpty(O.categoryMatches)})})})}n.areTokenCategoriesNotUsed=H}),Sn=ve(n=>{var e=n&&n.__extends||(function(){var O=function(M,C){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Q){X.__proto__=Q}||function(X,Q){for(var W in Q)Object.prototype.hasOwnProperty.call(Q,W)&&(X[W]=Q[W])},O(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");O(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=xe(),i=xe(),r=Ye(),a=Tt(),o=Rt(),u=vt(),c=He(),s=ft();function f(O,M,C,X,Q){var W=t.map(O,function(U){return h(U,X)}),$=t.map(O,function(U){return d(U,U,X)}),te=[],ce=[],ae=[];i.every($,i.isEmpty)&&(te=i.map(O,function(U){return E(U,X)}),ce=i.map(O,function(U){return S(U,M,X)}),ae=H(O,M,X));var le=P(O,C,X),ne=i.map(O,function(U){return k(U,X)}),pe=i.map(O,function(U){return m(U,O,Q,X)});return t.flatten(W.concat(ae,$,te,ce,le,ne,pe))}n.validateGrammar=f;function h(O,M){var C=new T;O.accept(C);var X=C.allProductions,Q=t.groupBy(X,g),W=t.pick(Q,function(te){return te.length>1}),$=t.map(t.values(W),function(te){var ce=t.first(te),ae=M.buildDuplicateFoundError(O,te),le=a.getProductionDslName(ce),ne={message:ae,type:r.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:O.name,dslName:le,occurrence:ce.idx},pe=p(ce);return pe&&(ne.parameter=pe),ne});return $}function g(O){return a.getProductionDslName(O)+"_#_"+O.idx+"_#_"+p(O)}n.identifyProductionForDuplicates=g;function p(O){return O instanceof c.Terminal?O.terminalType.name:O instanceof c.NonTerminal?O.nonTerminalName:""}var T=(function(O){e(M,O);function M(){var C=O!==null&&O.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})(s.GAstVisitor);n.OccurrenceValidationCollector=T;function m(O,M,C,X){var Q=[],W=i.reduce(M,function(te,ce){return ce.name===O.name?te+1:te},0);if(W>1){var $=X.buildDuplicateRuleNameError({topLevelRule:O,grammarName:C});Q.push({message:$,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:O.name})}return Q}n.validateRuleDoesNotAlreadyExist=m;function l(O,M,C){var X=[],Q;return t.contains(M,O)||(Q="Invalid rule override, rule: ->"+O+"<- 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:O})),X}n.validateRuleIsOverridden=l;function d(O,M,C,X){X===void 0&&(X=[]);var Q=[],W=y(M.definition);if(t.isEmpty(W))return[];var $=O.name,te=t.contains(W,O);te&&Q.push({message:C.buildLeftRecursionError({topLevelRule:O,leftRecursionPath:X}),type:r.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:$});var ce=t.difference(W,X.concat([O])),ae=t.map(ce,function(le){var ne=t.cloneArr(X);return ne.push(le),d(O,le,C,ne)});return Q.concat(t.flatten(ae))}n.validateNoLeftRecursion=d;function y(O){var M=[];if(t.isEmpty(O))return M;var C=t.first(O);if(C instanceof c.NonTerminal)M.push(C.referencedRule);else if(C instanceof c.Alternative||C instanceof c.Option||C instanceof c.RepetitionMandatory||C instanceof c.RepetitionMandatoryWithSeparator||C instanceof c.RepetitionWithSeparator||C instanceof c.Repetition)M=M.concat(y(C.definition));else if(C instanceof c.Alternation)M=t.flatten(t.map(C.definition,function($){return y($.definition)}));else if(!(C instanceof c.Terminal))throw Error("non exhaustive match");var X=a.isOptionalProd(C),Q=O.length>1;if(X&&Q){var W=t.drop(O);return M.concat(y(W))}else return M}n.getFirstNoneTerminal=y;var v=(function(O){e(M,O);function M(){var C=O!==null&&O.apply(this,arguments)||this;return C.alternations=[],C}return M.prototype.visitAlternation=function(C){this.alternations.push(C)},M})(s.GAstVisitor);function E(O,M){var C=new v;O.accept(C);var X=C.alternations,Q=t.reduce(X,function(W,$){var te=t.dropRight($.definition),ce=t.map(te,function(ae,le){var ne=u.nextPossibleTokensAfter([ae],[],null,1);return t.isEmpty(ne)?{message:M.buildEmptyAlternationError({topLevelRule:O,alternation:$,emptyChoiceIdx:le}),type:r.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:O.name,occurrence:$.idx,alternative:le+1}:null});return W.concat(t.compact(ce))},[]);return Q}n.validateEmptyOrAlternative=E;function S(O,M,C){var X=new v;O.accept(X);var Q=X.alternations;Q=i.reject(Q,function($){return $.ignoreAmbiguities===!0});var W=t.reduce(Q,function($,te){var ce=te.idx,ae=te.maxLookahead||M,le=o.getLookaheadPathsForOr(ce,O,ae,te),ne=x(le,te,O,C),pe=B(le,te,O,C);return $.concat(ne,pe)},[]);return W}n.validateAmbiguousAlternationAlternatives=S;var I=(function(O){e(M,O);function M(){var C=O!==null&&O.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})(s.GAstVisitor);n.RepetionCollector=I;function k(O,M){var C=new v;O.accept(C);var X=C.alternations,Q=t.reduce(X,function(W,$){return $.definition.length>255&&W.push({message:M.buildTooManyAlternativesError({topLevelRule:O,alternation:$}),type:r.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:O.name,occurrence:$.idx}),W},[]);return Q}n.validateTooManyAlts=k;function H(O,M,C){var X=[];return i.forEach(O,function(Q){var W=new I;Q.accept(W);var $=W.allProductions;i.forEach($,function(te){var ce=o.getProdType(te),ae=te.maxLookahead||M,le=te.idx,ne=o.getLookaheadPathsForOptionalProd(le,Q,ce,ae),pe=ne[0];if(i.isEmpty(i.flatten(pe))){var U=C.buildEmptyRepetitionError({topLevelRule:Q,repetition:te});X.push({message:U,type:r.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:Q.name})}})}),X}n.validateSomeNonEmptyLookaheadPath=H;function x(O,M,C,X){var Q=[],W=i.reduce(O,function(te,ce,ae){return M.definition[ae].ignoreAmbiguities===!0||i.forEach(ce,function(le){var ne=[ae];i.forEach(O,function(pe,U){ae!==U&&o.containsPath(pe,le)&&M.definition[U].ignoreAmbiguities!==!0&&ne.push(U)}),ne.length>1&&!o.containsPath(Q,le)&&(Q.push(le),te.push({alts:ne,path:le}))}),te},[]),$=t.map(W,function(te){var ce=i.map(te.alts,function(le){return le+1}),ae=X.buildAlternationAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:ce,prefixPath:te.path});return{message:ae,type:r.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:C.name,occurrence:M.idx,alternatives:[te.alts]}});return $}function B(O,M,C,X){var Q=[],W=i.reduce(O,function($,te,ce){var ae=i.map(te,function(le){return{idx:ce,path:le}});return $.concat(ae)},[]);return i.forEach(W,function($){var te=M.definition[$.idx];if(te.ignoreAmbiguities!==!0){var ce=$.idx,ae=$.path,le=i.findAll(W,function(pe){return M.definition[pe.idx].ignoreAmbiguities!==!0&&pe.idx<ce&&o.isStrictPrefixOfPath(pe.path,ae)}),ne=i.map(le,function(pe){var U=[pe.idx+1,ce+1],G=M.idx===0?"":M.idx,K=X.buildAlternationPrefixAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:U,prefixPath:pe.path});return{message:K,type:r.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:C.name,occurrence:G,alternatives:U}});Q=Q.concat(ne)}}),Q}n.checkPrefixAlternativesAmbiguities=B;function P(O,M,C){var X=[],Q=i.map(M,function(W){return W.name});return i.forEach(O,function(W){var $=W.name;if(i.contains(Q,$)){var te=C.buildNamespaceConflictError(W);X.push({message:te,type:r.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:$})}}),X}}),oi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateGrammar=n.resolveGrammar=void 0;var e=xe(),t=ii(),i=Sn(),r=Et();function a(u){u=e.defaults(u,{errMsgProvider:r.defaultGrammarResolverErrorProvider});var c={};return e.forEach(u.rules,function(s){c[s.name]=s}),t.resolveGrammar(c,u.errMsgProvider)}n.resolveGrammar=a;function o(u){return u=e.defaults(u,{errMsgProvider:r.defaultGrammarValidatorErrorProvider}),i.validateGrammar(u.rules,u.maxLookahead,u.tokenTypes,u.errMsgProvider,u.grammarName)}n.validateGrammar=o}),dt=ve(n=>{var e=n&&n.__extends||(function(){var T=function(m,l){return T=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])},T(m,l)};return function(m,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");T(m,l);function d(){this.constructor=m}m.prototype=l===null?Object.create(l):(d.prototype=l.prototype,new d)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EarlyExitException=n.NotAllInputParsedException=n.NoViableAltException=n.MismatchedTokenException=n.isRecognitionException=void 0;var t=xe(),i="MismatchedTokenException",r="NoViableAltException",a="EarlyExitException",o="NotAllInputParsedException",u=[i,r,a,o];Object.freeze(u);function c(T){return t.contains(u,T.name)}n.isRecognitionException=c;var s=(function(T){e(m,T);function m(l,d){var y=this.constructor,v=T.call(this,l)||this;return v.token=d,v.resyncedTokens=[],Object.setPrototypeOf(v,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return m})(Error),f=(function(T){e(m,T);function m(l,d,y){var v=T.call(this,l,d)||this;return v.previousToken=y,v.name=i,v}return m})(s);n.MismatchedTokenException=f;var h=(function(T){e(m,T);function m(l,d,y){var v=T.call(this,l,d)||this;return v.previousToken=y,v.name=r,v}return m})(s);n.NoViableAltException=h;var g=(function(T){e(m,T);function m(l,d){var y=T.call(this,l,d)||this;return y.name=o,y}return m})(s);n.NotAllInputParsedException=g;var p=(function(T){e(m,T);function m(l,d,y){var v=T.call(this,l,d)||this;return v.previousToken=y,v.name=a,v}return m})(s);n.EarlyExitException=p}),On=ve(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=nt(),t=xe(),i=dt(),r=Ln(),a=Ye();n.EOF_FOLLOW_KEY={},n.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function o(s){this.name=n.IN_RULE_RECOVERY_EXCEPTION,this.message=s}n.InRuleRecoveryException=o,o.prototype=Error.prototype;var u=(function(){function s(){}return s.prototype.initRecoverable=function(f){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(f,"recoveryEnabled")?f.recoveryEnabled:a.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=c)},s.prototype.getTokenToInsert=function(f){var h=e.createTokenInstance(f,"",NaN,NaN,NaN,NaN,NaN,NaN);return h.isInsertedInRecovery=!0,h},s.prototype.canTokenTypeBeInsertedInRecovery=function(f){return!0},s.prototype.tryInRepetitionRecovery=function(f,h,g,p){for(var T=this,m=this.findReSyncTokenType(),l=this.exportLexerState(),d=[],y=!1,v=this.LA(1),E=this.LA(1),S=function(){var I=T.LA(0),k=T.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:v,previous:I,ruleName:T.getCurrRuleFullName()}),H=new i.MismatchedTokenException(k,v,T.LA(0));H.resyncedTokens=t.dropRight(d),T.SAVE_ERROR(H)};!y;)if(this.tokenMatcher(E,p)){S();return}else if(g.call(this)){S(),f.apply(this,h);return}else this.tokenMatcher(E,m)?y=!0:(E=this.SKIP_TOKEN(),this.addToResyncTokens(E,d));this.importLexerState(l)},s.prototype.shouldInRepetitionRecoveryBeTried=function(f,h,g){return!(g===!1||f===void 0||h===void 0||this.tokenMatcher(this.LA(1),f)||this.isBackTracking()||this.canPerformInRuleRecovery(f,this.getFollowsForInRuleRecovery(f,h)))},s.prototype.getFollowsForInRuleRecovery=function(f,h){var g=this.getCurrentGrammarPath(f,h),p=this.getNextPossibleTokenTypes(g);return p},s.prototype.tryInRuleRecovery=function(f,h){if(this.canRecoverWithSingleTokenInsertion(f,h)){var g=this.getTokenToInsert(f);return g}if(this.canRecoverWithSingleTokenDeletion(f)){var p=this.SKIP_TOKEN();return this.consumeToken(),p}throw new o("sad sad panda")},s.prototype.canPerformInRuleRecovery=function(f,h){return this.canRecoverWithSingleTokenInsertion(f,h)||this.canRecoverWithSingleTokenDeletion(f)},s.prototype.canRecoverWithSingleTokenInsertion=function(f,h){var g=this;if(!this.canTokenTypeBeInsertedInRecovery(f)||t.isEmpty(h))return!1;var p=this.LA(1),T=t.find(h,function(m){return g.tokenMatcher(p,m)})!==void 0;return T},s.prototype.canRecoverWithSingleTokenDeletion=function(f){var h=this.tokenMatcher(this.LA(2),f);return h},s.prototype.isInCurrentRuleReSyncSet=function(f){var h=this.getCurrFollowKey(),g=this.getFollowSetFromFollowKey(h);return t.contains(g,f)},s.prototype.findReSyncTokenType=function(){for(var f=this.flattenFollowSet(),h=this.LA(1),g=2;;){var p=h.tokenType;if(t.contains(f,p))return p;h=this.LA(g),g++}},s.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return n.EOF_FOLLOW_KEY;var f=this.getLastExplicitRuleShortName(),h=this.getLastExplicitRuleOccurrenceIndex(),g=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(f),idxInCallingRule:h,inRule:this.shortRuleNameToFullName(g)}},s.prototype.buildFullFollowKeyStack=function(){var f=this,h=this.RULE_STACK,g=this.RULE_OCCURRENCE_STACK;return t.map(h,function(p,T){return T===0?n.EOF_FOLLOW_KEY:{ruleName:f.shortRuleNameToFullName(p),idxInCallingRule:g[T],inRule:f.shortRuleNameToFullName(h[T-1])}})},s.prototype.flattenFollowSet=function(){var f=this,h=t.map(this.buildFullFollowKeyStack(),function(g){return f.getFollowSetFromFollowKey(g)});return t.flatten(h)},s.prototype.getFollowSetFromFollowKey=function(f){if(f===n.EOF_FOLLOW_KEY)return[e.EOF];var h=f.ruleName+f.idxInCallingRule+r.IN+f.inRule;return this.resyncFollows[h]},s.prototype.addToResyncTokens=function(f,h){return this.tokenMatcher(f,e.EOF)||h.push(f),h},s.prototype.reSyncTo=function(f){for(var h=[],g=this.LA(1);this.tokenMatcher(g,f)===!1;)g=this.SKIP_TOKEN(),this.addToResyncTokens(g,h);return t.dropRight(h)},s.prototype.attemptInRepetitionRecovery=function(f,h,g,p,T,m,l){},s.prototype.getCurrentGrammarPath=function(f,h){var g=this.getHumanReadableRuleStack(),p=t.cloneArr(this.RULE_OCCURRENCE_STACK),T={ruleStack:g,occurrenceStack:p,lastTok:f,lastTokOccurrence:h};return T},s.prototype.getHumanReadableRuleStack=function(){var f=this;return t.map(this.RULE_STACK,function(h){return f.shortRuleNameToFullName(h)})},s})();n.Recoverable=u;function c(s,f,h,g,p,T,m){var l=this.getKeyForAutomaticLookahead(g,p),d=this.firstAfterRepMap[l];if(d===void 0){var y=this.getCurrRuleFullName(),v=this.getGAstProductions()[y],E=new T(v,p);d=E.startWalking(),this.firstAfterRepMap[l]=d}var S=d.token,I=d.occurrence,k=d.isEndOfRule;this.RULE_STACK.length===1&&k&&S===void 0&&(S=e.EOF,I=1),this.shouldInRepetitionRecoveryBeTried(S,I,m)&&this.tryInRepetitionRecovery(s,f,h,S)}n.attemptInRepetitionRecovery=c}),Bt=ve(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}),si=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LooksAhead=void 0;var e=Rt(),t=xe(),i=Ye(),r=Bt(),a=Tt(),o=(function(){function u(){}return u.prototype.initLooksAhead=function(c){this.dynamicTokensEnabled=t.has(c,"dynamicTokensEnabled")?c.dynamicTokensEnabled:i.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(c,"maxLookahead")?c.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(c){var s=this;t.forEach(c,function(f){s.TRACE_INIT(f.name+" Rule Lookahead",function(){var h=a.collectMethods(f),g=h.alternation,p=h.repetition,T=h.option,m=h.repetitionMandatory,l=h.repetitionMandatoryWithSeparator,d=h.repetitionWithSeparator;t.forEach(g,function(y){var v=y.idx===0?"":y.idx;s.TRACE_INIT(""+a.getProductionDslName(y)+v,function(){var E=e.buildLookaheadFuncForOr(y.idx,f,y.maxLookahead||s.maxLookahead,y.hasPredicates,s.dynamicTokensEnabled,s.lookAheadBuilderForAlternatives),S=r.getKeyForAutomaticLookahead(s.fullRuleNameToShort[f.name],r.OR_IDX,y.idx);s.setLaFuncCache(S,E)})}),t.forEach(p,function(y){s.computeLookaheadFunc(f,y.idx,r.MANY_IDX,e.PROD_TYPE.REPETITION,y.maxLookahead,a.getProductionDslName(y))}),t.forEach(T,function(y){s.computeLookaheadFunc(f,y.idx,r.OPTION_IDX,e.PROD_TYPE.OPTION,y.maxLookahead,a.getProductionDslName(y))}),t.forEach(m,function(y){s.computeLookaheadFunc(f,y.idx,r.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,y.maxLookahead,a.getProductionDslName(y))}),t.forEach(l,function(y){s.computeLookaheadFunc(f,y.idx,r.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,y.maxLookahead,a.getProductionDslName(y))}),t.forEach(d,function(y){s.computeLookaheadFunc(f,y.idx,r.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,y.maxLookahead,a.getProductionDslName(y))})})})},u.prototype.computeLookaheadFunc=function(c,s,f,h,g,p){var T=this;this.TRACE_INIT(""+p+(s===0?"":s),function(){var m=e.buildLookaheadFuncForOptionalProd(s,c,g||T.maxLookahead,T.dynamicTokensEnabled,h,T.lookAheadBuilderForOptional),l=r.getKeyForAutomaticLookahead(T.fullRuleNameToShort[c.name],f,s);T.setLaFuncCache(l,m)})},u.prototype.lookAheadBuilderForOptional=function(c,s,f){return e.buildSingleAlternativeLookaheadFunction(c,s,f)},u.prototype.lookAheadBuilderForAlternatives=function(c,s,f,h){return e.buildAlternativesLookAheadFunc(c,s,f,h)},u.prototype.getKeyForAutomaticLookahead=function(c,s){var f=this.getLastExplicitRuleShortName();return r.getKeyForAutomaticLookahead(f,c,s)},u.prototype.getLaFuncFromCache=function(c){},u.prototype.getLaFuncFromMap=function(c){return this.lookAheadFuncsCache.get(c)},u.prototype.getLaFuncFromObj=function(c){return this.lookAheadFuncsCache[c]},u.prototype.setLaFuncCache=function(c,s){},u.prototype.setLaFuncCacheUsingMap=function(c,s){this.lookAheadFuncsCache.set(c,s)},u.prototype.setLaFuncUsingObj=function(c,s){this.lookAheadFuncsCache[c]=s},u})();n.LooksAhead=o}),ai=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addNoneTerminalToCst=n.addTerminalToCst=n.setNodeLocationFull=n.setNodeLocationOnlyOffset=void 0;function e(a,o){isNaN(a.startOffset)===!0?(a.startOffset=o.startOffset,a.endOffset=o.endOffset):a.endOffset<o.endOffset&&(a.endOffset=o.endOffset)}n.setNodeLocationOnlyOffset=e;function t(a,o){isNaN(a.startOffset)===!0?(a.startOffset=o.startOffset,a.startColumn=o.startColumn,a.startLine=o.startLine,a.endOffset=o.endOffset,a.endColumn=o.endColumn,a.endLine=o.endLine):a.endOffset<o.endOffset&&(a.endOffset=o.endOffset,a.endColumn=o.endColumn,a.endLine=o.endLine)}n.setNodeLocationFull=t;function i(a,o,u){a.children[u]===void 0?a.children[u]=[o]:a.children[u].push(o)}n.addTerminalToCst=i;function r(a,o,u){a.children[o]===void 0?a.children[o]=[u]:a.children[o].push(u)}n.addNoneTerminalToCst=r}),xn=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defineNameProp=n.functionName=n.classNameFromInstance=void 0;var e=xe();function t(o){return r(o.constructor)}n.classNameFromInstance=t;var i="name";function r(o){var u=o.name;return u||"anonymous"}n.functionName=r;function a(o,u){var c=Object.getOwnPropertyDescriptor(o,i);return e.isUndefined(c)||c.configurable?(Object.defineProperty(o,i,{enumerable:!1,configurable:!0,writable:!1,value:u}),!0):!1}n.defineNameProp=a}),ci=ve(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=xe(),t=xn();function i(h,g){for(var p=e.keys(h),T=p.length,m=0;m<T;m++)for(var l=p[m],d=h[l],y=d.length,v=0;v<y;v++){var E=d[v];E.tokenTypeIdx===void 0&&this[E.name](E.children,g)}}n.defaultVisit=i;function r(h,g){var p=function(){};t.defineNameProp(p,h+"BaseSemantics");var T={visit:function(m,l){if(e.isArray(m)&&(m=m[0]),!e.isUndefined(m))return this[m.name](m.children,l)},validateVisitor:function(){var m=u(this,g);if(!e.isEmpty(m)){var l=e.map(m,function(d){return d.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
163
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return f},buildInvalidRuleNameError:function(o){return"deprecated"},buildDuplicateRuleNameError:function(o){var c;o.topLevelRule instanceof n.Rule?c=o.topLevelRule.name:c=o.topLevelRule;var A="Duplicate definition, rule: ->"+c+"<- is already defined in the grammar: ->"+o.grammarName+"<-";return A}}}),No=Be(i=>{var e=i&&i.__extends||(function(){var c=function(A,a){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,u){f.__proto__=u}||function(f,u){for(var b in u)Object.prototype.hasOwnProperty.call(u,b)&&(f[b]=u[b])},c(A,a)};return function(A,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");c(A,a);function f(){this.constructor=A}A.prototype=a===null?Object.create(a):(f.prototype=a.prototype,new f)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.GastRefResolverVisitor=i.resolveGrammar=void 0;var t=Xe(),r=Se(),n=Ct();function s(c,A){var a=new o(c,A);return a.resolveRefs(),a.errors}i.resolveGrammar=s;var o=(function(c){e(A,c);function A(a,f){var u=c.call(this)||this;return u.nameToTopRule=a,u.errMsgProvider=f,u.errors=[],u}return A.prototype.resolveRefs=function(){var a=this;r.forEach(r.values(this.nameToTopRule),function(f){a.currTopLevel=f,f.accept(a)})},A.prototype.visitNonTerminal=function(a){var f=this.nameToTopRule[a.nonTerminalName];if(f)a.referencedRule=f;else{var u=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,a);this.errors.push({message:u,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:a.nonTerminalName})}},A})(n.GAstVisitor);i.GastRefResolverVisitor=o}),Lt=Be(i=>{var e=i&&i.__extends||(function(){var l=function(h,p){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,E){C.__proto__=E}||function(C,E){for(var B in E)Object.prototype.hasOwnProperty.call(E,B)&&(C[B]=E[B])},l(h,p)};return function(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");l(h,p);function C(){this.constructor=h}h.prototype=p===null?Object.create(p):(C.prototype=p.prototype,new C)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.nextPossibleTokensAfter=i.possiblePathsFrom=i.NextTerminalAfterAtLeastOneSepWalker=i.NextTerminalAfterAtLeastOneWalker=i.NextTerminalAfterManySepWalker=i.NextTerminalAfterManyWalker=i.AbstractNextTerminalAfterProductionWalker=i.NextAfterTokenWalker=i.AbstractNextPossibleTokensWalker=void 0;var t=ln(),r=Se(),n=Fi(),s=We(),o=(function(l){e(h,l);function h(p,C){var E=l.call(this)||this;return E.topProd=p,E.path=C,E.possibleTokTypes=[],E.nextProductionName="",E.nextProductionOccurrence=0,E.found=!1,E.isAtEndOfPath=!1,E}return h.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},h.prototype.walk=function(p,C){C===void 0&&(C=[]),this.found||l.prototype.walk.call(this,p,C)},h.prototype.walkProdRef=function(p,C,E){if(p.referencedRule.name===this.nextProductionName&&p.idx===this.nextProductionOccurrence){var B=C.concat(E);this.updateExpectedNext(),this.walk(p.referencedRule,B)}},h.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())},h})(t.RestWalker);i.AbstractNextPossibleTokensWalker=o;var c=(function(l){e(h,l);function h(p,C){var E=l.call(this,p,C)||this;return E.path=C,E.nextTerminalName="",E.nextTerminalOccurrence=0,E.nextTerminalName=E.path.lastTok.name,E.nextTerminalOccurrence=E.path.lastTokOccurrence,E}return h.prototype.walkTerminal=function(p,C,E){if(this.isAtEndOfPath&&p.terminalType.name===this.nextTerminalName&&p.idx===this.nextTerminalOccurrence&&!this.found){var B=C.concat(E),Q=new s.Alternative({definition:B});this.possibleTokTypes=n.first(Q),this.found=!0}},h})(o);i.NextAfterTokenWalker=c;var A=(function(l){e(h,l);function h(p,C){var E=l.call(this)||this;return E.topRule=p,E.occurrence=C,E.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},E}return h.prototype.startWalking=function(){return this.walk(this.topRule),this.result},h})(t.RestWalker);i.AbstractNextTerminalAfterProductionWalker=A;var a=(function(l){e(h,l);function h(){return l!==null&&l.apply(this,arguments)||this}return h.prototype.walkMany=function(p,C,E){if(p.idx===this.occurrence){var B=r.first(C.concat(E));this.result.isEndOfRule=B===void 0,B instanceof s.Terminal&&(this.result.token=B.terminalType,this.result.occurrence=B.idx)}else l.prototype.walkMany.call(this,p,C,E)},h})(A);i.NextTerminalAfterManyWalker=a;var f=(function(l){e(h,l);function h(){return l!==null&&l.apply(this,arguments)||this}return h.prototype.walkManySep=function(p,C,E){if(p.idx===this.occurrence){var B=r.first(C.concat(E));this.result.isEndOfRule=B===void 0,B instanceof s.Terminal&&(this.result.token=B.terminalType,this.result.occurrence=B.idx)}else l.prototype.walkManySep.call(this,p,C,E)},h})(A);i.NextTerminalAfterManySepWalker=f;var u=(function(l){e(h,l);function h(){return l!==null&&l.apply(this,arguments)||this}return h.prototype.walkAtLeastOne=function(p,C,E){if(p.idx===this.occurrence){var B=r.first(C.concat(E));this.result.isEndOfRule=B===void 0,B instanceof s.Terminal&&(this.result.token=B.terminalType,this.result.occurrence=B.idx)}else l.prototype.walkAtLeastOne.call(this,p,C,E)},h})(A);i.NextTerminalAfterAtLeastOneWalker=u;var b=(function(l){e(h,l);function h(){return l!==null&&l.apply(this,arguments)||this}return h.prototype.walkAtLeastOneSep=function(p,C,E){if(p.idx===this.occurrence){var B=r.first(C.concat(E));this.result.isEndOfRule=B===void 0,B instanceof s.Terminal&&(this.result.token=B.terminalType,this.result.occurrence=B.idx)}else l.prototype.walkAtLeastOneSep.call(this,p,C,E)},h})(A);i.NextTerminalAfterAtLeastOneSepWalker=b;function d(l,h,p){p===void 0&&(p=[]),p=r.cloneArr(p);var C=[],E=0;function B(v){return v.concat(r.drop(l,E+1))}function Q(v){var O=d(B(v),h,p);return C.concat(O)}for(;p.length<h&&E<l.length;){var S=l[E];if(S instanceof s.Alternative||S instanceof s.NonTerminal)return Q(S.definition);if(S instanceof s.Option)C=Q(S.definition);else if(S instanceof s.RepetitionMandatory){var U=S.definition.concat([new s.Repetition({definition:S.definition})]);return Q(U)}else if(S instanceof s.RepetitionMandatoryWithSeparator){var U=[new s.Alternative({definition:S.definition}),new s.Repetition({definition:[new s.Terminal({terminalType:S.separator})].concat(S.definition)})];return Q(U)}else if(S instanceof s.RepetitionWithSeparator){var U=S.definition.concat([new s.Repetition({definition:[new s.Terminal({terminalType:S.separator})].concat(S.definition)})]);C=Q(U)}else if(S instanceof s.Repetition){var U=S.definition.concat([new s.Repetition({definition:S.definition})]);C=Q(U)}else{if(S instanceof s.Alternation)return r.forEach(S.definition,function(v){r.isEmpty(v.definition)===!1&&(C=Q(v.definition))}),C;if(S instanceof s.Terminal)p.push(S.terminalType);else throw Error("non exhaustive match")}E++}return C.push({partialPath:p,suffixDef:r.drop(l,E)}),C}i.possiblePathsFrom=d;function I(l,h,p,C){var E="EXIT_NONE_TERMINAL",B=[E],Q="EXIT_ALTERNATIVE",S=!1,U=h.length,v=U-C-1,O=[],L=[];for(L.push({idx:-1,def:l,ruleStack:[],occurrenceStack:[]});!r.isEmpty(L);){var k=L.pop();if(k===Q){S&&r.last(L).idx<=v&&L.pop();continue}var D=k.def,_=k.idx,V=k.ruleStack,J=k.occurrenceStack;if(!r.isEmpty(D)){var q=D[0];if(q===E){var X={idx:_,def:r.drop(D),ruleStack:r.dropRight(V),occurrenceStack:r.dropRight(J)};L.push(X)}else if(q instanceof s.Terminal)if(_<U-1){var $=_+1,le=h[$];if(p(le,q.terminalType)){var X={idx:$,def:r.drop(D),ruleStack:V,occurrenceStack:J};L.push(X)}}else if(_===U-1)O.push({nextTokenType:q.terminalType,nextTokenOccurrence:q.idx,ruleStack:V,occurrenceStack:J}),S=!0;else throw Error("non exhaustive match");else if(q instanceof s.NonTerminal){var re=r.cloneArr(V);re.push(q.nonTerminalName);var oe=r.cloneArr(J);oe.push(q.idx);var X={idx:_,def:q.definition.concat(B,r.drop(D)),ruleStack:re,occurrenceStack:oe};L.push(X)}else if(q instanceof s.Option){var te={idx:_,def:r.drop(D),ruleStack:V,occurrenceStack:J};L.push(te),L.push(Q);var he={idx:_,def:q.definition.concat(r.drop(D)),ruleStack:V,occurrenceStack:J};L.push(he)}else if(q instanceof s.RepetitionMandatory){var P=new s.Repetition({definition:q.definition,idx:q.idx}),j=q.definition.concat([P],r.drop(D)),X={idx:_,def:j,ruleStack:V,occurrenceStack:J};L.push(X)}else if(q instanceof s.RepetitionMandatoryWithSeparator){var W=new s.Terminal({terminalType:q.separator}),P=new s.Repetition({definition:[W].concat(q.definition),idx:q.idx}),j=q.definition.concat([P],r.drop(D)),X={idx:_,def:j,ruleStack:V,occurrenceStack:J};L.push(X)}else if(q instanceof s.RepetitionWithSeparator){var te={idx:_,def:r.drop(D),ruleStack:V,occurrenceStack:J};L.push(te),L.push(Q);var W=new s.Terminal({terminalType:q.separator}),Z=new s.Repetition({definition:[W].concat(q.definition),idx:q.idx}),j=q.definition.concat([Z],r.drop(D)),he={idx:_,def:j,ruleStack:V,occurrenceStack:J};L.push(he)}else if(q instanceof s.Repetition){var te={idx:_,def:r.drop(D),ruleStack:V,occurrenceStack:J};L.push(te),L.push(Q);var Z=new s.Repetition({definition:q.definition,idx:q.idx}),j=q.definition.concat([Z],r.drop(D)),he={idx:_,def:j,ruleStack:V,occurrenceStack:J};L.push(he)}else if(q instanceof s.Alternation)for(var ne=q.definition.length-1;ne>=0;ne--){var Ae=q.definition[ne],be={idx:_,def:Ae.definition.concat(r.drop(D)),ruleStack:V,occurrenceStack:J};L.push(be),L.push(Q)}else if(q instanceof s.Alternative)L.push({idx:_,def:q.definition.concat(r.drop(D)),ruleStack:V,occurrenceStack:J});else if(q instanceof s.Rule)L.push(g(q,_,V,J));else throw Error("non exhaustive match")}}return O}i.nextPossibleTokensAfter=I;function g(l,h,p,C){var E=r.cloneArr(p);E.push(l.name);var B=r.cloneArr(C);return B.push(1),{idx:h,def:l.definition,ruleStack:E,occurrenceStack:B}}}),xt=Be(i=>{var e=i&&i.__extends||(function(){var v=function(O,L){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,D){k.__proto__=D}||function(k,D){for(var _ in D)Object.prototype.hasOwnProperty.call(D,_)&&(k[_]=D[_])},v(O,L)};return function(O,L){if(typeof L!="function"&&L!==null)throw new TypeError("Class extends value "+String(L)+" is not a constructor or null");v(O,L);function k(){this.constructor=O}O.prototype=L===null?Object.create(L):(k.prototype=L.prototype,new k)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.areTokenCategoriesNotUsed=i.isStrictPrefixOfPath=i.containsPath=i.getLookaheadPathsForOptionalProd=i.getLookaheadPathsForOr=i.lookAheadSequenceFromAlternatives=i.buildSingleAlternativeLookaheadFunction=i.buildAlternativesLookAheadFunc=i.buildLookaheadFuncForOptionalProd=i.buildLookaheadFuncForOr=i.getProdType=i.PROD_TYPE=void 0;var t=Se(),r=Lt(),n=ln(),s=bt(),o=We(),c=Ct(),A;(function(v){v[v.OPTION=0]="OPTION",v[v.REPETITION=1]="REPETITION",v[v.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",v[v.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",v[v.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",v[v.ALTERNATION=5]="ALTERNATION"})(A=i.PROD_TYPE||(i.PROD_TYPE={}));function a(v){if(v instanceof o.Option)return A.OPTION;if(v instanceof o.Repetition)return A.REPETITION;if(v instanceof o.RepetitionMandatory)return A.REPETITION_MANDATORY;if(v instanceof o.RepetitionMandatoryWithSeparator)return A.REPETITION_MANDATORY_WITH_SEPARATOR;if(v instanceof o.RepetitionWithSeparator)return A.REPETITION_WITH_SEPARATOR;if(v instanceof o.Alternation)return A.ALTERNATION;throw Error("non exhaustive match")}i.getProdType=a;function f(v,O,L,k,D,_){var V=E(v,O,L),J=U(V)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher;return _(V,k,J,D)}i.buildLookaheadFuncForOr=f;function u(v,O,L,k,D,_){var V=B(v,O,D,L),J=U(V)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher;return _(V[0],J,k)}i.buildLookaheadFuncForOptionalProd=u;function b(v,O,L,k){var D=v.length,_=t.every(v,function(q){return t.every(q,function(X){return X.length===1})});if(O)return function(q){for(var X=t.map(q,function(Z){return Z.GATE}),$=0;$<D;$++){var le=v[$],re=le.length,oe=X[$];if(!(oe!==void 0&&oe.call(this)===!1))e:for(var te=0;te<re;te++){for(var he=le[te],P=he.length,j=0;j<P;j++){var W=this.LA(j+1);if(L(W,he[j])===!1)continue e}return $}}};if(_&&!k){var V=t.map(v,function(q){return t.flatten(q)}),J=t.reduce(V,function(q,X,$){return t.forEach(X,function(le){t.has(q,le.tokenTypeIdx)||(q[le.tokenTypeIdx]=$),t.forEach(le.categoryMatches,function(re){t.has(q,re)||(q[re]=$)})}),q},[]);return function(){var q=this.LA(1);return J[q.tokenTypeIdx]}}else return function(){for(var q=0;q<D;q++){var X=v[q],$=X.length;e:for(var le=0;le<$;le++){for(var re=X[le],oe=re.length,te=0;te<oe;te++){var he=this.LA(te+1);if(L(he,re[te])===!1)continue e}return q}}}}i.buildAlternativesLookAheadFunc=b;function d(v,O,L){var k=t.every(v,function(X){return X.length===1}),D=v.length;if(k&&!L){var _=t.flatten(v);if(_.length===1&&t.isEmpty(_[0].categoryMatches)){var V=_[0],J=V.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===J}}else{var q=t.reduce(_,function(X,$,le){return X[$.tokenTypeIdx]=!0,t.forEach($.categoryMatches,function(re){X[re]=!0}),X},[]);return function(){var X=this.LA(1);return q[X.tokenTypeIdx]===!0}}}else return function(){e:for(var X=0;X<D;X++){for(var $=v[X],le=$.length,re=0;re<le;re++){var oe=this.LA(re+1);if(O(oe,$[re])===!1)continue e}return!0}return!1}}i.buildSingleAlternativeLookaheadFunction=d;var I=(function(v){e(O,v);function O(L,k,D){var _=v.call(this)||this;return _.topProd=L,_.targetOccurrence=k,_.targetProdType=D,_}return O.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},O.prototype.checkIsTarget=function(L,k,D,_){return L.idx===this.targetOccurrence&&this.targetProdType===k?(this.restDef=D.concat(_),!0):!1},O.prototype.walkOption=function(L,k,D){this.checkIsTarget(L,A.OPTION,k,D)||v.prototype.walkOption.call(this,L,k,D)},O.prototype.walkAtLeastOne=function(L,k,D){this.checkIsTarget(L,A.REPETITION_MANDATORY,k,D)||v.prototype.walkOption.call(this,L,k,D)},O.prototype.walkAtLeastOneSep=function(L,k,D){this.checkIsTarget(L,A.REPETITION_MANDATORY_WITH_SEPARATOR,k,D)||v.prototype.walkOption.call(this,L,k,D)},O.prototype.walkMany=function(L,k,D){this.checkIsTarget(L,A.REPETITION,k,D)||v.prototype.walkOption.call(this,L,k,D)},O.prototype.walkManySep=function(L,k,D){this.checkIsTarget(L,A.REPETITION_WITH_SEPARATOR,k,D)||v.prototype.walkOption.call(this,L,k,D)},O})(n.RestWalker),g=(function(v){e(O,v);function O(L,k,D){var _=v.call(this)||this;return _.targetOccurrence=L,_.targetProdType=k,_.targetRef=D,_.result=[],_}return O.prototype.checkIsTarget=function(L,k){L.idx===this.targetOccurrence&&this.targetProdType===k&&(this.targetRef===void 0||L===this.targetRef)&&(this.result=L.definition)},O.prototype.visitOption=function(L){this.checkIsTarget(L,A.OPTION)},O.prototype.visitRepetition=function(L){this.checkIsTarget(L,A.REPETITION)},O.prototype.visitRepetitionMandatory=function(L){this.checkIsTarget(L,A.REPETITION_MANDATORY)},O.prototype.visitRepetitionMandatoryWithSeparator=function(L){this.checkIsTarget(L,A.REPETITION_MANDATORY_WITH_SEPARATOR)},O.prototype.visitRepetitionWithSeparator=function(L){this.checkIsTarget(L,A.REPETITION_WITH_SEPARATOR)},O.prototype.visitAlternation=function(L){this.checkIsTarget(L,A.ALTERNATION)},O})(c.GAstVisitor);function l(v){for(var O=new Array(v),L=0;L<v;L++)O[L]=[];return O}function h(v){for(var O=[""],L=0;L<v.length;L++){for(var k=v[L],D=[],_=0;_<O.length;_++){var V=O[_];D.push(V+"_"+k.tokenTypeIdx);for(var J=0;J<k.categoryMatches.length;J++){var q="_"+k.categoryMatches[J];D.push(V+q)}}O=D}return O}function p(v,O,L){for(var k=0;k<v.length;k++)if(k!==L)for(var D=v[k],_=0;_<O.length;_++){var V=O[_];if(D[V]===!0)return!1}return!0}function C(v,O){for(var L=t.map(v,function($){return r.possiblePathsFrom([$],1)}),k=l(L.length),D=t.map(L,function($){var le={};return t.forEach($,function(re){var oe=h(re.partialPath);t.forEach(oe,function(te){le[te]=!0})}),le}),_=L,V=1;V<=O;V++){var J=_;_=l(J.length);for(var q=function($){for(var le=J[$],re=0;re<le.length;re++){var oe=le[re].partialPath,te=le[re].suffixDef,he=h(oe),P=p(D,he,$);if(P||t.isEmpty(te)||oe.length===O){var j=k[$];if(Q(j,oe)===!1){j.push(oe);for(var W=0;W<he.length;W++){var Z=he[W];D[$][Z]=!0}}}else{var ne=r.possiblePathsFrom(te,V+1,oe);_[$]=_[$].concat(ne),t.forEach(ne,function(Ae){var be=h(Ae.partialPath);t.forEach(be,function(Ie){D[$][Ie]=!0})})}}},X=0;X<J.length;X++)q(X)}return k}i.lookAheadSequenceFromAlternatives=C;function E(v,O,L,k){var D=new g(v,A.ALTERNATION,k);return O.accept(D),C(D.result,L)}i.getLookaheadPathsForOr=E;function B(v,O,L,k){var D=new g(v,L);O.accept(D);var _=D.result,V=new I(O,v,L),J=V.startWalking(),q=new o.Alternative({definition:_}),X=new o.Alternative({definition:J});return C([q,X],k)}i.getLookaheadPathsForOptionalProd=B;function Q(v,O){e:for(var L=0;L<v.length;L++){var k=v[L];if(k.length===O.length){for(var D=0;D<k.length;D++){var _=O[D],V=k[D],J=_===V||V.categoryMatchesMap[_.tokenTypeIdx]!==void 0;if(J===!1)continue e}return!0}}return!1}i.containsPath=Q;function S(v,O){return v.length<O.length&&t.every(v,function(L,k){var D=O[k];return L===D||D.categoryMatchesMap[L.tokenTypeIdx]})}i.isStrictPrefixOfPath=S;function U(v){return t.every(v,function(O){return t.every(O,function(L){return t.every(L,function(k){return t.isEmpty(k.categoryMatches)})})})}i.areTokenCategoriesNotUsed=U}),Oi=Be(i=>{var e=i&&i.__extends||(function(){var k=function(D,_){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(V,J){V.__proto__=J}||function(V,J){for(var q in J)Object.prototype.hasOwnProperty.call(J,q)&&(V[q]=J[q])},k(D,_)};return function(D,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");k(D,_);function V(){this.constructor=D}D.prototype=_===null?Object.create(_):(V.prototype=_.prototype,new V)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.checkPrefixAlternativesAmbiguities=i.validateSomeNonEmptyLookaheadPath=i.validateTooManyAlts=i.RepetionCollector=i.validateAmbiguousAlternationAlternatives=i.validateEmptyOrAlternative=i.getFirstNoneTerminal=i.validateNoLeftRecursion=i.validateRuleIsOverridden=i.validateRuleDoesNotAlreadyExist=i.OccurrenceValidationCollector=i.identifyProductionForDuplicates=i.validateGrammar=void 0;var t=Se(),r=Se(),n=Xe(),s=St(),o=xt(),c=Lt(),A=We(),a=Ct();function f(k,D,_,V,J){var q=t.map(k,function(P){return u(P,V)}),X=t.map(k,function(P){return h(P,P,V)}),$=[],le=[],re=[];r.every(X,r.isEmpty)&&($=r.map(k,function(P){return E(P,V)}),le=r.map(k,function(P){return B(P,D,V)}),re=U(k,D,V));var oe=L(k,_,V),te=r.map(k,function(P){return S(P,V)}),he=r.map(k,function(P){return g(P,k,J,V)});return t.flatten(q.concat(re,X,$,le,oe,te,he))}i.validateGrammar=f;function u(k,D){var _=new I;k.accept(_);var V=_.allProductions,J=t.groupBy(V,b),q=t.pick(J,function($){return $.length>1}),X=t.map(t.values(q),function($){var le=t.first($),re=D.buildDuplicateFoundError(k,$),oe=s.getProductionDslName(le),te={message:re,type:n.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:k.name,dslName:oe,occurrence:le.idx},he=d(le);return he&&(te.parameter=he),te});return X}function b(k){return s.getProductionDslName(k)+"_#_"+k.idx+"_#_"+d(k)}i.identifyProductionForDuplicates=b;function d(k){return k instanceof A.Terminal?k.terminalType.name:k instanceof A.NonTerminal?k.nonTerminalName:""}var I=(function(k){e(D,k);function D(){var _=k!==null&&k.apply(this,arguments)||this;return _.allProductions=[],_}return D.prototype.visitNonTerminal=function(_){this.allProductions.push(_)},D.prototype.visitOption=function(_){this.allProductions.push(_)},D.prototype.visitRepetitionWithSeparator=function(_){this.allProductions.push(_)},D.prototype.visitRepetitionMandatory=function(_){this.allProductions.push(_)},D.prototype.visitRepetitionMandatoryWithSeparator=function(_){this.allProductions.push(_)},D.prototype.visitRepetition=function(_){this.allProductions.push(_)},D.prototype.visitAlternation=function(_){this.allProductions.push(_)},D.prototype.visitTerminal=function(_){this.allProductions.push(_)},D})(a.GAstVisitor);i.OccurrenceValidationCollector=I;function g(k,D,_,V){var J=[],q=r.reduce(D,function($,le){return le.name===k.name?$+1:$},0);if(q>1){var X=V.buildDuplicateRuleNameError({topLevelRule:k,grammarName:_});J.push({message:X,type:n.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:k.name})}return J}i.validateRuleDoesNotAlreadyExist=g;function l(k,D,_){var V=[],J;return t.contains(D,k)||(J="Invalid rule override, rule: ->"+k+"<- cannot be overridden in the grammar: ->"+_+"<-as it is not defined in any of the super grammars ",V.push({message:J,type:n.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:k})),V}i.validateRuleIsOverridden=l;function h(k,D,_,V){V===void 0&&(V=[]);var J=[],q=p(D.definition);if(t.isEmpty(q))return[];var X=k.name,$=t.contains(q,k);$&&J.push({message:_.buildLeftRecursionError({topLevelRule:k,leftRecursionPath:V}),type:n.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:X});var le=t.difference(q,V.concat([k])),re=t.map(le,function(oe){var te=t.cloneArr(V);return te.push(oe),h(k,oe,_,te)});return J.concat(t.flatten(re))}i.validateNoLeftRecursion=h;function p(k){var D=[];if(t.isEmpty(k))return D;var _=t.first(k);if(_ instanceof A.NonTerminal)D.push(_.referencedRule);else if(_ instanceof A.Alternative||_ instanceof A.Option||_ instanceof A.RepetitionMandatory||_ instanceof A.RepetitionMandatoryWithSeparator||_ instanceof A.RepetitionWithSeparator||_ instanceof A.Repetition)D=D.concat(p(_.definition));else if(_ instanceof A.Alternation)D=t.flatten(t.map(_.definition,function(X){return p(X.definition)}));else if(!(_ instanceof A.Terminal))throw Error("non exhaustive match");var V=s.isOptionalProd(_),J=k.length>1;if(V&&J){var q=t.drop(k);return D.concat(p(q))}else return D}i.getFirstNoneTerminal=p;var C=(function(k){e(D,k);function D(){var _=k!==null&&k.apply(this,arguments)||this;return _.alternations=[],_}return D.prototype.visitAlternation=function(_){this.alternations.push(_)},D})(a.GAstVisitor);function E(k,D){var _=new C;k.accept(_);var V=_.alternations,J=t.reduce(V,function(q,X){var $=t.dropRight(X.definition),le=t.map($,function(re,oe){var te=c.nextPossibleTokensAfter([re],[],null,1);return t.isEmpty(te)?{message:D.buildEmptyAlternationError({topLevelRule:k,alternation:X,emptyChoiceIdx:oe}),type:n.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:k.name,occurrence:X.idx,alternative:oe+1}:null});return q.concat(t.compact(le))},[]);return J}i.validateEmptyOrAlternative=E;function B(k,D,_){var V=new C;k.accept(V);var J=V.alternations;J=r.reject(J,function(X){return X.ignoreAmbiguities===!0});var q=t.reduce(J,function(X,$){var le=$.idx,re=$.maxLookahead||D,oe=o.getLookaheadPathsForOr(le,k,re,$),te=v(oe,$,k,_),he=O(oe,$,k,_);return X.concat(te,he)},[]);return q}i.validateAmbiguousAlternationAlternatives=B;var Q=(function(k){e(D,k);function D(){var _=k!==null&&k.apply(this,arguments)||this;return _.allProductions=[],_}return D.prototype.visitRepetitionWithSeparator=function(_){this.allProductions.push(_)},D.prototype.visitRepetitionMandatory=function(_){this.allProductions.push(_)},D.prototype.visitRepetitionMandatoryWithSeparator=function(_){this.allProductions.push(_)},D.prototype.visitRepetition=function(_){this.allProductions.push(_)},D})(a.GAstVisitor);i.RepetionCollector=Q;function S(k,D){var _=new C;k.accept(_);var V=_.alternations,J=t.reduce(V,function(q,X){return X.definition.length>255&&q.push({message:D.buildTooManyAlternativesError({topLevelRule:k,alternation:X}),type:n.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:k.name,occurrence:X.idx}),q},[]);return J}i.validateTooManyAlts=S;function U(k,D,_){var V=[];return r.forEach(k,function(J){var q=new Q;J.accept(q);var X=q.allProductions;r.forEach(X,function($){var le=o.getProdType($),re=$.maxLookahead||D,oe=$.idx,te=o.getLookaheadPathsForOptionalProd(oe,J,le,re),he=te[0];if(r.isEmpty(r.flatten(he))){var P=_.buildEmptyRepetitionError({topLevelRule:J,repetition:$});V.push({message:P,type:n.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:J.name})}})}),V}i.validateSomeNonEmptyLookaheadPath=U;function v(k,D,_,V){var J=[],q=r.reduce(k,function($,le,re){return D.definition[re].ignoreAmbiguities===!0||r.forEach(le,function(oe){var te=[re];r.forEach(k,function(he,P){re!==P&&o.containsPath(he,oe)&&D.definition[P].ignoreAmbiguities!==!0&&te.push(P)}),te.length>1&&!o.containsPath(J,oe)&&(J.push(oe),$.push({alts:te,path:oe}))}),$},[]),X=t.map(q,function($){var le=r.map($.alts,function(oe){return oe+1}),re=V.buildAlternationAmbiguityError({topLevelRule:_,alternation:D,ambiguityIndices:le,prefixPath:$.path});return{message:re,type:n.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:_.name,occurrence:D.idx,alternatives:[$.alts]}});return X}function O(k,D,_,V){var J=[],q=r.reduce(k,function(X,$,le){var re=r.map($,function(oe){return{idx:le,path:oe}});return X.concat(re)},[]);return r.forEach(q,function(X){var $=D.definition[X.idx];if($.ignoreAmbiguities!==!0){var le=X.idx,re=X.path,oe=r.findAll(q,function(he){return D.definition[he.idx].ignoreAmbiguities!==!0&&he.idx<le&&o.isStrictPrefixOfPath(he.path,re)}),te=r.map(oe,function(he){var P=[he.idx+1,le+1],j=D.idx===0?"":D.idx,W=V.buildAlternationPrefixAmbiguityError({topLevelRule:_,alternation:D,ambiguityIndices:P,prefixPath:he.path});return{message:W,type:n.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:_.name,occurrence:j,alternatives:P}});J=J.concat(te)}}),J}i.checkPrefixAlternativesAmbiguities=O;function L(k,D,_){var V=[],J=r.map(D,function(q){return q.name});return r.forEach(k,function(q){var X=q.name;if(r.contains(J,X)){var $=_.buildNamespaceConflictError(q);V.push({message:$,type:n.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:X})}}),V}}),Do=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.validateGrammar=i.resolveGrammar=void 0;var e=Se(),t=No(),r=Oi(),n=_t();function s(c){c=e.defaults(c,{errMsgProvider:n.defaultGrammarResolverErrorProvider});var A={};return e.forEach(c.rules,function(a){A[a.name]=a}),t.resolveGrammar(A,c.errMsgProvider)}i.resolveGrammar=s;function o(c){return c=e.defaults(c,{errMsgProvider:n.defaultGrammarValidatorErrorProvider}),r.validateGrammar(c.rules,c.maxLookahead,c.tokenTypes,c.errMsgProvider,c.grammarName)}i.validateGrammar=o}),yt=Be(i=>{var e=i&&i.__extends||(function(){var I=function(g,l){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var C in p)Object.prototype.hasOwnProperty.call(p,C)&&(h[C]=p[C])},I(g,l)};return function(g,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");I(g,l);function h(){this.constructor=g}g.prototype=l===null?Object.create(l):(h.prototype=l.prototype,new h)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.EarlyExitException=i.NotAllInputParsedException=i.NoViableAltException=i.MismatchedTokenException=i.isRecognitionException=void 0;var t=Se(),r="MismatchedTokenException",n="NoViableAltException",s="EarlyExitException",o="NotAllInputParsedException",c=[r,n,s,o];Object.freeze(c);function A(I){return t.contains(c,I.name)}i.isRecognitionException=A;var a=(function(I){e(g,I);function g(l,h){var p=this.constructor,C=I.call(this,l)||this;return C.token=h,C.resyncedTokens=[],Object.setPrototypeOf(C,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(C,C.constructor),C}return g})(Error),f=(function(I){e(g,I);function g(l,h,p){var C=I.call(this,l,h)||this;return C.previousToken=p,C.name=r,C}return g})(a);i.MismatchedTokenException=f;var u=(function(I){e(g,I);function g(l,h,p){var C=I.call(this,l,h)||this;return C.previousToken=p,C.name=n,C}return g})(a);i.NoViableAltException=u;var b=(function(I){e(g,I);function g(l,h){var p=I.call(this,l,h)||this;return p.name=o,p}return g})(a);i.NotAllInputParsedException=b;var d=(function(I){e(g,I);function g(l,h,p){var C=I.call(this,l,h)||this;return C.previousToken=p,C.name=s,C}return g})(a);i.EarlyExitException=d}),Pi=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.attemptInRepetitionRecovery=i.Recoverable=i.InRuleRecoveryException=i.IN_RULE_RECOVERY_EXCEPTION=i.EOF_FOLLOW_KEY=void 0;var e=ct(),t=Se(),r=yt(),n=Mi(),s=Xe();i.EOF_FOLLOW_KEY={},i.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function o(a){this.name=i.IN_RULE_RECOVERY_EXCEPTION,this.message=a}i.InRuleRecoveryException=o,o.prototype=Error.prototype;var c=(function(){function a(){}return a.prototype.initRecoverable=function(f){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(f,"recoveryEnabled")?f.recoveryEnabled:s.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=A)},a.prototype.getTokenToInsert=function(f){var u=e.createTokenInstance(f,"",NaN,NaN,NaN,NaN,NaN,NaN);return u.isInsertedInRecovery=!0,u},a.prototype.canTokenTypeBeInsertedInRecovery=function(f){return!0},a.prototype.tryInRepetitionRecovery=function(f,u,b,d){for(var I=this,g=this.findReSyncTokenType(),l=this.exportLexerState(),h=[],p=!1,C=this.LA(1),E=this.LA(1),B=function(){var Q=I.LA(0),S=I.errorMessageProvider.buildMismatchTokenMessage({expected:d,actual:C,previous:Q,ruleName:I.getCurrRuleFullName()}),U=new r.MismatchedTokenException(S,C,I.LA(0));U.resyncedTokens=t.dropRight(h),I.SAVE_ERROR(U)};!p;)if(this.tokenMatcher(E,d)){B();return}else if(b.call(this)){B(),f.apply(this,u);return}else this.tokenMatcher(E,g)?p=!0:(E=this.SKIP_TOKEN(),this.addToResyncTokens(E,h));this.importLexerState(l)},a.prototype.shouldInRepetitionRecoveryBeTried=function(f,u,b){return!(b===!1||f===void 0||u===void 0||this.tokenMatcher(this.LA(1),f)||this.isBackTracking()||this.canPerformInRuleRecovery(f,this.getFollowsForInRuleRecovery(f,u)))},a.prototype.getFollowsForInRuleRecovery=function(f,u){var b=this.getCurrentGrammarPath(f,u),d=this.getNextPossibleTokenTypes(b);return d},a.prototype.tryInRuleRecovery=function(f,u){if(this.canRecoverWithSingleTokenInsertion(f,u)){var b=this.getTokenToInsert(f);return b}if(this.canRecoverWithSingleTokenDeletion(f)){var d=this.SKIP_TOKEN();return this.consumeToken(),d}throw new o("sad sad panda")},a.prototype.canPerformInRuleRecovery=function(f,u){return this.canRecoverWithSingleTokenInsertion(f,u)||this.canRecoverWithSingleTokenDeletion(f)},a.prototype.canRecoverWithSingleTokenInsertion=function(f,u){var b=this;if(!this.canTokenTypeBeInsertedInRecovery(f)||t.isEmpty(u))return!1;var d=this.LA(1),I=t.find(u,function(g){return b.tokenMatcher(d,g)})!==void 0;return I},a.prototype.canRecoverWithSingleTokenDeletion=function(f){var u=this.tokenMatcher(this.LA(2),f);return u},a.prototype.isInCurrentRuleReSyncSet=function(f){var u=this.getCurrFollowKey(),b=this.getFollowSetFromFollowKey(u);return t.contains(b,f)},a.prototype.findReSyncTokenType=function(){for(var f=this.flattenFollowSet(),u=this.LA(1),b=2;;){var d=u.tokenType;if(t.contains(f,d))return d;u=this.LA(b),b++}},a.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return i.EOF_FOLLOW_KEY;var f=this.getLastExplicitRuleShortName(),u=this.getLastExplicitRuleOccurrenceIndex(),b=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(f),idxInCallingRule:u,inRule:this.shortRuleNameToFullName(b)}},a.prototype.buildFullFollowKeyStack=function(){var f=this,u=this.RULE_STACK,b=this.RULE_OCCURRENCE_STACK;return t.map(u,function(d,I){return I===0?i.EOF_FOLLOW_KEY:{ruleName:f.shortRuleNameToFullName(d),idxInCallingRule:b[I],inRule:f.shortRuleNameToFullName(u[I-1])}})},a.prototype.flattenFollowSet=function(){var f=this,u=t.map(this.buildFullFollowKeyStack(),function(b){return f.getFollowSetFromFollowKey(b)});return t.flatten(u)},a.prototype.getFollowSetFromFollowKey=function(f){if(f===i.EOF_FOLLOW_KEY)return[e.EOF];var u=f.ruleName+f.idxInCallingRule+n.IN+f.inRule;return this.resyncFollows[u]},a.prototype.addToResyncTokens=function(f,u){return this.tokenMatcher(f,e.EOF)||u.push(f),u},a.prototype.reSyncTo=function(f){for(var u=[],b=this.LA(1);this.tokenMatcher(b,f)===!1;)b=this.SKIP_TOKEN(),this.addToResyncTokens(b,u);return t.dropRight(u)},a.prototype.attemptInRepetitionRecovery=function(f,u,b,d,I,g,l){},a.prototype.getCurrentGrammarPath=function(f,u){var b=this.getHumanReadableRuleStack(),d=t.cloneArr(this.RULE_OCCURRENCE_STACK),I={ruleStack:b,occurrenceStack:d,lastTok:f,lastTokOccurrence:u};return I},a.prototype.getHumanReadableRuleStack=function(){var f=this;return t.map(this.RULE_STACK,function(u){return f.shortRuleNameToFullName(u)})},a})();i.Recoverable=c;function A(a,f,u,b,d,I,g){var l=this.getKeyForAutomaticLookahead(b,d),h=this.firstAfterRepMap[l];if(h===void 0){var p=this.getCurrRuleFullName(),C=this.getGAstProductions()[p],E=new I(C,d);h=E.startWalking(),this.firstAfterRepMap[l]=h}var B=h.token,Q=h.occurrence,S=h.isEndOfRule;this.RULE_STACK.length===1&&S&&B===void 0&&(B=e.EOF,Q=1),this.shouldInRepetitionRecoveryBeTried(B,Q,g)&&this.tryInRepetitionRecovery(a,f,u,B)}i.attemptInRepetitionRecovery=A}),un=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getKeyForAutomaticLookahead=i.AT_LEAST_ONE_SEP_IDX=i.MANY_SEP_IDX=i.AT_LEAST_ONE_IDX=i.MANY_IDX=i.OPTION_IDX=i.OR_IDX=i.BITS_FOR_ALT_IDX=i.BITS_FOR_RULE_IDX=i.BITS_FOR_OCCURRENCE_IDX=i.BITS_FOR_METHOD_TYPE=void 0,i.BITS_FOR_METHOD_TYPE=4,i.BITS_FOR_OCCURRENCE_IDX=8,i.BITS_FOR_RULE_IDX=12,i.BITS_FOR_ALT_IDX=8,i.OR_IDX=1<<i.BITS_FOR_OCCURRENCE_IDX,i.OPTION_IDX=2<<i.BITS_FOR_OCCURRENCE_IDX,i.MANY_IDX=3<<i.BITS_FOR_OCCURRENCE_IDX,i.AT_LEAST_ONE_IDX=4<<i.BITS_FOR_OCCURRENCE_IDX,i.MANY_SEP_IDX=5<<i.BITS_FOR_OCCURRENCE_IDX,i.AT_LEAST_ONE_SEP_IDX=6<<i.BITS_FOR_OCCURRENCE_IDX;function e(t,r,n){return n|r|t}i.getKeyForAutomaticLookahead=e,32-i.BITS_FOR_ALT_IDX}),Fo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LooksAhead=void 0;var e=xt(),t=Se(),r=Xe(),n=un(),s=St(),o=(function(){function c(){}return c.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)},c.prototype.preComputeLookaheadFunctions=function(A){var a=this;t.forEach(A,function(f){a.TRACE_INIT(f.name+" Rule Lookahead",function(){var u=s.collectMethods(f),b=u.alternation,d=u.repetition,I=u.option,g=u.repetitionMandatory,l=u.repetitionMandatoryWithSeparator,h=u.repetitionWithSeparator;t.forEach(b,function(p){var C=p.idx===0?"":p.idx;a.TRACE_INIT(""+s.getProductionDslName(p)+C,function(){var E=e.buildLookaheadFuncForOr(p.idx,f,p.maxLookahead||a.maxLookahead,p.hasPredicates,a.dynamicTokensEnabled,a.lookAheadBuilderForAlternatives),B=n.getKeyForAutomaticLookahead(a.fullRuleNameToShort[f.name],n.OR_IDX,p.idx);a.setLaFuncCache(B,E)})}),t.forEach(d,function(p){a.computeLookaheadFunc(f,p.idx,n.MANY_IDX,e.PROD_TYPE.REPETITION,p.maxLookahead,s.getProductionDslName(p))}),t.forEach(I,function(p){a.computeLookaheadFunc(f,p.idx,n.OPTION_IDX,e.PROD_TYPE.OPTION,p.maxLookahead,s.getProductionDslName(p))}),t.forEach(g,function(p){a.computeLookaheadFunc(f,p.idx,n.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,p.maxLookahead,s.getProductionDslName(p))}),t.forEach(l,function(p){a.computeLookaheadFunc(f,p.idx,n.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,p.maxLookahead,s.getProductionDslName(p))}),t.forEach(h,function(p){a.computeLookaheadFunc(f,p.idx,n.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,p.maxLookahead,s.getProductionDslName(p))})})})},c.prototype.computeLookaheadFunc=function(A,a,f,u,b,d){var I=this;this.TRACE_INIT(""+d+(a===0?"":a),function(){var g=e.buildLookaheadFuncForOptionalProd(a,A,b||I.maxLookahead,I.dynamicTokensEnabled,u,I.lookAheadBuilderForOptional),l=n.getKeyForAutomaticLookahead(I.fullRuleNameToShort[A.name],f,a);I.setLaFuncCache(l,g)})},c.prototype.lookAheadBuilderForOptional=function(A,a,f){return e.buildSingleAlternativeLookaheadFunction(A,a,f)},c.prototype.lookAheadBuilderForAlternatives=function(A,a,f,u){return e.buildAlternativesLookAheadFunc(A,a,f,u)},c.prototype.getKeyForAutomaticLookahead=function(A,a){var f=this.getLastExplicitRuleShortName();return n.getKeyForAutomaticLookahead(f,A,a)},c.prototype.getLaFuncFromCache=function(A){},c.prototype.getLaFuncFromMap=function(A){return this.lookAheadFuncsCache.get(A)},c.prototype.getLaFuncFromObj=function(A){return this.lookAheadFuncsCache[A]},c.prototype.setLaFuncCache=function(A,a){},c.prototype.setLaFuncCacheUsingMap=function(A,a){this.lookAheadFuncsCache.set(A,a)},c.prototype.setLaFuncUsingObj=function(A,a){this.lookAheadFuncsCache[A]=a},c})();i.LooksAhead=o}),Mo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addNoneTerminalToCst=i.addTerminalToCst=i.setNodeLocationFull=i.setNodeLocationOnlyOffset=void 0;function e(s,o){isNaN(s.startOffset)===!0?(s.startOffset=o.startOffset,s.endOffset=o.endOffset):s.endOffset<o.endOffset&&(s.endOffset=o.endOffset)}i.setNodeLocationOnlyOffset=e;function t(s,o){isNaN(s.startOffset)===!0?(s.startOffset=o.startOffset,s.startColumn=o.startColumn,s.startLine=o.startLine,s.endOffset=o.endOffset,s.endColumn=o.endColumn,s.endLine=o.endLine):s.endOffset<o.endOffset&&(s.endOffset=o.endOffset,s.endColumn=o.endColumn,s.endLine=o.endLine)}i.setNodeLocationFull=t;function r(s,o,c){s.children[c]===void 0?s.children[c]=[o]:s.children[c].push(o)}i.addTerminalToCst=r;function n(s,o,c){s.children[o]===void 0?s.children[o]=[c]:s.children[o].push(c)}i.addNoneTerminalToCst=n}),Gi=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.defineNameProp=i.functionName=i.classNameFromInstance=void 0;var e=Se();function t(o){return n(o.constructor)}i.classNameFromInstance=t;var r="name";function n(o){var c=o.name;return c||"anonymous"}i.functionName=n;function s(o,c){var A=Object.getOwnPropertyDescriptor(o,r);return e.isUndefined(A)||A.configurable?(Object.defineProperty(o,r,{enumerable:!1,configurable:!0,writable:!1,value:c}),!0):!1}i.defineNameProp=s}),Oo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.validateRedundantMethods=i.validateMissingCstMethods=i.validateVisitor=i.CstVisitorDefinitionError=i.createBaseVisitorConstructorWithDefaults=i.createBaseSemanticVisitorConstructor=i.defaultVisit=void 0;var e=Se(),t=Gi();function r(u,b){for(var d=e.keys(u),I=d.length,g=0;g<I;g++)for(var l=d[g],h=u[l],p=h.length,C=0;C<p;C++){var E=h[C];E.tokenTypeIdx===void 0&&this[E.name](E.children,b)}}i.defaultVisit=r;function n(u,b){var d=function(){};t.defineNameProp(d,u+"BaseSemantics");var I={visit:function(g,l){if(e.isArray(g)&&(g=g[0]),!e.isUndefined(g))return this[g.name](g.children,l)},validateVisitor:function(){var g=c(this,b);if(!e.isEmpty(g)){var l=e.map(g,function(h){return h.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
163
164
  `+(""+l.join(`
164
165
 
165
166
  `).replace(/\n/g,`
166
- `)))}}};return p.prototype=T,p.prototype.constructor=p,p._RULE_NAMES=g,p}n.createBaseSemanticVisitorConstructor=r;function a(h,g,p){var T=function(){};t.defineNameProp(T,h+"BaseSemanticsWithDefaults");var m=Object.create(p.prototype);return e.forEach(g,function(l){m[l]=i}),T.prototype=m,T.prototype.constructor=T,T}n.createBaseVisitorConstructorWithDefaults=a;var o;(function(h){h[h.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",h[h.MISSING_METHOD=1]="MISSING_METHOD"})(o=n.CstVisitorDefinitionError||(n.CstVisitorDefinitionError={}));function u(h,g){var p=c(h,g),T=f(h,g);return p.concat(T)}n.validateVisitor=u;function c(h,g){var p=e.map(g,function(T){if(!e.isFunction(h[T]))return{msg:"Missing visitor method: <"+T+"> on "+t.functionName(h.constructor)+" CST Visitor.",type:o.MISSING_METHOD,methodName:T}});return e.compact(p)}n.validateMissingCstMethods=c;var s=["constructor","visit","validateVisitor"];function f(h,g){var p=[];for(var T in h)e.isFunction(h[T])&&!e.contains(s,T)&&!e.contains(g,T)&&p.push({msg:"Redundant visitor method: <"+T+"> on "+t.functionName(h.constructor)+` CST Visitor
167
+ `)))}}};return d.prototype=I,d.prototype.constructor=d,d._RULE_NAMES=b,d}i.createBaseSemanticVisitorConstructor=n;function s(u,b,d){var I=function(){};t.defineNameProp(I,u+"BaseSemanticsWithDefaults");var g=Object.create(d.prototype);return e.forEach(b,function(l){g[l]=r}),I.prototype=g,I.prototype.constructor=I,I}i.createBaseVisitorConstructorWithDefaults=s;var o;(function(u){u[u.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",u[u.MISSING_METHOD=1]="MISSING_METHOD"})(o=i.CstVisitorDefinitionError||(i.CstVisitorDefinitionError={}));function c(u,b){var d=A(u,b),I=f(u,b);return d.concat(I)}i.validateVisitor=c;function A(u,b){var d=e.map(b,function(I){if(!e.isFunction(u[I]))return{msg:"Missing visitor method: <"+I+"> on "+t.functionName(u.constructor)+" CST Visitor.",type:o.MISSING_METHOD,methodName:I}});return e.compact(d)}i.validateMissingCstMethods=A;var a=["constructor","visit","validateVisitor"];function f(u,b){var d=[];for(var I in u)e.isFunction(u[I])&&!e.contains(a,I)&&!e.contains(b,I)&&d.push({msg:"Redundant visitor method: <"+I+"> on "+t.functionName(u.constructor)+` CST Visitor
167
168
  There is no Grammar Rule corresponding to this method's name.
168
- `,type:o.REDUNDANT_METHOD,methodName:T});return p}n.validateRedundantMethods=f}),li=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TreeBuilder=void 0;var e=ai(),t=xe(),i=ci(),r=Ye(),a=(function(){function o(){}return o.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+'"')},o.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(u){u.location={startOffset:NaN,endOffset:NaN}},o.prototype.setInitialNodeLocationOnlyOffsetRegular=function(u){u.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},o.prototype.setInitialNodeLocationFullRecovery=function(u){u.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.setInitialNodeLocationFullRegular=function(u){var c=this.LA(1);u.location={startOffset:c.startOffset,startLine:c.startLine,startColumn:c.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.cstInvocationStateUpdate=function(u,c){var s={name:u,children:{}};this.setInitialNodeLocation(s),this.CST_STACK.push(s)},o.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},o.prototype.cstPostRuleFull=function(u){var c=this.LA(0),s=u.location;s.startOffset<=c.startOffset?(s.endOffset=c.endOffset,s.endLine=c.endLine,s.endColumn=c.endColumn):(s.startOffset=NaN,s.startLine=NaN,s.startColumn=NaN)},o.prototype.cstPostRuleOnlyOffset=function(u){var c=this.LA(0),s=u.location;s.startOffset<=c.startOffset?s.endOffset=c.endOffset:s.startOffset=NaN},o.prototype.cstPostTerminal=function(u,c){var s=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(s,c,u),this.setNodeLocationFromToken(s.location,c)},o.prototype.cstPostNonTerminal=function(u,c){var s=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(s,c,u),this.setNodeLocationFromNode(s.location,u.location)},o.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},o.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},o.prototype.getLastExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-1]},o.prototype.getPreviousExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-2]},o.prototype.getLastExplicitRuleOccurrenceIndex=function(){var u=this.RULE_OCCURRENCE_STACK;return u[u.length-1]},o})();n.TreeBuilder=a}),ui=ve(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 a=this.currIdx+r;return a<0||this.tokVectorLength<=a?e.END_OF_FILE:this.tokVector[a]},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}),hi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerApi=void 0;var e=xe(),t=dt(),i=Ye(),r=Et(),a=Sn(),o=He(),u=(function(){function c(){}return c.prototype.ACTION=function(s){return s.call(this)},c.prototype.consume=function(s,f,h){return this.consumeInternal(f,s,h)},c.prototype.subrule=function(s,f,h){return this.subruleInternal(f,s,h)},c.prototype.option=function(s,f){return this.optionInternal(f,s)},c.prototype.or=function(s,f){return this.orInternal(f,s)},c.prototype.many=function(s,f){return this.manyInternal(s,f)},c.prototype.atLeastOne=function(s,f){return this.atLeastOneInternal(s,f)},c.prototype.CONSUME=function(s,f){return this.consumeInternal(s,0,f)},c.prototype.CONSUME1=function(s,f){return this.consumeInternal(s,1,f)},c.prototype.CONSUME2=function(s,f){return this.consumeInternal(s,2,f)},c.prototype.CONSUME3=function(s,f){return this.consumeInternal(s,3,f)},c.prototype.CONSUME4=function(s,f){return this.consumeInternal(s,4,f)},c.prototype.CONSUME5=function(s,f){return this.consumeInternal(s,5,f)},c.prototype.CONSUME6=function(s,f){return this.consumeInternal(s,6,f)},c.prototype.CONSUME7=function(s,f){return this.consumeInternal(s,7,f)},c.prototype.CONSUME8=function(s,f){return this.consumeInternal(s,8,f)},c.prototype.CONSUME9=function(s,f){return this.consumeInternal(s,9,f)},c.prototype.SUBRULE=function(s,f){return this.subruleInternal(s,0,f)},c.prototype.SUBRULE1=function(s,f){return this.subruleInternal(s,1,f)},c.prototype.SUBRULE2=function(s,f){return this.subruleInternal(s,2,f)},c.prototype.SUBRULE3=function(s,f){return this.subruleInternal(s,3,f)},c.prototype.SUBRULE4=function(s,f){return this.subruleInternal(s,4,f)},c.prototype.SUBRULE5=function(s,f){return this.subruleInternal(s,5,f)},c.prototype.SUBRULE6=function(s,f){return this.subruleInternal(s,6,f)},c.prototype.SUBRULE7=function(s,f){return this.subruleInternal(s,7,f)},c.prototype.SUBRULE8=function(s,f){return this.subruleInternal(s,8,f)},c.prototype.SUBRULE9=function(s,f){return this.subruleInternal(s,9,f)},c.prototype.OPTION=function(s){return this.optionInternal(s,0)},c.prototype.OPTION1=function(s){return this.optionInternal(s,1)},c.prototype.OPTION2=function(s){return this.optionInternal(s,2)},c.prototype.OPTION3=function(s){return this.optionInternal(s,3)},c.prototype.OPTION4=function(s){return this.optionInternal(s,4)},c.prototype.OPTION5=function(s){return this.optionInternal(s,5)},c.prototype.OPTION6=function(s){return this.optionInternal(s,6)},c.prototype.OPTION7=function(s){return this.optionInternal(s,7)},c.prototype.OPTION8=function(s){return this.optionInternal(s,8)},c.prototype.OPTION9=function(s){return this.optionInternal(s,9)},c.prototype.OR=function(s){return this.orInternal(s,0)},c.prototype.OR1=function(s){return this.orInternal(s,1)},c.prototype.OR2=function(s){return this.orInternal(s,2)},c.prototype.OR3=function(s){return this.orInternal(s,3)},c.prototype.OR4=function(s){return this.orInternal(s,4)},c.prototype.OR5=function(s){return this.orInternal(s,5)},c.prototype.OR6=function(s){return this.orInternal(s,6)},c.prototype.OR7=function(s){return this.orInternal(s,7)},c.prototype.OR8=function(s){return this.orInternal(s,8)},c.prototype.OR9=function(s){return this.orInternal(s,9)},c.prototype.MANY=function(s){this.manyInternal(0,s)},c.prototype.MANY1=function(s){this.manyInternal(1,s)},c.prototype.MANY2=function(s){this.manyInternal(2,s)},c.prototype.MANY3=function(s){this.manyInternal(3,s)},c.prototype.MANY4=function(s){this.manyInternal(4,s)},c.prototype.MANY5=function(s){this.manyInternal(5,s)},c.prototype.MANY6=function(s){this.manyInternal(6,s)},c.prototype.MANY7=function(s){this.manyInternal(7,s)},c.prototype.MANY8=function(s){this.manyInternal(8,s)},c.prototype.MANY9=function(s){this.manyInternal(9,s)},c.prototype.MANY_SEP=function(s){this.manySepFirstInternal(0,s)},c.prototype.MANY_SEP1=function(s){this.manySepFirstInternal(1,s)},c.prototype.MANY_SEP2=function(s){this.manySepFirstInternal(2,s)},c.prototype.MANY_SEP3=function(s){this.manySepFirstInternal(3,s)},c.prototype.MANY_SEP4=function(s){this.manySepFirstInternal(4,s)},c.prototype.MANY_SEP5=function(s){this.manySepFirstInternal(5,s)},c.prototype.MANY_SEP6=function(s){this.manySepFirstInternal(6,s)},c.prototype.MANY_SEP7=function(s){this.manySepFirstInternal(7,s)},c.prototype.MANY_SEP8=function(s){this.manySepFirstInternal(8,s)},c.prototype.MANY_SEP9=function(s){this.manySepFirstInternal(9,s)},c.prototype.AT_LEAST_ONE=function(s){this.atLeastOneInternal(0,s)},c.prototype.AT_LEAST_ONE1=function(s){return this.atLeastOneInternal(1,s)},c.prototype.AT_LEAST_ONE2=function(s){this.atLeastOneInternal(2,s)},c.prototype.AT_LEAST_ONE3=function(s){this.atLeastOneInternal(3,s)},c.prototype.AT_LEAST_ONE4=function(s){this.atLeastOneInternal(4,s)},c.prototype.AT_LEAST_ONE5=function(s){this.atLeastOneInternal(5,s)},c.prototype.AT_LEAST_ONE6=function(s){this.atLeastOneInternal(6,s)},c.prototype.AT_LEAST_ONE7=function(s){this.atLeastOneInternal(7,s)},c.prototype.AT_LEAST_ONE8=function(s){this.atLeastOneInternal(8,s)},c.prototype.AT_LEAST_ONE9=function(s){this.atLeastOneInternal(9,s)},c.prototype.AT_LEAST_ONE_SEP=function(s){this.atLeastOneSepFirstInternal(0,s)},c.prototype.AT_LEAST_ONE_SEP1=function(s){this.atLeastOneSepFirstInternal(1,s)},c.prototype.AT_LEAST_ONE_SEP2=function(s){this.atLeastOneSepFirstInternal(2,s)},c.prototype.AT_LEAST_ONE_SEP3=function(s){this.atLeastOneSepFirstInternal(3,s)},c.prototype.AT_LEAST_ONE_SEP4=function(s){this.atLeastOneSepFirstInternal(4,s)},c.prototype.AT_LEAST_ONE_SEP5=function(s){this.atLeastOneSepFirstInternal(5,s)},c.prototype.AT_LEAST_ONE_SEP6=function(s){this.atLeastOneSepFirstInternal(6,s)},c.prototype.AT_LEAST_ONE_SEP7=function(s){this.atLeastOneSepFirstInternal(7,s)},c.prototype.AT_LEAST_ONE_SEP8=function(s){this.atLeastOneSepFirstInternal(8,s)},c.prototype.AT_LEAST_ONE_SEP9=function(s){this.atLeastOneSepFirstInternal(9,s)},c.prototype.RULE=function(s,f,h){if(h===void 0&&(h=i.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,s)){var g=r.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:s,grammarName:this.className}),p={message:g,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:s};this.definitionErrors.push(p)}this.definedRulesNames.push(s);var T=this.defineRule(s,f,h);return this[s]=T,T},c.prototype.OVERRIDE_RULE=function(s,f,h){h===void 0&&(h=i.DEFAULT_RULE_CONFIG);var g=[];g=g.concat(a.validateRuleIsOverridden(s,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(g);var p=this.defineRule(s,f,h);return this[s]=p,p},c.prototype.BACKTRACK=function(s,f){return function(){this.isBackTrackingStack.push(1);var h=this.saveRecogState();try{return s.apply(this,f),!0}catch(g){if(t.isRecognitionException(g))return!1;throw g}finally{this.reloadRecogState(h),this.isBackTrackingStack.pop()}}},c.prototype.getGAstProductions=function(){return this.gastProductionsCache},c.prototype.getSerializedGastProductions=function(){return o.serializeGrammar(e.values(this.gastProductionsCache))},c})();n.RecognizerApi=u}),fi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerEngine=void 0;var e=xe(),t=Bt(),i=dt(),r=Rt(),a=vt(),o=Ye(),u=On(),c=nt(),s=ht(),f=xn(),h=(function(){function g(){}return g.prototype.initRecognizerEngine=function(p,T){if(this.className=f.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=s.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(T,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
169
+ `,type:o.REDUNDANT_METHOD,methodName:I});return d}i.validateRedundantMethods=f}),Po=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TreeBuilder=void 0;var e=Mo(),t=Se(),r=Oo(),n=Xe(),s=(function(){function o(){}return o.prototype.initTreeBuilder=function(c){if(this.CST_STACK=[],this.outputCst=c.outputCst,this.nodeLocationTracking=t.has(c,"nodeLocationTracking")?c.nodeLocationTracking:n.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: "'+c.nodeLocationTracking+'"')},o.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(c){c.location={startOffset:NaN,endOffset:NaN}},o.prototype.setInitialNodeLocationOnlyOffsetRegular=function(c){c.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},o.prototype.setInitialNodeLocationFullRecovery=function(c){c.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.setInitialNodeLocationFullRegular=function(c){var A=this.LA(1);c.location={startOffset:A.startOffset,startLine:A.startLine,startColumn:A.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.cstInvocationStateUpdate=function(c,A){var a={name:c,children:{}};this.setInitialNodeLocation(a),this.CST_STACK.push(a)},o.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},o.prototype.cstPostRuleFull=function(c){var A=this.LA(0),a=c.location;a.startOffset<=A.startOffset?(a.endOffset=A.endOffset,a.endLine=A.endLine,a.endColumn=A.endColumn):(a.startOffset=NaN,a.startLine=NaN,a.startColumn=NaN)},o.prototype.cstPostRuleOnlyOffset=function(c){var A=this.LA(0),a=c.location;a.startOffset<=A.startOffset?a.endOffset=A.endOffset:a.startOffset=NaN},o.prototype.cstPostTerminal=function(c,A){var a=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(a,A,c),this.setNodeLocationFromToken(a.location,A)},o.prototype.cstPostNonTerminal=function(c,A){var a=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(a,A,c),this.setNodeLocationFromNode(a.location,c.location)},o.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var c=r.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=c,c}return this.baseCstVisitorConstructor},o.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var c=r.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=c,c}return this.baseCstVisitorWithDefaultsConstructor},o.prototype.getLastExplicitRuleShortName=function(){var c=this.RULE_STACK;return c[c.length-1]},o.prototype.getPreviousExplicitRuleShortName=function(){var c=this.RULE_STACK;return c[c.length-2]},o.prototype.getLastExplicitRuleOccurrenceIndex=function(){var c=this.RULE_OCCURRENCE_STACK;return c[c.length-1]},o})();i.TreeBuilder=s}),Go=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LexerAdapter=void 0;var e=Xe(),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(n){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=n,this.tokVectorLength=n.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(n){var s=this.currIdx+n;return s<0||this.tokVectorLength<=s?e.END_OF_FILE:this.tokVector[s]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(n){this.currIdx=n},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})();i.LexerAdapter=t}),Uo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RecognizerApi=void 0;var e=Se(),t=yt(),r=Xe(),n=_t(),s=Oi(),o=We(),c=(function(){function A(){}return A.prototype.ACTION=function(a){return a.call(this)},A.prototype.consume=function(a,f,u){return this.consumeInternal(f,a,u)},A.prototype.subrule=function(a,f,u){return this.subruleInternal(f,a,u)},A.prototype.option=function(a,f){return this.optionInternal(f,a)},A.prototype.or=function(a,f){return this.orInternal(f,a)},A.prototype.many=function(a,f){return this.manyInternal(a,f)},A.prototype.atLeastOne=function(a,f){return this.atLeastOneInternal(a,f)},A.prototype.CONSUME=function(a,f){return this.consumeInternal(a,0,f)},A.prototype.CONSUME1=function(a,f){return this.consumeInternal(a,1,f)},A.prototype.CONSUME2=function(a,f){return this.consumeInternal(a,2,f)},A.prototype.CONSUME3=function(a,f){return this.consumeInternal(a,3,f)},A.prototype.CONSUME4=function(a,f){return this.consumeInternal(a,4,f)},A.prototype.CONSUME5=function(a,f){return this.consumeInternal(a,5,f)},A.prototype.CONSUME6=function(a,f){return this.consumeInternal(a,6,f)},A.prototype.CONSUME7=function(a,f){return this.consumeInternal(a,7,f)},A.prototype.CONSUME8=function(a,f){return this.consumeInternal(a,8,f)},A.prototype.CONSUME9=function(a,f){return this.consumeInternal(a,9,f)},A.prototype.SUBRULE=function(a,f){return this.subruleInternal(a,0,f)},A.prototype.SUBRULE1=function(a,f){return this.subruleInternal(a,1,f)},A.prototype.SUBRULE2=function(a,f){return this.subruleInternal(a,2,f)},A.prototype.SUBRULE3=function(a,f){return this.subruleInternal(a,3,f)},A.prototype.SUBRULE4=function(a,f){return this.subruleInternal(a,4,f)},A.prototype.SUBRULE5=function(a,f){return this.subruleInternal(a,5,f)},A.prototype.SUBRULE6=function(a,f){return this.subruleInternal(a,6,f)},A.prototype.SUBRULE7=function(a,f){return this.subruleInternal(a,7,f)},A.prototype.SUBRULE8=function(a,f){return this.subruleInternal(a,8,f)},A.prototype.SUBRULE9=function(a,f){return this.subruleInternal(a,9,f)},A.prototype.OPTION=function(a){return this.optionInternal(a,0)},A.prototype.OPTION1=function(a){return this.optionInternal(a,1)},A.prototype.OPTION2=function(a){return this.optionInternal(a,2)},A.prototype.OPTION3=function(a){return this.optionInternal(a,3)},A.prototype.OPTION4=function(a){return this.optionInternal(a,4)},A.prototype.OPTION5=function(a){return this.optionInternal(a,5)},A.prototype.OPTION6=function(a){return this.optionInternal(a,6)},A.prototype.OPTION7=function(a){return this.optionInternal(a,7)},A.prototype.OPTION8=function(a){return this.optionInternal(a,8)},A.prototype.OPTION9=function(a){return this.optionInternal(a,9)},A.prototype.OR=function(a){return this.orInternal(a,0)},A.prototype.OR1=function(a){return this.orInternal(a,1)},A.prototype.OR2=function(a){return this.orInternal(a,2)},A.prototype.OR3=function(a){return this.orInternal(a,3)},A.prototype.OR4=function(a){return this.orInternal(a,4)},A.prototype.OR5=function(a){return this.orInternal(a,5)},A.prototype.OR6=function(a){return this.orInternal(a,6)},A.prototype.OR7=function(a){return this.orInternal(a,7)},A.prototype.OR8=function(a){return this.orInternal(a,8)},A.prototype.OR9=function(a){return this.orInternal(a,9)},A.prototype.MANY=function(a){this.manyInternal(0,a)},A.prototype.MANY1=function(a){this.manyInternal(1,a)},A.prototype.MANY2=function(a){this.manyInternal(2,a)},A.prototype.MANY3=function(a){this.manyInternal(3,a)},A.prototype.MANY4=function(a){this.manyInternal(4,a)},A.prototype.MANY5=function(a){this.manyInternal(5,a)},A.prototype.MANY6=function(a){this.manyInternal(6,a)},A.prototype.MANY7=function(a){this.manyInternal(7,a)},A.prototype.MANY8=function(a){this.manyInternal(8,a)},A.prototype.MANY9=function(a){this.manyInternal(9,a)},A.prototype.MANY_SEP=function(a){this.manySepFirstInternal(0,a)},A.prototype.MANY_SEP1=function(a){this.manySepFirstInternal(1,a)},A.prototype.MANY_SEP2=function(a){this.manySepFirstInternal(2,a)},A.prototype.MANY_SEP3=function(a){this.manySepFirstInternal(3,a)},A.prototype.MANY_SEP4=function(a){this.manySepFirstInternal(4,a)},A.prototype.MANY_SEP5=function(a){this.manySepFirstInternal(5,a)},A.prototype.MANY_SEP6=function(a){this.manySepFirstInternal(6,a)},A.prototype.MANY_SEP7=function(a){this.manySepFirstInternal(7,a)},A.prototype.MANY_SEP8=function(a){this.manySepFirstInternal(8,a)},A.prototype.MANY_SEP9=function(a){this.manySepFirstInternal(9,a)},A.prototype.AT_LEAST_ONE=function(a){this.atLeastOneInternal(0,a)},A.prototype.AT_LEAST_ONE1=function(a){return this.atLeastOneInternal(1,a)},A.prototype.AT_LEAST_ONE2=function(a){this.atLeastOneInternal(2,a)},A.prototype.AT_LEAST_ONE3=function(a){this.atLeastOneInternal(3,a)},A.prototype.AT_LEAST_ONE4=function(a){this.atLeastOneInternal(4,a)},A.prototype.AT_LEAST_ONE5=function(a){this.atLeastOneInternal(5,a)},A.prototype.AT_LEAST_ONE6=function(a){this.atLeastOneInternal(6,a)},A.prototype.AT_LEAST_ONE7=function(a){this.atLeastOneInternal(7,a)},A.prototype.AT_LEAST_ONE8=function(a){this.atLeastOneInternal(8,a)},A.prototype.AT_LEAST_ONE9=function(a){this.atLeastOneInternal(9,a)},A.prototype.AT_LEAST_ONE_SEP=function(a){this.atLeastOneSepFirstInternal(0,a)},A.prototype.AT_LEAST_ONE_SEP1=function(a){this.atLeastOneSepFirstInternal(1,a)},A.prototype.AT_LEAST_ONE_SEP2=function(a){this.atLeastOneSepFirstInternal(2,a)},A.prototype.AT_LEAST_ONE_SEP3=function(a){this.atLeastOneSepFirstInternal(3,a)},A.prototype.AT_LEAST_ONE_SEP4=function(a){this.atLeastOneSepFirstInternal(4,a)},A.prototype.AT_LEAST_ONE_SEP5=function(a){this.atLeastOneSepFirstInternal(5,a)},A.prototype.AT_LEAST_ONE_SEP6=function(a){this.atLeastOneSepFirstInternal(6,a)},A.prototype.AT_LEAST_ONE_SEP7=function(a){this.atLeastOneSepFirstInternal(7,a)},A.prototype.AT_LEAST_ONE_SEP8=function(a){this.atLeastOneSepFirstInternal(8,a)},A.prototype.AT_LEAST_ONE_SEP9=function(a){this.atLeastOneSepFirstInternal(9,a)},A.prototype.RULE=function(a,f,u){if(u===void 0&&(u=r.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,a)){var b=n.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:a,grammarName:this.className}),d={message:b,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:a};this.definitionErrors.push(d)}this.definedRulesNames.push(a);var I=this.defineRule(a,f,u);return this[a]=I,I},A.prototype.OVERRIDE_RULE=function(a,f,u){u===void 0&&(u=r.DEFAULT_RULE_CONFIG);var b=[];b=b.concat(s.validateRuleIsOverridden(a,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(b);var d=this.defineRule(a,f,u);return this[a]=d,d},A.prototype.BACKTRACK=function(a,f){return function(){this.isBackTrackingStack.push(1);var u=this.saveRecogState();try{return a.apply(this,f),!0}catch(b){if(t.isRecognitionException(b))return!1;throw b}finally{this.reloadRecogState(u),this.isBackTrackingStack.pop()}}},A.prototype.getGAstProductions=function(){return this.gastProductionsCache},A.prototype.getSerializedGastProductions=function(){return o.serializeGrammar(e.values(this.gastProductionsCache))},A})();i.RecognizerApi=c}),Ho=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RecognizerEngine=void 0;var e=Se(),t=un(),r=yt(),n=xt(),s=Lt(),o=Xe(),c=Pi(),A=ct(),a=bt(),f=Gi(),u=(function(){function b(){}return b.prototype.initRecognizerEngine=function(d,I){if(this.className=f.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=a.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(I,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
169
170
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
170
- For Further details.`);if(e.isArray(p)){if(e.isEmpty(p))throw Error(`A Token Vocabulary cannot be empty.
171
+ For Further details.`);if(e.isArray(d)){if(e.isEmpty(d))throw Error(`A Token Vocabulary cannot be empty.
171
172
  Note that the first argument for the parser constructor
172
- 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.
173
+ is no longer a Token vector (since v4.0).`);if(typeof d[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
173
174
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
174
- 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)),s.isTokenType)){var m=e.flatten(e.values(p.modes)),l=e.uniq(m);this.tokensMap=e.reduce(l,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=c.EOF;var d=e.every(e.values(p),function(y){return e.isEmpty(y.categoryMatches)});this.tokenMatcher=d?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher,s.augmentTokenTypes(e.values(this.tokensMap))},g.prototype.defineRule=function(p,T,m){if(this.selfAnalysisDone)throw Error("Grammar rule <"+p+`> may not be defined after the 'performSelfAnalysis' method has been called'
175
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var l=e.has(m,"resyncEnabled")?m.resyncEnabled:o.DEFAULT_RULE_CONFIG.resyncEnabled,d=e.has(m,"recoveryValueFunc")?m.recoveryValueFunc:o.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(I){try{if(this.outputCst===!0){T.apply(this,I);var k=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(k),k}else return T.apply(this,I)}catch(H){return this.invokeRuleCatch(H,l,d)}finally{this.ruleFinallyStateUpdate()}}var E=function(I,k){return I===void 0&&(I=0),this.ruleInvocationStateUpdate(y,p,I),v.call(this,k)},S="ruleName";return E[S]=p,E.originalGrammarAction=T,E},g.prototype.invokeRuleCatch=function(p,T,m){var l=this.RULE_STACK.length===1,d=T&&!this.isBackTracking()&&this.recoveryEnabled;if(i.isRecognitionException(p)){var y=p;if(d){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(y.resyncedTokens=this.reSyncTo(v),this.outputCst){var E=this.CST_STACK[this.CST_STACK.length-1];return E.recoveredNode=!0,E}else return m();else{if(this.outputCst){var E=this.CST_STACK[this.CST_STACK.length-1];E.recoveredNode=!0,y.partialCstResult=E}throw y}}else{if(l)return this.moveToTerminatedState(),m();throw y}}else throw p},g.prototype.optionInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.OPTION_IDX,T);return this.optionInternalLogic(p,T,m)},g.prototype.optionInternalLogic=function(p,T,m){var l=this,d=this.getLaFuncFromCache(m),y,v;if(p.DEF!==void 0){if(y=p.DEF,v=p.GATE,v!==void 0){var E=d;d=function(){return v.call(l)&&E.call(l)}}}else y=p;if(d.call(this)===!0)return y.call(this)},g.prototype.atLeastOneInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,p);return this.atLeastOneInternalLogic(p,T,m)},g.prototype.atLeastOneInternalLogic=function(p,T,m){var l=this,d=this.getLaFuncFromCache(m),y,v;if(T.DEF!==void 0){if(y=T.DEF,v=T.GATE,v!==void 0){var E=d;d=function(){return v.call(l)&&E.call(l)}}}else y=T;if(d.call(this)===!0)for(var S=this.doSingleRepetition(y);d.call(this)===!0&&S===!0;)S=this.doSingleRepetition(y);else throw this.raiseEarlyExitException(p,r.PROD_TYPE.REPETITION_MANDATORY,T.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[p,T],d,t.AT_LEAST_ONE_IDX,p,a.NextTerminalAfterAtLeastOneWalker)},g.prototype.atLeastOneSepFirstInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,p);this.atLeastOneSepFirstInternalLogic(p,T,m)},g.prototype.atLeastOneSepFirstInternalLogic=function(p,T,m){var l=this,d=T.DEF,y=T.SEP,v=this.getLaFuncFromCache(m);if(v.call(this)===!0){d.call(this);for(var E=function(){return l.tokenMatcher(l.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,y,E,d,a.NextTerminalAfterAtLeastOneSepWalker],E,t.AT_LEAST_ONE_SEP_IDX,p,a.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(p,r.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,T.ERR_MSG)},g.prototype.manyInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.MANY_IDX,p);return this.manyInternalLogic(p,T,m)},g.prototype.manyInternalLogic=function(p,T,m){var l=this,d=this.getLaFuncFromCache(m),y,v;if(T.DEF!==void 0){if(y=T.DEF,v=T.GATE,v!==void 0){var E=d;d=function(){return v.call(l)&&E.call(l)}}}else y=T;for(var S=!0;d.call(this)===!0&&S===!0;)S=this.doSingleRepetition(y);this.attemptInRepetitionRecovery(this.manyInternal,[p,T],d,t.MANY_IDX,p,a.NextTerminalAfterManyWalker,S)},g.prototype.manySepFirstInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,p);this.manySepFirstInternalLogic(p,T,m)},g.prototype.manySepFirstInternalLogic=function(p,T,m){var l=this,d=T.DEF,y=T.SEP,v=this.getLaFuncFromCache(m);if(v.call(this)===!0){d.call(this);for(var E=function(){return l.tokenMatcher(l.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,y,E,d,a.NextTerminalAfterManySepWalker],E,t.MANY_SEP_IDX,p,a.NextTerminalAfterManySepWalker)}},g.prototype.repetitionSepSecondInternal=function(p,T,m,l,d){for(;m();)this.CONSUME(T),l.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,T,m,l,d],m,t.AT_LEAST_ONE_SEP_IDX,p,d)},g.prototype.doSingleRepetition=function(p){var T=this.getLexerPosition();p.call(this);var m=this.getLexerPosition();return m>T},g.prototype.orInternal=function(p,T){var m=this.getKeyForAutomaticLookahead(t.OR_IDX,T),l=e.isArray(p)?p:p.DEF,d=this.getLaFuncFromCache(m),y=d.call(this,l);if(y!==void 0){var v=l[y];return v.ALT.call(this)}this.raiseNoAltException(T,p.ERR_MSG)},g.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),T=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:p,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new i.NotAllInputParsedException(T,p))}},g.prototype.subruleInternal=function(p,T,m){var l;try{var d=m!==void 0?m.ARGS:void 0;return l=p.call(this,T,d),this.cstPostNonTerminal(l,m!==void 0&&m.LABEL!==void 0?m.LABEL:p.ruleName),l}catch(y){this.subruleInternalError(y,m,p.ruleName)}},g.prototype.subruleInternalError=function(p,T,m){throw i.isRecognitionException(p)&&p.partialCstResult!==void 0&&(this.cstPostNonTerminal(p.partialCstResult,T!==void 0&&T.LABEL!==void 0?T.LABEL:m),delete p.partialCstResult),p},g.prototype.consumeInternal=function(p,T,m){var l;try{var d=this.LA(1);this.tokenMatcher(d,p)===!0?(this.consumeToken(),l=d):this.consumeInternalError(p,d,m)}catch(y){l=this.consumeInternalRecovery(p,T,y)}return this.cstPostTerminal(m!==void 0&&m.LABEL!==void 0?m.LABEL:p.name,l),l},g.prototype.consumeInternalError=function(p,T,m){var l,d=this.LA(0);throw m!==void 0&&m.ERR_MSG?l=m.ERR_MSG:l=this.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:T,previous:d,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new i.MismatchedTokenException(l,T,d))},g.prototype.consumeInternalRecovery=function(p,T,m){if(this.recoveryEnabled&&m.name==="MismatchedTokenException"&&!this.isBackTracking()){var l=this.getFollowsForInRuleRecovery(p,T);try{return this.tryInRuleRecovery(p,l)}catch(d){throw d.name===u.IN_RULE_RECOVERY_EXCEPTION?m:d}}else throw m},g.prototype.saveRecogState=function(){var p=this.errors,T=e.cloneArr(this.RULE_STACK);return{errors:p,lexerState:this.exportLexerState(),RULE_STACK:T,CST_STACK:this.CST_STACK}},g.prototype.reloadRecogState=function(p){this.errors=p.errors,this.importLexerState(p.lexerState),this.RULE_STACK=p.RULE_STACK},g.prototype.ruleInvocationStateUpdate=function(p,T,m){this.RULE_OCCURRENCE_STACK.push(m),this.RULE_STACK.push(p),this.cstInvocationStateUpdate(T,p)},g.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},g.prototype.getCurrRuleFullName=function(){var p=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[p]},g.prototype.shortRuleNameToFullName=function(p){return this.shortRuleNameToFull[p]},g.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),c.EOF)},g.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},g})();n.RecognizerEngine=h}),di=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorHandler=void 0;var e=dt(),t=xe(),i=Rt(),r=Ye(),a=(function(){function o(){}return o.prototype.initErrorHandler=function(u){this._errors=[],this.errorMessageProvider=t.has(u,"errorMessageProvider")?u.errorMessageProvider:r.DEFAULT_PARSER_CONFIG.errorMessageProvider},o.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(o.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(u){this._errors=u},enumerable:!1,configurable:!0}),o.prototype.raiseEarlyExitException=function(u,c,s){for(var f=this.getCurrRuleFullName(),h=this.getGAstProductions()[f],g=i.getLookaheadPathsForOptionalProd(u,h,c,this.maxLookahead),p=g[0],T=[],m=1;m<=this.maxLookahead;m++)T.push(this.LA(m));var l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:p,actual:T,previous:this.LA(0),customUserDescription:s,ruleName:f});throw this.SAVE_ERROR(new e.EarlyExitException(l,this.LA(1),this.LA(0)))},o.prototype.raiseNoAltException=function(u,c){for(var s=this.getCurrRuleFullName(),f=this.getGAstProductions()[s],h=i.getLookaheadPathsForOr(u,f,this.maxLookahead),g=[],p=1;p<=this.maxLookahead;p++)g.push(this.LA(p));var T=this.LA(0),m=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:h,actual:g,previous:T,customUserDescription:c,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(m,this.LA(1),T))},o})();n.ErrorHandler=a}),pi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ContentAssist=void 0;var e=vt(),t=xe(),i=(function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(a,o){var u=this.gastProductionsCache[a];if(t.isUndefined(u))throw Error("Rule ->"+a+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([u],o,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(a){var o=t.first(a.ruleStack),u=this.getGAstProductions(),c=u[o],s=new e.NextAfterTokenWalker(c,a).startWalking();return s},r})();n.ContentAssist=i}),mi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GastRecorder=void 0;var e=xe(),t=He(),i=gt(),r=ht(),a=nt(),o=Ye(),u=Bt(),c={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(c);var s=!0,f=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,h=a.createToken({name:"RECORDING_PHASE_TOKEN",pattern:i.Lexer.NA});r.augmentTokenTypes([h]);var g=a.createTokenInstance(h,`This IToken indicates the Parser is in Recording Phase
176
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(g);var p={name:`This CSTNode indicates the Parser is in Recording Phase
177
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},T=(function(){function v(){}return v.prototype.initGastRecorder=function(E){this.recordingProdStack=[],this.RECORDING_PHASE=!1},v.prototype.enableRecording=function(){var E=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var S=function(k){var H=k>0?k:"";E["CONSUME"+H]=function(x,B){return this.consumeInternalRecord(x,k,B)},E["SUBRULE"+H]=function(x,B){return this.subruleInternalRecord(x,k,B)},E["OPTION"+H]=function(x){return this.optionInternalRecord(x,k)},E["OR"+H]=function(x){return this.orInternalRecord(x,k)},E["MANY"+H]=function(x){this.manyInternalRecord(k,x)},E["MANY_SEP"+H]=function(x){this.manySepFirstInternalRecord(k,x)},E["AT_LEAST_ONE"+H]=function(x){this.atLeastOneInternalRecord(k,x)},E["AT_LEAST_ONE_SEP"+H]=function(x){this.atLeastOneSepFirstInternalRecord(k,x)}},I=0;I<10;I++)S(I);E.consume=function(k,H,x){return this.consumeInternalRecord(H,k,x)},E.subrule=function(k,H,x){return this.subruleInternalRecord(H,k,x)},E.option=function(k,H){return this.optionInternalRecord(H,k)},E.or=function(k,H){return this.orInternalRecord(H,k)},E.many=function(k,H){this.manyInternalRecord(k,H)},E.atLeastOne=function(k,H){this.atLeastOneInternalRecord(k,H)},E.ACTION=E.ACTION_RECORD,E.BACKTRACK=E.BACKTRACK_RECORD,E.LA=E.LA_RECORD})},v.prototype.disableRecording=function(){var E=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var S=0;S<10;S++){var I=S>0?S:"";delete E["CONSUME"+I],delete E["SUBRULE"+I],delete E["OPTION"+I],delete E["OR"+I],delete E["MANY"+I],delete E["MANY_SEP"+I],delete E["AT_LEAST_ONE"+I],delete E["AT_LEAST_ONE_SEP"+I]}delete E.consume,delete E.subrule,delete E.option,delete E.or,delete E.many,delete E.atLeastOne,delete E.ACTION,delete E.BACKTRACK,delete E.LA})},v.prototype.ACTION_RECORD=function(E){},v.prototype.BACKTRACK_RECORD=function(E,S){return function(){return!0}},v.prototype.LA_RECORD=function(E){return o.END_OF_FILE},v.prototype.topLevelRuleRecord=function(E,S){try{var I=new t.Rule({definition:[],name:E});return I.name=E,this.recordingProdStack.push(I),S.call(this),this.recordingProdStack.pop(),I}catch(k){if(k.KNOWN_RECORDER_ERROR!==!0)try{k.message=k.message+`
175
+ For Further details.`)}if(e.isArray(d))this.tokensMap=e.reduce(d,function(p,C){return p[C.name]=C,p},{});else if(e.has(d,"modes")&&e.every(e.flatten(e.values(d.modes)),a.isTokenType)){var g=e.flatten(e.values(d.modes)),l=e.uniq(g);this.tokensMap=e.reduce(l,function(p,C){return p[C.name]=C,p},{})}else if(e.isObject(d))this.tokensMap=e.cloneObj(d);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 h=e.every(e.values(d),function(p){return e.isEmpty(p.categoryMatches)});this.tokenMatcher=h?a.tokenStructuredMatcherNoCategories:a.tokenStructuredMatcher,a.augmentTokenTypes(e.values(this.tokensMap))},b.prototype.defineRule=function(d,I,g){if(this.selfAnalysisDone)throw Error("Grammar rule <"+d+`> may not be defined after the 'performSelfAnalysis' method has been called'
176
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var l=e.has(g,"resyncEnabled")?g.resyncEnabled:o.DEFAULT_RULE_CONFIG.resyncEnabled,h=e.has(g,"recoveryValueFunc")?g.recoveryValueFunc:o.DEFAULT_RULE_CONFIG.recoveryValueFunc,p=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[p]=d,this.fullRuleNameToShort[d]=p;function C(Q){try{if(this.outputCst===!0){I.apply(this,Q);var S=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(S),S}else return I.apply(this,Q)}catch(U){return this.invokeRuleCatch(U,l,h)}finally{this.ruleFinallyStateUpdate()}}var E=function(Q,S){return Q===void 0&&(Q=0),this.ruleInvocationStateUpdate(p,d,Q),C.call(this,S)},B="ruleName";return E[B]=d,E.originalGrammarAction=I,E},b.prototype.invokeRuleCatch=function(d,I,g){var l=this.RULE_STACK.length===1,h=I&&!this.isBackTracking()&&this.recoveryEnabled;if(r.isRecognitionException(d)){var p=d;if(h){var C=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(C))if(p.resyncedTokens=this.reSyncTo(C),this.outputCst){var E=this.CST_STACK[this.CST_STACK.length-1];return E.recoveredNode=!0,E}else return g();else{if(this.outputCst){var E=this.CST_STACK[this.CST_STACK.length-1];E.recoveredNode=!0,p.partialCstResult=E}throw p}}else{if(l)return this.moveToTerminatedState(),g();throw p}}else throw d},b.prototype.optionInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.OPTION_IDX,I);return this.optionInternalLogic(d,I,g)},b.prototype.optionInternalLogic=function(d,I,g){var l=this,h=this.getLaFuncFromCache(g),p,C;if(d.DEF!==void 0){if(p=d.DEF,C=d.GATE,C!==void 0){var E=h;h=function(){return C.call(l)&&E.call(l)}}}else p=d;if(h.call(this)===!0)return p.call(this)},b.prototype.atLeastOneInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,d);return this.atLeastOneInternalLogic(d,I,g)},b.prototype.atLeastOneInternalLogic=function(d,I,g){var l=this,h=this.getLaFuncFromCache(g),p,C;if(I.DEF!==void 0){if(p=I.DEF,C=I.GATE,C!==void 0){var E=h;h=function(){return C.call(l)&&E.call(l)}}}else p=I;if(h.call(this)===!0)for(var B=this.doSingleRepetition(p);h.call(this)===!0&&B===!0;)B=this.doSingleRepetition(p);else throw this.raiseEarlyExitException(d,n.PROD_TYPE.REPETITION_MANDATORY,I.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[d,I],h,t.AT_LEAST_ONE_IDX,d,s.NextTerminalAfterAtLeastOneWalker)},b.prototype.atLeastOneSepFirstInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,d);this.atLeastOneSepFirstInternalLogic(d,I,g)},b.prototype.atLeastOneSepFirstInternalLogic=function(d,I,g){var l=this,h=I.DEF,p=I.SEP,C=this.getLaFuncFromCache(g);if(C.call(this)===!0){h.call(this);for(var E=function(){return l.tokenMatcher(l.LA(1),p)};this.tokenMatcher(this.LA(1),p)===!0;)this.CONSUME(p),h.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[d,p,E,h,s.NextTerminalAfterAtLeastOneSepWalker],E,t.AT_LEAST_ONE_SEP_IDX,d,s.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(d,n.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,I.ERR_MSG)},b.prototype.manyInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.MANY_IDX,d);return this.manyInternalLogic(d,I,g)},b.prototype.manyInternalLogic=function(d,I,g){var l=this,h=this.getLaFuncFromCache(g),p,C;if(I.DEF!==void 0){if(p=I.DEF,C=I.GATE,C!==void 0){var E=h;h=function(){return C.call(l)&&E.call(l)}}}else p=I;for(var B=!0;h.call(this)===!0&&B===!0;)B=this.doSingleRepetition(p);this.attemptInRepetitionRecovery(this.manyInternal,[d,I],h,t.MANY_IDX,d,s.NextTerminalAfterManyWalker,B)},b.prototype.manySepFirstInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,d);this.manySepFirstInternalLogic(d,I,g)},b.prototype.manySepFirstInternalLogic=function(d,I,g){var l=this,h=I.DEF,p=I.SEP,C=this.getLaFuncFromCache(g);if(C.call(this)===!0){h.call(this);for(var E=function(){return l.tokenMatcher(l.LA(1),p)};this.tokenMatcher(this.LA(1),p)===!0;)this.CONSUME(p),h.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[d,p,E,h,s.NextTerminalAfterManySepWalker],E,t.MANY_SEP_IDX,d,s.NextTerminalAfterManySepWalker)}},b.prototype.repetitionSepSecondInternal=function(d,I,g,l,h){for(;g();)this.CONSUME(I),l.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[d,I,g,l,h],g,t.AT_LEAST_ONE_SEP_IDX,d,h)},b.prototype.doSingleRepetition=function(d){var I=this.getLexerPosition();d.call(this);var g=this.getLexerPosition();return g>I},b.prototype.orInternal=function(d,I){var g=this.getKeyForAutomaticLookahead(t.OR_IDX,I),l=e.isArray(d)?d:d.DEF,h=this.getLaFuncFromCache(g),p=h.call(this,l);if(p!==void 0){var C=l[p];return C.ALT.call(this)}this.raiseNoAltException(I,d.ERR_MSG)},b.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var d=this.LA(1),I=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:d,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new r.NotAllInputParsedException(I,d))}},b.prototype.subruleInternal=function(d,I,g){var l;try{var h=g!==void 0?g.ARGS:void 0;return l=d.call(this,I,h),this.cstPostNonTerminal(l,g!==void 0&&g.LABEL!==void 0?g.LABEL:d.ruleName),l}catch(p){this.subruleInternalError(p,g,d.ruleName)}},b.prototype.subruleInternalError=function(d,I,g){throw r.isRecognitionException(d)&&d.partialCstResult!==void 0&&(this.cstPostNonTerminal(d.partialCstResult,I!==void 0&&I.LABEL!==void 0?I.LABEL:g),delete d.partialCstResult),d},b.prototype.consumeInternal=function(d,I,g){var l;try{var h=this.LA(1);this.tokenMatcher(h,d)===!0?(this.consumeToken(),l=h):this.consumeInternalError(d,h,g)}catch(p){l=this.consumeInternalRecovery(d,I,p)}return this.cstPostTerminal(g!==void 0&&g.LABEL!==void 0?g.LABEL:d.name,l),l},b.prototype.consumeInternalError=function(d,I,g){var l,h=this.LA(0);throw g!==void 0&&g.ERR_MSG?l=g.ERR_MSG:l=this.errorMessageProvider.buildMismatchTokenMessage({expected:d,actual:I,previous:h,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new r.MismatchedTokenException(l,I,h))},b.prototype.consumeInternalRecovery=function(d,I,g){if(this.recoveryEnabled&&g.name==="MismatchedTokenException"&&!this.isBackTracking()){var l=this.getFollowsForInRuleRecovery(d,I);try{return this.tryInRuleRecovery(d,l)}catch(h){throw h.name===c.IN_RULE_RECOVERY_EXCEPTION?g:h}}else throw g},b.prototype.saveRecogState=function(){var d=this.errors,I=e.cloneArr(this.RULE_STACK);return{errors:d,lexerState:this.exportLexerState(),RULE_STACK:I,CST_STACK:this.CST_STACK}},b.prototype.reloadRecogState=function(d){this.errors=d.errors,this.importLexerState(d.lexerState),this.RULE_STACK=d.RULE_STACK},b.prototype.ruleInvocationStateUpdate=function(d,I,g){this.RULE_OCCURRENCE_STACK.push(g),this.RULE_STACK.push(d),this.cstInvocationStateUpdate(I,d)},b.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},b.prototype.getCurrRuleFullName=function(){var d=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[d]},b.prototype.shortRuleNameToFullName=function(d){return this.shortRuleNameToFull[d]},b.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),A.EOF)},b.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},b})();i.RecognizerEngine=u}),jo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ErrorHandler=void 0;var e=yt(),t=Se(),r=xt(),n=Xe(),s=(function(){function o(){}return o.prototype.initErrorHandler=function(c){this._errors=[],this.errorMessageProvider=t.has(c,"errorMessageProvider")?c.errorMessageProvider:n.DEFAULT_PARSER_CONFIG.errorMessageProvider},o.prototype.SAVE_ERROR=function(c){if(e.isRecognitionException(c))return c.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(c),c;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(o.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(c){this._errors=c},enumerable:!1,configurable:!0}),o.prototype.raiseEarlyExitException=function(c,A,a){for(var f=this.getCurrRuleFullName(),u=this.getGAstProductions()[f],b=r.getLookaheadPathsForOptionalProd(c,u,A,this.maxLookahead),d=b[0],I=[],g=1;g<=this.maxLookahead;g++)I.push(this.LA(g));var l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:d,actual:I,previous:this.LA(0),customUserDescription:a,ruleName:f});throw this.SAVE_ERROR(new e.EarlyExitException(l,this.LA(1),this.LA(0)))},o.prototype.raiseNoAltException=function(c,A){for(var a=this.getCurrRuleFullName(),f=this.getGAstProductions()[a],u=r.getLookaheadPathsForOr(c,f,this.maxLookahead),b=[],d=1;d<=this.maxLookahead;d++)b.push(this.LA(d));var I=this.LA(0),g=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:u,actual:b,previous:I,customUserDescription:A,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(g,this.LA(1),I))},o})();i.ErrorHandler=s}),qo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ContentAssist=void 0;var e=Lt(),t=Se(),r=(function(){function n(){}return n.prototype.initContentAssist=function(){},n.prototype.computeContentAssist=function(s,o){var c=this.gastProductionsCache[s];if(t.isUndefined(c))throw Error("Rule ->"+s+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([c],o,this.tokenMatcher,this.maxLookahead)},n.prototype.getNextPossibleTokenTypes=function(s){var o=t.first(s.ruleStack),c=this.getGAstProductions(),A=c[o],a=new e.NextAfterTokenWalker(A,s).startWalking();return a},n})();i.ContentAssist=r}),Ko=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GastRecorder=void 0;var e=Se(),t=We(),r=kt(),n=bt(),s=ct(),o=Xe(),c=un(),A={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(A);var a=!0,f=Math.pow(2,c.BITS_FOR_OCCURRENCE_IDX)-1,u=s.createToken({name:"RECORDING_PHASE_TOKEN",pattern:r.Lexer.NA});n.augmentTokenTypes([u]);var b=s.createTokenInstance(u,`This IToken indicates the Parser is in Recording Phase
177
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(b);var d={name:`This CSTNode indicates the Parser is in Recording Phase
178
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},I=(function(){function C(){}return C.prototype.initGastRecorder=function(E){this.recordingProdStack=[],this.RECORDING_PHASE=!1},C.prototype.enableRecording=function(){var E=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var B=function(S){var U=S>0?S:"";E["CONSUME"+U]=function(v,O){return this.consumeInternalRecord(v,S,O)},E["SUBRULE"+U]=function(v,O){return this.subruleInternalRecord(v,S,O)},E["OPTION"+U]=function(v){return this.optionInternalRecord(v,S)},E["OR"+U]=function(v){return this.orInternalRecord(v,S)},E["MANY"+U]=function(v){this.manyInternalRecord(S,v)},E["MANY_SEP"+U]=function(v){this.manySepFirstInternalRecord(S,v)},E["AT_LEAST_ONE"+U]=function(v){this.atLeastOneInternalRecord(S,v)},E["AT_LEAST_ONE_SEP"+U]=function(v){this.atLeastOneSepFirstInternalRecord(S,v)}},Q=0;Q<10;Q++)B(Q);E.consume=function(S,U,v){return this.consumeInternalRecord(U,S,v)},E.subrule=function(S,U,v){return this.subruleInternalRecord(U,S,v)},E.option=function(S,U){return this.optionInternalRecord(U,S)},E.or=function(S,U){return this.orInternalRecord(U,S)},E.many=function(S,U){this.manyInternalRecord(S,U)},E.atLeastOne=function(S,U){this.atLeastOneInternalRecord(S,U)},E.ACTION=E.ACTION_RECORD,E.BACKTRACK=E.BACKTRACK_RECORD,E.LA=E.LA_RECORD})},C.prototype.disableRecording=function(){var E=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var B=0;B<10;B++){var Q=B>0?B:"";delete E["CONSUME"+Q],delete E["SUBRULE"+Q],delete E["OPTION"+Q],delete E["OR"+Q],delete E["MANY"+Q],delete E["MANY_SEP"+Q],delete E["AT_LEAST_ONE"+Q],delete E["AT_LEAST_ONE_SEP"+Q]}delete E.consume,delete E.subrule,delete E.option,delete E.or,delete E.many,delete E.atLeastOne,delete E.ACTION,delete E.BACKTRACK,delete E.LA})},C.prototype.ACTION_RECORD=function(E){},C.prototype.BACKTRACK_RECORD=function(E,B){return function(){return!0}},C.prototype.LA_RECORD=function(E){return o.END_OF_FILE},C.prototype.topLevelRuleRecord=function(E,B){try{var Q=new t.Rule({definition:[],name:E});return Q.name=E,this.recordingProdStack.push(Q),B.call(this),this.recordingProdStack.pop(),Q}catch(S){if(S.KNOWN_RECORDER_ERROR!==!0)try{S.message=S.message+`
178
179
  This error was thrown during the "grammar recording phase" For more info see:
179
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw k}throw k}},v.prototype.optionInternalRecord=function(E,S){return m.call(this,t.Option,E,S)},v.prototype.atLeastOneInternalRecord=function(E,S){m.call(this,t.RepetitionMandatory,S,E)},v.prototype.atLeastOneSepFirstInternalRecord=function(E,S){m.call(this,t.RepetitionMandatoryWithSeparator,S,E,s)},v.prototype.manyInternalRecord=function(E,S){m.call(this,t.Repetition,S,E)},v.prototype.manySepFirstInternalRecord=function(E,S){m.call(this,t.RepetitionWithSeparator,S,E,s)},v.prototype.orInternalRecord=function(E,S){return l.call(this,E,S)},v.prototype.subruleInternalRecord=function(E,S,I){if(y(S),!E||e.has(E,"ruleName")===!1){var k=new Error("<SUBRULE"+d(S)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(E)+">")+(`
180
- inside top level rule: <`+this.recordingProdStack[0].name+">"));throw k.KNOWN_RECORDER_ERROR=!0,k}var H=e.peek(this.recordingProdStack),x=E.ruleName,B=new t.NonTerminal({idx:S,nonTerminalName:x,referencedRule:void 0});return H.definition.push(B),this.outputCst?p:c},v.prototype.consumeInternalRecord=function(E,S,I){if(y(S),!r.hasShortKeyProperty(E)){var k=new Error("<CONSUME"+d(S)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(E)+">")+(`
181
- inside top level rule: <`+this.recordingProdStack[0].name+">"));throw k.KNOWN_RECORDER_ERROR=!0,k}var H=e.peek(this.recordingProdStack),x=new t.Terminal({idx:S,terminalType:E});return H.definition.push(x),g},v})();n.GastRecorder=T;function m(v,E,S,I){I===void 0&&(I=!1),y(S);var k=e.peek(this.recordingProdStack),H=e.isFunction(E)?E:E.DEF,x=new v({definition:[],idx:S});return I&&(x.separator=E.SEP),e.has(E,"MAX_LOOKAHEAD")&&(x.maxLookahead=E.MAX_LOOKAHEAD),this.recordingProdStack.push(x),H.call(this),k.definition.push(x),this.recordingProdStack.pop(),c}function l(v,E){var S=this;y(E);var I=e.peek(this.recordingProdStack),k=e.isArray(v)===!1,H=k===!1?v:v.DEF,x=new t.Alternation({definition:[],idx:E,ignoreAmbiguities:k&&v.IGNORE_AMBIGUITIES===!0});e.has(v,"MAX_LOOKAHEAD")&&(x.maxLookahead=v.MAX_LOOKAHEAD);var B=e.some(H,function(P){return e.isFunction(P.GATE)});return x.hasPredicates=B,I.definition.push(x),e.forEach(H,function(P){var O=new t.Alternative({definition:[]});x.definition.push(O),e.has(P,"IGNORE_AMBIGUITIES")?O.ignoreAmbiguities=P.IGNORE_AMBIGUITIES:e.has(P,"GATE")&&(O.ignoreAmbiguities=!0),S.recordingProdStack.push(O),P.ALT.call(S),S.recordingProdStack.pop()}),c}function d(v){return v===0?"":""+v}function y(v){if(v<0||v>f){var E=new Error("Invalid DSL Method idx value: <"+v+`>
182
- `+("Idx value must be a none negative value smaller than "+(f+1)));throw E.KNOWN_RECORDER_ERROR=!0,E}}}),yi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PerformanceTracer=void 0;var e=xe(),t=Ye(),i=(function(){function r(){}return r.prototype.initPerformanceTracer=function(a){if(e.has(a,"traceInitPerf")){var o=a.traceInitPerf,u=typeof o=="number";this.traceInitMaxIdent=u?o:1/0,this.traceInitPerf=u?o>0:o}else this.traceInitMaxIdent=0,this.traceInitPerf=t.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(a,o){if(this.traceInitPerf===!0){this.traceInitIndent++;var u=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(u+"--> <"+a+">");var c=e.timer(o),s=c.time,f=c.value,h=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&h(u+"<-- <"+a+"> time: "+s+"ms"),this.traceInitIndent--,f}else return o()},r})();n.PerformanceTracer=i}),gi=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.applyMixins=void 0;function e(t,i){i.forEach(function(r){var a=r.prototype;Object.getOwnPropertyNames(a).forEach(function(o){if(o!=="constructor"){var u=Object.getOwnPropertyDescriptor(a,o);u&&(u.get||u.set)?Object.defineProperty(t.prototype,o,u):t.prototype[o]=r.prototype[o]}})})}n.applyMixins=e}),Ye=ve(n=>{var e=n&&n.__extends||(function(){var I=function(k,H){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,B){x.__proto__=B}||function(x,B){for(var P in B)Object.prototype.hasOwnProperty.call(B,P)&&(x[P]=B[P])},I(k,H)};return function(k,H){if(typeof H!="function"&&H!==null)throw new TypeError("Class extends value "+String(H)+" is not a constructor or null");I(k,H);function x(){this.constructor=k}k.prototype=H===null?Object.create(H):(x.prototype=H.prototype,new x)}})();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=xe(),i=ri(),r=nt(),a=Et(),o=oi(),u=On(),c=si(),s=li(),f=ui(),h=hi(),g=fi(),p=di(),T=pi(),m=mi(),l=yi(),d=gi();n.END_OF_FILE=r.createTokenInstance(r.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:a.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),n.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(function(I){I[I.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",I[I.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",I[I.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",I[I.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",I[I.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",I[I.LEFT_RECURSION=5]="LEFT_RECURSION",I[I.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",I[I.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",I[I.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",I[I.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",I[I.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",I[I.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",I[I.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(n.ParserDefinitionErrorType||(n.ParserDefinitionErrorType={}));function y(I){return I===void 0&&(I=void 0),function(){return I}}n.EMPTY_ALT=y;var v=(function(){function I(k,H){this.definitionErrors=[],this.selfAnalysisDone=!1;var x=this;if(x.initErrorHandler(H),x.initLexerAdapter(),x.initLooksAhead(H),x.initRecognizerEngine(k,H),x.initRecoverable(H),x.initTreeBuilder(H),x.initContentAssist(),x.initGastRecorder(H),x.initPerformanceTracer(H),t.has(H,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
180
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw S}throw S}},C.prototype.optionInternalRecord=function(E,B){return g.call(this,t.Option,E,B)},C.prototype.atLeastOneInternalRecord=function(E,B){g.call(this,t.RepetitionMandatory,B,E)},C.prototype.atLeastOneSepFirstInternalRecord=function(E,B){g.call(this,t.RepetitionMandatoryWithSeparator,B,E,a)},C.prototype.manyInternalRecord=function(E,B){g.call(this,t.Repetition,B,E)},C.prototype.manySepFirstInternalRecord=function(E,B){g.call(this,t.RepetitionWithSeparator,B,E,a)},C.prototype.orInternalRecord=function(E,B){return l.call(this,E,B)},C.prototype.subruleInternalRecord=function(E,B,Q){if(p(B),!E||e.has(E,"ruleName")===!1){var S=new Error("<SUBRULE"+h(B)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(E)+">")+(`
181
+ inside top level rule: <`+this.recordingProdStack[0].name+">"));throw S.KNOWN_RECORDER_ERROR=!0,S}var U=e.peek(this.recordingProdStack),v=E.ruleName,O=new t.NonTerminal({idx:B,nonTerminalName:v,referencedRule:void 0});return U.definition.push(O),this.outputCst?d:A},C.prototype.consumeInternalRecord=function(E,B,Q){if(p(B),!n.hasShortKeyProperty(E)){var S=new Error("<CONSUME"+h(B)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(E)+">")+(`
182
+ inside top level rule: <`+this.recordingProdStack[0].name+">"));throw S.KNOWN_RECORDER_ERROR=!0,S}var U=e.peek(this.recordingProdStack),v=new t.Terminal({idx:B,terminalType:E});return U.definition.push(v),b},C})();i.GastRecorder=I;function g(C,E,B,Q){Q===void 0&&(Q=!1),p(B);var S=e.peek(this.recordingProdStack),U=e.isFunction(E)?E:E.DEF,v=new C({definition:[],idx:B});return Q&&(v.separator=E.SEP),e.has(E,"MAX_LOOKAHEAD")&&(v.maxLookahead=E.MAX_LOOKAHEAD),this.recordingProdStack.push(v),U.call(this),S.definition.push(v),this.recordingProdStack.pop(),A}function l(C,E){var B=this;p(E);var Q=e.peek(this.recordingProdStack),S=e.isArray(C)===!1,U=S===!1?C:C.DEF,v=new t.Alternation({definition:[],idx:E,ignoreAmbiguities:S&&C.IGNORE_AMBIGUITIES===!0});e.has(C,"MAX_LOOKAHEAD")&&(v.maxLookahead=C.MAX_LOOKAHEAD);var O=e.some(U,function(L){return e.isFunction(L.GATE)});return v.hasPredicates=O,Q.definition.push(v),e.forEach(U,function(L){var k=new t.Alternative({definition:[]});v.definition.push(k),e.has(L,"IGNORE_AMBIGUITIES")?k.ignoreAmbiguities=L.IGNORE_AMBIGUITIES:e.has(L,"GATE")&&(k.ignoreAmbiguities=!0),B.recordingProdStack.push(k),L.ALT.call(B),B.recordingProdStack.pop()}),A}function h(C){return C===0?"":""+C}function p(C){if(C<0||C>f){var E=new Error("Invalid DSL Method idx value: <"+C+`>
183
+ `+("Idx value must be a none negative value smaller than "+(f+1)));throw E.KNOWN_RECORDER_ERROR=!0,E}}}),zo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PerformanceTracer=void 0;var e=Se(),t=Xe(),r=(function(){function n(){}return n.prototype.initPerformanceTracer=function(s){if(e.has(s,"traceInitPerf")){var o=s.traceInitPerf,c=typeof o=="number";this.traceInitMaxIdent=c?o:1/0,this.traceInitPerf=c?o>0:o}else this.traceInitMaxIdent=0,this.traceInitPerf=t.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},n.prototype.TRACE_INIT=function(s,o){if(this.traceInitPerf===!0){this.traceInitIndent++;var c=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(c+"--> <"+s+">");var A=e.timer(o),a=A.time,f=A.value,u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(c+"<-- <"+s+"> time: "+a+"ms"),this.traceInitIndent--,f}else return o()},n})();i.PerformanceTracer=r}),Wo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.applyMixins=void 0;function e(t,r){r.forEach(function(n){var s=n.prototype;Object.getOwnPropertyNames(s).forEach(function(o){if(o!=="constructor"){var c=Object.getOwnPropertyDescriptor(s,o);c&&(c.get||c.set)?Object.defineProperty(t.prototype,o,c):t.prototype[o]=n.prototype[o]}})})}i.applyMixins=e}),Xe=Be(i=>{var e=i&&i.__extends||(function(){var Q=function(S,U){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,O){v.__proto__=O}||function(v,O){for(var L in O)Object.prototype.hasOwnProperty.call(O,L)&&(v[L]=O[L])},Q(S,U)};return function(S,U){if(typeof U!="function"&&U!==null)throw new TypeError("Class extends value "+String(U)+" is not a constructor or null");Q(S,U);function v(){this.constructor=S}S.prototype=U===null?Object.create(U):(v.prototype=U.prototype,new v)}})();Object.defineProperty(i,"__esModule",{value:!0}),i.EmbeddedActionsParser=i.CstParser=i.Parser=i.EMPTY_ALT=i.ParserDefinitionErrorType=i.DEFAULT_RULE_CONFIG=i.DEFAULT_PARSER_CONFIG=i.END_OF_FILE=void 0;var t=Se(),r=xo(),n=ct(),s=_t(),o=Do(),c=Pi(),A=Fo(),a=Po(),f=Go(),u=Uo(),b=Ho(),d=jo(),I=qo(),g=Ko(),l=zo(),h=Wo();i.END_OF_FILE=n.createTokenInstance(n.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(i.END_OF_FILE),i.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:s.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),i.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(function(Q){Q[Q.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",Q[Q.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",Q[Q.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",Q[Q.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",Q[Q.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",Q[Q.LEFT_RECURSION=5]="LEFT_RECURSION",Q[Q.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",Q[Q.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",Q[Q.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",Q[Q.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",Q[Q.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",Q[Q.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",Q[Q.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(i.ParserDefinitionErrorType||(i.ParserDefinitionErrorType={}));function p(Q){return Q===void 0&&(Q=void 0),function(){return Q}}i.EMPTY_ALT=p;var C=(function(){function Q(S,U){this.definitionErrors=[],this.selfAnalysisDone=!1;var v=this;if(v.initErrorHandler(U),v.initLexerAdapter(),v.initLooksAhead(U),v.initRecognizerEngine(S,U),v.initRecoverable(U),v.initTreeBuilder(U),v.initContentAssist(),v.initGastRecorder(U),v.initPerformanceTracer(U),t.has(U,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
183
184
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
184
185
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
185
- For further details.`);this.skipValidations=t.has(H,"skipValidations")?H.skipValidations:n.DEFAULT_PARSER_CONFIG.skipValidations}return I.performSelfAnalysis=function(k){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},I.prototype.performSelfAnalysis=function(){var k=this;this.TRACE_INIT("performSelfAnalysis",function(){var H;k.selfAnalysisDone=!0;var x=k.className;k.TRACE_INIT("toFastProps",function(){t.toFastProperties(k)}),k.TRACE_INIT("Grammar Recording",function(){try{k.enableRecording(),t.forEach(k.definedRulesNames,function(P){var O=k[P],M=O.originalGrammarAction,C=void 0;k.TRACE_INIT(P+" Rule",function(){C=k.topLevelRuleRecord(P,M)}),k.gastProductionsCache[P]=C})}finally{k.disableRecording()}});var B=[];if(k.TRACE_INIT("Grammar Resolving",function(){B=o.resolveGrammar({rules:t.values(k.gastProductionsCache)}),k.definitionErrors=k.definitionErrors.concat(B)}),k.TRACE_INIT("Grammar Validations",function(){if(t.isEmpty(B)&&k.skipValidations===!1){var P=o.validateGrammar({rules:t.values(k.gastProductionsCache),maxLookahead:k.maxLookahead,tokenTypes:t.values(k.tokensMap),errMsgProvider:a.defaultGrammarValidatorErrorProvider,grammarName:x});k.definitionErrors=k.definitionErrors.concat(P)}}),t.isEmpty(k.definitionErrors)&&(k.recoveryEnabled&&k.TRACE_INIT("computeAllProdsFollows",function(){var P=i.computeAllProdsFollows(t.values(k.gastProductionsCache));k.resyncFollows=P}),k.TRACE_INIT("ComputeLookaheadFunctions",function(){k.preComputeLookaheadFunctions(t.values(k.gastProductionsCache))})),!I.DEFER_DEFINITION_ERRORS_HANDLING&&!t.isEmpty(k.definitionErrors))throw H=t.map(k.definitionErrors,function(P){return P.message}),new Error(`Parser Definition Errors detected:
186
- `+H.join(`
186
+ For further details.`);this.skipValidations=t.has(U,"skipValidations")?U.skipValidations:i.DEFAULT_PARSER_CONFIG.skipValidations}return Q.performSelfAnalysis=function(S){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},Q.prototype.performSelfAnalysis=function(){var S=this;this.TRACE_INIT("performSelfAnalysis",function(){var U;S.selfAnalysisDone=!0;var v=S.className;S.TRACE_INIT("toFastProps",function(){t.toFastProperties(S)}),S.TRACE_INIT("Grammar Recording",function(){try{S.enableRecording(),t.forEach(S.definedRulesNames,function(L){var k=S[L],D=k.originalGrammarAction,_=void 0;S.TRACE_INIT(L+" Rule",function(){_=S.topLevelRuleRecord(L,D)}),S.gastProductionsCache[L]=_})}finally{S.disableRecording()}});var O=[];if(S.TRACE_INIT("Grammar Resolving",function(){O=o.resolveGrammar({rules:t.values(S.gastProductionsCache)}),S.definitionErrors=S.definitionErrors.concat(O)}),S.TRACE_INIT("Grammar Validations",function(){if(t.isEmpty(O)&&S.skipValidations===!1){var L=o.validateGrammar({rules:t.values(S.gastProductionsCache),maxLookahead:S.maxLookahead,tokenTypes:t.values(S.tokensMap),errMsgProvider:s.defaultGrammarValidatorErrorProvider,grammarName:v});S.definitionErrors=S.definitionErrors.concat(L)}}),t.isEmpty(S.definitionErrors)&&(S.recoveryEnabled&&S.TRACE_INIT("computeAllProdsFollows",function(){var L=r.computeAllProdsFollows(t.values(S.gastProductionsCache));S.resyncFollows=L}),S.TRACE_INIT("ComputeLookaheadFunctions",function(){S.preComputeLookaheadFunctions(t.values(S.gastProductionsCache))})),!Q.DEFER_DEFINITION_ERRORS_HANDLING&&!t.isEmpty(S.definitionErrors))throw U=t.map(S.definitionErrors,function(L){return L.message}),new Error(`Parser Definition Errors detected:
187
+ `+U.join(`
187
188
  -------------------------------
188
- `))})},I.DEFER_DEFINITION_ERRORS_HANDLING=!1,I})();n.Parser=v,d.applyMixins(v,[u.Recoverable,c.LooksAhead,s.TreeBuilder,f.LexerAdapter,g.RecognizerEngine,h.RecognizerApi,p.ErrorHandler,T.ContentAssist,m.GastRecorder,l.PerformanceTracer]);var E=(function(I){e(k,I);function k(H,x){x===void 0&&(x=n.DEFAULT_PARSER_CONFIG);var B=this,P=t.cloneObj(x);return P.outputCst=!0,B=I.call(this,H,P)||this,B}return k})(v);n.CstParser=E;var S=(function(I){e(k,I);function k(H,x){x===void 0&&(x=n.DEFAULT_PARSER_CONFIG);var B=this,P=t.cloneObj(x);return P.outputCst=!1,B=I.call(this,H,P)||this,B}return k})(v);n.EmbeddedActionsParser=S}),Ti=ve(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSyntaxDiagramsCode=void 0;var e=Rn();function t(i,r){var a=r===void 0?{}:r,o=a.resourceBase,u=o===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/":o,c=a.css,s=c===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/diagrams.css":c,f=`
189
+ `))})},Q.DEFER_DEFINITION_ERRORS_HANDLING=!1,Q})();i.Parser=C,h.applyMixins(C,[c.Recoverable,A.LooksAhead,a.TreeBuilder,f.LexerAdapter,b.RecognizerEngine,u.RecognizerApi,d.ErrorHandler,I.ContentAssist,g.GastRecorder,l.PerformanceTracer]);var E=(function(Q){e(S,Q);function S(U,v){v===void 0&&(v=i.DEFAULT_PARSER_CONFIG);var O=this,L=t.cloneObj(v);return L.outputCst=!0,O=Q.call(this,U,L)||this,O}return S})(C);i.CstParser=E;var B=(function(Q){e(S,Q);function S(U,v){v===void 0&&(v=i.DEFAULT_PARSER_CONFIG);var O=this,L=t.cloneObj(v);return L.outputCst=!1,O=Q.call(this,U,L)||this,O}return S})(C);i.EmbeddedActionsParser=B}),Vo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSyntaxDiagramsCode=void 0;var e=xi();function t(r,n){var s=n===void 0?{}:n,o=s.resourceBase,c=o===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/":o,A=s.css,a=A===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/diagrams.css":A,f=`
189
190
  <!-- This is a generated file -->
190
191
  <!DOCTYPE html>
191
192
  <meta charset="utf-8">
@@ -195,26 +196,94 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
195
196
  }
196
197
  </style>
197
198
 
198
- `,h=`
199
- <link rel='stylesheet' href='`+s+`'>
200
- `,g=`
201
- <script src='`+u+`vendor/railroad-diagrams.js'><\/script>
202
- <script src='`+u+`src/diagrams_builder.js'><\/script>
203
- <script src='`+u+`src/diagrams_behavior.js'><\/script>
204
- <script src='`+u+`src/main.js'><\/script>
205
- `,p=`
199
+ `,u=`
200
+ <link rel='stylesheet' href='`+a+`'>
201
+ `,b=`
202
+ <script src='`+c+`vendor/railroad-diagrams.js'><\/script>
203
+ <script src='`+c+`src/diagrams_builder.js'><\/script>
204
+ <script src='`+c+`src/diagrams_behavior.js'><\/script>
205
+ <script src='`+c+`src/main.js'><\/script>
206
+ `,d=`
206
207
  <div id="diagrams" align="center"></div>
207
- `,T=`
208
+ `,I=`
208
209
  <script>
209
- window.serializedGrammar = `+JSON.stringify(i,null," ")+`;
210
+ window.serializedGrammar = `+JSON.stringify(r,null," ")+`;
210
211
  <\/script>
211
- `,m=`
212
+ `,g=`
212
213
  <script>
213
214
  var diagramsDiv = document.getElementById("diagrams");
214
215
  main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
215
216
  <\/script>
216
- `;return f+h+g+p+T+m}n.createSyntaxDiagramsCode=t}),Ei=ve(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=Rn();Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return e.VERSION}});var t=Ye();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 i=gt();Object.defineProperty(n,"Lexer",{enumerable:!0,get:function(){return i.Lexer}}),Object.defineProperty(n,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return i.LexerDefinitionErrorType}});var r=nt();Object.defineProperty(n,"createToken",{enumerable:!0,get:function(){return r.createToken}}),Object.defineProperty(n,"createTokenInstance",{enumerable:!0,get:function(){return r.createTokenInstance}}),Object.defineProperty(n,"EOF",{enumerable:!0,get:function(){return r.EOF}}),Object.defineProperty(n,"tokenLabel",{enumerable:!0,get:function(){return r.tokenLabel}}),Object.defineProperty(n,"tokenMatcher",{enumerable:!0,get:function(){return r.tokenMatcher}}),Object.defineProperty(n,"tokenName",{enumerable:!0,get:function(){return r.tokenName}});var a=Et();Object.defineProperty(n,"defaultParserErrorProvider",{enumerable:!0,get:function(){return a.defaultParserErrorProvider}});var o=dt();Object.defineProperty(n,"EarlyExitException",{enumerable:!0,get:function(){return o.EarlyExitException}}),Object.defineProperty(n,"isRecognitionException",{enumerable:!0,get:function(){return o.isRecognitionException}}),Object.defineProperty(n,"MismatchedTokenException",{enumerable:!0,get:function(){return o.MismatchedTokenException}}),Object.defineProperty(n,"NotAllInputParsedException",{enumerable:!0,get:function(){return o.NotAllInputParsedException}}),Object.defineProperty(n,"NoViableAltException",{enumerable:!0,get:function(){return o.NoViableAltException}});var u=_n();Object.defineProperty(n,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return u.defaultLexerErrorProvider}});var c=He();Object.defineProperty(n,"Alternation",{enumerable:!0,get:function(){return c.Alternation}}),Object.defineProperty(n,"Alternative",{enumerable:!0,get:function(){return c.Alternative}}),Object.defineProperty(n,"NonTerminal",{enumerable:!0,get:function(){return c.NonTerminal}}),Object.defineProperty(n,"Option",{enumerable:!0,get:function(){return c.Option}}),Object.defineProperty(n,"Repetition",{enumerable:!0,get:function(){return c.Repetition}}),Object.defineProperty(n,"RepetitionMandatory",{enumerable:!0,get:function(){return c.RepetitionMandatory}}),Object.defineProperty(n,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return c.RepetitionMandatoryWithSeparator}}),Object.defineProperty(n,"RepetitionWithSeparator",{enumerable:!0,get:function(){return c.RepetitionWithSeparator}}),Object.defineProperty(n,"Rule",{enumerable:!0,get:function(){return c.Rule}}),Object.defineProperty(n,"Terminal",{enumerable:!0,get:function(){return c.Terminal}});var s=He();Object.defineProperty(n,"serializeGrammar",{enumerable:!0,get:function(){return s.serializeGrammar}}),Object.defineProperty(n,"serializeProduction",{enumerable:!0,get:function(){return s.serializeProduction}});var f=ft();Object.defineProperty(n,"GAstVisitor",{enumerable:!0,get:function(){return f.GAstVisitor}});function h(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
217
+ `;return f+u+b+d+I+g}i.createSyntaxDiagramsCode=t}),Yo=Be(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Parser=i.createSyntaxDiagramsCode=i.clearCache=i.GAstVisitor=i.serializeProduction=i.serializeGrammar=i.Terminal=i.Rule=i.RepetitionWithSeparator=i.RepetitionMandatoryWithSeparator=i.RepetitionMandatory=i.Repetition=i.Option=i.NonTerminal=i.Alternative=i.Alternation=i.defaultLexerErrorProvider=i.NoViableAltException=i.NotAllInputParsedException=i.MismatchedTokenException=i.isRecognitionException=i.EarlyExitException=i.defaultParserErrorProvider=i.tokenName=i.tokenMatcher=i.tokenLabel=i.EOF=i.createTokenInstance=i.createToken=i.LexerDefinitionErrorType=i.Lexer=i.EMPTY_ALT=i.ParserDefinitionErrorType=i.EmbeddedActionsParser=i.CstParser=i.VERSION=void 0;var e=xi();Object.defineProperty(i,"VERSION",{enumerable:!0,get:function(){return e.VERSION}});var t=Xe();Object.defineProperty(i,"CstParser",{enumerable:!0,get:function(){return t.CstParser}}),Object.defineProperty(i,"EmbeddedActionsParser",{enumerable:!0,get:function(){return t.EmbeddedActionsParser}}),Object.defineProperty(i,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return t.ParserDefinitionErrorType}}),Object.defineProperty(i,"EMPTY_ALT",{enumerable:!0,get:function(){return t.EMPTY_ALT}});var r=kt();Object.defineProperty(i,"Lexer",{enumerable:!0,get:function(){return r.Lexer}}),Object.defineProperty(i,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return r.LexerDefinitionErrorType}});var n=ct();Object.defineProperty(i,"createToken",{enumerable:!0,get:function(){return n.createToken}}),Object.defineProperty(i,"createTokenInstance",{enumerable:!0,get:function(){return n.createTokenInstance}}),Object.defineProperty(i,"EOF",{enumerable:!0,get:function(){return n.EOF}}),Object.defineProperty(i,"tokenLabel",{enumerable:!0,get:function(){return n.tokenLabel}}),Object.defineProperty(i,"tokenMatcher",{enumerable:!0,get:function(){return n.tokenMatcher}}),Object.defineProperty(i,"tokenName",{enumerable:!0,get:function(){return n.tokenName}});var s=_t();Object.defineProperty(i,"defaultParserErrorProvider",{enumerable:!0,get:function(){return s.defaultParserErrorProvider}});var o=yt();Object.defineProperty(i,"EarlyExitException",{enumerable:!0,get:function(){return o.EarlyExitException}}),Object.defineProperty(i,"isRecognitionException",{enumerable:!0,get:function(){return o.isRecognitionException}}),Object.defineProperty(i,"MismatchedTokenException",{enumerable:!0,get:function(){return o.MismatchedTokenException}}),Object.defineProperty(i,"NotAllInputParsedException",{enumerable:!0,get:function(){return o.NotAllInputParsedException}}),Object.defineProperty(i,"NoViableAltException",{enumerable:!0,get:function(){return o.NoViableAltException}});var c=Di();Object.defineProperty(i,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return c.defaultLexerErrorProvider}});var A=We();Object.defineProperty(i,"Alternation",{enumerable:!0,get:function(){return A.Alternation}}),Object.defineProperty(i,"Alternative",{enumerable:!0,get:function(){return A.Alternative}}),Object.defineProperty(i,"NonTerminal",{enumerable:!0,get:function(){return A.NonTerminal}}),Object.defineProperty(i,"Option",{enumerable:!0,get:function(){return A.Option}}),Object.defineProperty(i,"Repetition",{enumerable:!0,get:function(){return A.Repetition}}),Object.defineProperty(i,"RepetitionMandatory",{enumerable:!0,get:function(){return A.RepetitionMandatory}}),Object.defineProperty(i,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return A.RepetitionMandatoryWithSeparator}}),Object.defineProperty(i,"RepetitionWithSeparator",{enumerable:!0,get:function(){return A.RepetitionWithSeparator}}),Object.defineProperty(i,"Rule",{enumerable:!0,get:function(){return A.Rule}}),Object.defineProperty(i,"Terminal",{enumerable:!0,get:function(){return A.Terminal}});var a=We();Object.defineProperty(i,"serializeGrammar",{enumerable:!0,get:function(){return a.serializeGrammar}}),Object.defineProperty(i,"serializeProduction",{enumerable:!0,get:function(){return a.serializeProduction}});var f=Ct();Object.defineProperty(i,"GAstVisitor",{enumerable:!0,get:function(){return f.GAstVisitor}});function u(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
217
218
  It performs no action other than printing this message.
218
- Please avoid using it as it will be completely removed in the future`)}n.clearCache=h;var g=Ti();Object.defineProperty(n,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return g.createSyntaxDiagramsCode}});var p=(function(){function T(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
219
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return T})();n.Parser=p});const at=Ei();class vi extends R.Loader{constructor(e){super(e)}load(e,t,i,r){const a=this,o=a.path===""?R.LoaderUtils.extractUrlBase(e):a.path,u=new R.FileLoader(a.manager);u.setPath(a.path),u.setRequestHeader(a.requestHeader),u.setWithCredentials(a.withCredentials),u.load(e,function(c){try{t(a.parse(c,o))}catch(s){r?r(s):console.error(s),a.manager.itemError(e)}},i,r)}parse(e,t){const i={};function r(b){const A=a(),_=new Ri(A.tokens),N=new _i(A.tokenVocabulary),L=o(N.getBaseCstVisitorConstructor()),w=_.lex(b);N.input=w.tokens;const D=N.vrml();if(N.errors.length>0)throw console.error(N.errors),Error("THREE.VRMLLoader2: Parsing errors detected.");return L.visit(D)}function a(){const b=at.createToken,A=b({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]*/}),_=b({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:A}),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=b({name:"Version",pattern:/#VRML.*/,longer_alt:_}),w=b({name:"NodeName",pattern:new RegExp(N.join("|")),longer_alt:_}),D=b({name:"DEF",pattern:/DEF/,longer_alt:_}),j=b({name:"USE",pattern:/USE/,longer_alt:_}),V=b({name:"ROUTE",pattern:/ROUTE/,longer_alt:_}),Z=b({name:"TO",pattern:/TO/,longer_alt:_}),re=b({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),ge=b({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),Oe=b({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Fe=b({name:"TrueLiteral",pattern:/TRUE/}),Ie=b({name:"FalseLiteral",pattern:/FALSE/}),Ee=b({name:"NullLiteral",pattern:/NULL/}),Re=b({name:"LSquare",pattern:/\[/}),Ne=b({name:"RSquare",pattern:/]/}),Me=b({name:"LCurly",pattern:/{/}),Se=b({name:"RCurly",pattern:/}/}),De=b({name:"Comment",pattern:/#.*/,group:at.Lexer.SKIPPED}),Ge=[b({name:"WhiteSpace",pattern:/[ ,\s]/,group:at.Lexer.SKIPPED}),w,D,j,V,Z,Fe,Ie,Ee,L,_,A,re,ge,Oe,Re,Ne,Me,Se,De],ze={};for(let Le=0,ue=Ge.length;Le<ue;Le++){const he=Ge[Le];ze[he.name]=he}return{tokens:Ge,tokenVocabulary:ze}}function o(b){class A extends b{constructor(){super(),this.validateVisitor()}vrml(L){const w={version:this.visit(L.version),nodes:[],routes:[]};for(let D=0,j=L.node.length;D<j;D++){const V=L.node[D];w.nodes.push(this.visit(V))}if(L.route)for(let D=0,j=L.route.length;D<j;D++){const V=L.route[D];w.routes.push(this.visit(V))}return w}version(L){return L.Version[0].image}node(L){const w={name:L.NodeName[0].image,fields:[]};if(L.field)for(let D=0,j=L.field.length;D<j;D++){const V=L.field[D];w.fields.push(this.visit(V))}return L.def&&(w.DEF=this.visit(L.def[0])),w}field(L){const w={name:L.Identifier[0].image,type:null,values:null};let D;return L.singleFieldValue&&(D=this.visit(L.singleFieldValue[0])),L.multiFieldValue&&(D=this.visit(L.multiFieldValue[0])),w.type=D.type,w.values=D.values,w}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 w={type:null,values:[]};if(L.node){w.type="node";for(let D=0,j=L.node.length;D<j;D++){const V=L.node[D];w.values.push(N.visit(V))}}if(L.use){w.type="use";for(let D=0,j=L.use.length;D<j;D++){const V=L.use[D];w.values.push(N.visit(V))}}if(L.StringLiteral){w.type="string";for(let D=0,j=L.StringLiteral.length;D<j;D++){const V=L.StringLiteral[D];w.values.push(V.image.replace(/'|"/g,""))}}if(L.NumberLiteral){w.type="number";for(let D=0,j=L.NumberLiteral.length;D<j;D++){const V=L.NumberLiteral[D];w.values.push(parseFloat(V.image))}}if(L.HexLiteral){w.type="hex";for(let D=0,j=L.HexLiteral.length;D<j;D++){const V=L.HexLiteral[D];w.values.push(V.image)}}if(L.TrueLiteral){w.type="boolean";for(let D=0,j=L.TrueLiteral.length;D<j;D++)L.TrueLiteral[D].image==="TRUE"&&w.values.push(!0)}if(L.FalseLiteral){w.type="boolean";for(let D=0,j=L.FalseLiteral.length;D<j;D++)L.FalseLiteral[D].image==="FALSE"&&w.values.push(!1)}return L.NullLiteral&&(w.type="null",L.NullLiteral.forEach(function(){w.values.push(null)})),w}return new A}function u(b){const A=b.nodes,_=new R.Scene;for(let N=0,L=A.length;N<L;N++){const w=A[N];c(w)}for(let N=0,L=A.length;N<L;N++){const w=A[N],D=s(w);D instanceof R.Object3D&&_.add(D),w.name==="WorldInfo"&&(_.userData.worldInfo=D)}return _}function c(b){b.DEF&&(i[b.DEF]=b);const A=b.fields;for(let _=0,N=A.length;_<N;_++){const L=A[_];if(L.type==="node"){const w=L.values;for(let D=0,j=w.length;D<j;D++)c(w[D])}}}function s(b){return b.USE?Q(b.USE):(b.build!==void 0||(b.build=f(b)),b.build)}function f(b){const A=b.name;let _;switch(A){case"Anchor":case"Group":case"Transform":case"Collision":_=h(b);break;case"Background":_=g(b);break;case"Shape":_=p(b);break;case"Appearance":_=T(b);break;case"Material":_=m(b);break;case"ImageTexture":_=v(b);break;case"PixelTexture":_=y(b);break;case"TextureTransform":_=E(b);break;case"IndexedFaceSet":_=k(b);break;case"IndexedLineSet":_=H(b);break;case"PointSet":_=x(b);break;case"Box":_=B(b);break;case"Cone":_=P(b);break;case"Cylinder":_=O(b);break;case"Sphere":_=M(b);break;case"ElevationGrid":_=C(b);break;case"Extrusion":_=X(b);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":_=S(b);break;case"WorldInfo":_=I(b);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.VRMLLoader2: Unknown node:",A);break}return _!==void 0&&b.DEF!==void 0&&_.hasOwnProperty("name")===!0&&(_.name=b.DEF),_}function h(b){const A=new R.Group,_=b.fields;for(let N=0,L=_.length;N<L;N++){const w=_[N],D=w.name,j=w.values;switch(D){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":W(j,A);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const V=new R.Vector3(j[0],j[1],j[2]).normalize(),Z=j[3];A.quaternion.setFromAxisAngle(V,Z);break;case"scale":A.scale.set(j[0],j[1],j[2]);break;case"scaleOrientation":break;case"translation":A.position.set(j[0],j[1],j[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",D);break}}return A}function g(b){const A=new R.Group;let _,N,L,w;const D=b.fields;for(let V=0,Z=D.length;V<Z;V++){const re=D[V],ge=re.name,Oe=re.values;switch(ge){case"groundAngle":_=Oe;break;case"groundColor":N=Oe;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":L=Oe;break;case"skyColor":w=Oe;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",ge);break}}const j=1e4;if(w){const V=new R.SphereGeometry(j,32,16),Z=new R.MeshBasicMaterial({fog:!1,side:R.BackSide,depthWrite:!1,depthTest:!1});w.length>3?(z(V,j,L,F(w),!0),Z.vertexColors=!0):Z.color.setRGB(w[0],w[1],w[2],R.SRGBColorSpace);const re=new R.Mesh(V,Z);A.add(re)}if(N&&N.length>0){const V=new R.SphereGeometry(j,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),Z=new R.MeshBasicMaterial({fog:!1,side:R.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});z(V,j,_,F(N),!1);const re=new R.Mesh(V,Z);A.add(re)}return A.renderOrder=-1/0,A}function p(b){const A=b.fields;let _=new R.MeshBasicMaterial({name:R.Loader.DEFAULT_MATERIAL_NAME,color:0}),N;for(let w=0,D=A.length;w<D;w++){const j=A[w],V=j.name,Z=j.values;switch(V){case"appearance":Z[0]!==null&&(_=s(Z[0]));break;case"geometry":Z[0]!==null&&(N=s(Z[0]));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",V);break}}let L;if(N&&N.attributes.position){const w=N._type;if(w==="points"){const D=new R.PointsMaterial({name:R.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?D.vertexColors=!0:_.isMeshPhongMaterial&&D.color.copy(_.emissive),L=new R.Points(N,D)}else if(w==="line"){const D=new R.LineBasicMaterial({name:R.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?D.vertexColors=!0:_.isMeshPhongMaterial&&D.color.copy(_.emissive),L=new R.LineSegments(N,D)}else N._solid!==void 0&&(_.side=N._solid?R.FrontSide:R.DoubleSide),N.attributes.color!==void 0&&(_.vertexColors=!0),L=new R.Mesh(N,_)}else L=new R.Object3D,L.visible=!1;return L}function T(b){let A=new R.MeshPhongMaterial,_;const N=b.fields;for(let L=0,w=N.length;L<w;L++){const D=N[L],j=D.name,V=D.values;switch(j){case"material":if(V[0]!==null){const re=s(V[0]);re.diffuseColor&&A.color.copy(re.diffuseColor),re.emissiveColor&&A.emissive.copy(re.emissiveColor),re.shininess&&(A.shininess=re.shininess),re.specularColor&&A.specular.copy(re.specularColor),re.transparency&&(A.opacity=1-re.transparency),re.transparency>0&&(A.transparent=!0)}else A=new R.MeshBasicMaterial({name:R.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const Z=V[0];Z!==null&&(Z.name==="ImageTexture"||Z.name==="PixelTexture"||Z.USE)&&(A.map=s(Z));break;case"textureTransform":V[0]!==null&&(_=s(V[0]));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",j);break}}if(A.map){if(A.map.__type){switch(A.map.__type){case Xe.INTENSITY_ALPHA:A.opacity=1;break;case Xe.RGB:A.color.set(16777215);break;case Xe.RGBA:A.color.set(16777215),A.opacity=1;break}delete A.map.__type}_&&(A.map.center.copy(_.center),A.map.rotation=_.rotation,A.map.repeat.copy(_.scale),A.map.offset.copy(_.translation))}return A}function m(b){const A={},_=b.fields;for(let N=0,L=_.length;N<L;N++){const w=_[N],D=w.name,j=w.values;switch(D){case"ambientIntensity":break;case"diffuseColor":A.diffuseColor=new R.Color().setRGB(j[0],j[1],j[2],R.SRGBColorSpace);break;case"emissiveColor":A.emissiveColor=new R.Color().setRGB(j[0],j[1],j[2],R.SRGBColorSpace);break;case"shininess":A.shininess=j[0];break;case"specularColor":A.specularColor=new R.Color().setRGB(j[0],j[1],j[2],R.SRGBColorSpace);break;case"transparency":A.transparency=j[0];break;default:console.warn("THREE.VRMLLoader2: Unknown field:",D);break}}return A}function l(b,A,_){let N;switch(A){case Xe.INTENSITY:N=parseInt(b),_.r=N,_.g=N,_.b=N,_.a=1;break;case Xe.INTENSITY_ALPHA:N=parseInt("0x"+b.substring(2,4)),_.r=N,_.g=N,_.b=N,_.a=parseInt("0x"+b.substring(4,6));break;case Xe.RGB:_.r=parseInt("0x"+b.substring(2,4)),_.g=parseInt("0x"+b.substring(4,6)),_.b=parseInt("0x"+b.substring(6,8)),_.a=1;break;case Xe.RGBA:_.r=parseInt("0x"+b.substring(2,4)),_.g=parseInt("0x"+b.substring(4,6)),_.b=parseInt("0x"+b.substring(6,8)),_.a=parseInt("0x"+b.substring(8,10));break}}function d(b){let A;switch(b){case 1:A=Xe.INTENSITY;break;case 2:A=Xe.INTENSITY_ALPHA;break;case 3:A=Xe.RGB;break;case 4:A=Xe.RGBA;break}return A}function y(b){let A,_=R.RepeatWrapping,N=R.RepeatWrapping;const L=b.fields;for(let w=0,D=L.length;w<D;w++){const j=L[w],V=j.name,Z=j.values;switch(V){case"image":const re=Z[0],ge=Z[1],Oe=Z[2],Fe=d(Oe),Ie=new Uint8Array(4*re*ge),Ee={r:0,g:0,b:0,a:0};for(let Re=3,Ne=0,Me=Z.length;Re<Me;Re++,Ne++){l(Z[Re],Fe,Ee);const Se=Ne*4;Ie[Se+0]=Ee.r,Ie[Se+1]=Ee.g,Ie[Se+2]=Ee.b,Ie[Se+3]=Ee.a}A=new R.DataTexture(Ie,re,ge),A.colorSpace=R.SRGBColorSpace,A.needsUpdate=!0,A.__type=Fe;break;case"repeatS":Z[0]===!1&&(_=R.ClampToEdgeWrapping);break;case"repeatT":Z[0]===!1&&(N=R.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",V);break}}return A&&(A.wrapS=_,A.wrapT=N),A}function v(b){let A,_=R.RepeatWrapping,N=R.RepeatWrapping;const L=b.fields;for(let w=0,D=L.length;w<D;w++){const j=L[w],V=j.name,Z=j.values;switch(V){case"url":const re=Z[0];re&&(A=ee.load(re));break;case"repeatS":Z[0]===!1&&(_=R.ClampToEdgeWrapping);break;case"repeatT":Z[0]===!1&&(N=R.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",V);break}}return A&&(A.wrapS=_,A.wrapT=N,A.colorSpace=R.SRGBColorSpace),A}function E(b){const A={center:new R.Vector2,rotation:new R.Vector2,scale:new R.Vector2,translation:new R.Vector2},_=b.fields;for(let N=0,L=_.length;N<L;N++){const w=_[N],D=w.name,j=w.values;switch(D){case"center":A.center.set(j[0],j[1]);break;case"rotation":A.rotation=j[0];break;case"scale":A.scale.set(j[0],j[1]);break;case"translation":A.translation.set(j[0],j[1]);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",D);break}}return A}function S(b){return b.fields[0].values}function I(b){const A={},_=b.fields;for(let N=0,L=_.length;N<L;N++){const w=_[N],D=w.name,j=w.values;switch(D){case"title":A.title=j[0];break;case"info":A.info=j;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",D);break}}return A}function k(b){let A,_,N,L,w=!0,D=!0,j=0,V,Z,re,ge,Oe=!0,Fe=!0;const Ie=b.fields;for(let Ce=0,Ge=Ie.length;Ce<Ge;Ce++){const ze=Ie[Ce],Le=ze.name,ue=ze.values;switch(Le){case"color":const he=ue[0];he!==null&&(A=s(he));break;case"coord":const oe=ue[0];oe!==null&&(_=s(oe));break;case"normal":const fe=ue[0];fe!==null&&(N=s(fe));break;case"texCoord":const me=ue[0];me!==null&&(L=s(me));break;case"ccw":w=ue[0];break;case"colorIndex":V=ue;break;case"colorPerVertex":Oe=ue[0];break;case"convex":break;case"coordIndex":Z=ue;break;case"creaseAngle":j=ue[0];break;case"normalIndex":re=ue;break;case"normalPerVertex":Fe=ue[0];break;case"solid":D=ue[0];break;case"texCoordIndex":ge=ue;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",Le);break}}if(Z===void 0)return console.warn("THREE.VRMLLoader2: Missing coordIndex."),new R.BufferGeometry;const Ee=$(Z,w);let Re,Ne,Me;if(A){if(Oe===!0)if(V&&V.length>0){const Ce=$(V,w);Re=J(Ee,Ce,A,3)}else Re=ye(Ee,new R.Float32BufferAttribute(A,3));else if(V&&V.length>0){const Ce=ce(A,V),Ge=te(Ce,Z);Re=ie(Ee,Ge)}else{const Ce=te(A,Z);Re=ie(Ee,Ce)}Y(Re)}if(N)if(Fe===!0)if(re&&re.length>0){const Ce=$(re,w);Ne=J(Ee,Ce,N,3)}else Ne=ye(Ee,new R.Float32BufferAttribute(N,3));else if(re&&re.length>0){const Ce=ce(N,re),Ge=te(Ce,Z);Ne=ie(Ee,Ge)}else{const Ce=te(N,Z);Ne=ie(Ee,Ce)}else Ne=We(Ee,_,j);if(L)if(ge&&ge.length>0){const Ce=$(ge,w);Me=J(Ee,Ce,L,2)}else Me=ye(Ee,new R.Float32BufferAttribute(L,2));const Se=new R.BufferGeometry,De=ye(Ee,new R.Float32BufferAttribute(_,3));return Se.setAttribute("position",De),Se.setAttribute("normal",Ne),Re&&Se.setAttribute("color",Re),Me&&Se.setAttribute("uv",Me),Se._solid=D,Se._type="mesh",Se}function H(b){let A,_,N,L,w=!0;const D=b.fields;for(let ge=0,Oe=D.length;ge<Oe;ge++){const Fe=D[ge],Ie=Fe.name,Ee=Fe.values;switch(Ie){case"color":const Re=Ee[0];Re!==null&&(A=s(Re));break;case"coord":const Ne=Ee[0];Ne!==null&&(_=s(Ne));break;case"colorIndex":N=Ee;break;case"colorPerVertex":w=Ee[0];break;case"coordIndex":L=Ee;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",Ie);break}}let j;const V=ae(L);if(A){if(w===!0)if(N.length>0){const ge=ae(N);j=J(V,ge,A,3)}else j=ye(V,new R.Float32BufferAttribute(A,3));else if(N.length>0){const ge=ce(A,N),Oe=le(ge,L);j=Te(V,Oe)}else{const ge=le(A,L);j=Te(V,ge)}Y(j)}const Z=new R.BufferGeometry,re=ye(V,new R.Float32BufferAttribute(_,3));return Z.setAttribute("position",re),j&&Z.setAttribute("color",j),Z._type="line",Z}function x(b){let A,_;const N=b.fields;for(let w=0,D=N.length;w<D;w++){const j=N[w],V=j.name,Z=j.values;switch(V){case"color":const re=Z[0];re!==null&&(A=s(re));break;case"coord":const ge=Z[0];ge!==null&&(_=s(ge));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",V);break}}const L=new R.BufferGeometry;if(L.setAttribute("position",new R.Float32BufferAttribute(_,3)),A){const w=new R.Float32BufferAttribute(A,3);Y(w),L.setAttribute("color",w)}return L._type="points",L}function B(b){const A=new R.Vector3(2,2,2),_=b.fields;for(let L=0,w=_.length;L<w;L++){const D=_[L],j=D.name,V=D.values;j==="size"?(A.x=V[0],A.y=V[1],A.z=V[2]):console.warn("THREE.VRMLLoader2: Unknown field:",j)}return new R.BoxGeometry(A.x,A.y,A.z)}function P(b){let A=1,_=2,N=!1;const L=b.fields;for(let D=0,j=L.length;D<j;D++){const V=L[D],Z=V.name,re=V.values;switch(Z){case"bottom":N=!re[0];break;case"bottomRadius":A=re[0];break;case"height":_=re[0];break;case"side":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",Z);break}}return new R.ConeGeometry(A,_,16,1,N)}function O(b){let A=1,_=2;const N=b.fields;for(let w=0,D=N.length;w<D;w++){const j=N[w],V=j.name,Z=j.values;switch(V){case"bottom":break;case"radius":A=Z[0];break;case"height":_=Z[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",V);break}}return new R.CylinderGeometry(A,A,_,16,1)}function M(b){let A=1;const _=b.fields;for(let L=0,w=_.length;L<w;L++){const D=_[L],j=D.name,V=D.values;j==="radius"?A=V[0]:console.warn("THREE.VRMLLoader2: Unknown field:",j)}return new R.SphereGeometry(A,16,16)}function C(b){let A,_,N,L,w=!0,D=!0,j=!0,V=!0,Z=0,re=2,ge=2,Oe=1,Fe=1;const Ie=b.fields;for(let ue=0,he=Ie.length;ue<he;ue++){const oe=Ie[ue],fe=oe.name,me=oe.values;switch(fe){case"color":const Pe=me[0];Pe!==null&&(A=s(Pe));break;case"normal":const Qe=me[0];Qe!==null&&(_=s(Qe));break;case"texCoord":const Ze=me[0];Ze!==null&&(N=s(Ze));break;case"height":L=me;break;case"ccw":V=me[0];break;case"colorPerVertex":w=me[0];break;case"creaseAngle":Z=me[0];break;case"normalPerVertex":D=me[0];break;case"solid":j=me[0];break;case"xDimension":re=me[0];break;case"xSpacing":Oe=me[0];break;case"zDimension":ge=me[0];break;case"zSpacing":Fe=me[0];break;default:console.warn("THREE.VRMLLoader2: Unknown field:",fe);break}}const Ee=[],Re=[],Ne=[],Me=[];for(let ue=0;ue<ge;ue++)for(let he=0;he<re;he++){const oe=ue*re+he,fe=Oe*ue,me=L[oe],Pe=Fe*he;if(Ee.push(fe,me,Pe),A&&w===!0){const Qe=A[oe*3+0],Ze=A[oe*3+1],At=A[oe*3+2];Ne.push(Qe,Ze,At)}if(_&&D===!0){const Qe=_[oe*3+0],Ze=_[oe*3+1],At=_[oe*3+2];Re.push(Qe,Ze,At)}if(N){const Qe=N[oe*2+0],Ze=N[oe*2+1];Me.push(Qe,Ze)}else Me.push(ue/(re-1),he/(ge-1))}const Se=[];for(let ue=0;ue<re-1;ue++)for(let he=0;he<ge-1;he++){const oe=ue+he*re,fe=ue+(he+1)*re,me=ue+1+(he+1)*re,Pe=ue+1+he*re;V===!0?(Se.push(oe,me,fe),Se.push(me,oe,Pe)):(Se.push(oe,fe,me),Se.push(me,Pe,oe))}const De=ye(Se,new R.Float32BufferAttribute(Ee,3)),Ce=ye(Se,new R.Float32BufferAttribute(Me,2));let Ge,ze;if(A){if(w===!1){for(let ue=0;ue<re-1;ue++)for(let he=0;he<ge-1;he++){const oe=ue+he*(re-1),fe=A[oe*3+0],me=A[oe*3+1],Pe=A[oe*3+2];Ne.push(fe,me,Pe),Ne.push(fe,me,Pe),Ne.push(fe,me,Pe),Ne.push(fe,me,Pe),Ne.push(fe,me,Pe),Ne.push(fe,me,Pe)}Ge=new R.Float32BufferAttribute(Ne,3)}else Ge=ye(Se,new R.Float32BufferAttribute(Ne,3));Y(Ge)}if(_)if(D===!1){for(let ue=0;ue<re-1;ue++)for(let he=0;he<ge-1;he++){const oe=ue+he*(re-1),fe=_[oe*3+0],me=_[oe*3+1],Pe=_[oe*3+2];Re.push(fe,me,Pe),Re.push(fe,me,Pe),Re.push(fe,me,Pe),Re.push(fe,me,Pe),Re.push(fe,me,Pe),Re.push(fe,me,Pe)}ze=new R.Float32BufferAttribute(Re,3)}else ze=ye(Se,new R.Float32BufferAttribute(Re,3));else ze=We(Se,Ee,Z);const Le=new R.BufferGeometry;return Le.setAttribute("position",De),Le.setAttribute("normal",ze),Le.setAttribute("uv",Ce),Ge&&Le.setAttribute("color",Ge),Le._solid=j,Le._type="mesh",Le}function X(b){let A=[1,1,1,-1,-1,-1,-1,1,1,1],_=[0,0,0,0,1,0],N,L,w=!0,D=!0,j=0,V=!0,Z=!0;const re=b.fields;for(let Le=0,ue=re.length;Le<ue;Le++){const he=re[Le],oe=he.name,fe=he.values;switch(oe){case"beginCap":w=fe[0];break;case"ccw":D=fe[0];break;case"convex":break;case"creaseAngle":j=fe[0];break;case"crossSection":A=fe;break;case"endCap":V=fe[0];break;case"orientation":L=fe;break;case"scale":N=fe;break;case"solid":Z=fe[0];break;case"spine":_=fe;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",oe);break}}const ge=A[0]===A[A.length-2]&&A[1]===A[A.length-1],Oe=[],Fe=new R.Vector3,Ie=new R.Vector3,Ee=new R.Vector3,Re=new R.Vector3,Ne=new R.Quaternion;for(let Le=0,ue=0,he=0,oe=_.length;Le<oe;Le+=3,ue+=2,he+=4){Fe.fromArray(_,Le),Ie.x=N?N[ue+0]:1,Ie.y=1,Ie.z=N?N[ue+1]:1,Ee.x=L?L[he+0]:0,Ee.y=L?L[he+1]:0,Ee.z=L?L[he+2]:1;const fe=L?L[he+3]:0;for(let me=0,Pe=A.length;me<Pe;me+=2)Re.x=A[me+0],Re.y=0,Re.z=A[me+1],Re.multiply(Ie),Ne.setFromAxisAngle(Ee,fe),Re.applyQuaternion(Ne),Re.add(Fe),Oe.push(Re.x,Re.y,Re.z)}const Me=[],Se=_.length/3,De=A.length/2;for(let Le=0;Le<Se-1;Le++)for(let ue=0;ue<De-1;ue++){const he=ue+Le*De;let oe=ue+1+Le*De;const fe=ue+(Le+1)*De;let me=ue+1+(Le+1)*De;ue===De-2&&ge===!0&&(oe=Le*De,me=(Le+1)*De),D===!0?(Me.push(he,oe,fe),Me.push(fe,oe,me)):(Me.push(he,fe,oe),Me.push(fe,me,oe))}if(w===!0||V===!0){const Le=[];for(let oe=0,fe=A.length;oe<fe;oe+=2)Le.push(new R.Vector2(A[oe],A[oe+1]));const ue=R.ShapeUtils.triangulateShape(Le,[]),he=[];for(let oe=0,fe=ue.length;oe<fe;oe++){const me=ue[oe];he.push(me[0],me[1],me[2])}if(w===!0)for(let oe=0,fe=he.length;oe<fe;oe+=3)D===!0?Me.push(he[oe+0],he[oe+1],he[oe+2]):Me.push(he[oe+0],he[oe+2],he[oe+1]);if(V===!0){const oe=De*(Se-1);for(let fe=0,me=he.length;fe<me;fe+=3)D===!0?Me.push(oe+he[fe+0],oe+he[fe+2],oe+he[fe+1]):Me.push(oe+he[fe+0],oe+he[fe+1],oe+he[fe+2])}}const Ce=ye(Me,new R.Float32BufferAttribute(Oe,3)),Ge=We(Me,Oe,j),ze=new R.BufferGeometry;return ze.setAttribute("position",Ce),ze.setAttribute("normal",Ge),ze._solid=Z,ze._type="mesh",ze}function Q(b){const A=i[b],_=s(A);return _.isObject3D||_.isMaterial?_.clone():_}function W(b,A){for(let _=0,N=b.length;_<N;_++){const L=s(b[_]);L instanceof R.Object3D&&A.add(L)}}function $(b,A){const _=[];let N=0;for(let L=0,w=b.length;L<w;L++){const D=b[N],j=b[L+(A?1:2)],V=b[L+(A?2:1)];_.push(D,j,V),(b[L+3]===-1||L+3>=w)&&(L+=3,N=L+1)}return _}function te(b,A){const _=[];let N=0;for(let L=0,w=A.length;L<w;L++){const D=N*3,j=b[D],V=b[D+1],Z=b[D+2];_.push(j,V,Z),(A[L+3]===-1||L+3>=w)&&(L+=3,N++)}return _}function ce(b,A){const _=[];for(let N=0,L=A.length;N<L;N++){const D=A[N]*3,j=b[D],V=b[D+1],Z=b[D+2];_.push(j,V,Z)}return _}function ae(b){const A=[];for(let _=0,N=b.length;_<N;_++){const L=b[_],w=b[_+1];A.push(L,w),(b[_+2]===-1||_+2>=N)&&(_+=2)}return A}function le(b,A){const _=[];let N=0;for(let L=0,w=A.length;L<w;L++){const D=N*3,j=b[D],V=b[D+1],Z=b[D+2];_.push(j,V,Z),(A[L+2]===-1||L+2>=w)&&(L+=2,N++)}return _}const ne=new R.Vector3,pe=new R.Vector3,U=new R.Vector3,G=new R.Vector2,K=new R.Vector2,q=new R.Vector2;function J(b,A,_,N){const L=[];for(let w=0,D=b.length;w<D;w+=3){const j=A[w],V=A[w+1],Z=A[w+2];N===2?(G.fromArray(_,j*N),K.fromArray(_,V*N),q.fromArray(_,Z*N),L.push(G.x,G.y),L.push(K.x,K.y),L.push(q.x,q.y)):(ne.fromArray(_,j*N),pe.fromArray(_,V*N),U.fromArray(_,Z*N),L.push(ne.x,ne.y,ne.z),L.push(pe.x,pe.y,pe.z),L.push(U.x,U.y,U.z))}return new R.Float32BufferAttribute(L,N)}function ie(b,A){const _=[];for(let N=0,L=0,w=b.length;N<w;N+=3,L++)ne.fromArray(A,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 R.Float32BufferAttribute(_,3)}function Te(b,A){const _=[];for(let N=0,L=0,w=b.length;N<w;N+=2,L++)ne.fromArray(A,L*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new R.Float32BufferAttribute(_,3)}function ye(b,A){const _=A.array,N=A.itemSize,L=new _.constructor(b.length*N);let w=0,D=0;for(let j=0,V=b.length;j<V;j++){w=b[j]*N;for(let Z=0;Z<N;Z++)L[D++]=_[w++]}return new R.Float32BufferAttribute(L,N)}const we=new R.Vector3,Be=new R.Vector3;function We(b,A,_){const N=[],L={};for(let D=0,j=b.length;D<j;D+=3){const V=b[D],Z=b[D+1],re=b[D+2],ge=new bi(V,Z,re);ne.fromArray(A,V*3),pe.fromArray(A,Z*3),U.fromArray(A,re*3),Be.subVectors(U,pe),we.subVectors(ne,pe),Be.cross(we),Be.normalize(),ge.normal.copy(Be),L[V]===void 0&&(L[V]=[]),L[Z]===void 0&&(L[Z]=[]),L[re]===void 0&&(L[re]=[]),L[V].push(ge.normal),L[Z].push(ge.normal),L[re].push(ge.normal),N.push(ge)}const w=[];for(let D=0,j=N.length;D<j;D++){const V=N[D],Z=Ue(L[V.a],V.normal,_),re=Ue(L[V.b],V.normal,_),ge=Ue(L[V.c],V.normal,_);ne.fromArray(A,V.a*3),pe.fromArray(A,V.b*3),U.fromArray(A,V.c*3),w.push(Z.x,Z.y,Z.z),w.push(re.x,re.y,re.z),w.push(ge.x,ge.y,ge.z)}return new R.Float32BufferAttribute(w,3)}function Ue(b,A,_){const N=new R.Vector3;if(_===0)N.copy(A);else for(let L=0,w=b.length;L<w;L++)b[L].angleTo(A)<_&&N.add(b[L]);return N.normalize()}function F(b){const A=[];for(let _=0,N=b.length;_<N;_+=3)A.push(new R.Color(b[_],b[_+1],b[_+2]));return A}function Y(b){const A=new R.Color;for(let _=0;_<b.count;_++)A.fromBufferAttribute(b,_),R.ColorManagement.colorSpaceToWorking(A,R.SRGBColorSpace),b.setXYZ(_,A.r,A.g,A.b)}function z(b,A,_,N,L){const w=[],D=L===!0?0:Math.PI;for(let Oe=0,Fe=N.length;Oe<Fe;Oe++){let Ie=Oe===0?0:_[Oe-1];Ie=L===!0?Ie:D-Ie;const Ee=new R.Vector3;Ee.setFromSphericalCoords(A,Ie,0),w.push(Ee)}const j=b.index,V=b.attributes.position,Z=new R.BufferAttribute(new Float32Array(b.attributes.position.count*3),3),re=new R.Vector3,ge=new R.Color;for(let Oe=0;Oe<j.count;Oe++){const Fe=j.getX(Oe);re.fromBufferAttribute(V,Fe);let Ie,Ee,Re=1;for(let Se=1;Se<w.length;Se++){Ie=Se-1,Ee=Se;const De=w[Ie],Ce=w[Ee];if(L===!0){if(re.y<=De.y&&re.y>Ce.y){Re=Math.abs(De.y-re.y)/Math.abs(De.y-Ce.y);break}}else if(re.y>=De.y&&re.y<Ce.y){Re=Math.abs(De.y-re.y)/Math.abs(De.y-Ce.y);break}}const Ne=N[Ie],Me=N[Ee];ge.copy(Ne).lerp(Me,Re),R.ColorManagement.colorSpaceToWorking(ge,R.SRGBColorSpace),Z.setXYZ(Fe,ge.r,ge.g,ge.b)}b.setAttribute("color",Z)}const ee=new R.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 de=r(e);return u(de)}}class Ri{constructor(e){this.lexer=new at.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 Ai=at.CstParser;class _i extends Ai{constructor(e){super(e);const t=this,i=e.Version,r=e.LCurly,a=e.RCurly,o=e.LSquare,u=e.RSquare,c=e.Identifier,s=e.RouteIdentifier,f=e.StringLiteral,h=e.HexLiteral,g=e.NumberLiteral,p=e.TrueLiteral,T=e.FalseLiteral,m=e.NullLiteral,l=e.DEF,d=e.USE,y=e.ROUTE,v=e.TO,E=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(E),t.CONSUME(r),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(a)}),t.RULE("field",function(){t.CONSUME(c),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(l),t.OR([{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(E)}}])}),t.RULE("use",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(E)}}])}),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(f)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(g)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(T)}},{ALT:function(){t.CONSUME(m)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(o),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(g)}},{ALT:function(){t.CONSUME(m)}}])}),t.CONSUME(u)}),t.RULE("route",function(){t.CONSUME(y),t.CONSUME(s),t.CONSUME(v),t.CONSUME2(s)}),this.performSelfAnalysis()}}class bi{constructor(e,t,i){this.a=e,this.b=t,this.c=i,this.normal=new R.Vector3}}const Xe={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};class Li extends R.Loader{constructor(e){super(e),this.animateBonePositions=!0,this.animateBoneRotations=!0,this.animateBoneScales=!0}load(e,t,i,r){const a=this,o=new R.FileLoader(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(u){try{t(a.parse(u))}catch(c){r?r(c):console.error(c),a.manager.itemError(e)}},i,r)}parse(e){function t(p){u(p)!=="HIERARCHY"&&console.error("THREE.BVHLoader2: HIERARCHY expected.");const T=[],m=r(p,u(p),T);u(p)!=="MOTION"&&console.error("THREE.BVHLoader2: MOTION expected.");let l=u(p).split(/[\s]+/);const d=parseInt(l[1]);isNaN(d)&&console.error("THREE.BVHLoader2: Failed to read number of frames."),l=u(p).split(/[\s]+/);const y=parseFloat(l[2]);isNaN(y)&&console.error("THREE.BVHLoader2: Failed to read frame time.");for(let v=0;v<d;v++)l=u(p).split(/[\s]+/),i(l,v*y,m);return T}function i(p,T,m){if(m.type==="ENDSITE")return;const l={time:T,position:new R.Vector3,rotation:new R.Quaternion,scale:new R.Vector3(1,1,1)};m.frames.push(l);const d=new R.Quaternion,y=new R.Vector3(1,0,0),v=new R.Vector3(0,1,0),E=new R.Vector3(0,0,1);for(let S=0;S<m.channels.length;S++)switch(m.channels[S]){case"Xposition":l.position.x=parseFloat(p.shift().trim());break;case"Yposition":l.position.y=parseFloat(p.shift().trim());break;case"Zposition":l.position.z=parseFloat(p.shift().trim());break;case"Xrotation":d.setFromAxisAngle(y,parseFloat(p.shift().trim())*Math.PI/180),l.rotation.multiply(d);break;case"Yrotation":d.setFromAxisAngle(v,parseFloat(p.shift().trim())*Math.PI/180),l.rotation.multiply(d);break;case"Zrotation":d.setFromAxisAngle(E,parseFloat(p.shift().trim())*Math.PI/180),l.rotation.multiply(d);break;case"Xscale":l.scale.x=parseFloat(p.shift().trim());break;case"Yscale":l.scale.y=parseFloat(p.shift().trim());break;case"Zscale":l.scale.z=parseFloat(p.shift().trim());break;default:console.warn("THREE.BVHLoader2: Invalid channel type.")}for(let S=0;S<m.children.length;S++)i(p,T,m.children[S])}function r(p,T,m){const l={name:"",type:"",frames:[]};m.push(l);let d=T.split(/[\s]+/);d[0].toUpperCase()==="END"&&d[1].toUpperCase()==="SITE"?(l.type="ENDSITE",l.name="ENDSITE"):(l.name=d[1],l.type=d[0].toUpperCase()),u(p)!=="{"&&console.error("THREE.BVHLoader2: Expected opening { after type & name"),d=u(p).split(/[\s]+/),d[0]!=="OFFSET"&&console.error("THREE.BVHLoader2: Expected OFFSET but got: "+d[0]),d.length!==4&&console.error("THREE.BVHLoader2: Invalid number of values for OFFSET.");const y=new R.Vector3(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));if((isNaN(y.x)||isNaN(y.y)||isNaN(y.z))&&console.error("THREE.BVHLoader2: Invalid values of OFFSET."),l.offset=y,l.type!=="ENDSITE"){d=u(p).split(/[\s]+/),d[0]!=="CHANNELS"&&console.error("THREE.BVHLoader2: Expected CHANNELS definition.");const v=parseInt(d[1]);l.channels=d.splice(2,v),l.children=[]}for(;;){const v=u(p);if(v==="}")return l;l.children.push(r(p,v,m))}}function a(p,T){const m=new R.Bone;if(T.push(m),m.position.add(p.offset),m.name=p.name,p.type!=="ENDSITE")for(let l=0;l<p.children.length;l++)m.add(a(p.children[l],T));return m}function o(p){const T=[];for(let m=0;m<p.length;m++){const l=p[m];if(l.type==="ENDSITE")continue;const d=[],y=[],v=[],E=[];for(let S=0;S<l.frames.length;S++){const I=l.frames[S];d.push(I.time),y.push(I.position.x+l.offset.x),y.push(I.position.y+l.offset.y),y.push(I.position.z+l.offset.z),v.push(I.rotation.x),v.push(I.rotation.y),v.push(I.rotation.z),v.push(I.rotation.w),E.push(I.scale.x),E.push(I.scale.y),E.push(I.scale.z)}c.animateBonePositions&&T.push(new R.VectorKeyframeTrack(l.name+".position",d,y)),c.animateBoneRotations&&T.push(new R.QuaternionKeyframeTrack(l.name+".quaternion",d,v)),c.animateBoneScales&&T.push(new R.VectorKeyframeTrack(l.name+".scale",d,E))}return new R.AnimationClip("animation",-1,T)}function u(p){let T;for(;(T=p.shift().trim()).length===0;);return T}const c=this,s=e.split(/[\r\n]+/g),f=t(s),h=[];a(f[0],h);const g=o(f);return{skeleton:new R.Skeleton(h),clip:g}}}let pt;async function Si(n,e){return pt||(pt=new vi),pt.manager.setURLModifier(i=>(i.startsWith("./")&&(i=i.substring(2)),URL.createObjectURL(nr(n,i)))),await pt.loadAsync(e)}let Ot;async function Oi(n,e){Ot||(Ot=new Li);const t=Pt(n,e);return await Ot.parse(t)}function xi(n){const e=n.clip.clone(),t=n.skeleton.bones[0].clone(!0),i=[];t.traverse(a=>{a instanceof se.Bone&&i.push(a)});const r=new se.Skeleton(i);return r.calculateInverses(),{clip:e,skeleton:r}}class kt{isDummy=!0;skeleton=new se.Skeleton([new se.Bone]);clip=new se.AnimationClip("dummy")}class st extends je{bvhs={};vrmls={};ready;viewActions;currentAction;comment=null;constructor(e){super(),this.viewActions={},this.currentAction={actionRoot:new se.Object3D,boneRoot:new se.Bone},this.ready=this.asyncInit(e)}initObject(){return new se.Object3D}initMotion(){return new Ct(this)}async asyncInit(e){const t=await ln(e),i=new DOMParser,r=Pt(t,"CATALOG.XML"),a=i.parseFromString(r,"application/xml");if(a.querySelector("parsererror"))return console.error("Acerola3D.asyncInit(): CATALOG.XML parse error."),this;const o="http://acerola3d.sourceforge.jp/a3/catalog",u=a.getElementsByTagNameNS(o,"c");u[0]&&(this.comment=u[0].textContent);const c=a.getElementsByTagNameNS(o,"a"),s=[];for(const f of Array.from(c)){const h=f.getAttribute("an");if(h){const g=f.getAttribute("bvh");let p=null;if(g){const E=t.zipUrl+"!"+g;this.bvhs[E]?p=xi(this.bvhs[E]):(p=await Oi(t,g),this.bvhs[g]=p),p&&p.clip.tracks.forEach(S=>{S.setInterpolation(se.InterpolateDiscrete)})}else p=new kt;const T=f.getAttribute("scale"),m=T?Number(T):1,l=f.getAttribute("offset"),d=new Ae;if(l){const E=l.split(" ");d.set(Number(E[0]),Number(E[1]),Number(E[2]))}const y={},v=f.getElementsByTagNameNS(o,"p");for(const E of Array.from(v)){const S=E.getAttribute("name"),I=E.getAttribute("wrl");if(S&&I){let k;const H=t.zipUrl+"!"+I;this.vrmls[H]?(k=this.vrmls[H].clone(!0),y[S]=k):(k=await Si(t,I),this.vrmls[H]=k,y[S]=k)}}s.push({name:h,bvh:p,scale:m,offset:d,parts:y})}}return this.generateViewActionsFromActionSeeds(s),this.motion instanceof Ct&&this.motion.myInitialize(s),this}generateViewActionsFromActionSeeds(e){this.viewActions={};for(const t of e){const i=new se.Object3D;if(i.position.set(t.offset.x,t.offset.y,t.offset.z),i.scale.set(t.scale,t.scale,t.scale),t.bvh instanceof kt){for(const r of Object.values(t.parts))i.add(r);this.viewActions[t.name]={actionRoot:i,boneRoot:t.bvh.skeleton.bones[0].clone(!0)}}else{const r=t.bvh.skeleton.bones[0].clone(!0);i.add(r),In(r,t.parts),this.viewActions[t.name]={actionRoot:i,boneRoot:r}}i.traverse(r=>{r.userData.a3js={objectA3:this}})}}changeAction(e){this.object.remove(this.currentAction.actionRoot);const t=this.viewActions[e];this.object.add(t.actionRoot),this.currentAction=t}}function In(n,e){if(Hn(n)){const t=e[n.name];t&&n.add(t)}n.children&&n.children.forEach(t=>{In(t,e)})}class Ct extends tt{actionSeeds;motionActions;currentAction;isPaused;constructor(e){super(e),this.isPaused=!1,this.actionSeeds=[],this.motionActions={}}setObject(e){this.isPaused=!1,e instanceof st?(super.setObject(e),this.actionSeeds.length>0&&this.myInitialize([])):console.warn("Acerola3DMotion can set only Acerola3D object.")}myInitialize(e){if(!(this.objectA3 instanceof st))return;const t=[];for(const a of this.actionSeeds)t.push(a);for(const a of e)t.filter(o=>o.name===a.name).length===0&&t.push(a);this.objectA3.generateViewActionsFromActionSeeds(t),this.actionSeeds=t,this.motionActions={};for(const a of this.actionSeeds){if(a.bvh instanceof kt){this.motionActions[a.name]={bvh:a.bvh};break}const o=this.objectA3.viewActions[a.name].boneRoot,u=new se.AnimationMixer(o),c=u.clipAction(a.bvh.clip),s={bvh:a.bvh,mixer:u,clipAction:c};this.motionActions[a.name]=s}const i=this.actionSeeds[0].name;this.objectA3.changeAction(i);const r=this.motionActions[i];r.clipAction?.play(),this.currentAction=r}detachObject(e){if(!(this.objectA3 instanceof st))return;const t=this.actionSeeds[0].name;for(const i of this.actionSeeds){const r=this.motionActions[i.name];r.mixer?.stopAllAction();const a=this.objectA3.viewActions[i.name].boneRoot;a&&r.mixer?.uncacheRoot(a),delete this.motionActions[i.name]}this.objectA3.changeAction(t),super.detachObject(e)}update(e){super.update(e),this.currentAction&&!this.isPaused&&this.currentAction.mixer&&this.currentAction.mixer?.update(e)}controlMotion(e){if(!(this.objectA3 instanceof st))return;const t=this.motionActions[e];t&&(this.currentAction&&this.currentAction.clipAction?.stop(),this.objectA3.changeAction(e),t.clipAction?.play(),this.currentAction=t)}setPause(e){this.isPaused=e}setTime(e){this.currentAction?.mixer?.setTime(e)}}class Ii extends je{constructor(e){super(e)}initObject(e){return e}}class Ni extends je{constructor(...e){super(e)}initObject(e){const t=e.filter(c=>typeof c=="number"),i=e.filter(c=>typeof c=="string"),r=new se.BoxGeometry(...t),a=i.length>0?i[0]:"rgb(128,128,128)",o=new se.MeshStandardMaterial({color:a});return new se.Mesh(r,o)}}class wi extends je{constructor(...e){super(e)}initObject(e){const t=e.filter(c=>typeof c=="number"),i=e.filter(c=>typeof c=="string"),r=new se.SphereGeometry(...t),a=i.length>0?i[0]:"rgb(128,128,128)",o=new se.MeshStandardMaterial({color:a});return new se.Mesh(r,o)}}class ki extends je{constructor(e){super(e)}initObject(e){return new un(e)}}exports.Acerola3D=st;exports.Acerola3DMotion=Ct;exports.Box=Ni;exports.Camera=sn;exports.Canvas=fn;exports.ControllerBase=an;exports.GLTF=En;exports.GLTFMotion=vn;exports.GeneralCamera=ut;exports.HTML=ki;exports.Motion=tt;exports.ObjectA3=je;exports.OrbitController=cn;exports.Quat=ke;exports.RapierPhysicsEngine=lt;exports.Scene=on;exports.Sound=$e;exports.Sphere=wi;exports.Test=ur;exports.Text3D=gr;exports.ThreeJS=Ii;exports.Vec3=Ae;exports.ViewBase=Dt;exports.Window=dn;exports.asyncSleep=tr;exports.deepMerge=yt;exports.getQuatOfLookAt=ct;exports.initFont=yr;exports.initPhysics=$n;exports.initSound=sr;exports.vec3EulerToQuat=tn;
219
+ Please avoid using it as it will be completely removed in the future`)}i.clearCache=u;var b=Vo();Object.defineProperty(i,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return b.createSyntaxDiagramsCode}});var d=(function(){function I(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
220
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return I})();i.Parser=d});const pt=Yo();class Jo extends m.Loader{constructor(e){super(e)}load(e,t,r,n){const s=this,o=s.path===""?m.LoaderUtils.extractUrlBase(e):s.path,c=new m.FileLoader(s.manager);c.setPath(s.path),c.setRequestHeader(s.requestHeader),c.setWithCredentials(s.withCredentials),c.load(e,function(A){try{t(s.parse(A,o))}catch(a){n?n(a):console.error(a),s.manager.itemError(e)}},r,n)}parse(e,t){const r={};function n(R){const y=s(),T=new Xo(y.tokens),x=new $o(y.tokenVocabulary),w=o(x.getBaseCstVisitorConstructor()),N=T.lex(R);x.input=N.tokens;const F=x.vrml();if(x.errors.length>0)throw console.error(x.errors),Error("THREE.VRMLLoader2: Parsing errors detected.");return w.visit(F)}function s(){const R=pt.createToken,y=R({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]*/}),T=R({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:y}),x=["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"],w=R({name:"Version",pattern:/#VRML.*/,longer_alt:T}),N=R({name:"NodeName",pattern:new RegExp(x.join("|")),longer_alt:T}),F=R({name:"DEF",pattern:/DEF/,longer_alt:T}),G=R({name:"USE",pattern:/USE/,longer_alt:T}),z=R({name:"ROUTE",pattern:/ROUTE/,longer_alt:T}),ee=R({name:"TO",pattern:/TO/,longer_alt:T}),se=R({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),me=R({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),ke=R({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Pe=R({name:"TrueLiteral",pattern:/TRUE/}),_e=R({name:"FalseLiteral",pattern:/FALSE/}),ye=R({name:"NullLiteral",pattern:/NULL/}),Te=R({name:"LSquare",pattern:/\[/}),Le=R({name:"RSquare",pattern:/]/}),Fe=R({name:"LCurly",pattern:/{/}),Qe=R({name:"RCurly",pattern:/}/}),Oe=R({name:"Comment",pattern:/#.*/,group:pt.Lexer.SKIPPED}),qe=[R({name:"WhiteSpace",pattern:/[ ,\s]/,group:pt.Lexer.SKIPPED}),N,F,G,z,ee,Pe,_e,ye,w,T,y,se,me,ke,Te,Le,Fe,Qe,Oe],Ke={};for(let ve=0,fe=qe.length;ve<fe;ve++){const de=qe[ve];Ke[de.name]=de}return{tokens:qe,tokenVocabulary:Ke}}function o(R){class y extends R{constructor(){super(),this.validateVisitor()}vrml(w){const N={version:this.visit(w.version),nodes:[],routes:[]};for(let F=0,G=w.node.length;F<G;F++){const z=w.node[F];N.nodes.push(this.visit(z))}if(w.route)for(let F=0,G=w.route.length;F<G;F++){const z=w.route[F];N.routes.push(this.visit(z))}return N}version(w){return w.Version[0].image}node(w){const N={name:w.NodeName[0].image,fields:[]};if(w.field)for(let F=0,G=w.field.length;F<G;F++){const z=w.field[F];N.fields.push(this.visit(z))}return w.def&&(N.DEF=this.visit(w.def[0])),N}field(w){const N={name:w.Identifier[0].image,type:null,values:null};let F;return w.singleFieldValue&&(F=this.visit(w.singleFieldValue[0])),w.multiFieldValue&&(F=this.visit(w.multiFieldValue[0])),N.type=F.type,N.values=F.values,N}def(w){return(w.Identifier||w.NodeName)[0].image}use(w){return{USE:(w.Identifier||w.NodeName)[0].image}}singleFieldValue(w){return T(this,w)}multiFieldValue(w){return T(this,w)}route(w){return{FROM:w.RouteIdentifier[0].image,TO:w.RouteIdentifier[1].image}}}function T(x,w){const N={type:null,values:[]};if(w.node){N.type="node";for(let F=0,G=w.node.length;F<G;F++){const z=w.node[F];N.values.push(x.visit(z))}}if(w.use){N.type="use";for(let F=0,G=w.use.length;F<G;F++){const z=w.use[F];N.values.push(x.visit(z))}}if(w.StringLiteral){N.type="string";for(let F=0,G=w.StringLiteral.length;F<G;F++){const z=w.StringLiteral[F];N.values.push(z.image.replace(/'|"/g,""))}}if(w.NumberLiteral){N.type="number";for(let F=0,G=w.NumberLiteral.length;F<G;F++){const z=w.NumberLiteral[F];N.values.push(parseFloat(z.image))}}if(w.HexLiteral){N.type="hex";for(let F=0,G=w.HexLiteral.length;F<G;F++){const z=w.HexLiteral[F];N.values.push(z.image)}}if(w.TrueLiteral){N.type="boolean";for(let F=0,G=w.TrueLiteral.length;F<G;F++)w.TrueLiteral[F].image==="TRUE"&&N.values.push(!0)}if(w.FalseLiteral){N.type="boolean";for(let F=0,G=w.FalseLiteral.length;F<G;F++)w.FalseLiteral[F].image==="FALSE"&&N.values.push(!1)}return w.NullLiteral&&(N.type="null",w.NullLiteral.forEach(function(){N.values.push(null)})),N}return new y}function c(R){const y=R.nodes,T=new m.Scene;for(let x=0,w=y.length;x<w;x++){const N=y[x];A(N)}for(let x=0,w=y.length;x<w;x++){const N=y[x],F=a(N);F instanceof m.Object3D&&T.add(F),N.name==="WorldInfo"&&(T.userData.worldInfo=F)}return T}function A(R){R.DEF&&(r[R.DEF]=R);const y=R.fields;for(let T=0,x=y.length;T<x;T++){const w=y[T];if(w.type==="node"){const N=w.values;for(let F=0,G=N.length;F<G;F++)A(N[F])}}}function a(R){return R.USE?J(R.USE):(R.build!==void 0||(R.build=f(R)),R.build)}function f(R){const y=R.name;let T;switch(y){case"Anchor":case"Group":case"Transform":case"Collision":T=u(R);break;case"Background":T=b(R);break;case"Shape":T=d(R);break;case"Appearance":T=I(R);break;case"Material":T=g(R);break;case"ImageTexture":T=C(R);break;case"PixelTexture":T=p(R);break;case"TextureTransform":T=E(R);break;case"IndexedFaceSet":T=S(R);break;case"IndexedLineSet":T=U(R);break;case"PointSet":T=v(R);break;case"Box":T=O(R);break;case"Cone":T=L(R);break;case"Cylinder":T=k(R);break;case"Sphere":T=D(R);break;case"ElevationGrid":T=_(R);break;case"Extrusion":T=V(R);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":T=B(R);break;case"WorldInfo":T=Q(R);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.VRMLLoader2: Unknown node:",y);break}return T!==void 0&&R.DEF!==void 0&&T.hasOwnProperty("name")===!0&&(T.name=R.DEF),T}function u(R){const y=new m.Group,T=R.fields;for(let x=0,w=T.length;x<w;x++){const N=T[x],F=N.name,G=N.values;switch(F){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":q(G,y);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const z=new m.Vector3(G[0],G[1],G[2]).normalize(),ee=G[3];y.quaternion.setFromAxisAngle(z,ee);break;case"scale":y.scale.set(G[0],G[1],G[2]);break;case"scaleOrientation":break;case"translation":y.position.set(G[0],G[1],G[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",F);break}}return y}function b(R){const y=new m.Group;let T,x,w,N;const F=R.fields;for(let z=0,ee=F.length;z<ee;z++){const se=F[z],me=se.name,ke=se.values;switch(me){case"groundAngle":T=ke;break;case"groundColor":x=ke;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":w=ke;break;case"skyColor":N=ke;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",me);break}}const G=1e4;if(N){const z=new m.SphereGeometry(G,32,16),ee=new m.MeshBasicMaterial({fog:!1,side:m.BackSide,depthWrite:!1,depthTest:!1});N.length>3?(K(z,G,w,M(N),!0),ee.vertexColors=!0):ee.color.setRGB(N[0],N[1],N[2],m.SRGBColorSpace);const se=new m.Mesh(z,ee);y.add(se)}if(x&&x.length>0){const z=new m.SphereGeometry(G,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),ee=new m.MeshBasicMaterial({fog:!1,side:m.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});K(z,G,T,M(x),!1);const se=new m.Mesh(z,ee);y.add(se)}return y.renderOrder=-1/0,y}function d(R){const y=R.fields;let T=new m.MeshBasicMaterial({name:m.Loader.DEFAULT_MATERIAL_NAME,color:0}),x;for(let N=0,F=y.length;N<F;N++){const G=y[N],z=G.name,ee=G.values;switch(z){case"appearance":ee[0]!==null&&(T=a(ee[0]));break;case"geometry":ee[0]!==null&&(x=a(ee[0]));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",z);break}}let w;if(x&&x.attributes.position){const N=x._type;if(N==="points"){const F=new m.PointsMaterial({name:m.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:T.opacity,transparent:T.transparent});x.attributes.color!==void 0?F.vertexColors=!0:T.isMeshPhongMaterial&&F.color.copy(T.emissive),w=new m.Points(x,F)}else if(N==="line"){const F=new m.LineBasicMaterial({name:m.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:T.opacity,transparent:T.transparent});x.attributes.color!==void 0?F.vertexColors=!0:T.isMeshPhongMaterial&&F.color.copy(T.emissive),w=new m.LineSegments(x,F)}else x._solid!==void 0&&(T.side=x._solid?m.FrontSide:m.DoubleSide),x.attributes.color!==void 0&&(T.vertexColors=!0),w=new m.Mesh(x,T)}else w=new m.Object3D,w.visible=!1;return w}function I(R){let y=new m.MeshPhongMaterial,T;const x=R.fields;for(let w=0,N=x.length;w<N;w++){const F=x[w],G=F.name,z=F.values;switch(G){case"material":if(z[0]!==null){const se=a(z[0]);se.diffuseColor&&y.color.copy(se.diffuseColor),se.emissiveColor&&y.emissive.copy(se.emissiveColor),se.shininess&&(y.shininess=se.shininess),se.specularColor&&y.specular.copy(se.specularColor),se.transparency&&(y.opacity=1-se.transparency),se.transparency>0&&(y.transparent=!0)}else y=new m.MeshBasicMaterial({name:m.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const ee=z[0];ee!==null&&(ee.name==="ImageTexture"||ee.name==="PixelTexture"||ee.USE)&&(y.map=a(ee));break;case"textureTransform":z[0]!==null&&(T=a(z[0]));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",G);break}}if(y.map){if(y.map.__type){switch(y.map.__type){case Ze.INTENSITY_ALPHA:y.opacity=1;break;case Ze.RGB:y.color.set(16777215);break;case Ze.RGBA:y.color.set(16777215),y.opacity=1;break}delete y.map.__type}T&&(y.map.center.copy(T.center),y.map.rotation=T.rotation,y.map.repeat.copy(T.scale),y.map.offset.copy(T.translation))}return y}function g(R){const y={},T=R.fields;for(let x=0,w=T.length;x<w;x++){const N=T[x],F=N.name,G=N.values;switch(F){case"ambientIntensity":break;case"diffuseColor":y.diffuseColor=new m.Color().setRGB(G[0],G[1],G[2],m.SRGBColorSpace);break;case"emissiveColor":y.emissiveColor=new m.Color().setRGB(G[0],G[1],G[2],m.SRGBColorSpace);break;case"shininess":y.shininess=G[0];break;case"specularColor":y.specularColor=new m.Color().setRGB(G[0],G[1],G[2],m.SRGBColorSpace);break;case"transparency":y.transparency=G[0];break;default:console.warn("THREE.VRMLLoader2: Unknown field:",F);break}}return y}function l(R,y,T){let x;switch(y){case Ze.INTENSITY:x=parseInt(R),T.r=x,T.g=x,T.b=x,T.a=1;break;case Ze.INTENSITY_ALPHA:x=parseInt("0x"+R.substring(2,4)),T.r=x,T.g=x,T.b=x,T.a=parseInt("0x"+R.substring(4,6));break;case Ze.RGB:T.r=parseInt("0x"+R.substring(2,4)),T.g=parseInt("0x"+R.substring(4,6)),T.b=parseInt("0x"+R.substring(6,8)),T.a=1;break;case Ze.RGBA:T.r=parseInt("0x"+R.substring(2,4)),T.g=parseInt("0x"+R.substring(4,6)),T.b=parseInt("0x"+R.substring(6,8)),T.a=parseInt("0x"+R.substring(8,10));break}}function h(R){let y;switch(R){case 1:y=Ze.INTENSITY;break;case 2:y=Ze.INTENSITY_ALPHA;break;case 3:y=Ze.RGB;break;case 4:y=Ze.RGBA;break}return y}function p(R){let y,T=m.RepeatWrapping,x=m.RepeatWrapping;const w=R.fields;for(let N=0,F=w.length;N<F;N++){const G=w[N],z=G.name,ee=G.values;switch(z){case"image":const se=ee[0],me=ee[1],ke=ee[2],Pe=h(ke),_e=new Uint8Array(4*se*me),ye={r:0,g:0,b:0,a:0};for(let Te=3,Le=0,Fe=ee.length;Te<Fe;Te++,Le++){l(ee[Te],Pe,ye);const Qe=Le*4;_e[Qe+0]=ye.r,_e[Qe+1]=ye.g,_e[Qe+2]=ye.b,_e[Qe+3]=ye.a}y=new m.DataTexture(_e,se,me),y.colorSpace=m.SRGBColorSpace,y.needsUpdate=!0,y.__type=Pe;break;case"repeatS":ee[0]===!1&&(T=m.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(x=m.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",z);break}}return y&&(y.wrapS=T,y.wrapT=x),y}function C(R){let y,T=m.RepeatWrapping,x=m.RepeatWrapping;const w=R.fields;for(let N=0,F=w.length;N<F;N++){const G=w[N],z=G.name,ee=G.values;switch(z){case"url":const se=ee[0];se&&(y=ie.load(se));break;case"repeatS":ee[0]===!1&&(T=m.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(x=m.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",z);break}}return y&&(y.wrapS=T,y.wrapT=x,y.colorSpace=m.SRGBColorSpace),y}function E(R){const y={center:new m.Vector2,rotation:new m.Vector2,scale:new m.Vector2,translation:new m.Vector2},T=R.fields;for(let x=0,w=T.length;x<w;x++){const N=T[x],F=N.name,G=N.values;switch(F){case"center":y.center.set(G[0],G[1]);break;case"rotation":y.rotation=G[0];break;case"scale":y.scale.set(G[0],G[1]);break;case"translation":y.translation.set(G[0],G[1]);break;default:console.warn("THREE.VRMLLoader2: Unknown field:",F);break}}return y}function B(R){return R.fields[0].values}function Q(R){const y={},T=R.fields;for(let x=0,w=T.length;x<w;x++){const N=T[x],F=N.name,G=N.values;switch(F){case"title":y.title=G[0];break;case"info":y.info=G;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",F);break}}return y}function S(R){let y,T,x,w,N=!0,F=!0,G=0,z,ee,se,me,ke=!0,Pe=!0;const _e=R.fields;for(let De=0,qe=_e.length;De<qe;De++){const Ke=_e[De],ve=Ke.name,fe=Ke.values;switch(ve){case"color":const de=fe[0];de!==null&&(y=a(de));break;case"coord":const ue=fe[0];ue!==null&&(T=a(ue));break;case"normal":const pe=fe[0];pe!==null&&(x=a(pe));break;case"texCoord":const Ee=fe[0];Ee!==null&&(w=a(Ee));break;case"ccw":N=fe[0];break;case"colorIndex":z=fe;break;case"colorPerVertex":ke=fe[0];break;case"convex":break;case"coordIndex":ee=fe;break;case"creaseAngle":G=fe[0];break;case"normalIndex":se=fe;break;case"normalPerVertex":Pe=fe[0];break;case"solid":F=fe[0];break;case"texCoordIndex":me=fe;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",ve);break}}if(ee===void 0)return console.warn("THREE.VRMLLoader2: Missing coordIndex."),new m.BufferGeometry;const ye=X(ee,N);let Te,Le,Fe;if(y){if(ke===!0)if(z&&z.length>0){const De=X(z,N);Te=ne(ye,De,y,3)}else Te=Ie(ye,new m.Float32BufferAttribute(y,3));else if(z&&z.length>0){const De=le(y,z),qe=$(De,ee);Te=Ae(ye,qe)}else{const De=$(y,ee);Te=Ae(ye,De)}Y(Te)}if(x)if(Pe===!0)if(se&&se.length>0){const De=X(se,N);Le=ne(ye,De,x,3)}else Le=Ie(ye,new m.Float32BufferAttribute(x,3));else if(se&&se.length>0){const De=le(x,se),qe=$(De,ee);Le=Ae(ye,qe)}else{const De=$(x,ee);Le=Ae(ye,De)}else Le=Ve(ye,T,G);if(w)if(me&&me.length>0){const De=X(me,N);Fe=ne(ye,De,w,2)}else Fe=Ie(ye,new m.Float32BufferAttribute(w,2));const Qe=new m.BufferGeometry,Oe=Ie(ye,new m.Float32BufferAttribute(T,3));return Qe.setAttribute("position",Oe),Qe.setAttribute("normal",Le),Te&&Qe.setAttribute("color",Te),Fe&&Qe.setAttribute("uv",Fe),Qe._solid=F,Qe._type="mesh",Qe}function U(R){let y,T,x,w,N=!0;const F=R.fields;for(let me=0,ke=F.length;me<ke;me++){const Pe=F[me],_e=Pe.name,ye=Pe.values;switch(_e){case"color":const Te=ye[0];Te!==null&&(y=a(Te));break;case"coord":const Le=ye[0];Le!==null&&(T=a(Le));break;case"colorIndex":x=ye;break;case"colorPerVertex":N=ye[0];break;case"coordIndex":w=ye;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",_e);break}}let G;const z=re(w);if(y){if(N===!0)if(x.length>0){const me=re(x);G=ne(z,me,y,3)}else G=Ie(z,new m.Float32BufferAttribute(y,3));else if(x.length>0){const me=le(y,x),ke=oe(me,w);G=be(z,ke)}else{const me=oe(y,w);G=be(z,me)}Y(G)}const ee=new m.BufferGeometry,se=Ie(z,new m.Float32BufferAttribute(T,3));return ee.setAttribute("position",se),G&&ee.setAttribute("color",G),ee._type="line",ee}function v(R){let y,T;const x=R.fields;for(let N=0,F=x.length;N<F;N++){const G=x[N],z=G.name,ee=G.values;switch(z){case"color":const se=ee[0];se!==null&&(y=a(se));break;case"coord":const me=ee[0];me!==null&&(T=a(me));break;default:console.warn("THREE.VRMLLoader2: Unknown field:",z);break}}const w=new m.BufferGeometry;if(w.setAttribute("position",new m.Float32BufferAttribute(T,3)),y){const N=new m.Float32BufferAttribute(y,3);Y(N),w.setAttribute("color",N)}return w._type="points",w}function O(R){const y=new m.Vector3(2,2,2),T=R.fields;for(let w=0,N=T.length;w<N;w++){const F=T[w],G=F.name,z=F.values;G==="size"?(y.x=z[0],y.y=z[1],y.z=z[2]):console.warn("THREE.VRMLLoader2: Unknown field:",G)}return new m.BoxGeometry(y.x,y.y,y.z)}function L(R){let y=1,T=2,x=!1;const w=R.fields;for(let F=0,G=w.length;F<G;F++){const z=w[F],ee=z.name,se=z.values;switch(ee){case"bottom":x=!se[0];break;case"bottomRadius":y=se[0];break;case"height":T=se[0];break;case"side":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",ee);break}}return new m.ConeGeometry(y,T,16,1,x)}function k(R){let y=1,T=2;const x=R.fields;for(let N=0,F=x.length;N<F;N++){const G=x[N],z=G.name,ee=G.values;switch(z){case"bottom":break;case"radius":y=ee[0];break;case"height":T=ee[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader2: Unknown field:",z);break}}return new m.CylinderGeometry(y,y,T,16,1)}function D(R){let y=1;const T=R.fields;for(let w=0,N=T.length;w<N;w++){const F=T[w],G=F.name,z=F.values;G==="radius"?y=z[0]:console.warn("THREE.VRMLLoader2: Unknown field:",G)}return new m.SphereGeometry(y,16,16)}function _(R){let y,T,x,w,N=!0,F=!0,G=!0,z=!0,ee=0,se=2,me=2,ke=1,Pe=1;const _e=R.fields;for(let fe=0,de=_e.length;fe<de;fe++){const ue=_e[fe],pe=ue.name,Ee=ue.values;switch(pe){case"color":const Me=Ee[0];Me!==null&&(y=a(Me));break;case"normal":const nt=Ee[0];nt!==null&&(T=a(nt));break;case"texCoord":const it=Ee[0];it!==null&&(x=a(it));break;case"height":w=Ee;break;case"ccw":z=Ee[0];break;case"colorPerVertex":N=Ee[0];break;case"creaseAngle":ee=Ee[0];break;case"normalPerVertex":F=Ee[0];break;case"solid":G=Ee[0];break;case"xDimension":se=Ee[0];break;case"xSpacing":ke=Ee[0];break;case"zDimension":me=Ee[0];break;case"zSpacing":Pe=Ee[0];break;default:console.warn("THREE.VRMLLoader2: Unknown field:",pe);break}}const ye=[],Te=[],Le=[],Fe=[];for(let fe=0;fe<me;fe++)for(let de=0;de<se;de++){const ue=fe*se+de,pe=ke*fe,Ee=w[ue],Me=Pe*de;if(ye.push(pe,Ee,Me),y&&N===!0){const nt=y[ue*3+0],it=y[ue*3+1],Nt=y[ue*3+2];Le.push(nt,it,Nt)}if(T&&F===!0){const nt=T[ue*3+0],it=T[ue*3+1],Nt=T[ue*3+2];Te.push(nt,it,Nt)}if(x){const nt=x[ue*2+0],it=x[ue*2+1];Fe.push(nt,it)}else Fe.push(fe/(se-1),de/(me-1))}const Qe=[];for(let fe=0;fe<se-1;fe++)for(let de=0;de<me-1;de++){const ue=fe+de*se,pe=fe+(de+1)*se,Ee=fe+1+(de+1)*se,Me=fe+1+de*se;z===!0?(Qe.push(ue,Ee,pe),Qe.push(Ee,ue,Me)):(Qe.push(ue,pe,Ee),Qe.push(Ee,Me,ue))}const Oe=Ie(Qe,new m.Float32BufferAttribute(ye,3)),De=Ie(Qe,new m.Float32BufferAttribute(Fe,2));let qe,Ke;if(y){if(N===!1){for(let fe=0;fe<se-1;fe++)for(let de=0;de<me-1;de++){const ue=fe+de*(se-1),pe=y[ue*3+0],Ee=y[ue*3+1],Me=y[ue*3+2];Le.push(pe,Ee,Me),Le.push(pe,Ee,Me),Le.push(pe,Ee,Me),Le.push(pe,Ee,Me),Le.push(pe,Ee,Me),Le.push(pe,Ee,Me)}qe=new m.Float32BufferAttribute(Le,3)}else qe=Ie(Qe,new m.Float32BufferAttribute(Le,3));Y(qe)}if(T)if(F===!1){for(let fe=0;fe<se-1;fe++)for(let de=0;de<me-1;de++){const ue=fe+de*(se-1),pe=T[ue*3+0],Ee=T[ue*3+1],Me=T[ue*3+2];Te.push(pe,Ee,Me),Te.push(pe,Ee,Me),Te.push(pe,Ee,Me),Te.push(pe,Ee,Me),Te.push(pe,Ee,Me),Te.push(pe,Ee,Me)}Ke=new m.Float32BufferAttribute(Te,3)}else Ke=Ie(Qe,new m.Float32BufferAttribute(Te,3));else Ke=Ve(Qe,ye,ee);const ve=new m.BufferGeometry;return ve.setAttribute("position",Oe),ve.setAttribute("normal",Ke),ve.setAttribute("uv",De),qe&&ve.setAttribute("color",qe),ve._solid=G,ve._type="mesh",ve}function V(R){let y=[1,1,1,-1,-1,-1,-1,1,1,1],T=[0,0,0,0,1,0],x,w,N=!0,F=!0,G=0,z=!0,ee=!0;const se=R.fields;for(let ve=0,fe=se.length;ve<fe;ve++){const de=se[ve],ue=de.name,pe=de.values;switch(ue){case"beginCap":N=pe[0];break;case"ccw":F=pe[0];break;case"convex":break;case"creaseAngle":G=pe[0];break;case"crossSection":y=pe;break;case"endCap":z=pe[0];break;case"orientation":w=pe;break;case"scale":x=pe;break;case"solid":ee=pe[0];break;case"spine":T=pe;break;default:console.warn("THREE.VRMLLoader2: Unknown field:",ue);break}}const me=y[0]===y[y.length-2]&&y[1]===y[y.length-1],ke=[],Pe=new m.Vector3,_e=new m.Vector3,ye=new m.Vector3,Te=new m.Vector3,Le=new m.Quaternion;for(let ve=0,fe=0,de=0,ue=T.length;ve<ue;ve+=3,fe+=2,de+=4){Pe.fromArray(T,ve),_e.x=x?x[fe+0]:1,_e.y=1,_e.z=x?x[fe+1]:1,ye.x=w?w[de+0]:0,ye.y=w?w[de+1]:0,ye.z=w?w[de+2]:1;const pe=w?w[de+3]:0;for(let Ee=0,Me=y.length;Ee<Me;Ee+=2)Te.x=y[Ee+0],Te.y=0,Te.z=y[Ee+1],Te.multiply(_e),Le.setFromAxisAngle(ye,pe),Te.applyQuaternion(Le),Te.add(Pe),ke.push(Te.x,Te.y,Te.z)}const Fe=[],Qe=T.length/3,Oe=y.length/2;for(let ve=0;ve<Qe-1;ve++)for(let fe=0;fe<Oe-1;fe++){const de=fe+ve*Oe;let ue=fe+1+ve*Oe;const pe=fe+(ve+1)*Oe;let Ee=fe+1+(ve+1)*Oe;fe===Oe-2&&me===!0&&(ue=ve*Oe,Ee=(ve+1)*Oe),F===!0?(Fe.push(de,ue,pe),Fe.push(pe,ue,Ee)):(Fe.push(de,pe,ue),Fe.push(pe,Ee,ue))}if(N===!0||z===!0){const ve=[];for(let ue=0,pe=y.length;ue<pe;ue+=2)ve.push(new m.Vector2(y[ue],y[ue+1]));const fe=m.ShapeUtils.triangulateShape(ve,[]),de=[];for(let ue=0,pe=fe.length;ue<pe;ue++){const Ee=fe[ue];de.push(Ee[0],Ee[1],Ee[2])}if(N===!0)for(let ue=0,pe=de.length;ue<pe;ue+=3)F===!0?Fe.push(de[ue+0],de[ue+1],de[ue+2]):Fe.push(de[ue+0],de[ue+2],de[ue+1]);if(z===!0){const ue=Oe*(Qe-1);for(let pe=0,Ee=de.length;pe<Ee;pe+=3)F===!0?Fe.push(ue+de[pe+0],ue+de[pe+2],ue+de[pe+1]):Fe.push(ue+de[pe+0],ue+de[pe+1],ue+de[pe+2])}}const De=Ie(Fe,new m.Float32BufferAttribute(ke,3)),qe=Ve(Fe,ke,G),Ke=new m.BufferGeometry;return Ke.setAttribute("position",De),Ke.setAttribute("normal",qe),Ke._solid=ee,Ke._type="mesh",Ke}function J(R){const y=r[R],T=a(y);return T.isObject3D||T.isMaterial?T.clone():T}function q(R,y){for(let T=0,x=R.length;T<x;T++){const w=a(R[T]);w instanceof m.Object3D&&y.add(w)}}function X(R,y){const T=[];let x=0;for(let w=0,N=R.length;w<N;w++){const F=R[x],G=R[w+(y?1:2)],z=R[w+(y?2:1)];T.push(F,G,z),(R[w+3]===-1||w+3>=N)&&(w+=3,x=w+1)}return T}function $(R,y){const T=[];let x=0;for(let w=0,N=y.length;w<N;w++){const F=x*3,G=R[F],z=R[F+1],ee=R[F+2];T.push(G,z,ee),(y[w+3]===-1||w+3>=N)&&(w+=3,x++)}return T}function le(R,y){const T=[];for(let x=0,w=y.length;x<w;x++){const F=y[x]*3,G=R[F],z=R[F+1],ee=R[F+2];T.push(G,z,ee)}return T}function re(R){const y=[];for(let T=0,x=R.length;T<x;T++){const w=R[T],N=R[T+1];y.push(w,N),(R[T+2]===-1||T+2>=x)&&(T+=2)}return y}function oe(R,y){const T=[];let x=0;for(let w=0,N=y.length;w<N;w++){const F=x*3,G=R[F],z=R[F+1],ee=R[F+2];T.push(G,z,ee),(y[w+2]===-1||w+2>=N)&&(w+=2,x++)}return T}const te=new m.Vector3,he=new m.Vector3,P=new m.Vector3,j=new m.Vector2,W=new m.Vector2,Z=new m.Vector2;function ne(R,y,T,x){const w=[];for(let N=0,F=R.length;N<F;N+=3){const G=y[N],z=y[N+1],ee=y[N+2];x===2?(j.fromArray(T,G*x),W.fromArray(T,z*x),Z.fromArray(T,ee*x),w.push(j.x,j.y),w.push(W.x,W.y),w.push(Z.x,Z.y)):(te.fromArray(T,G*x),he.fromArray(T,z*x),P.fromArray(T,ee*x),w.push(te.x,te.y,te.z),w.push(he.x,he.y,he.z),w.push(P.x,P.y,P.z))}return new m.Float32BufferAttribute(w,x)}function Ae(R,y){const T=[];for(let x=0,w=0,N=R.length;x<N;x+=3,w++)te.fromArray(y,w*3),T.push(te.x,te.y,te.z),T.push(te.x,te.y,te.z),T.push(te.x,te.y,te.z);return new m.Float32BufferAttribute(T,3)}function be(R,y){const T=[];for(let x=0,w=0,N=R.length;x<N;x+=2,w++)te.fromArray(y,w*3),T.push(te.x,te.y,te.z),T.push(te.x,te.y,te.z);return new m.Float32BufferAttribute(T,3)}function Ie(R,y){const T=y.array,x=y.itemSize,w=new T.constructor(R.length*x);let N=0,F=0;for(let G=0,z=R.length;G<z;G++){N=R[G]*x;for(let ee=0;ee<x;ee++)w[F++]=T[N++]}return new m.Float32BufferAttribute(w,x)}const Ne=new m.Vector3,je=new m.Vector3;function Ve(R,y,T){const x=[],w={};for(let F=0,G=R.length;F<G;F+=3){const z=R[F],ee=R[F+1],se=R[F+2],me=new es(z,ee,se);te.fromArray(y,z*3),he.fromArray(y,ee*3),P.fromArray(y,se*3),je.subVectors(P,he),Ne.subVectors(te,he),je.cross(Ne),je.normalize(),me.normal.copy(je),w[z]===void 0&&(w[z]=[]),w[ee]===void 0&&(w[ee]=[]),w[se]===void 0&&(w[se]=[]),w[z].push(me.normal),w[ee].push(me.normal),w[se].push(me.normal),x.push(me)}const N=[];for(let F=0,G=x.length;F<G;F++){const z=x[F],ee=Ue(w[z.a],z.normal,T),se=Ue(w[z.b],z.normal,T),me=Ue(w[z.c],z.normal,T);te.fromArray(y,z.a*3),he.fromArray(y,z.b*3),P.fromArray(y,z.c*3),N.push(ee.x,ee.y,ee.z),N.push(se.x,se.y,se.z),N.push(me.x,me.y,me.z)}return new m.Float32BufferAttribute(N,3)}function Ue(R,y,T){const x=new m.Vector3;if(T===0)x.copy(y);else for(let w=0,N=R.length;w<N;w++)R[w].angleTo(y)<T&&x.add(R[w]);return x.normalize()}function M(R){const y=[];for(let T=0,x=R.length;T<x;T+=3)y.push(new m.Color(R[T],R[T+1],R[T+2]));return y}function Y(R){const y=new m.Color;for(let T=0;T<R.count;T++)y.fromBufferAttribute(R,T),m.ColorManagement.colorSpaceToWorking(y,m.SRGBColorSpace),R.setXYZ(T,y.r,y.g,y.b)}function K(R,y,T,x,w){const N=[],F=w===!0?0:Math.PI;for(let ke=0,Pe=x.length;ke<Pe;ke++){let _e=ke===0?0:T[ke-1];_e=w===!0?_e:F-_e;const ye=new m.Vector3;ye.setFromSphericalCoords(y,_e,0),N.push(ye)}const G=R.index,z=R.attributes.position,ee=new m.BufferAttribute(new Float32Array(R.attributes.position.count*3),3),se=new m.Vector3,me=new m.Color;for(let ke=0;ke<G.count;ke++){const Pe=G.getX(ke);se.fromBufferAttribute(z,Pe);let _e,ye,Te=1;for(let Qe=1;Qe<N.length;Qe++){_e=Qe-1,ye=Qe;const Oe=N[_e],De=N[ye];if(w===!0){if(se.y<=Oe.y&&se.y>De.y){Te=Math.abs(Oe.y-se.y)/Math.abs(Oe.y-De.y);break}}else if(se.y>=Oe.y&&se.y<De.y){Te=Math.abs(Oe.y-se.y)/Math.abs(Oe.y-De.y);break}}const Le=x[_e],Fe=x[ye];me.copy(Le).lerp(Fe,Te),m.ColorManagement.colorSpaceToWorking(me,m.SRGBColorSpace),ee.setXYZ(Pe,me.r,me.g,me.b)}R.setAttribute("color",ee)}const ie=new m.TextureLoader(this.manager);if(ie.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const ge=n(e);return c(ge)}}class Xo{constructor(e){this.lexer=new pt.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 Zo=pt.CstParser;class $o extends Zo{constructor(e){super(e);const t=this,r=e.Version,n=e.LCurly,s=e.RCurly,o=e.LSquare,c=e.RSquare,A=e.Identifier,a=e.RouteIdentifier,f=e.StringLiteral,u=e.HexLiteral,b=e.NumberLiteral,d=e.TrueLiteral,I=e.FalseLiteral,g=e.NullLiteral,l=e.DEF,h=e.USE,p=e.ROUTE,C=e.TO,E=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(E),t.CONSUME(n),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(s)}),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(l),t.OR([{ALT:function(){t.CONSUME(A)}},{ALT:function(){t.CONSUME(E)}}])}),t.RULE("use",function(){t.CONSUME(h),t.OR([{ALT:function(){t.CONSUME(A)}},{ALT:function(){t.CONSUME(E)}}])}),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(f)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(b)}},{ALT:function(){t.CONSUME(d)}},{ALT:function(){t.CONSUME(I)}},{ALT:function(){t.CONSUME(g)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(o),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(b)}},{ALT:function(){t.CONSUME(g)}}])}),t.CONSUME(c)}),t.RULE("route",function(){t.CONSUME(p),t.CONSUME(a),t.CONSUME(C),t.CONSUME2(a)}),this.performSelfAnalysis()}}class es{constructor(e,t,r){this.a=e,this.b=t,this.c=r,this.normal=new m.Vector3}}const Ze={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};class ts extends m.Loader{constructor(e){super(e),this.animateBonePositions=!0,this.animateBoneRotations=!0,this.animateBoneScales=!0}load(e,t,r,n){const s=this,o=new m.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(c){try{t(s.parse(c))}catch(A){n?n(A):console.error(A),s.manager.itemError(e)}},r,n)}parse(e){function t(d){c(d)!=="HIERARCHY"&&console.error("THREE.BVHLoader2: HIERARCHY expected.");const I=[],g=n(d,c(d),I);c(d)!=="MOTION"&&console.error("THREE.BVHLoader2: MOTION expected.");let l=c(d).split(/[\s]+/);const h=parseInt(l[1]);isNaN(h)&&console.error("THREE.BVHLoader2: Failed to read number of frames."),l=c(d).split(/[\s]+/);const p=parseFloat(l[2]);isNaN(p)&&console.error("THREE.BVHLoader2: Failed to read frame time.");for(let C=0;C<h;C++)l=c(d).split(/[\s]+/),r(l,C*p,g);return I}function r(d,I,g){if(g.type==="ENDSITE")return;const l={time:I,position:new m.Vector3,rotation:new m.Quaternion,scale:new m.Vector3(1,1,1)};g.frames.push(l);const h=new m.Quaternion,p=new m.Vector3(1,0,0),C=new m.Vector3(0,1,0),E=new m.Vector3(0,0,1);for(let B=0;B<g.channels.length;B++)switch(g.channels[B]){case"Xposition":l.position.x=parseFloat(d.shift().trim());break;case"Yposition":l.position.y=parseFloat(d.shift().trim());break;case"Zposition":l.position.z=parseFloat(d.shift().trim());break;case"Xrotation":h.setFromAxisAngle(p,parseFloat(d.shift().trim())*Math.PI/180),l.rotation.multiply(h);break;case"Yrotation":h.setFromAxisAngle(C,parseFloat(d.shift().trim())*Math.PI/180),l.rotation.multiply(h);break;case"Zrotation":h.setFromAxisAngle(E,parseFloat(d.shift().trim())*Math.PI/180),l.rotation.multiply(h);break;case"Xscale":l.scale.x=parseFloat(d.shift().trim());break;case"Yscale":l.scale.y=parseFloat(d.shift().trim());break;case"Zscale":l.scale.z=parseFloat(d.shift().trim());break;default:console.warn("THREE.BVHLoader2: Invalid channel type.")}for(let B=0;B<g.children.length;B++)r(d,I,g.children[B])}function n(d,I,g){const l={name:"",type:"",frames:[]};g.push(l);let h=I.split(/[\s]+/);h[0].toUpperCase()==="END"&&h[1].toUpperCase()==="SITE"?(l.type="ENDSITE",l.name="ENDSITE"):(l.name=h[1],l.type=h[0].toUpperCase()),c(d)!=="{"&&console.error("THREE.BVHLoader2: Expected opening { after type & name"),h=c(d).split(/[\s]+/),h[0]!=="OFFSET"&&console.error("THREE.BVHLoader2: Expected OFFSET but got: "+h[0]),h.length!==4&&console.error("THREE.BVHLoader2: Invalid number of values for OFFSET.");const p=new m.Vector3(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));if((isNaN(p.x)||isNaN(p.y)||isNaN(p.z))&&console.error("THREE.BVHLoader2: Invalid values of OFFSET."),l.offset=p,l.type!=="ENDSITE"){h=c(d).split(/[\s]+/),h[0]!=="CHANNELS"&&console.error("THREE.BVHLoader2: Expected CHANNELS definition.");const C=parseInt(h[1]);l.channels=h.splice(2,C),l.children=[]}for(;;){const C=c(d);if(C==="}")return l;l.children.push(n(d,C,g))}}function s(d,I){const g=new m.Bone;if(I.push(g),g.position.add(d.offset),g.name=d.name,d.type!=="ENDSITE")for(let l=0;l<d.children.length;l++)g.add(s(d.children[l],I));return g}function o(d){const I=[];for(let g=0;g<d.length;g++){const l=d[g];if(l.type==="ENDSITE")continue;const h=[],p=[],C=[],E=[];for(let B=0;B<l.frames.length;B++){const Q=l.frames[B];h.push(Q.time),p.push(Q.position.x+l.offset.x),p.push(Q.position.y+l.offset.y),p.push(Q.position.z+l.offset.z),C.push(Q.rotation.x),C.push(Q.rotation.y),C.push(Q.rotation.z),C.push(Q.rotation.w),E.push(Q.scale.x),E.push(Q.scale.y),E.push(Q.scale.z)}A.animateBonePositions&&I.push(new m.VectorKeyframeTrack(l.name+".position",h,p)),A.animateBoneRotations&&I.push(new m.QuaternionKeyframeTrack(l.name+".quaternion",h,C)),A.animateBoneScales&&I.push(new m.VectorKeyframeTrack(l.name+".scale",h,E))}return new m.AnimationClip("animation",-1,I)}function c(d){let I;for(;(I=d.shift().trim()).length===0;);return I}const A=this,a=e.split(/[\r\n]+/g),f=t(a),u=[];s(f[0],u);const b=o(f);return{skeleton:new m.Skeleton(u),clip:b}}}let Bt;async function ns(i,e){return Bt||(Bt=new Jo),Bt.manager.setURLModifier(r=>(r.startsWith("./")&&(r=r.substring(2)),URL.createObjectURL(dr(i,r)))),await Bt.loadAsync(e)}let Kt;async function is(i,e){Kt||(Kt=new ts);const t=nn(i,e);return await Kt.parse(t)}function rs(i){const e=i.clip.clone(),t=i.skeleton.bones[0].clone(!0),r=[];t.traverse(s=>{s instanceof ae.Bone&&r.push(s)});const n=new ae.Skeleton(r);return n.calculateInverses(),{clip:e,skeleton:n}}class os{isDummy=!0;skeleton=new ae.Skeleton([new ae.Bone]);clip=new ae.AnimationClip("dummy")}const zt={},Wt={};class mt extends xe{ready;actions;comment=null;constructor(e){super(),this.actions={},this.ready=this.asyncInit(e)}initObject(){return new ae.Object3D}async asyncInit(e){const t=await Fn(e),r=new DOMParser,n=nn(t,"CATALOG.XML"),s=r.parseFromString(n,"application/xml");if(s.querySelector("parsererror"))return console.error("Acerola3D.asyncInit(): CATALOG.XML parse error."),this;const o="http://acerola3d.sourceforge.jp/a3/catalog",c=s.getElementsByTagNameNS(o,"c");c[0]&&(this.comment=c[0].textContent);const A=s.getElementsByTagNameNS(o,"a"),a={},f={};let u;for(const b of Array.from(A)){const d=b.getAttribute("an");if(d){u||(u=d);let I;const g=b.getAttribute("bvh");if(g){const U=t.zipUrl+"!"+g;zt[U]||(zt[U]=await is(t,g)),I=rs(zt[U]),I&&I.clip.tracks.forEach(v=>{v.setInterpolation(ae.InterpolateDiscrete)})}else I=new os;const l={};I.skeleton.bones.forEach(U=>{l[U.name]=U});const h=b.getAttribute("scale"),p=h?Number(h):1,C=b.getAttribute("offset"),E=new ce;if(C){const U=C.split(" ");E.set(Number(U[0]),Number(U[1]),Number(U[2]))}const B={},Q=b.getElementsByTagNameNS(o,"p");for(const U of Array.from(Q)){const v=U.getAttribute("name"),O=U.getAttribute("wrl");if(v&&O){const L=t.zipUrl+"!"+O;Wt[L]||(Wt[L]=await ns(t,O)),B[v]=Wt[L].clone(!0)}}const S=new ae.Object3D;S.add(I.skeleton.bones[0]),Ui(S,B),S.position.add(E),S.scale.set(p,p,p),S.traverse(U=>{U.userData.a3js={objectA3:this}}),a[d]={name:d,root:S,bones:l,skeleton:I.skeleton,bvh:I,scale:p,offset:E,parts:B},f[d]=new ss(I.clip,d)}}return this.actions=a,this.setPoseMotions(f),u&&this.setState(u),this}addAction(e){this.actions[e.name]=e}removeAction(e){const t=this.actions[e];return delete this.actions[e],t}addActionRoot(e){const t=this.actions[e];t&&(this.object.add(t.root),this.bones=t.bones,this.skeletons=[t.skeleton])}removeActionRoot(e){const t=this.actions[e];t&&(this.object.remove(t.root),this.bones={},this.skeletons=[])}}function Ui(i,e){if(ir(i)){const t=e[i.name];t&&i.add(t)}i.children&&i.children.forEach(t=>{Ui(t,e)})}class ss extends on{prepare3D(e){e instanceof mt&&e.addActionRoot(this.name)}cleanup3D(e){e instanceof mt&&e.removeActionRoot(this.name)}}class as extends xe{constructor(e){super(e)}initObject(e){return e}}class As extends xe{constructor(...e){super(e)}initObject(e){const t=e.filter(A=>typeof A=="number"),r=e.filter(A=>typeof A=="string"),n=new ae.BoxGeometry(...t),s=r.length>0?r[0]:"rgb(128,128,128)",o=new ae.MeshStandardMaterial({color:s});return new ae.Mesh(n,o)}}class cs extends xe{constructor(...e){super(e)}initObject(e){const t=e.filter(A=>typeof A=="number"),r=e.filter(A=>typeof A=="string"),n=new ae.SphereGeometry(...t),s=r.length>0?r[0]:"rgb(128,128,128)",o=new ae.MeshStandardMaterial({color:s});return new ae.Mesh(n,o)}}class ls extends xe{constructor(){super()}initObject(){const e=new ae.Object3D,t=new ae.DirectionalLight(16777215);t.position.set(1,1,1),e.add(t);const r=new ae.AmbientLight(4210752);return e.add(r),e}}class us extends xe{constructor(e){super(e)}initObject(e){const t=new ae.PlaneGeometry(1,1),r=new ae.TextureLoader().load(e),n=new ae.MeshBasicMaterial({map:r});return new ae.Mesh(t,n)}}class hs extends xe{constructor(e){super(e)}initObject(e){return new Gn(e)}}const fs={touchDevice:navigator.maxTouchPoints>0};class Hi extends HTMLElement{option;canvas;scene;camera;controller;_maxDistance;_leftActive;_leftCenter;leftJoystick;_rightActive;_rightCenter;rightJoystick;leftButton;rightButton;keys;constructor(e={}){super(),this.option={...fs,...e},this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
221
+ <style>
222
+ :host {
223
+ .game-ui {
224
+ position: relative;
225
+ }
226
+ .joystick {
227
+ position: absolute;
228
+ width: 120px;
229
+ height: 120px;
230
+ border-radius: 50%;
231
+ background: rgba(255,255,255,0.08);
232
+ border: 2px solid rgba(255,255,255,0.2);
233
+ backdrop-filter: blur(4px);
234
+ }
235
+ .stick {
236
+ position: absolute;
237
+ width: 60px;
238
+ height: 60px;
239
+ border-radius: 50%;
240
+ background: rgba(255,255,255,0.4);
241
+ top: 50%;
242
+ left: 50%;
243
+ transform: translate(-50%, -50%);
244
+ }
245
+ .joystick.left {
246
+ bottom: 40px;
247
+ left: 30px;
248
+ }
249
+ .joystick.right {
250
+ bottom: 40px;
251
+ right: 30px;
252
+ }
253
+ .btn {
254
+ position: absolute;
255
+ border-radius: 50%;
256
+ border: none;
257
+ color: white;
258
+ font-size: 14px;
259
+ background: rgba(255,255,255,0.15);
260
+ border: 2px solid rgba(255,255,255,0.3);
261
+ backdrop-filter: blur(4px);
262
+ cursor: pointer;
263
+ }
264
+ .btn.left {
265
+ width: 90px;
266
+ height: 90px;
267
+ bottom: 50px;
268
+ left: 200px;
269
+ }
270
+ .btn.right {
271
+ width: 90px;
272
+ height: 90px;
273
+ bottom: 50px;
274
+ right: 200px;
275
+ }
276
+ .btn:active {
277
+ transform: scale(0.9);
278
+ }
279
+ }
280
+ </style>
281
+ <div class="game-ui">
282
+ <slot></slot>
283
+ <div class="joystick left"><div class="stick"></div></div>
284
+ <div class="joystick right"><div class="stick"></div></div>
285
+ <button class="btn left">L</button>
286
+ <button class="btn right">R</button>
287
+ </div>
288
+ `,this.canvas=new an,this.append(this.canvas),this.scene=this.canvas.scene,this.camera=this.canvas.camera,this.controller=this.canvas.controller,this._maxDistance=40,this._leftActive=!1,this._leftCenter={x:0,y:0},this.leftJoystick={x:0,y:0},this._rightActive=!1,this._rightCenter={x:0,y:0},this.rightJoystick={x:0,y:0},this.leftButton=!1,this.rightButton=!1,this.keys=new Set;const t=this.shadowRoot.querySelector(".joystick.left .stick");if(!t)return;t.addEventListener("pointerdown",o=>{this._leftActive=!0;const c=t.getBoundingClientRect();this._leftCenter.x=c.left+c.width/2,this._leftCenter.y=c.top+c.height/2,t.setPointerCapture(o.pointerId)}),t.addEventListener("pointermove",o=>{if(!this._leftActive)return;const c=o.clientX-this._leftCenter.x,A=o.clientY-this._leftCenter.y,a=Math.sqrt(c*c+A*A);let f=c,u=A;if(a>40){const b=Math.atan2(A,c);f=Math.cos(b)*this._maxDistance,u=Math.sin(b)*this._maxDistance}t.style.transform=`translate(calc(-50% + ${f}px), calc(-50% + ${u}px))`,this.leftJoystick.x=f/this._maxDistance,this.leftJoystick.y=-(u/this._maxDistance)}),t.addEventListener("pointerup",()=>{this._leftActive=!1,t.style.transform="translate(-50%, -50%)",this.leftJoystick.x=0,this.leftJoystick.y=0});const r=this.shadowRoot.querySelector(".joystick.right .stick");if(!r)return;r.addEventListener("pointerdown",o=>{this._rightActive=!0;const c=r.getBoundingClientRect();this._rightCenter.x=c.left+c.width/2,this._rightCenter.y=c.top+c.height/2,r.setPointerCapture(o.pointerId)}),r.addEventListener("pointermove",o=>{if(!this._rightActive)return;const c=o.clientX-this._rightCenter.x,A=o.clientY-this._rightCenter.y,a=Math.sqrt(c*c+A*A);let f=c,u=A;if(a>40){const b=Math.atan2(A,c);f=Math.cos(b)*this._maxDistance,u=Math.sin(b)*this._maxDistance}r.style.transform=`translate(calc(-50% + ${f}px), calc(-50% + ${u}px))`,this.rightJoystick.x=f/this._maxDistance,this.rightJoystick.y=-(u/this._maxDistance)}),r.addEventListener("pointerup",()=>{this._rightActive=!1,r.style.transform="translate(-50%, -50%)",this.rightJoystick.x=0,this.rightJoystick.y=0});const n=this.shadowRoot.querySelector(".btn.left");if(!n)return;n.addEventListener("pointerdown",()=>{this.leftButton=!0}),n.addEventListener("pointerup",()=>{this.leftButton=!1});const s=this.shadowRoot.querySelector(".btn.right");s&&(s.addEventListener("pointerdown",()=>{this.rightButton=!0}),s.addEventListener("pointerup",()=>{this.rightButton=!1}),window.addEventListener("keydown",o=>{this.keys.add(o.code),this.updateUIFromKeyInfo()}),window.addEventListener("keyup",o=>{this.keys.delete(o.code),this.updateUIFromKeyInfo()}),this.option.touchDevice||(this.shadowRoot.querySelectorAll(".joystick").forEach(o=>{o.style.display="none"}),this.shadowRoot.querySelectorAll(".btn").forEach(o=>{o.style.display="none"})))}updateUIFromKeyInfo(){const e={x:0,y:0},t={x:0,y:0};this.keys.has("KeyW")&&(e.y+=1),this.keys.has("KeyA")&&(e.x-=1),this.keys.has("KeyS")&&(e.y-=1),this.keys.has("KeyD")&&(e.x+=1),this.keys.has("ArrowUp")&&(t.y+=1),this.keys.has("ArrowLeft")&&(t.x-=1),this.keys.has("ArrowDown")&&(t.y-=1),this.keys.has("ArrowRight")&&(t.x+=1);const r=Math.sqrt(e.x*e.x+e.y*e.y);r>0&&(e.x/=r,e.y/=r),this.leftJoystick=e;const n=Math.sqrt(t.x*t.x+t.y*t.y);n>0&&(t.x/=n,t.y/=n),this.rightJoystick=t,this.keys.has("Space")?this.leftButton=!0:this.leftButton=!1,this.keys.has("Enter")?this.rightButton=!0:this.rightButton=!1}replaceScene(e){return this.canvas.replaceScene(e)}setController(e){this.canvas.setController(e)}worldToScreen(e){return this.canvas.worldToScreen(e)}screenToWorld(e,t,r){return this.canvas.screenToWorld(e,t,r)}cameraToScreen(e){return this.canvas.cameraToScreen(e)}screenToCamera(e,t,r){return this.canvas.screenToCamera(e,t,r)}waitForRender(){return this.canvas.waitForRender()}}customElements.define("game-canvas-a3",Hi);const ds={mass:1e3,defaultLocation:{x:0,y:1,z:0},defaultQuat:{x:0,y:0,z:0,w:1},chassisWidth:2,chassisHeight:1,chassisLength:4,wheelFLPosition:{x:1,y:0,z:1.5},wheelFRPosition:{x:-1,y:0,z:1.5},wheelRLPosition:{x:1,y:0,z:-1.5},wheelRRPosition:{x:-1,y:0,z:-1.5},wheelFLRadius:.3,wheelFRRadius:.3,wheelRLRadius:.3,wheelRRRadius:.3,wheelFLWidth:.4,wheelFRWidth:.4,wheelRLWidth:.4,wheelRRWidth:.4,wheelFLSuspensionRestLength:.8,wheelFRSuspensionRestLength:.8,wheelRLSuspensionRestLength:.8,wheelRRSuspensionRestLength:.8,wheelFLDirection:{x:0,y:-1,z:0},wheelFRDirection:{x:0,y:-1,z:0},wheelRLDirection:{x:0,y:-1,z:0},wheelRRDirection:{x:0,y:-1,z:0},wheelFLAxle:{x:-1,y:0,z:0},wheelFRAxle:{x:-1,y:0,z:0},wheelRLAxle:{x:-1,y:0,z:0},wheelRRAxle:{x:-1,y:0,z:0},wheelFLSuspensionStiffness:24,wheelFRSuspensionStiffness:24,wheelRLSuspensionStiffness:24,wheelRRSuspensionStiffness:24,wheelFLWheelFrictionSlip:1e3,wheelFRWheelFrictionSlip:1e3,wheelRLWheelFrictionSlip:1e3,wheelRRWheelFrictionSlip:1e3};class ps{opt;trans;pose;constructor(e){this.opt={...ds,...e},this.trans=new gs(this),this.pose=new Es(this)}handle(e){this.trans.controller&&(this.trans.controller.setWheelSteering(0,e),this.trans.controller.setWheelSteering(1,e))}accelerator(e){this.trans.controller&&(this.trans.controller.setWheelEngineForce(0,e),this.trans.controller.setWheelEngineForce(1,e),this.trans.controller.setWheelEngineForce(2,e),this.trans.controller.setWheelEngineForce(3,e))}brake(e){this.trans.controller&&(this.trans.controller.setWheelBrake(0,e),this.trans.controller.setWheelBrake(1,e),this.trans.controller.setWheelBrake(2,e),this.trans.controller.setWheelBrake(3,e))}reset(){this.trans.chassisBody&&(this.trans.chassisBody.setTranslation(this.opt.defaultLocation,!0),this.trans.chassisBody.setRotation(this.opt.defaultQuat,!0),this.trans.chassisBody.setLinvel({x:0,y:0,z:0},!0),this.trans.chassisBody.setAngvel({x:0,y:0,z:0},!0))}}class gs{cm;trans;objectA3;controller;chassisBodyDesc;chassisBody;chassisColliderDesc;chassisCollider;constructor(e){this.cm=e,this.trans=new He}init(e,t){this.trans.set(e),this.objectA3=t,this.chassisBodyDesc=new Ge.RigidBodyDesc(Ge.RigidBodyType.Dynamic),this.chassisColliderDesc=Ge.ColliderDesc.cuboid(this.cm.opt.chassisWidth/2,this.cm.opt.chassisHeight/2,this.cm.opt.chassisLength/2),this.chassisColliderDesc.setMass(this.cm.opt.mass)}addOneselfToPhysics(e){this.chassisBodyDesc&&(this.chassisBody=e.world.createRigidBody(this.chassisBodyDesc),this.chassisBody.setTranslation(this.cm.opt.defaultLocation,!0),this.chassisBody.setRotation(this.cm.opt.defaultQuat,!0)),this.chassisColliderDesc&&(this.chassisCollider=e.world.createCollider(this.chassisColliderDesc,this.chassisBody)),this.chassisCollider&&this.objectA3&&tt.set(this.chassisCollider.handle,this.objectA3),this.chassisBody&&(this.controller=e.world.createVehicleController(this.chassisBody)),this.controller&&(this.controller.addWheel(this.cm.opt.wheelFLPosition,this.cm.opt.wheelFLDirection,this.cm.opt.wheelFLAxle,this.cm.opt.wheelFLSuspensionRestLength,this.cm.opt.wheelFLRadius),this.controller.setWheelSuspensionStiffness(0,this.cm.opt.wheelFLSuspensionStiffness),this.controller.setWheelFrictionSlip(0,this.cm.opt.wheelFLWheelFrictionSlip),this.controller.addWheel(this.cm.opt.wheelFRPosition,this.cm.opt.wheelFRDirection,this.cm.opt.wheelFRAxle,this.cm.opt.wheelFRSuspensionRestLength,this.cm.opt.wheelFRRadius),this.controller.setWheelSuspensionStiffness(1,this.cm.opt.wheelFRSuspensionStiffness),this.controller.setWheelFrictionSlip(1,this.cm.opt.wheelFRWheelFrictionSlip),this.controller.addWheel(this.cm.opt.wheelRLPosition,this.cm.opt.wheelRLDirection,this.cm.opt.wheelRLAxle,this.cm.opt.wheelRLSuspensionRestLength,this.cm.opt.wheelRLRadius),this.controller.setWheelSuspensionStiffness(2,this.cm.opt.wheelRLSuspensionStiffness),this.controller.setWheelFrictionSlip(2,this.cm.opt.wheelRLWheelFrictionSlip),this.controller.addWheel(this.cm.opt.wheelRRPosition,this.cm.opt.wheelRRDirection,this.cm.opt.wheelRRAxle,this.cm.opt.wheelRRSuspensionRestLength,this.cm.opt.wheelRRRadius),this.controller.setWheelSuspensionStiffness(3,this.cm.opt.wheelRRSuspensionStiffness),this.controller.setWheelFrictionSlip(3,this.cm.opt.wheelRRWheelFrictionSlip))}removeOneselfFromPhysics(e){this.chassisBody&&e.world.removeRigidBody(this.chassisBody),this.chassisCollider&&(e.world.removeCollider(this.chassisCollider,!1),tt.delete(this.chassisCollider.handle))}setLocation(e){}setLocationNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinvel(e){}setAngvel(e){}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){if(!this.controller)return!0;let e=!1;return e||=this.controller.wheelIsInContact(0),e||=this.controller.wheelIsInContact(1),e||=this.controller.wheelIsInContact(2),e||=this.controller.wheelIsInContact(3),e}update(e){this.controller?.updateVehicle(e),this.chassisBody&&this.trans.loc.set(this.chassisBody.translation()),this.chassisBody&&this.trans.quat.set(this.chassisBody.rotation())}}class Es{cm;name;playCount;time;constructor(e){this.cm=e,this.name="default",this.playCount=0,this.time=0}prepare3D(e){e instanceof mt&&e.addActionRoot("default")}cleanup3D(e){e instanceof mt&&e.removeActionRoot("default")}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}update(e){if(!this.cm.trans.chassisBody)return{};if(!this.cm.trans.controller)return{};const t=new ce(this.cm.trans.chassisBody.translation()),n=new Ce(this.cm.trans.chassisBody.rotation()).clone().conjugate(),s=new ce(this.cm.trans.chassisBody.translation());s.sub(t);const o=new Ce(this.cm.trans.chassisBody.rotation());o.mul(n);const c=new Ce,A=new ce,a=new Ce;{const l=new ce(this.cm.opt.wheelFLAxle),h=new ce(this.cm.opt.wheelFLPosition),p=this.cm.trans.controller.wheelSuspensionLength(0)||0,C=this.cm.trans.controller.wheelSteering(0)||0,E=this.cm.trans.controller.wheelRotation(0)||0;A.set(h),A.sub(0,p,0),a.set(0,Math.sin(C/2),0,Math.cos(C/2)),c.set(l.x*Math.sin(E/2),l.y*Math.sin(E/2),l.z*Math.sin(E/2),Math.cos(E/2)),a.mul(c)}const f=new ce,u=new Ce;{const l=new ce(this.cm.opt.wheelFRAxle),h=new ce(this.cm.opt.wheelFRPosition),p=this.cm.trans.controller.wheelSuspensionLength(1)||0,C=this.cm.trans.controller.wheelSteering(1)||0,E=this.cm.trans.controller.wheelRotation(1)||0;f.set(h),f.sub(0,p,0),u.set(0,Math.sin(C/2),0,Math.cos(C/2)),c.set(l.x*Math.sin(E/2),l.y*Math.sin(E/2),l.z*Math.sin(E/2),Math.cos(E/2)),u.mul(c)}const b=new ce,d=new Ce;{const l=new ce(this.cm.opt.wheelRLAxle),h=new ce(this.cm.opt.wheelRLPosition),p=this.cm.trans.controller.wheelSuspensionLength(2)||0,C=this.cm.trans.controller.wheelSteering(2)||0,E=this.cm.trans.controller.wheelRotation(2)||0;b.set(h),b.sub(0,p,0),d.set(0,Math.sin(C/2),0,Math.cos(C/2)),c.set(l.x*Math.sin(E/2),l.y*Math.sin(E/2),l.z*Math.sin(E/2),Math.cos(E/2)),d.mul(c)}const I=new ce,g=new Ce;{const l=new ce(this.cm.opt.wheelRRAxle),h=new ce(this.cm.opt.wheelRRPosition),p=this.cm.trans.controller.wheelSuspensionLength(3)||0,C=this.cm.trans.controller.wheelSteering(3)||0,E=this.cm.trans.controller.wheelRotation(3)||0;I.set(h),I.sub(0,p,0),g.set(0,Math.sin(C/2),0,Math.cos(C/2)),c.set(l.x*Math.sin(E/2),l.y*Math.sin(E/2),l.z*Math.sin(E/2),Math.cos(E/2)),g.mul(c)}return{chassis:{loc:s,quat:o},frontRight:{loc:f,quat:u},frontLeft:{loc:A,quat:a},rearRight:{loc:I,quat:g},rearLeft:{loc:b,quat:d}}}}exports.Acerola3D=mt;exports.AvatarController=mr;exports.Box=As;exports.Camera=Mn;exports.Canvas=an;exports.CarMotion=ps;exports.CharactorTransformMotion=Dn;exports.ClipPoseMotion=on;exports.ControllerBase=Qt;exports.DefaultTransformMotion=Et;exports.FixedTransformMotion=cr;exports.FollowAvatarController=Ir;exports.GLTF=yo;exports.GameCanvas=Hi;exports.GeneralCamera=It;exports.HTML=hs;exports.Image=us;exports.ObjectA3=xe;exports.OrbitController=On;exports.Quat=Ce;exports.RapierPhysicsEngine=gt;exports.Scene=xn;exports.Sound=ot;exports.Sphere=cs;exports.StandardLights=ls;exports.Test=Ro;exports.Text3D=_o;exports.ThreeJS=as;exports.Transform=He;exports.Vec3=ce;exports.Window=_i;exports.asyncSleep=fr;exports.collisionMap=tt;exports.deepMerge=vt;exports.getQuatOfLookAt=st;exports.initFont=So;exports.initPhysics=Ar;exports.initSound=Cr;exports.vec3EulerToQuat=At;
220
289
  //# sourceMappingURL=a3js.cjs.js.map