@galacean/cli 2.0.0-alpha.26 → 2.0.0-alpha.28

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.
Files changed (97) hide show
  1. package/dist/cli.bundle.cjs +55252 -18754
  2. package/dist/preview-client/_static/{Accordion-2cd014f1.js → Accordion-6f002a96.js} +1 -1
  3. package/dist/preview-client/_static/{AmbientLightAsset-be9e872c.js → AmbientLightAsset-57a59fc2.js} +2 -2
  4. package/dist/preview-client/_static/{AnimationClipAsset-d7b37af0.js → AnimationClipAsset-0a1f63eb.js} +1 -1
  5. package/dist/preview-client/_static/{AnimatorControllerAsset-2716497a.js → AnimatorControllerAsset-9192e596.js} +1 -1
  6. package/dist/preview-client/_static/{AnimatorStore-883a28ad.js → AnimatorStore-484b10cf.js} +1 -1
  7. package/dist/preview-client/_static/{AssetViewer-3847c058.js → AssetViewer-9f395efb.js} +1 -1
  8. package/dist/preview-client/_static/{AudioAsset-c28f33ab.js → AudioAsset-0ea4ba7b.js} +1 -1
  9. package/dist/preview-client/_static/{AudioComponent-3d6c73ce.js → AudioComponent-9bf5944c.js} +1 -1
  10. package/dist/preview-client/_static/{Callout-e2a89f6f.js → Callout-45631a14.js} +1 -1
  11. package/dist/preview-client/_static/{CameraComponent-3dc63451.js → CameraComponent-039457d1.js} +1 -1
  12. package/dist/preview-client/_static/{Component-0f881fc1.js → Component-c3c0c167.js} +1 -1
  13. package/dist/preview-client/_static/{DirectLight-96dbba47.js → DirectLight-7b1f4b9f.js} +1 -1
  14. package/dist/preview-client/_static/{FontAsset-d34b5378.js → FontAsset-10273d05.js} +2 -2
  15. package/dist/preview-client/_static/{FormItemArray-b8cda1d2.js → FormItemArray-9d4196d8.js} +2 -2
  16. package/dist/preview-client/_static/{GlTFAsset-5970e707.js → GlTFAsset-917bf1ee.js} +5 -5
  17. package/dist/preview-client/_static/{IconPlus-def01e2b.js → IconPlus-2bfc60da.js} +1 -1
  18. package/dist/preview-client/_static/{IconPointFilled-62d3c3b2.js → IconPointFilled-192e99c9.js} +1 -1
  19. package/dist/preview-client/_static/{LightBaseComponent-d651a276.js → LightBaseComponent-948d3192.js} +1 -1
  20. package/dist/preview-client/_static/{LottieAnimationComponent-f10dc558.js → LottieAnimationComponent-da226765.js} +1 -1
  21. package/dist/preview-client/_static/{MarkdownAsset-b2a3fad5.js → MarkdownAsset-602f93bf.js} +1 -1
  22. package/dist/preview-client/_static/MaterialAsset-aa93db51.js +1 -0
  23. package/dist/preview-client/_static/{MaterialInspector-8d466d59.js → MaterialInspector-45e208c7.js} +1 -1
  24. package/dist/preview-client/_static/Menu-beacc39d.js +17 -0
  25. package/dist/preview-client/_static/MeshAsset-585f4b18.js +1 -0
  26. package/dist/preview-client/_static/{MeshRendererBaseComponent-fde6b6a5.js → MeshRendererBaseComponent-0bc9f5b3.js} +1 -1
  27. package/dist/preview-client/_static/{MeshRendererComponent-430774ef.js → MeshRendererComponent-84208d23.js} +1 -1
  28. package/dist/preview-client/_static/{MeshThumbnail-07ffa076.js → MeshThumbnail-9bbe01dc.js} +1 -1
  29. package/dist/preview-client/_static/ParticleRendererComponent-f3ac8d1b.js +26 -0
  30. package/dist/preview-client/_static/{PhysicsMaterialAsset-a2f73b5c.js → PhysicsMaterialAsset-2dd013f8.js} +1 -1
  31. package/dist/preview-client/_static/{PhysicsStore-818c2f61.js → PhysicsStore-fcb01282.js} +1 -1
  32. package/dist/preview-client/_static/{PointLight-add790ea.js → PointLight-d9ace100.js} +1 -1
  33. package/dist/preview-client/_static/{PostProcessComponent-af270a77.js → PostProcessComponent-2b5255d9.js} +3 -3
  34. package/dist/preview-client/_static/PrefabAsset-8c923465.js +1 -0
  35. package/dist/preview-client/_static/{PrimitiveMesh-075dda8a.js → PrimitiveMesh-fde624a6.js} +1 -1
  36. package/dist/preview-client/_static/{ReferencedMaterial-d11151b5.js → ReferencedMaterial-890492a2.js} +1 -1
  37. package/dist/preview-client/_static/{RenderTargetAsset-b3cd1c49.js → RenderTargetAsset-bf38a725.js} +1 -1
  38. package/dist/preview-client/_static/SceneAsset-7a9dbdd8.js +1 -0
  39. package/dist/preview-client/_static/{ShaderAsset-a9d667f5.js → ShaderAsset-2f2c1e95.js} +12 -12
  40. package/dist/preview-client/_static/{ShaderChunkAsset-e43dde8a.js → ShaderChunkAsset-a3ff3959.js} +2 -2
  41. package/dist/preview-client/_static/{ShaderUIScriptAsset-e1cd0b8b.js → ShaderUIScriptAsset-d3a2d680.js} +1 -1
  42. package/dist/preview-client/_static/{SkinnedMeshRendererComponent-9756bd5f.js → SkinnedMeshRendererComponent-96740600.js} +1 -1
  43. package/dist/preview-client/_static/{SpineAnimationComponent-f3e0ff44.js → SpineAnimationComponent-3d4eec48.js} +1 -1
  44. package/dist/preview-client/_static/{SpineSkeletonDataAsset-43b731f1.js → SpineSkeletonDataAsset-a8598103.js} +1 -1
  45. package/dist/preview-client/_static/{SpotLight-649b0e21.js → SpotLight-680a6e17.js} +1 -1
  46. package/dist/preview-client/_static/{SpriteBaseComponent-d2a7ab4c.js → SpriteBaseComponent-96a500d7.js} +1 -1
  47. package/dist/preview-client/_static/{SpriteMaskComponent-2c1cef5e.js → SpriteMaskComponent-58c35ea2.js} +1 -1
  48. package/dist/preview-client/_static/{SpriteRendererComponent-33b71997.js → SpriteRendererComponent-5c89f7dd.js} +1 -1
  49. package/dist/preview-client/_static/{TextBaseComponent-9310e0c6.js → TextBaseComponent-248ea222.js} +3 -3
  50. package/dist/preview-client/_static/{TextRendererComponent-8dc0d7fb.js → TextRendererComponent-78458825.js} +1 -1
  51. package/dist/preview-client/_static/{TextureAsset-a7ff39b1.js → TextureAsset-bf69040b.js} +4 -4
  52. package/dist/preview-client/_static/Tooltip-0268ffac.js +1 -0
  53. package/dist/preview-client/_static/{TrailRendererComponent-c4635fab.js → TrailRendererComponent-838e0118.js} +1 -1
  54. package/dist/preview-client/_static/{TransformBaseComponent-1473deaa.js → TransformBaseComponent-c92aa259.js} +1 -1
  55. package/dist/preview-client/_static/{TransformComponent-e544f7ac.js → TransformComponent-d28b4035.js} +1 -1
  56. package/dist/preview-client/_static/{XRReferenceImageAsset-96f516ba.js → XRReferenceImageAsset-16071f5c.js} +1 -1
  57. package/dist/preview-client/_static/{audio-b5fbde34.js → audio-1d573775.js} +1 -1
  58. package/dist/preview-client/_static/{createOnModelChange-370b83da.js → createOnModelChange-38471bb6.js} +1 -1
  59. package/dist/preview-client/_static/{createReactComponent-58d9f0dd.js → createReactComponent-3e49f864.js} +1 -1
  60. package/dist/preview-client/_static/index-0a57ae09.js +1 -0
  61. package/dist/preview-client/_static/{index-74bcfad9.js → index-1d0ae2e4.js} +1 -1
  62. package/dist/preview-client/_static/{index-dd0763bf.js → index-1fa3ba70.js} +1 -1
  63. package/dist/preview-client/_static/index-2c567b8d.js +1 -0
  64. package/dist/preview-client/_static/{index-da16047f.js → index-2f54d4c9.js} +1 -1
  65. package/dist/preview-client/_static/{index-0dd5bb36.js → index-4084db44.js} +1 -1
  66. package/dist/preview-client/_static/index-5c27dafa.js +1 -0
  67. package/dist/preview-client/_static/{index-88650db7.js → index-65c6af4a.js} +3 -3
  68. package/dist/preview-client/_static/{index-05b76766.js → index-68806c86.js} +1 -1
  69. package/dist/preview-client/_static/{index-cdbb2f4d.js → index-8a22fe59.js} +1 -1
  70. package/dist/preview-client/_static/index-9e3daa94.js +1 -0
  71. package/dist/preview-client/_static/index-bdda02cf.js +1 -0
  72. package/dist/preview-client/_static/index-c88f78ce.js +1 -0
  73. package/dist/preview-client/_static/{index-ab8556cb.js → index-ce381b62.js} +3 -3
  74. package/dist/preview-client/_static/{index-c3dec278.js → index-d497fb6d.js} +214 -175
  75. package/dist/preview-client/_static/index-e4fb05d8.js +1 -0
  76. package/dist/preview-client/_static/{ktx2-encoder-db93524f.js → ktx2-encoder-772f6c33.js} +1 -1
  77. package/dist/preview-client/_static/{module-ec094ef6.js → module-136992e3.js} +1 -1
  78. package/dist/preview-client/_static/{module-ada3dced.js → module-1470d524.js} +1 -1
  79. package/dist/preview-client/_static/{module-de7ee724.js → module-77c2ea8c.js} +1 -1
  80. package/dist/preview-client/_static/{postmen-2853c0e6.js → postmen-0413c689.js} +2 -2
  81. package/dist/preview-client/_static/{shader-data-utils-f0e4f5a3.js → shader-data-utils-e38a959d.js} +1 -1
  82. package/dist/preview-client/index.html +1 -1
  83. package/package.json +29 -24
  84. package/dist/preview-client/_static/MaterialAsset-5353c4cb.js +0 -1
  85. package/dist/preview-client/_static/Menu-c8e6194b.js +0 -17
  86. package/dist/preview-client/_static/MeshAsset-c2bf60c5.js +0 -1
  87. package/dist/preview-client/_static/ParticleRendererComponent-e106bd8c.js +0 -26
  88. package/dist/preview-client/_static/PrefabAsset-59743dbb.js +0 -1
  89. package/dist/preview-client/_static/SceneAsset-08752701.js +0 -1
  90. package/dist/preview-client/_static/Tooltip-b5be390f.js +0 -1
  91. package/dist/preview-client/_static/index-29c59aff.js +0 -1
  92. package/dist/preview-client/_static/index-3680d0e0.js +0 -1
  93. package/dist/preview-client/_static/index-42aa3a49.js +0 -1
  94. package/dist/preview-client/_static/index-496f331d.js +0 -1
  95. package/dist/preview-client/_static/index-9f0122f0.js +0 -1
  96. package/dist/preview-client/_static/index-c6b7045c.js +0 -1
  97. package/dist/preview-client/_static/index-dddcae01.js +0 -1
@@ -1 +1 @@
1
- import{G as de,al as he,am as me,an as pe,ao as ve,F as Se,ai as v,X as ue,ap as we,H as ke,aq as q,ar as U,b as B,as as Q,at as be,au as ye}from"./index-c3dec278.js";function ce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ce=function(){return!!e})()}function V(e,r){return V=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},V(e,r)}function R(e,r,a){return ce()?R=Reflect.construct:R=function(t,i,s){var o=[null];o.push.apply(o,i);var h=Function.bind.apply(t,o),u=new h;return s&&V(u,s.prototype),u},R.apply(null,arguments)}function X(e,r){for(var a=0;a<r.length;a++){var n=r[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,r,a){return r&&X(e.prototype,r),a&&X(e,a),e}function p(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&V(e,r)}function ee(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}var M=function(e){return e[e.Controller=0]="Controller",e[e.LeftController=1]="LeftController",e[e.RightController=2]="RightController",e[e.Camera=3]="Camera",e[e.LeftCamera=4]="LeftCamera",e[e.RightCamera=5]="RightCamera",e[e.LeftHand=6]="LeftHand",e[e.RightHand=7]="RightHand",e}({}),k=function(e){return e[e.None=0]="None",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized",e[e.Running=3]="Running",e[e.Paused=4]="Paused",e}({}),Me=function(){function e(a){this._xrManager=a}var r=e.prototype;return r.attachCamera=function(n,t){var i=this._xrManager.inputManager.getTrackedDevice(n),s=i._camera;if(s!==t){switch(s&&(s._cameraType=q.Normal),n){case M.Camera:t._cameraType=q.XRCenterCamera;break;case M.LeftCamera:t._cameraType=q.XRLeftCamera;break;case M.RightCamera:t._cameraType=q.XRRightCamera;break}i._camera=t}},r.detachCamera=function(n){var t=this._xrManager.inputManager.getTrackedDevice(n),i=t._camera;return i&&(i._cameraType=q.Normal),t._camera=null,i},r._onSessionStart=function(){},r._onUpdate=function(){for(var n=this._xrManager.inputManager._cameras,t=this._xrManager.sessionManager._platformSession,i=0,s=n.length;i<s;i++){var o=n[i],h=o._camera;if(h){var u=h.entity.transform,c=o.pose;u.position=c.position,u.rotationQuaternion=c.rotation;var f=h.viewport,_=o.viewport,l=_.x,g=_.y,d=_.width,m=_.height;l===f.x&&g===f.y&&d===f.z&&m===f.w||(h.viewport=f.set(l,g,d,m)),U.equals(h.projectionMatrix,o.projectionMatrix)||(h.projectionMatrix=o.projectionMatrix),h.renderTarget||h._adjustPixelViewport(t.framebufferWidth,t.framebufferHeight)}}},r._onSessionExit=function(){for(var n=this._xrManager.inputManager._cameras,t=0,i=n.length;t<i;t++){var s;(s=n[t]._camera)==null||s._updatePixelViewport()}},r._getIgnoreClearFlags=function(n){return n===q.XRCenterCamera?this._xrManager.sessionManager.state===k.Running?B.Color:B.None:B.None},r._onDestroy=function(){},A(e,[{key:"fixedFoveation",get:function(){var n=this._xrManager.sessionManager,t=n._platformSession;if(t)return t.getFixedFoveation();throw new Error("XR session is not available.")},set:function(n){var t=this._xrManager.sessionManager,i=t._platformSession;if(i)i.setFixedFoveation(n);else throw new Error("XR session is not available.")}}]),e}(),O=function(){this.position=new v,this.rotation=new ye,this.matrix=new U,this.inverseMatrix=new U},w=function(e){return e[e.NotTracking=0]="NotTracking",e[e.Tracking=1]="Tracking",e[e.TrackingLost=2]="TrackingLost",e}({}),fe=function(r){this.type=r,this.trackingState=w.NotTracking},xe=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.pose=new O,a.viewport=new be,a.projectionMatrix=new U,a}return r}(fe),b=function(e){return e[e.None=0]="None",e[e.Select=1]="Select",e[e.Trigger=1]="Trigger",e[e.Squeeze=2]="Squeeze",e[e.TouchPad=4]="TouchPad",e[e.AButton=8]="AButton",e[e.BButton=16]="BButton",e}({}),Ce=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.gripPose=new O,n.targetRayPose=new O,n.pressedButtons=b.None,n.down=b.None,n.up=b.None,n}var a=r.prototype;return a.isButtonDown=function(t){return(this.down&t)!==0},a.isButtonUp=function(t){return(this.up&t)!==0},a.isButtonHeldDown=function(t){return(this.pressedButtons&t)!==0},r}(fe),P=function(e){return e[e.SelectStart=0]="SelectStart",e[e.Select=1]="Select",e[e.SelectEnd=2]="SelectEnd",e[e.SqueezeStart=3]="SqueezeStart",e[e.Squeeze=4]="Squeeze",e[e.SqueezeEnd=5]="SqueezeEnd",e}({}),te=function(e){return e[e.Gaze=0]="Gaze",e[e.TrackedPointer=1]="TrackedPointer",e[e.Screen=2]="Screen",e}({}),Ee=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onTrackedDeviceChanged=new Q,this._cameras=[],this._controllers=[],this._added=[],this._removed=[],this._trackedDevices=[],this._statusSnapshot=[];for(var t=this,i=t._trackedDevices,s=t._controllers,o=t._cameras,h=0;h<6;h++)switch(h){case M.Camera:case M.LeftCamera:case M.RightCamera:o.push(i[h]=new xe(h));break;case M.Controller:case M.LeftController:case M.RightController:s.push(i[h]=new Ce(h));break}this._statusSnapshot.fill(w.NotTracking,0,i.length)}var r=e.prototype;return r.getTrackedDevice=function(n){return this._trackedDevices[n]},r._onUpdate=function(){var n=this,t=n._added,i=n._removed,s=n._statusSnapshot,o=this,h=o._trackedDevices,u=o._controllers;t.length=i.length=0;for(var c=0,f=u.length;c<f;c++){var _=u[c];_.down=_.up=0}for(var l=this._xrManager.sessionManager,g=l._platformSession,d=g.events,m=0,S=d.length;m<S;m++)this._handleEvent(d[m]);g.resetEvents(),g.frame.updateInputs(h);for(var x=0,z=h.length;x<z;x++){var F=h[x];if(F){var E=F.trackingState;s[x]===w.Tracking?E!==w.Tracking&&i.push(F):E===w.Tracking&&t.push(F),s[x]=E}}(t.length>0||i.length>0)&&this.onTrackedDeviceChanged.invoke(t,i)},r._onDestroy=function(){this.onTrackedDeviceChanged.removeAll()},r._handleEvent=function(n){var t=this._trackedDevices[n.input];switch(n.targetRayMode){case te.TrackedPointer:switch(n.type){case P.SelectStart:t.down|=b.Select,t.pressedButtons|=b.Select;break;case P.SelectEnd:t.up|=b.Select,t.pressedButtons&=~b.Select;break;case P.SqueezeStart:t.down|=b.Squeeze,t.pressedButtons|=b.Squeeze;break;case P.SqueezeEnd:t.up|=b.Squeeze,t.pressedButtons&=~b.Squeeze;break}break;case te.Screen:var i=this,s=i._engine,o=s.inputManager._pointerManager._target,h=s.canvas._webCanvas,u=h.clientWidth,c=h.clientHeight,f=u*(n.x+1)*.5,_=c*(n.y+1)*.5;switch(n.type){case P.SelectStart:o.dispatchEvent(this._makeUpPointerEvent("pointerdown",n.id,f,_));break;case P.Select:o.dispatchEvent(this._makeUpPointerEvent("pointermove",n.id,f,_));break;case P.SelectEnd:o.dispatchEvent(this._makeUpPointerEvent("pointerup",n.id,f,_)),o.dispatchEvent(this._makeUpPointerEvent("pointerleave",n.id,f,_));break}break}},r._makeUpPointerEvent=function(n,t,i,s){var o={pointerId:t,clientX:i,clientY:s};switch(n){case"pointerdown":o.button=0,o.buttons=1;break;case"pointermove":o.button=-1,o.buttons=1;break;case"pointerup":o.button=0,o.buttons=0;break;case"pointerleave":o.button=0,o.buttons=0;break}return new PointerEvent(n,o)},r.addTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.on(n)},r.removeTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.off(n)},e}(),_e=function(e){return e[e.None=0]="None",e[e.AR=1]="AR",e[e.VR=2]="VR",e}({}),Pe=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onStateChanged=new Q,this._mode=_e.None,this._state=k.None,this._rhi=n._hardwareRenderer,this._raf=requestAnimationFrame.bind(window),this._caf=cancelAnimationFrame.bind(window),this._onSessionExit=this._onSessionExit.bind(this)}var r=e.prototype;return r.isSupportedMode=function(n){return this._xrManager._platformDevice.isSupportedSessionMode(n)},r.run=function(){var n=this,t=n._platformSession,i=n._engine;if(!t)throw new Error("Without session to run.");t.start(),this._setState(k.Running),this._xrManager._onSessionStart(),i.isPaused||(i.pause(),i.resume())},r.stop=function(){var n=this,t=n._platformSession,i=n._engine,s=n._rhi;if(!t)throw new Error("Without session to stop.");if(this._state!==k.Running)throw new Error("Session is not running.");s._mainFrameBuffer=null,s._mainFrameWidth=s._mainFrameHeight=0,t.stop(),this._setState(k.Paused),this._xrManager._onSessionStop(),i.isPaused||(i.pause(),i.resume())},r._setState=function(n){this._state=n,this.onStateChanged.invoke(n)},r._initialize=function(n,t){var i=this;return new Promise(function(s,o){for(var h=i._xrManager,u=[],c=0,f=t.length;c<f;c++){var _=t[c],l=_._platformFeature;l&&u.push(l)}h._platformDevice.requestSession(i._rhi,n,u).then(function(g){i._mode=n,i._platformSession=g,i._setState(k.Initialized),g.setSessionExitCallBack(i._onSessionExit),g.addEventListener(),h._onSessionInit(),s()},o)})},r._onUpdate=function(){var n=this,t=n._rhi,i=n._platformSession;t._mainFrameBuffer=i.framebuffer,t._mainFrameWidth=i.framebufferWidth,t._mainFrameHeight=i.framebufferHeight},r._getRequestAnimationFrame=function(){return this._state===k.Running?this._platformSession.requestAnimationFrame:this._raf},r._getCancelAnimationFrame=function(){return this._state===k.Running?this._platformSession.cancelAnimationFrame:this._caf},r._exit=function(){var n=this,t=n._platformSession;return t?t.end():Promise.reject("Without session to stop.")},r._onSessionExit=function(){var n=this,t=n._rhi,i=n._platformSession,s=n._engine;t._mainFrameBuffer=null,t._mainFrameWidth=t._mainFrameHeight=0,i.removeEventListener(),this._platformSession=null,this._setState(k.None),this._xrManager._onSessionExit(),s.isPaused||(s.pause(),s.resume())},r._onDestroy=function(){this.onStateChanged.removeAll(),this._raf=this._caf=null},r.addStateChangedListener=function(n){this.onStateChanged.on(n)},r.removeStateChangedListener=function(n){this.onStateChanged.off(n)},A(e,[{key:"mode",get:function(){return this._mode}},{key:"state",get:function(){return this._state}},{key:"supportedFrameRate",get:function(){return this._platformSession.supportedFrameRates}},{key:"frameRate",get:function(){return this._platformSession.frameRate}}]),e}(),J=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.isSupportedFeature=function(t){return this._platformDevice.isSupportedFeature(r._featureMap.get(t))},a.addFeature=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(this.sessionManager._platformSession)throw new Error("Cannot add feature when the session is initialized.");if(!this._platformDevice.isSupportedFeature(r._featureMap.get(t)))throw new Error("The feature is not supported");for(var h=this.features,u=0,c=h.length;u<c;u++)if(ee(h[u],t))throw new Error("The feature has been added");var f=R(t,[].concat([this],s));return h.push(f),f},a.getFeature=function(t){for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];if(ee(h,t))return h}},a.enterXR=function(t,i){var s=this;i===void 0&&(i=!0);var o=this.sessionManager;if(o._platformSession)throw new Error("Please exit XR immersive mode first.");if(!this._origin)throw new Error("Please set origin before enter XR.");return new Promise(function(h,u){o.isSupportedMode(t).then(function(){o._setState(k.Initializing),o._initialize(t,s.features).then(function(){i&&o.run(),h()},u)},u)})},a.exitXR=function(){var t=this;return new Promise(function(i,s){t.sessionManager._exit().then(function(){i()},s)})},a._initialize=function(t,i){this._features=[],this._platformDevice=i,this.sessionManager=new Pe(this,t),this.inputManager=new Ee(this,t),this.cameraManager=new Me(this)},a._update=function(){var t=this.sessionManager;if(t.state===k.Running){t._onUpdate(),this.inputManager._onUpdate(),this.cameraManager._onUpdate();for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];h.enabled&&h._onUpdate()}}},a._destroy=function(){var t=this;this.sessionManager._platformSession?this.exitXR().then(function(){t.sessionManager._onDestroy(),t.inputManager._onDestroy(),t.cameraManager._onDestroy()}):(this.sessionManager._onDestroy(),this.inputManager._onDestroy(),this.cameraManager._onDestroy())},a._getRequestAnimationFrame=function(){return this.sessionManager._getRequestAnimationFrame()},a._getCancelAnimationFrame=function(){return this.sessionManager._getCancelAnimationFrame()},a._getCameraIgnoreClearFlags=function(t){return this.cameraManager._getIgnoreClearFlags(t)},a._onSessionStop=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStop()}},a._onSessionInit=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionInit()}},a._onSessionStart=function(){this.cameraManager._onSessionStart();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStart()}},a._onSessionExit=function(){this.cameraManager._onSessionExit();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionExit(),o._onDestroy()}t.length=0},A(r,[{key:"features",get:function(){return this._features}},{key:"origin",get:function(){return this._origin},set:function(t){if(this.sessionManager._platformSession)throw new Error("Cannot set origin when the session is initialized.");this._origin=t}}]),r}(he);J._featureMap=new Map;function W(e){return function(r){J._featureMap.set(r,e)}}function Te(e,r){r.forEach(function(a){Object.getOwnPropertyNames(a.prototype).forEach(function(n){Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(a.prototype,n)||Object.create(null))})})}Te(he,[J]);var le=function(){function e(a,n){for(var t=arguments.length,i=new Array(t>2?t-2:0),s=2;s<t;s++)i[s-2]=arguments[s];var o;this._xrManager=a,this._type=n,this._enabled=!0,this._platformFeature=(o=a._platformDevice).createPlatformFeature.apply(o,[].concat([n],i)),this._onEnable()}var r=e.prototype;return r._onEnable=function(){},r._onDisable=function(){},r._onUpdate=function(){},r._onSessionInit=function(){},r._onSessionStart=function(){},r._onSessionStop=function(){},r._onSessionExit=function(){},r._onDestroy=function(){},A(e,[{key:"enabled",get:function(){return this._enabled},set:function(n){this.enabled!==n&&(this._enabled=n,n?this._onEnable():this._onDisable())}}]),e}(),y=function(e){return e[e.AnchorTracking=0]="AnchorTracking",e[e.ImageTracking=1]="ImageTracking",e[e.PlaneTracking=2]="PlaneTracking",e[e.HitTest=3]="HitTest",e}({}),H=function(e){return e[e.None=0]="None",e[e.Submitted=1]="Submitted",e[e.Resolved=2]="Resolved",e[e.Rejected=3]="Rejected",e[e.Destroyed=4]="Destroyed",e[e.WaitingDestroy=5]="WaitingDestroy",e}({}),T=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.onChanged=new Q,n._requestTrackings=[],n._tracked=[],n._added=[],n._updated=[],n._removed=[],n._statusSnapshot={},n}var a=r.prototype;return a._onUpdate=function(){var t=this._xrManager.sessionManager,i=t._platformSession,s=i.frame,o=this,h=o._platformFeature,u=o._requestTrackings,c=o._statusSnapshot,f=o._tracked,_=o._added,l=o._updated,g=o._removed;if(!(!s||!u.length)&&h.checkAvailable(i,s,u)){_.length=l.length=g.length=0,h.getTrackedResult(i,s,u,this._generateTracked);for(var d=0,m=u.length;d<m;d++){var S=u[d];switch(S.state){case H.Destroyed:for(var x=S.tracked,z=0,F=x.length;z<F;z++){var E=x[z],$=E.id;c[$]===w.Tracking&&(g.push(E),f.splice(f.indexOf(E),1)),c[$]=w.NotTracking}break;case H.Resolved:for(var Y=S.tracked,j=0,ge=Y.length;j<ge;j++){var C=Y[j],L=C.id;C.state===w.Tracking?c[L]===w.Tracking?l.push(C):(_.push(C),c[L]=w.Tracking,f.push(C)):(c[L]===w.Tracking&&(g.push(C),f.splice(f.indexOf(C),1)),c[L]=C.state)}break}}for(var N=u.length-1;N>=0;N--)u[N].state===H.Destroyed&&u.splice(N,1);(_.length>0||l.length>0||g.length>0)&&this.onChanged.invoke(_,l,g)}},a._onSessionStop=function(){this._added.length=this._updated.length=this._removed.length=0},a._onSessionExit=function(){this._requestTrackings.length=this._tracked.length=this._added.length=this._updated.length=this._removed.length=0,this.onChanged.removeAll()},a._addRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");this._requestTrackings.push(t),s.onAddRequestTracking(t)},a._removeRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");s.onDelRequestTracking(t)},a._removeAllRequestTrackings=function(){var t=this,i=t._platformFeature;if(this._xrManager.sessionManager._platformSession&&!i.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");for(var s=this,o=s._requestTrackings,h=0,u=o.length;h<u;h++)i.onDelRequestTracking(o[h])},a.addChangedListener=function(t){this.onChanged.on(t)},a.removeChangedListener=function(t){this.onChanged.off(t)},r}(le);T._uuid=0;var K=function(){this.pose=new O,this.state=w.NotTracking},ne=function(e){return e[e.Plane=1]="Plane",e[e.All=1]="All",e}({}),Ae=function(){this.point=new v,this.normal=new v};function D(e,r,a,n){var t=arguments.length,i=t<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,a):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,r,a,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(t<3?s(i):t>3?s(r,a,i):s(r,a))||i);return t>3&&i&&Object.defineProperty(r,a,i),i}var Fe=function(e){return e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.EveryThing=3]="EveryThing",e}({}),Z=function(){this.state=H.None,this.tracked=[]},qe=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.detectionMode=a,n}return r}(Z),De=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.polygon=[],a.attributesDirty=!1,a}return r}(K),I=function(e){p(r,e);function r(n,t){t===void 0&&(t=Fe.EveryThing);var i;return i=e.call(this,n,y.PlaneTracking,t)||this,i._addRequestTracking(new qe(t)),i}var a=r.prototype;return a._generateTracked=function(){var t=new De;return t.id=T._uuid++,t},A(r,[{key:"detectionMode",get:function(){return this._requestTrackings[0].detectionMode}},{key:"trackedPlanes",get:function(){return this._tracked}}]),r}(T);I=D([W(y.PlaneTracking)],I);var re=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.HitTest)||this,t._tempRay=new pe,t._tempPlane=new ve,t._tempVec2=new Se,t._tempVec30=new v,t._tempVec31=new v,t._tempVec32=new v,t._tempVec33=new v,t._tempVec34=new v,t._tempVec35=new v,t}var a=r.prototype;return a.hitTest=function(t,i){var s=[];return i&ne.Plane&&this._hitTestPlane(t,s),s},a.screenHitTest=function(t,i,s){var o=this,h=o._xrManager;if(h.sessionManager.mode!==_e.AR)throw new Error("Only AR mode supports using screen ray hit test.");var u=h.inputManager.getTrackedDevice(M.Camera),c=u._camera;if(!c)throw new Error("No camera available.");var f=c.screenPointToRay(this._tempVec2.set(t,i),this._tempRay);return this.hitTest(f,s)},a._hitTestPlane=function(t,i){var s=this._xrManager.getFeature(I);if(!s||!s.enabled)throw new Error("The plane estimation function needs to be turned on for plane hit test.");for(var o=this,h=o._tempPlane,u=o._tempVec30,c=o._tempVec31,f=o._tempVec32,_=s.trackedPlanes,l=0,g=_.length;l<g;l++){var d=_[l];u.set(0,1,0).transformNormal(d.pose.matrix),h.normal.copyFrom(u),h.distance=-v.dot(u,d.pose.position);var m=t.intersectPlane(h);if(m>=0&&(t.getPoint(m,c),v.transformToVec3(c,d.pose.inverseMatrix,f),this._checkPointerWithinPlane(f,d))){var S=new Ae;S.point.copyFrom(c),S.normal.copyFrom(u),S.distance=m,S.trackedObject=d,S.trackableType=ne.Plane,i.push(S)}}},a._checkPointerWithinPlane=function(t,i){for(var s=this,o=s._tempVec33,h=s._tempVec34,u=s._tempVec35,c=i.polygon,f=c.length,_=c[f-1],l=0,g=0;g<f;g++){var d=c[g];v.subtract(d,_,o),v.subtract(t,_,h),v.cross(o,h,u);var m=u.y;if(l===0)m>0?l=1:m<0&&(l=-1);else if(m>0&&l<0||m<0&&l>0)return!1;_=d}return!0},r}(le);re=D([W(y.HitTest)],re);var ze=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),Le=function(e){p(r,e);function r(a,n){var t;return t=e.call(this)||this,t.position=a,t.rotation=n,t}return r}(Z),ae=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.AnchorTracking)||this,t._anchors=[],t}var a=r.prototype;return a.addAnchor=function(t,i){if(!this._enabled)throw new Error("Cannot add an anchor from a disabled anchor manager.");var s=this,o=s._anchors,h=new Le(t,i),u=this._generateTracked();return h.tracked[0]=u,this._addRequestTracking(h),o.push(u),u},a.removeAnchor=function(t){if(!this._enabled)throw new Error("Cannot remove an anchor from a disabled anchor manager.");for(var i=this,s=i._requestTrackings,o=i._anchors,h=0,u=s.length;h<u;h++){var c=s[h];if(c.tracked[0]===t){this._removeRequestTracking(c);break}}o.splice(o.indexOf(t),1)},a.clearAnchors=function(){if(!this._enabled)throw new Error("Cannot remove anchors from a disabled anchor manager.");this._removeAllRequestTrackings()},a._generateTracked=function(){var t=new ze;return t.id=T._uuid++,t},A(r,[{key:"trackingAnchors",get:function(){return this._anchors}},{key:"trackedAnchors",get:function(){return this._tracked}}]),r}(T);ae=D([W(y.AnchorTracking)],ae);var Ne=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.image=a,n}return r}(Z),Re=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),ie=function(e){p(r,e);function r(n,t){var i;i=e.call(this,n,y.ImageTracking,t)||this,i._trackingImages=t;var s=t?t.length:0;if(s>0)for(var o=0,h=t.length;o<h;o++)i._addRequestTracking(new Ne(t[o]));else console.warn("No image to be tracked.");return i}var a=r.prototype;return a._generateTracked=function(){var t=new Re;return t.id=T._uuid++,t},A(r,[{key:"trackingImages",get:function(){return this._trackingImages}},{key:"trackedImages",get:function(){return this._tracked}}]),r}(T);ie=D([W(y.ImageTracking)],ie);var He=function(r,a,n){this.name=r,this.imageSource=a,this.physicalWidth=n},oe=function(){function e(){}return e.decode=function(a,n){return new ue(function(t,i){var s=n.nextFloat32();n.nextUint8();var o=new Image;o.onload=function(){t(new He("",o,s))},o.src=URL.createObjectURL(new window.Blob([n.nextImagesData(1)[0]]))})},e}();oe=D([me("XRReferenceImage")],oe);function G(){return G=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},G.apply(this,arguments)}var se=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.load=function(t,i){return new ue(function(s,o){i._request(t.url,G({},t,{type:"arraybuffer"})).then(function(h){we(h,i.engine).then(function(u){s(u)})}).catch(o)})},r}(ke);se=D([de("XRReferenceImage",[])],se);export{He as X,_e as a,M as b,k as c,ae as d,ie as e,I as f,Fe as g};
1
+ import{G as de,al as he,am as me,an as pe,ao as ve,F as Se,ai as v,X as ue,ap as we,H as ke,aq as q,ar as U,b as B,as as Q,at as be,au as ye}from"./index-d497fb6d.js";function ce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ce=function(){return!!e})()}function V(e,r){return V=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},V(e,r)}function R(e,r,a){return ce()?R=Reflect.construct:R=function(t,i,s){var o=[null];o.push.apply(o,i);var h=Function.bind.apply(t,o),u=new h;return s&&V(u,s.prototype),u},R.apply(null,arguments)}function X(e,r){for(var a=0;a<r.length;a++){var n=r[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,r,a){return r&&X(e.prototype,r),a&&X(e,a),e}function p(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&V(e,r)}function ee(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}var M=function(e){return e[e.Controller=0]="Controller",e[e.LeftController=1]="LeftController",e[e.RightController=2]="RightController",e[e.Camera=3]="Camera",e[e.LeftCamera=4]="LeftCamera",e[e.RightCamera=5]="RightCamera",e[e.LeftHand=6]="LeftHand",e[e.RightHand=7]="RightHand",e}({}),k=function(e){return e[e.None=0]="None",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized",e[e.Running=3]="Running",e[e.Paused=4]="Paused",e}({}),Me=function(){function e(a){this._xrManager=a}var r=e.prototype;return r.attachCamera=function(n,t){var i=this._xrManager.inputManager.getTrackedDevice(n),s=i._camera;if(s!==t){switch(s&&(s._cameraType=q.Normal),n){case M.Camera:t._cameraType=q.XRCenterCamera;break;case M.LeftCamera:t._cameraType=q.XRLeftCamera;break;case M.RightCamera:t._cameraType=q.XRRightCamera;break}i._camera=t}},r.detachCamera=function(n){var t=this._xrManager.inputManager.getTrackedDevice(n),i=t._camera;return i&&(i._cameraType=q.Normal),t._camera=null,i},r._onSessionStart=function(){},r._onUpdate=function(){for(var n=this._xrManager.inputManager._cameras,t=this._xrManager.sessionManager._platformSession,i=0,s=n.length;i<s;i++){var o=n[i],h=o._camera;if(h){var u=h.entity.transform,c=o.pose;u.position=c.position,u.rotationQuaternion=c.rotation;var f=h.viewport,_=o.viewport,l=_.x,g=_.y,d=_.width,m=_.height;l===f.x&&g===f.y&&d===f.z&&m===f.w||(h.viewport=f.set(l,g,d,m)),U.equals(h.projectionMatrix,o.projectionMatrix)||(h.projectionMatrix=o.projectionMatrix),h.renderTarget||h._adjustPixelViewport(t.framebufferWidth,t.framebufferHeight)}}},r._onSessionExit=function(){for(var n=this._xrManager.inputManager._cameras,t=0,i=n.length;t<i;t++){var s;(s=n[t]._camera)==null||s._updatePixelViewport()}},r._getIgnoreClearFlags=function(n){return n===q.XRCenterCamera?this._xrManager.sessionManager.state===k.Running?B.Color:B.None:B.None},r._onDestroy=function(){},A(e,[{key:"fixedFoveation",get:function(){var n=this._xrManager.sessionManager,t=n._platformSession;if(t)return t.getFixedFoveation();throw new Error("XR session is not available.")},set:function(n){var t=this._xrManager.sessionManager,i=t._platformSession;if(i)i.setFixedFoveation(n);else throw new Error("XR session is not available.")}}]),e}(),O=function(){this.position=new v,this.rotation=new ye,this.matrix=new U,this.inverseMatrix=new U},w=function(e){return e[e.NotTracking=0]="NotTracking",e[e.Tracking=1]="Tracking",e[e.TrackingLost=2]="TrackingLost",e}({}),fe=function(r){this.type=r,this.trackingState=w.NotTracking},xe=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.pose=new O,a.viewport=new be,a.projectionMatrix=new U,a}return r}(fe),b=function(e){return e[e.None=0]="None",e[e.Select=1]="Select",e[e.Trigger=1]="Trigger",e[e.Squeeze=2]="Squeeze",e[e.TouchPad=4]="TouchPad",e[e.AButton=8]="AButton",e[e.BButton=16]="BButton",e}({}),Ce=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.gripPose=new O,n.targetRayPose=new O,n.pressedButtons=b.None,n.down=b.None,n.up=b.None,n}var a=r.prototype;return a.isButtonDown=function(t){return(this.down&t)!==0},a.isButtonUp=function(t){return(this.up&t)!==0},a.isButtonHeldDown=function(t){return(this.pressedButtons&t)!==0},r}(fe),P=function(e){return e[e.SelectStart=0]="SelectStart",e[e.Select=1]="Select",e[e.SelectEnd=2]="SelectEnd",e[e.SqueezeStart=3]="SqueezeStart",e[e.Squeeze=4]="Squeeze",e[e.SqueezeEnd=5]="SqueezeEnd",e}({}),te=function(e){return e[e.Gaze=0]="Gaze",e[e.TrackedPointer=1]="TrackedPointer",e[e.Screen=2]="Screen",e}({}),Ee=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onTrackedDeviceChanged=new Q,this._cameras=[],this._controllers=[],this._added=[],this._removed=[],this._trackedDevices=[],this._statusSnapshot=[];for(var t=this,i=t._trackedDevices,s=t._controllers,o=t._cameras,h=0;h<6;h++)switch(h){case M.Camera:case M.LeftCamera:case M.RightCamera:o.push(i[h]=new xe(h));break;case M.Controller:case M.LeftController:case M.RightController:s.push(i[h]=new Ce(h));break}this._statusSnapshot.fill(w.NotTracking,0,i.length)}var r=e.prototype;return r.getTrackedDevice=function(n){return this._trackedDevices[n]},r._onUpdate=function(){var n=this,t=n._added,i=n._removed,s=n._statusSnapshot,o=this,h=o._trackedDevices,u=o._controllers;t.length=i.length=0;for(var c=0,f=u.length;c<f;c++){var _=u[c];_.down=_.up=0}for(var l=this._xrManager.sessionManager,g=l._platformSession,d=g.events,m=0,S=d.length;m<S;m++)this._handleEvent(d[m]);g.resetEvents(),g.frame.updateInputs(h);for(var x=0,z=h.length;x<z;x++){var F=h[x];if(F){var E=F.trackingState;s[x]===w.Tracking?E!==w.Tracking&&i.push(F):E===w.Tracking&&t.push(F),s[x]=E}}(t.length>0||i.length>0)&&this.onTrackedDeviceChanged.invoke(t,i)},r._onDestroy=function(){this.onTrackedDeviceChanged.removeAll()},r._handleEvent=function(n){var t=this._trackedDevices[n.input];switch(n.targetRayMode){case te.TrackedPointer:switch(n.type){case P.SelectStart:t.down|=b.Select,t.pressedButtons|=b.Select;break;case P.SelectEnd:t.up|=b.Select,t.pressedButtons&=~b.Select;break;case P.SqueezeStart:t.down|=b.Squeeze,t.pressedButtons|=b.Squeeze;break;case P.SqueezeEnd:t.up|=b.Squeeze,t.pressedButtons&=~b.Squeeze;break}break;case te.Screen:var i=this,s=i._engine,o=s.inputManager._pointerManager._target,h=s.canvas._webCanvas,u=h.clientWidth,c=h.clientHeight,f=u*(n.x+1)*.5,_=c*(n.y+1)*.5;switch(n.type){case P.SelectStart:o.dispatchEvent(this._makeUpPointerEvent("pointerdown",n.id,f,_));break;case P.Select:o.dispatchEvent(this._makeUpPointerEvent("pointermove",n.id,f,_));break;case P.SelectEnd:o.dispatchEvent(this._makeUpPointerEvent("pointerup",n.id,f,_)),o.dispatchEvent(this._makeUpPointerEvent("pointerleave",n.id,f,_));break}break}},r._makeUpPointerEvent=function(n,t,i,s){var o={pointerId:t,clientX:i,clientY:s};switch(n){case"pointerdown":o.button=0,o.buttons=1;break;case"pointermove":o.button=-1,o.buttons=1;break;case"pointerup":o.button=0,o.buttons=0;break;case"pointerleave":o.button=0,o.buttons=0;break}return new PointerEvent(n,o)},r.addTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.on(n)},r.removeTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.off(n)},e}(),_e=function(e){return e[e.None=0]="None",e[e.AR=1]="AR",e[e.VR=2]="VR",e}({}),Pe=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onStateChanged=new Q,this._mode=_e.None,this._state=k.None,this._rhi=n._hardwareRenderer,this._raf=requestAnimationFrame.bind(window),this._caf=cancelAnimationFrame.bind(window),this._onSessionExit=this._onSessionExit.bind(this)}var r=e.prototype;return r.isSupportedMode=function(n){return this._xrManager._platformDevice.isSupportedSessionMode(n)},r.run=function(){var n=this,t=n._platformSession,i=n._engine;if(!t)throw new Error("Without session to run.");t.start(),this._setState(k.Running),this._xrManager._onSessionStart(),i.isPaused||(i.pause(),i.resume())},r.stop=function(){var n=this,t=n._platformSession,i=n._engine,s=n._rhi;if(!t)throw new Error("Without session to stop.");if(this._state!==k.Running)throw new Error("Session is not running.");s._mainFrameBuffer=null,s._mainFrameWidth=s._mainFrameHeight=0,t.stop(),this._setState(k.Paused),this._xrManager._onSessionStop(),i.isPaused||(i.pause(),i.resume())},r._setState=function(n){this._state=n,this.onStateChanged.invoke(n)},r._initialize=function(n,t){var i=this;return new Promise(function(s,o){for(var h=i._xrManager,u=[],c=0,f=t.length;c<f;c++){var _=t[c],l=_._platformFeature;l&&u.push(l)}h._platformDevice.requestSession(i._rhi,n,u).then(function(g){i._mode=n,i._platformSession=g,i._setState(k.Initialized),g.setSessionExitCallBack(i._onSessionExit),g.addEventListener(),h._onSessionInit(),s()},o)})},r._onUpdate=function(){var n=this,t=n._rhi,i=n._platformSession;t._mainFrameBuffer=i.framebuffer,t._mainFrameWidth=i.framebufferWidth,t._mainFrameHeight=i.framebufferHeight},r._getRequestAnimationFrame=function(){return this._state===k.Running?this._platformSession.requestAnimationFrame:this._raf},r._getCancelAnimationFrame=function(){return this._state===k.Running?this._platformSession.cancelAnimationFrame:this._caf},r._exit=function(){var n=this,t=n._platformSession;return t?t.end():Promise.reject("Without session to stop.")},r._onSessionExit=function(){var n=this,t=n._rhi,i=n._platformSession,s=n._engine;t._mainFrameBuffer=null,t._mainFrameWidth=t._mainFrameHeight=0,i.removeEventListener(),this._platformSession=null,this._setState(k.None),this._xrManager._onSessionExit(),s.isPaused||(s.pause(),s.resume())},r._onDestroy=function(){this.onStateChanged.removeAll(),this._raf=this._caf=null},r.addStateChangedListener=function(n){this.onStateChanged.on(n)},r.removeStateChangedListener=function(n){this.onStateChanged.off(n)},A(e,[{key:"mode",get:function(){return this._mode}},{key:"state",get:function(){return this._state}},{key:"supportedFrameRate",get:function(){return this._platformSession.supportedFrameRates}},{key:"frameRate",get:function(){return this._platformSession.frameRate}}]),e}(),J=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.isSupportedFeature=function(t){return this._platformDevice.isSupportedFeature(r._featureMap.get(t))},a.addFeature=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(this.sessionManager._platformSession)throw new Error("Cannot add feature when the session is initialized.");if(!this._platformDevice.isSupportedFeature(r._featureMap.get(t)))throw new Error("The feature is not supported");for(var h=this.features,u=0,c=h.length;u<c;u++)if(ee(h[u],t))throw new Error("The feature has been added");var f=R(t,[].concat([this],s));return h.push(f),f},a.getFeature=function(t){for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];if(ee(h,t))return h}},a.enterXR=function(t,i){var s=this;i===void 0&&(i=!0);var o=this.sessionManager;if(o._platformSession)throw new Error("Please exit XR immersive mode first.");if(!this._origin)throw new Error("Please set origin before enter XR.");return new Promise(function(h,u){o.isSupportedMode(t).then(function(){o._setState(k.Initializing),o._initialize(t,s.features).then(function(){i&&o.run(),h()},u)},u)})},a.exitXR=function(){var t=this;return new Promise(function(i,s){t.sessionManager._exit().then(function(){i()},s)})},a._initialize=function(t,i){this._features=[],this._platformDevice=i,this.sessionManager=new Pe(this,t),this.inputManager=new Ee(this,t),this.cameraManager=new Me(this)},a._update=function(){var t=this.sessionManager;if(t.state===k.Running){t._onUpdate(),this.inputManager._onUpdate(),this.cameraManager._onUpdate();for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];h.enabled&&h._onUpdate()}}},a._destroy=function(){var t=this;this.sessionManager._platformSession?this.exitXR().then(function(){t.sessionManager._onDestroy(),t.inputManager._onDestroy(),t.cameraManager._onDestroy()}):(this.sessionManager._onDestroy(),this.inputManager._onDestroy(),this.cameraManager._onDestroy())},a._getRequestAnimationFrame=function(){return this.sessionManager._getRequestAnimationFrame()},a._getCancelAnimationFrame=function(){return this.sessionManager._getCancelAnimationFrame()},a._getCameraIgnoreClearFlags=function(t){return this.cameraManager._getIgnoreClearFlags(t)},a._onSessionStop=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStop()}},a._onSessionInit=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionInit()}},a._onSessionStart=function(){this.cameraManager._onSessionStart();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStart()}},a._onSessionExit=function(){this.cameraManager._onSessionExit();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionExit(),o._onDestroy()}t.length=0},A(r,[{key:"features",get:function(){return this._features}},{key:"origin",get:function(){return this._origin},set:function(t){if(this.sessionManager._platformSession)throw new Error("Cannot set origin when the session is initialized.");this._origin=t}}]),r}(he);J._featureMap=new Map;function W(e){return function(r){J._featureMap.set(r,e)}}function Te(e,r){r.forEach(function(a){Object.getOwnPropertyNames(a.prototype).forEach(function(n){Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(a.prototype,n)||Object.create(null))})})}Te(he,[J]);var le=function(){function e(a,n){for(var t=arguments.length,i=new Array(t>2?t-2:0),s=2;s<t;s++)i[s-2]=arguments[s];var o;this._xrManager=a,this._type=n,this._enabled=!0,this._platformFeature=(o=a._platformDevice).createPlatformFeature.apply(o,[].concat([n],i)),this._onEnable()}var r=e.prototype;return r._onEnable=function(){},r._onDisable=function(){},r._onUpdate=function(){},r._onSessionInit=function(){},r._onSessionStart=function(){},r._onSessionStop=function(){},r._onSessionExit=function(){},r._onDestroy=function(){},A(e,[{key:"enabled",get:function(){return this._enabled},set:function(n){this.enabled!==n&&(this._enabled=n,n?this._onEnable():this._onDisable())}}]),e}(),y=function(e){return e[e.AnchorTracking=0]="AnchorTracking",e[e.ImageTracking=1]="ImageTracking",e[e.PlaneTracking=2]="PlaneTracking",e[e.HitTest=3]="HitTest",e}({}),H=function(e){return e[e.None=0]="None",e[e.Submitted=1]="Submitted",e[e.Resolved=2]="Resolved",e[e.Rejected=3]="Rejected",e[e.Destroyed=4]="Destroyed",e[e.WaitingDestroy=5]="WaitingDestroy",e}({}),T=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.onChanged=new Q,n._requestTrackings=[],n._tracked=[],n._added=[],n._updated=[],n._removed=[],n._statusSnapshot={},n}var a=r.prototype;return a._onUpdate=function(){var t=this._xrManager.sessionManager,i=t._platformSession,s=i.frame,o=this,h=o._platformFeature,u=o._requestTrackings,c=o._statusSnapshot,f=o._tracked,_=o._added,l=o._updated,g=o._removed;if(!(!s||!u.length)&&h.checkAvailable(i,s,u)){_.length=l.length=g.length=0,h.getTrackedResult(i,s,u,this._generateTracked);for(var d=0,m=u.length;d<m;d++){var S=u[d];switch(S.state){case H.Destroyed:for(var x=S.tracked,z=0,F=x.length;z<F;z++){var E=x[z],$=E.id;c[$]===w.Tracking&&(g.push(E),f.splice(f.indexOf(E),1)),c[$]=w.NotTracking}break;case H.Resolved:for(var Y=S.tracked,j=0,ge=Y.length;j<ge;j++){var C=Y[j],L=C.id;C.state===w.Tracking?c[L]===w.Tracking?l.push(C):(_.push(C),c[L]=w.Tracking,f.push(C)):(c[L]===w.Tracking&&(g.push(C),f.splice(f.indexOf(C),1)),c[L]=C.state)}break}}for(var N=u.length-1;N>=0;N--)u[N].state===H.Destroyed&&u.splice(N,1);(_.length>0||l.length>0||g.length>0)&&this.onChanged.invoke(_,l,g)}},a._onSessionStop=function(){this._added.length=this._updated.length=this._removed.length=0},a._onSessionExit=function(){this._requestTrackings.length=this._tracked.length=this._added.length=this._updated.length=this._removed.length=0,this.onChanged.removeAll()},a._addRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");this._requestTrackings.push(t),s.onAddRequestTracking(t)},a._removeRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");s.onDelRequestTracking(t)},a._removeAllRequestTrackings=function(){var t=this,i=t._platformFeature;if(this._xrManager.sessionManager._platformSession&&!i.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");for(var s=this,o=s._requestTrackings,h=0,u=o.length;h<u;h++)i.onDelRequestTracking(o[h])},a.addChangedListener=function(t){this.onChanged.on(t)},a.removeChangedListener=function(t){this.onChanged.off(t)},r}(le);T._uuid=0;var K=function(){this.pose=new O,this.state=w.NotTracking},ne=function(e){return e[e.Plane=1]="Plane",e[e.All=1]="All",e}({}),Ae=function(){this.point=new v,this.normal=new v};function D(e,r,a,n){var t=arguments.length,i=t<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,a):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,r,a,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(t<3?s(i):t>3?s(r,a,i):s(r,a))||i);return t>3&&i&&Object.defineProperty(r,a,i),i}var Fe=function(e){return e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.EveryThing=3]="EveryThing",e}({}),Z=function(){this.state=H.None,this.tracked=[]},qe=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.detectionMode=a,n}return r}(Z),De=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.polygon=[],a.attributesDirty=!1,a}return r}(K),I=function(e){p(r,e);function r(n,t){t===void 0&&(t=Fe.EveryThing);var i;return i=e.call(this,n,y.PlaneTracking,t)||this,i._addRequestTracking(new qe(t)),i}var a=r.prototype;return a._generateTracked=function(){var t=new De;return t.id=T._uuid++,t},A(r,[{key:"detectionMode",get:function(){return this._requestTrackings[0].detectionMode}},{key:"trackedPlanes",get:function(){return this._tracked}}]),r}(T);I=D([W(y.PlaneTracking)],I);var re=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.HitTest)||this,t._tempRay=new pe,t._tempPlane=new ve,t._tempVec2=new Se,t._tempVec30=new v,t._tempVec31=new v,t._tempVec32=new v,t._tempVec33=new v,t._tempVec34=new v,t._tempVec35=new v,t}var a=r.prototype;return a.hitTest=function(t,i){var s=[];return i&ne.Plane&&this._hitTestPlane(t,s),s},a.screenHitTest=function(t,i,s){var o=this,h=o._xrManager;if(h.sessionManager.mode!==_e.AR)throw new Error("Only AR mode supports using screen ray hit test.");var u=h.inputManager.getTrackedDevice(M.Camera),c=u._camera;if(!c)throw new Error("No camera available.");var f=c.screenPointToRay(this._tempVec2.set(t,i),this._tempRay);return this.hitTest(f,s)},a._hitTestPlane=function(t,i){var s=this._xrManager.getFeature(I);if(!s||!s.enabled)throw new Error("The plane estimation function needs to be turned on for plane hit test.");for(var o=this,h=o._tempPlane,u=o._tempVec30,c=o._tempVec31,f=o._tempVec32,_=s.trackedPlanes,l=0,g=_.length;l<g;l++){var d=_[l];u.set(0,1,0).transformNormal(d.pose.matrix),h.normal.copyFrom(u),h.distance=-v.dot(u,d.pose.position);var m=t.intersectPlane(h);if(m>=0&&(t.getPoint(m,c),v.transformToVec3(c,d.pose.inverseMatrix,f),this._checkPointerWithinPlane(f,d))){var S=new Ae;S.point.copyFrom(c),S.normal.copyFrom(u),S.distance=m,S.trackedObject=d,S.trackableType=ne.Plane,i.push(S)}}},a._checkPointerWithinPlane=function(t,i){for(var s=this,o=s._tempVec33,h=s._tempVec34,u=s._tempVec35,c=i.polygon,f=c.length,_=c[f-1],l=0,g=0;g<f;g++){var d=c[g];v.subtract(d,_,o),v.subtract(t,_,h),v.cross(o,h,u);var m=u.y;if(l===0)m>0?l=1:m<0&&(l=-1);else if(m>0&&l<0||m<0&&l>0)return!1;_=d}return!0},r}(le);re=D([W(y.HitTest)],re);var ze=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),Le=function(e){p(r,e);function r(a,n){var t;return t=e.call(this)||this,t.position=a,t.rotation=n,t}return r}(Z),ae=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.AnchorTracking)||this,t._anchors=[],t}var a=r.prototype;return a.addAnchor=function(t,i){if(!this._enabled)throw new Error("Cannot add an anchor from a disabled anchor manager.");var s=this,o=s._anchors,h=new Le(t,i),u=this._generateTracked();return h.tracked[0]=u,this._addRequestTracking(h),o.push(u),u},a.removeAnchor=function(t){if(!this._enabled)throw new Error("Cannot remove an anchor from a disabled anchor manager.");for(var i=this,s=i._requestTrackings,o=i._anchors,h=0,u=s.length;h<u;h++){var c=s[h];if(c.tracked[0]===t){this._removeRequestTracking(c);break}}o.splice(o.indexOf(t),1)},a.clearAnchors=function(){if(!this._enabled)throw new Error("Cannot remove anchors from a disabled anchor manager.");this._removeAllRequestTrackings()},a._generateTracked=function(){var t=new ze;return t.id=T._uuid++,t},A(r,[{key:"trackingAnchors",get:function(){return this._anchors}},{key:"trackedAnchors",get:function(){return this._tracked}}]),r}(T);ae=D([W(y.AnchorTracking)],ae);var Ne=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.image=a,n}return r}(Z),Re=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),ie=function(e){p(r,e);function r(n,t){var i;i=e.call(this,n,y.ImageTracking,t)||this,i._trackingImages=t;var s=t?t.length:0;if(s>0)for(var o=0,h=t.length;o<h;o++)i._addRequestTracking(new Ne(t[o]));else console.warn("No image to be tracked.");return i}var a=r.prototype;return a._generateTracked=function(){var t=new Re;return t.id=T._uuid++,t},A(r,[{key:"trackingImages",get:function(){return this._trackingImages}},{key:"trackedImages",get:function(){return this._tracked}}]),r}(T);ie=D([W(y.ImageTracking)],ie);var He=function(r,a,n){this.name=r,this.imageSource=a,this.physicalWidth=n},oe=function(){function e(){}return e.decode=function(a,n){return new ue(function(t,i){var s=n.nextFloat32();n.nextUint8();var o=new Image;o.onload=function(){t(new He("",o,s))},o.src=URL.createObjectURL(new window.Blob([n.nextImagesData(1)[0]]))})},e}();oe=D([me("XRReferenceImage")],oe);function G(){return G=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},G.apply(this,arguments)}var se=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.load=function(t,i){return new ue(function(s,o){i._request(t.url,G({},t,{type:"arraybuffer"})).then(function(h){we(h,i.engine).then(function(u){s(u)})}).catch(o)})},r}(ke);se=D([de("XRReferenceImage",[])],se);export{He as X,_e as a,M as b,k as c,ae as d,ie as e,I as f,Fe as g};
@@ -1,2 +1,2 @@
1
- import{fq as rr}from"./index-c3dec278.js";import"./index-cdbb2f4d.js";var Ie={exports:{}},$e=function(r,n){return function(){for(var t=new Array(arguments.length),a=0;a<t.length;a++)t[a]=arguments[a];return r.apply(n,t)}},tr=$e,w=Object.prototype.toString;function ae(e){return Array.isArray(e)}function te(e){return typeof e>"u"}function nr(e){return e!==null&&!te(e)&&e.constructor!==null&&!te(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function _e(e){return w.call(e)==="[object ArrayBuffer]"}function ir(e){return w.call(e)==="[object FormData]"}function ar(e){var r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&_e(e.buffer),r}function sr(e){return typeof e=="string"}function or(e){return typeof e=="number"}function Fe(e){return e!==null&&typeof e=="object"}function N(e){if(w.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function ur(e){return w.call(e)==="[object Date]"}function fr(e){return w.call(e)==="[object File]"}function cr(e){return w.call(e)==="[object Blob]"}function ke(e){return w.call(e)==="[object Function]"}function lr(e){return Fe(e)&&ke(e.pipe)}function dr(e){return w.call(e)==="[object URLSearchParams]"}function hr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function pr(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function se(e,r){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),ae(e))for(var n=0,i=e.length;n<i;n++)r.call(null,e[n],n,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}function ne(){var e={};function r(t,a){N(e[a])&&N(t)?e[a]=ne(e[a],t):N(t)?e[a]=ne({},t):ae(t)?e[a]=t.slice():e[a]=t}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return e}function mr(e,r,n){return se(r,function(t,a){n&&typeof t=="function"?e[a]=tr(t,n):e[a]=t}),e}function vr(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var p={isArray:ae,isArrayBuffer:_e,isBuffer:nr,isFormData:ir,isArrayBufferView:ar,isString:sr,isNumber:or,isObject:Fe,isPlainObject:N,isUndefined:te,isDate:ur,isFile:fr,isBlob:cr,isFunction:ke,isStream:lr,isURLSearchParams:dr,isStandardBrowserEnv:pr,forEach:se,merge:ne,extend:mr,trim:hr,stripBOM:vr},O=p;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var He=function(r,n,i){if(!n)return r;var t;if(i)t=i(n);else if(O.isURLSearchParams(n))t=n.toString();else{var a=[];O.forEach(n,function(c,d){c===null||typeof c>"u"||(O.isArray(c)?d=d+"[]":c=[c],O.forEach(c,function(u){O.isDate(u)?u=u.toISOString():O.isObject(u)&&(u=JSON.stringify(u)),a.push(he(d)+"="+he(u))}))}),t=a.join("&")}if(t){var s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+t}return r},br=p;function L(){this.handlers=[]}L.prototype.use=function(r,n,i){return this.handlers.push({fulfilled:r,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};L.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)};L.prototype.forEach=function(r){br.forEach(this.handlers,function(i){i!==null&&r(i)})};var Er=L,yr=p,wr=function(r,n){yr.forEach(r,function(t,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(r[n]=t,delete r[a])})},Me=function(r,n,i,t,a){return r.config=n,i&&(r.code=i),r.request=t,r.response=a,r.isAxiosError=!0,r.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},r},Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_,pe;function ze(){if(pe)return _;pe=1;var e=Me;return _=function(n,i,t,a,s){var o=new Error(n);return e(o,i,t,a,s)},_}var F,me;function Rr(){if(me)return F;me=1;var e=ze();return F=function(n,i,t){var a=t.config.validateStatus;!t.status||!a||a(t.status)?n(t):i(e("Request failed with status code "+t.status,t.config,null,t.request,t))},F}var k,ve;function Cr(){if(ve)return k;ve=1;var e=p;return k=e.isStandardBrowserEnv()?function(){return{write:function(i,t,a,s,o,c){var d=[];d.push(i+"="+encodeURIComponent(t)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(s)&&d.push("path="+s),e.isString(o)&&d.push("domain="+o),c===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(i){var t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),k}var H,be;function Sr(){return be||(be=1,H=function(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}),H}var M,Ee;function Or(){return Ee||(Ee=1,M=function(r,n){return n?r.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):r}),M}var J,ye;function xr(){if(ye)return J;ye=1;var e=Sr(),r=Or();return J=function(i,t){return i&&!e(t)?r(i,t):t},J}var z,we;function qr(){if(we)return z;we=1;var e=p,r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return z=function(i){var t={},a,s,o;return i&&e.forEach(i.split(`
2
- `),function(d){if(o=d.indexOf(":"),a=e.trim(d.substr(0,o)).toLowerCase(),s=e.trim(d.substr(o+1)),a){if(t[a]&&r.indexOf(a)>=0)return;a==="set-cookie"?t[a]=(t[a]?t[a]:[]).concat([s]):t[a]=t[a]?t[a]+", "+s:s}}),t},z}var V,Re;function gr(){if(Re)return V;Re=1;var e=p;return V=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),t;function a(s){var o=s;return n&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return t=a(window.location.href),function(o){var c=e.isString(o)?a(o):o;return c.protocol===t.protocol&&c.host===t.host}}():function(){return function(){return!0}}(),V}var X,Ce;function j(){if(Ce)return X;Ce=1;function e(r){this.message=r}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,X=e,X}var W,Se;function Oe(){if(Se)return W;Se=1;var e=p,r=Rr(),n=Cr(),i=He,t=xr(),a=qr(),s=gr(),o=ze(),c=Je,d=j();return W=function(u){return new Promise(function(m,q){var g=u.data,A=u.headers,U=u.responseType,C;function fe(){u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}e.isFormData(g)&&delete A["Content-Type"];var f=new XMLHttpRequest;if(u.auth){var Qe=u.auth.username||"",Ze=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";A.Authorization="Basic "+btoa(Qe+":"+Ze)}var ce=t(u.baseURL,u.url);f.open(u.method.toUpperCase(),i(ce,u.params,u.paramsSerializer),!0),f.timeout=u.timeout;function le(){if(f){var b="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,S=!U||U==="text"||U==="json"?f.responseText:f.response,R={data:S,status:f.status,statusText:f.statusText,headers:b,config:u,request:f};r(function($){m($),fe()},function($){q($),fe()},R),f=null}}if("onloadend"in f?f.onloadend=le:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(le)},f.onabort=function(){f&&(q(o("Request aborted",u,"ECONNABORTED",f)),f=null)},f.onerror=function(){q(o("Network Error",u,null,f)),f=null},f.ontimeout=function(){var S=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",R=u.transitional||c;u.timeoutErrorMessage&&(S=u.timeoutErrorMessage),q(o(S,u,R.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},e.isStandardBrowserEnv()){var de=(u.withCredentials||s(ce))&&u.xsrfCookieName?n.read(u.xsrfCookieName):void 0;de&&(A[u.xsrfHeaderName]=de)}"setRequestHeader"in f&&e.forEach(A,function(S,R){typeof g>"u"&&R.toLowerCase()==="content-type"?delete A[R]:f.setRequestHeader(R,S)}),e.isUndefined(u.withCredentials)||(f.withCredentials=!!u.withCredentials),U&&U!=="json"&&(f.responseType=u.responseType),typeof u.onDownloadProgress=="function"&&f.addEventListener("progress",u.onDownloadProgress),typeof u.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",u.onUploadProgress),(u.cancelToken||u.signal)&&(C=function(b){f&&(q(!b||b&&b.type?new d("canceled"):b),f.abort(),f=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C))),g||(g=null),f.send(g)})},W}var h=p,xe=wr,Ar=Me,Ur=Je,Tr={"Content-Type":"application/x-www-form-urlencoded"};function qe(e,r){!h.isUndefined(e)&&h.isUndefined(e["Content-Type"])&&(e["Content-Type"]=r)}function Pr(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Oe()),e}function Nr(e,r,n){if(h.isString(e))try{return(r||JSON.parse)(e),h.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}var D={transitional:Ur,adapter:Pr(),transformRequest:[function(r,n){return xe(n,"Accept"),xe(n,"Content-Type"),h.isFormData(r)||h.isArrayBuffer(r)||h.isBuffer(r)||h.isStream(r)||h.isFile(r)||h.isBlob(r)?r:h.isArrayBufferView(r)?r.buffer:h.isURLSearchParams(r)?(qe(n,"application/x-www-form-urlencoded;charset=utf-8"),r.toString()):h.isObject(r)||n&&n["Content-Type"]==="application/json"?(qe(n,"application/json"),Nr(r)):r}],transformResponse:[function(r){var n=this.transitional||D.transitional,i=n&&n.silentJSONParsing,t=n&&n.forcedJSONParsing,a=!i&&this.responseType==="json";if(a||t&&h.isString(r)&&r.length)try{return JSON.parse(r)}catch(s){if(a)throw s.name==="SyntaxError"?Ar(s,this,"E_JSON_PARSE"):s}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(r){D.headers[r]={}});h.forEach(["post","put","patch"],function(r){D.headers[r]=h.merge(Tr)});var oe=D,Br=p,Lr=oe,jr=function(r,n,i){var t=this||Lr;return Br.forEach(i,function(s){r=s.call(t,r,n)}),r},G,ge;function Ve(){return ge||(ge=1,G=function(r){return!!(r&&r.__CANCEL__)}),G}var Ae=p,K=jr,Dr=Ve(),Ir=oe,$r=j();function Y(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new $r("canceled")}var _r=function(r){Y(r),r.headers=r.headers||{},r.data=K.call(r,r.data,r.headers,r.transformRequest),r.headers=Ae.merge(r.headers.common||{},r.headers[r.method]||{},r.headers),Ae.forEach(["delete","get","head","post","put","patch","common"],function(t){delete r.headers[t]});var n=r.adapter||Ir.adapter;return n(r).then(function(t){return Y(r),t.data=K.call(r,t.data,t.headers,r.transformResponse),t},function(t){return Dr(t)||(Y(r),t&&t.response&&(t.response.data=K.call(r,t.response.data,t.response.headers,r.transformResponse))),Promise.reject(t)})},v=p,Xe=function(r,n){n=n||{};var i={};function t(l,u){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge(l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function a(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(r[l],n[l])}function s(l){if(!v.isUndefined(n[l]))return t(void 0,n[l])}function o(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(void 0,n[l])}function c(l){if(l in n)return t(r[l],n[l]);if(l in r)return t(void 0,r[l])}var d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c};return v.forEach(Object.keys(r).concat(Object.keys(n)),function(u){var y=d[u]||a,m=y(u);v.isUndefined(m)&&y!==c||(i[u]=m)}),i},Q,Ue;function We(){return Ue||(Ue=1,Q={version:"0.26.1"}),Q}var Fr=We().version,ue={};["object","boolean","number","function","string","symbol"].forEach(function(e,r){ue[e]=function(i){return typeof i===e||"a"+(r<1?"n ":" ")+e}});var Te={};ue.transitional=function(r,n,i){function t(a,s){return"[Axios v"+Fr+"] Transitional option '"+a+"'"+s+(i?". "+i:"")}return function(a,s,o){if(r===!1)throw new Error(t(s," has been removed"+(n?" in "+n:"")));return n&&!Te[s]&&(Te[s]=!0,console.warn(t(s," has been deprecated since v"+n+" and will be removed in the near future"))),r?r(a,s,o):!0}};function kr(e,r,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),t=i.length;t-- >0;){var a=i[t],s=r[a];if(s){var o=e[a],c=o===void 0||s(o,a,e);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(n!==!0)throw Error("Unknown option "+a)}}var Hr={assertOptions:kr,validators:ue},Ge=p,Mr=He,Pe=Er,Ne=_r,I=Xe,Ke=Hr,x=Ke.validators;function T(e){this.defaults=e,this.interceptors={request:new Pe,response:new Pe}}T.prototype.request=function(r,n){typeof r=="string"?(n=n||{},n.url=r):n=r||{},n=I(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&Ke.assertOptions(i,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1);var t=[],a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,t.unshift(m.fulfilled,m.rejected))});var s=[];this.interceptors.response.forEach(function(m){s.push(m.fulfilled,m.rejected)});var o;if(!a){var c=[Ne,void 0];for(Array.prototype.unshift.apply(c,t),c=c.concat(s),o=Promise.resolve(n);c.length;)o=o.then(c.shift(),c.shift());return o}for(var d=n;t.length;){var l=t.shift(),u=t.shift();try{d=l(d)}catch(y){u(y);break}}try{o=Ne(d)}catch(y){return Promise.reject(y)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};T.prototype.getUri=function(r){return r=I(this.defaults,r),Mr(r.url,r.params,r.paramsSerializer).replace(/^\?/,"")};Ge.forEach(["delete","get","head","options"],function(r){T.prototype[r]=function(n,i){return this.request(I(i||{},{method:r,url:n,data:(i||{}).data}))}});Ge.forEach(["post","put","patch"],function(r){T.prototype[r]=function(n,i,t){return this.request(I(t||{},{method:r,url:n,data:i}))}});var Jr=T,Z,Be;function zr(){if(Be)return Z;Be=1;var e=j();function r(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var t=this;this.promise.then(function(a){if(t._listeners){var s,o=t._listeners.length;for(s=0;s<o;s++)t._listeners[s](a);t._listeners=null}}),this.promise.then=function(a){var s,o=new Promise(function(c){t.subscribe(c),s=c}).then(a);return o.cancel=function(){t.unsubscribe(s)},o},n(function(s){t.reason||(t.reason=new e(s),i(t.reason))})}return r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.prototype.subscribe=function(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]},r.prototype.unsubscribe=function(i){if(this._listeners){var t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}},r.source=function(){var i,t=new r(function(s){i=s});return{token:t,cancel:i}},Z=r,Z}var ee,Le;function Vr(){return Le||(Le=1,ee=function(r){return function(i){return r.apply(null,i)}}),ee}var re,je;function Xr(){if(je)return re;je=1;var e=p;return re=function(n){return e.isObject(n)&&n.isAxiosError===!0},re}var De=p,Wr=$e,B=Jr,Gr=Xe,Kr=oe;function Ye(e){var r=new B(e),n=Wr(B.prototype.request,r);return De.extend(n,B.prototype,r),De.extend(n,r),n.create=function(t){return Ye(Gr(e,t))},n}var E=Ye(Kr);E.Axios=B;E.Cancel=j();E.CancelToken=zr();E.isCancel=Ve();E.VERSION=We().version;E.all=function(r){return Promise.all(r)};E.spread=Vr();E.isAxiosError=Xr();Ie.exports=E;Ie.exports.default=E;/*! js-cookie v3.0.1 | MIT */function P(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var i in n)e[i]=n[i]}return e}var Yr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ie(e,r){function n(t,a,s){if(!(typeof document>"u")){s=P({},r,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in s)s[c]&&(o+="; "+c,s[c]!==!0&&(o+="="+s[c].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+o}}function i(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],s={},o=0;o<a.length;o++){var c=a[o].split("="),d=c.slice(1).join("=");try{var l=decodeURIComponent(c[0]);if(s[l]=e.read(d,l),t===l)break}catch{}}return t?s[t]:s}}return Object.create({set:n,get:i,remove:function(t,a){n(t,"",P({},a,{expires:-1}))},withAttributes:function(t){return ie(this.converter,P({},this.attributes,t))},withConverter:function(t){return ie(P({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}ie(Yr,{path:"/"});rr.createPublisher();
1
+ import{fu as rr}from"./index-d497fb6d.js";import"./index-8a22fe59.js";var Ie={exports:{}},$e=function(r,n){return function(){for(var t=new Array(arguments.length),a=0;a<t.length;a++)t[a]=arguments[a];return r.apply(n,t)}},tr=$e,w=Object.prototype.toString;function ae(e){return Array.isArray(e)}function te(e){return typeof e>"u"}function nr(e){return e!==null&&!te(e)&&e.constructor!==null&&!te(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function _e(e){return w.call(e)==="[object ArrayBuffer]"}function ir(e){return w.call(e)==="[object FormData]"}function ar(e){var r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&_e(e.buffer),r}function sr(e){return typeof e=="string"}function or(e){return typeof e=="number"}function Fe(e){return e!==null&&typeof e=="object"}function N(e){if(w.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function ur(e){return w.call(e)==="[object Date]"}function fr(e){return w.call(e)==="[object File]"}function cr(e){return w.call(e)==="[object Blob]"}function ke(e){return w.call(e)==="[object Function]"}function lr(e){return Fe(e)&&ke(e.pipe)}function dr(e){return w.call(e)==="[object URLSearchParams]"}function hr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function pr(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function se(e,r){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),ae(e))for(var n=0,i=e.length;n<i;n++)r.call(null,e[n],n,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}function ne(){var e={};function r(t,a){N(e[a])&&N(t)?e[a]=ne(e[a],t):N(t)?e[a]=ne({},t):ae(t)?e[a]=t.slice():e[a]=t}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return e}function mr(e,r,n){return se(r,function(t,a){n&&typeof t=="function"?e[a]=tr(t,n):e[a]=t}),e}function vr(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var p={isArray:ae,isArrayBuffer:_e,isBuffer:nr,isFormData:ir,isArrayBufferView:ar,isString:sr,isNumber:or,isObject:Fe,isPlainObject:N,isUndefined:te,isDate:ur,isFile:fr,isBlob:cr,isFunction:ke,isStream:lr,isURLSearchParams:dr,isStandardBrowserEnv:pr,forEach:se,merge:ne,extend:mr,trim:hr,stripBOM:vr},O=p;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var He=function(r,n,i){if(!n)return r;var t;if(i)t=i(n);else if(O.isURLSearchParams(n))t=n.toString();else{var a=[];O.forEach(n,function(c,d){c===null||typeof c>"u"||(O.isArray(c)?d=d+"[]":c=[c],O.forEach(c,function(u){O.isDate(u)?u=u.toISOString():O.isObject(u)&&(u=JSON.stringify(u)),a.push(he(d)+"="+he(u))}))}),t=a.join("&")}if(t){var s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+t}return r},br=p;function L(){this.handlers=[]}L.prototype.use=function(r,n,i){return this.handlers.push({fulfilled:r,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};L.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)};L.prototype.forEach=function(r){br.forEach(this.handlers,function(i){i!==null&&r(i)})};var Er=L,yr=p,wr=function(r,n){yr.forEach(r,function(t,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(r[n]=t,delete r[a])})},Me=function(r,n,i,t,a){return r.config=n,i&&(r.code=i),r.request=t,r.response=a,r.isAxiosError=!0,r.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},r},Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_,pe;function ze(){if(pe)return _;pe=1;var e=Me;return _=function(n,i,t,a,s){var o=new Error(n);return e(o,i,t,a,s)},_}var F,me;function Rr(){if(me)return F;me=1;var e=ze();return F=function(n,i,t){var a=t.config.validateStatus;!t.status||!a||a(t.status)?n(t):i(e("Request failed with status code "+t.status,t.config,null,t.request,t))},F}var k,ve;function Cr(){if(ve)return k;ve=1;var e=p;return k=e.isStandardBrowserEnv()?function(){return{write:function(i,t,a,s,o,c){var d=[];d.push(i+"="+encodeURIComponent(t)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(s)&&d.push("path="+s),e.isString(o)&&d.push("domain="+o),c===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(i){var t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),k}var H,be;function Sr(){return be||(be=1,H=function(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}),H}var M,Ee;function Or(){return Ee||(Ee=1,M=function(r,n){return n?r.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):r}),M}var J,ye;function xr(){if(ye)return J;ye=1;var e=Sr(),r=Or();return J=function(i,t){return i&&!e(t)?r(i,t):t},J}var z,we;function gr(){if(we)return z;we=1;var e=p,r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return z=function(i){var t={},a,s,o;return i&&e.forEach(i.split(`
2
+ `),function(d){if(o=d.indexOf(":"),a=e.trim(d.substr(0,o)).toLowerCase(),s=e.trim(d.substr(o+1)),a){if(t[a]&&r.indexOf(a)>=0)return;a==="set-cookie"?t[a]=(t[a]?t[a]:[]).concat([s]):t[a]=t[a]?t[a]+", "+s:s}}),t},z}var V,Re;function qr(){if(Re)return V;Re=1;var e=p;return V=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),t;function a(s){var o=s;return n&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return t=a(window.location.href),function(o){var c=e.isString(o)?a(o):o;return c.protocol===t.protocol&&c.host===t.host}}():function(){return function(){return!0}}(),V}var X,Ce;function j(){if(Ce)return X;Ce=1;function e(r){this.message=r}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,X=e,X}var W,Se;function Oe(){if(Se)return W;Se=1;var e=p,r=Rr(),n=Cr(),i=He,t=xr(),a=gr(),s=qr(),o=ze(),c=Je,d=j();return W=function(u){return new Promise(function(m,g){var q=u.data,A=u.headers,U=u.responseType,C;function fe(){u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}e.isFormData(q)&&delete A["Content-Type"];var f=new XMLHttpRequest;if(u.auth){var Qe=u.auth.username||"",Ze=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";A.Authorization="Basic "+btoa(Qe+":"+Ze)}var ce=t(u.baseURL,u.url);f.open(u.method.toUpperCase(),i(ce,u.params,u.paramsSerializer),!0),f.timeout=u.timeout;function le(){if(f){var b="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,S=!U||U==="text"||U==="json"?f.responseText:f.response,R={data:S,status:f.status,statusText:f.statusText,headers:b,config:u,request:f};r(function($){m($),fe()},function($){g($),fe()},R),f=null}}if("onloadend"in f?f.onloadend=le:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(le)},f.onabort=function(){f&&(g(o("Request aborted",u,"ECONNABORTED",f)),f=null)},f.onerror=function(){g(o("Network Error",u,null,f)),f=null},f.ontimeout=function(){var S=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",R=u.transitional||c;u.timeoutErrorMessage&&(S=u.timeoutErrorMessage),g(o(S,u,R.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},e.isStandardBrowserEnv()){var de=(u.withCredentials||s(ce))&&u.xsrfCookieName?n.read(u.xsrfCookieName):void 0;de&&(A[u.xsrfHeaderName]=de)}"setRequestHeader"in f&&e.forEach(A,function(S,R){typeof q>"u"&&R.toLowerCase()==="content-type"?delete A[R]:f.setRequestHeader(R,S)}),e.isUndefined(u.withCredentials)||(f.withCredentials=!!u.withCredentials),U&&U!=="json"&&(f.responseType=u.responseType),typeof u.onDownloadProgress=="function"&&f.addEventListener("progress",u.onDownloadProgress),typeof u.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",u.onUploadProgress),(u.cancelToken||u.signal)&&(C=function(b){f&&(g(!b||b&&b.type?new d("canceled"):b),f.abort(),f=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C))),q||(q=null),f.send(q)})},W}var h=p,xe=wr,Ar=Me,Ur=Je,Tr={"Content-Type":"application/x-www-form-urlencoded"};function ge(e,r){!h.isUndefined(e)&&h.isUndefined(e["Content-Type"])&&(e["Content-Type"]=r)}function Pr(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Oe()),e}function Nr(e,r,n){if(h.isString(e))try{return(r||JSON.parse)(e),h.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}var D={transitional:Ur,adapter:Pr(),transformRequest:[function(r,n){return xe(n,"Accept"),xe(n,"Content-Type"),h.isFormData(r)||h.isArrayBuffer(r)||h.isBuffer(r)||h.isStream(r)||h.isFile(r)||h.isBlob(r)?r:h.isArrayBufferView(r)?r.buffer:h.isURLSearchParams(r)?(ge(n,"application/x-www-form-urlencoded;charset=utf-8"),r.toString()):h.isObject(r)||n&&n["Content-Type"]==="application/json"?(ge(n,"application/json"),Nr(r)):r}],transformResponse:[function(r){var n=this.transitional||D.transitional,i=n&&n.silentJSONParsing,t=n&&n.forcedJSONParsing,a=!i&&this.responseType==="json";if(a||t&&h.isString(r)&&r.length)try{return JSON.parse(r)}catch(s){if(a)throw s.name==="SyntaxError"?Ar(s,this,"E_JSON_PARSE"):s}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(r){D.headers[r]={}});h.forEach(["post","put","patch"],function(r){D.headers[r]=h.merge(Tr)});var oe=D,Br=p,Lr=oe,jr=function(r,n,i){var t=this||Lr;return Br.forEach(i,function(s){r=s.call(t,r,n)}),r},G,qe;function Ve(){return qe||(qe=1,G=function(r){return!!(r&&r.__CANCEL__)}),G}var Ae=p,K=jr,Dr=Ve(),Ir=oe,$r=j();function Y(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new $r("canceled")}var _r=function(r){Y(r),r.headers=r.headers||{},r.data=K.call(r,r.data,r.headers,r.transformRequest),r.headers=Ae.merge(r.headers.common||{},r.headers[r.method]||{},r.headers),Ae.forEach(["delete","get","head","post","put","patch","common"],function(t){delete r.headers[t]});var n=r.adapter||Ir.adapter;return n(r).then(function(t){return Y(r),t.data=K.call(r,t.data,t.headers,r.transformResponse),t},function(t){return Dr(t)||(Y(r),t&&t.response&&(t.response.data=K.call(r,t.response.data,t.response.headers,r.transformResponse))),Promise.reject(t)})},v=p,Xe=function(r,n){n=n||{};var i={};function t(l,u){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge(l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function a(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(r[l],n[l])}function s(l){if(!v.isUndefined(n[l]))return t(void 0,n[l])}function o(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(void 0,n[l])}function c(l){if(l in n)return t(r[l],n[l]);if(l in r)return t(void 0,r[l])}var d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c};return v.forEach(Object.keys(r).concat(Object.keys(n)),function(u){var y=d[u]||a,m=y(u);v.isUndefined(m)&&y!==c||(i[u]=m)}),i},Q,Ue;function We(){return Ue||(Ue=1,Q={version:"0.26.1"}),Q}var Fr=We().version,ue={};["object","boolean","number","function","string","symbol"].forEach(function(e,r){ue[e]=function(i){return typeof i===e||"a"+(r<1?"n ":" ")+e}});var Te={};ue.transitional=function(r,n,i){function t(a,s){return"[Axios v"+Fr+"] Transitional option '"+a+"'"+s+(i?". "+i:"")}return function(a,s,o){if(r===!1)throw new Error(t(s," has been removed"+(n?" in "+n:"")));return n&&!Te[s]&&(Te[s]=!0,console.warn(t(s," has been deprecated since v"+n+" and will be removed in the near future"))),r?r(a,s,o):!0}};function kr(e,r,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),t=i.length;t-- >0;){var a=i[t],s=r[a];if(s){var o=e[a],c=o===void 0||s(o,a,e);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(n!==!0)throw Error("Unknown option "+a)}}var Hr={assertOptions:kr,validators:ue},Ge=p,Mr=He,Pe=Er,Ne=_r,I=Xe,Ke=Hr,x=Ke.validators;function T(e){this.defaults=e,this.interceptors={request:new Pe,response:new Pe}}T.prototype.request=function(r,n){typeof r=="string"?(n=n||{},n.url=r):n=r||{},n=I(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&Ke.assertOptions(i,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1);var t=[],a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,t.unshift(m.fulfilled,m.rejected))});var s=[];this.interceptors.response.forEach(function(m){s.push(m.fulfilled,m.rejected)});var o;if(!a){var c=[Ne,void 0];for(Array.prototype.unshift.apply(c,t),c=c.concat(s),o=Promise.resolve(n);c.length;)o=o.then(c.shift(),c.shift());return o}for(var d=n;t.length;){var l=t.shift(),u=t.shift();try{d=l(d)}catch(y){u(y);break}}try{o=Ne(d)}catch(y){return Promise.reject(y)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};T.prototype.getUri=function(r){return r=I(this.defaults,r),Mr(r.url,r.params,r.paramsSerializer).replace(/^\?/,"")};Ge.forEach(["delete","get","head","options"],function(r){T.prototype[r]=function(n,i){return this.request(I(i||{},{method:r,url:n,data:(i||{}).data}))}});Ge.forEach(["post","put","patch"],function(r){T.prototype[r]=function(n,i,t){return this.request(I(t||{},{method:r,url:n,data:i}))}});var Jr=T,Z,Be;function zr(){if(Be)return Z;Be=1;var e=j();function r(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var t=this;this.promise.then(function(a){if(t._listeners){var s,o=t._listeners.length;for(s=0;s<o;s++)t._listeners[s](a);t._listeners=null}}),this.promise.then=function(a){var s,o=new Promise(function(c){t.subscribe(c),s=c}).then(a);return o.cancel=function(){t.unsubscribe(s)},o},n(function(s){t.reason||(t.reason=new e(s),i(t.reason))})}return r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.prototype.subscribe=function(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]},r.prototype.unsubscribe=function(i){if(this._listeners){var t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}},r.source=function(){var i,t=new r(function(s){i=s});return{token:t,cancel:i}},Z=r,Z}var ee,Le;function Vr(){return Le||(Le=1,ee=function(r){return function(i){return r.apply(null,i)}}),ee}var re,je;function Xr(){if(je)return re;je=1;var e=p;return re=function(n){return e.isObject(n)&&n.isAxiosError===!0},re}var De=p,Wr=$e,B=Jr,Gr=Xe,Kr=oe;function Ye(e){var r=new B(e),n=Wr(B.prototype.request,r);return De.extend(n,B.prototype,r),De.extend(n,r),n.create=function(t){return Ye(Gr(e,t))},n}var E=Ye(Kr);E.Axios=B;E.Cancel=j();E.CancelToken=zr();E.isCancel=Ve();E.VERSION=We().version;E.all=function(r){return Promise.all(r)};E.spread=Vr();E.isAxiosError=Xr();Ie.exports=E;Ie.exports.default=E;/*! js-cookie v3.0.1 | MIT */function P(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var i in n)e[i]=n[i]}return e}var Yr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ie(e,r){function n(t,a,s){if(!(typeof document>"u")){s=P({},r,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in s)s[c]&&(o+="; "+c,s[c]!==!0&&(o+="="+s[c].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+o}}function i(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],s={},o=0;o<a.length;o++){var c=a[o].split("="),d=c.slice(1).join("=");try{var l=decodeURIComponent(c[0]);if(s[l]=e.read(d,l),t===l)break}catch{}}return t?s[t]:s}}return Object.create({set:n,get:i,remove:function(t,a){n(t,"",P({},a,{expires:-1}))},withAttributes:function(t){return ie(this.converter,P({},this.attributes,t))},withConverter:function(t){return ie(P({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}ie(Yr,{path:"/"});rr.createPublisher();
@@ -1 +1 @@
1
- import{b1 as C,b2 as w,C as c,b3 as k,V as d,ai as F,F as I}from"./index-c3dec278.js";var a=(t=>(t.Vector2="Vector2",t.Vector3="Vector3",t.Vector4="Vector4",t.Color="Color",t.Float="Float",t.Texture="Texture",t.Boolean="Boolean",t.Integer="Integer",t))(a||{});async function B(t,V,e,n,i){var S;const s=t.engineObject.shaderData;let r;const o=V.toString(),h=C.getByName(o).type;switch(h===w.Float?(n===a.Integer||n===c.Toggle||n===c.Boolean||n===c.Select)&&(n=a.Float):h===w.Int&&(n===a.Float||n===c.Slider||n===c.Number)&&(n=a.Integer),n){case c.Slider:case c.Number:case a.Float:s.setFloat(o,e);break;case c.Toggle:case c.Boolean:case c.Select:case a.Integer:s.setInt(o,Number(e));break;case c.AssetPicker:case a.Texture:if(e){const l=await t.root.assetStore.getAssetByRef(e);if(l){const b=l.engineObject;s.setTexture(o,b),i&&x(i,t,"enable")}else s.setTexture(o,null),i&&x(i,t,"disable"),console.error(`${o} in ${t.name} is missing.`)}else s.setTexture(o,null),i&&x(i,t,"disable");break;case c.Vector2:case a.Vector2:r=s.getVector2(o),e==null?s.setVector2(o,e):r?(r.x=e.x,r.y=e.y):s.setVector2(o,new I(e.x,e.y));break;case c.Vector3:case a.Vector3:r=s.getVector3(o),e==null?s.setVector3(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z):s.setVector3(o,new F(e.x,e.y,e.z));break;case c.Vector4:case a.Vector4:r=s.getVector4(o),e==null?s.setVector4(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w):s.setVector4(o,new d(e.x,e.y,e.z,e.w));break;case c.Color:case a.Color:{if(e==null){s.setColor(o,null);break}let{r:l,g:b,b:f}=e;const{a:m,intensity:g=1}=e;l*=g,b*=g,f*=g,r=s.getColor(o),r?(r.r=l,r.g=b,r.b=f,r.a=m):s.setColor(o,new k(l,b,f,m));break}}(S=t.updateThumbnail)==null||S.call(t)}function x(t,V,e){const n=V.engineObject.shaderData;e==="enable"?n.enableMacro(t):n.disableMacro(t)}export{a as E,B as s};
1
+ import{b2 as C,b3 as w,C as c,b4 as k,V as d,ai as F,F as I}from"./index-d497fb6d.js";var a=(t=>(t.Vector2="Vector2",t.Vector3="Vector3",t.Vector4="Vector4",t.Color="Color",t.Float="Float",t.Texture="Texture",t.Boolean="Boolean",t.Integer="Integer",t))(a||{});async function B(t,V,e,n,i){var S;const s=t.engineObject.shaderData;let r;const o=V.toString(),h=C.getByName(o).type;switch(h===w.Float?(n===a.Integer||n===c.Toggle||n===c.Boolean||n===c.Select)&&(n=a.Float):h===w.Int&&(n===a.Float||n===c.Slider||n===c.Number)&&(n=a.Integer),n){case c.Slider:case c.Number:case a.Float:s.setFloat(o,e);break;case c.Toggle:case c.Boolean:case c.Select:case a.Integer:s.setInt(o,Number(e));break;case c.AssetPicker:case a.Texture:if(e){const l=await t.root.assetStore.getAssetByRef(e);if(l){const b=l.engineObject;s.setTexture(o,b),i&&x(i,t,"enable")}else s.setTexture(o,null),i&&x(i,t,"disable"),console.error(`${o} in ${t.name} is missing.`)}else s.setTexture(o,null),i&&x(i,t,"disable");break;case c.Vector2:case a.Vector2:r=s.getVector2(o),e==null?s.setVector2(o,e):r?(r.x=e.x,r.y=e.y):s.setVector2(o,new I(e.x,e.y));break;case c.Vector3:case a.Vector3:r=s.getVector3(o),e==null?s.setVector3(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z):s.setVector3(o,new F(e.x,e.y,e.z));break;case c.Vector4:case a.Vector4:r=s.getVector4(o),e==null?s.setVector4(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w):s.setVector4(o,new d(e.x,e.y,e.z,e.w));break;case c.Color:case a.Color:{if(e==null){s.setColor(o,null);break}let{r:l,g:b,b:f}=e;const{a:m,intensity:g=1}=e;l*=g,b*=g,f*=g,r=s.getColor(o),r?(r.r=l,r.g=b,r.b=f,r.a=m):s.setColor(o,new k(l,b,f,m));break}}(S=t.updateThumbnail)==null||S.call(t)}function x(t,V,e){const n=V.engineObject.shaderData;e==="enable"?n.enableMacro(t):n.disableMacro(t)}export{a as E,B as s};
@@ -10,7 +10,7 @@
10
10
  #status { position: fixed; left: 8px; top: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 6px 8px; font: 12px/1.4 monospace; z-index: 10; opacity: 1; transition: opacity 0.5s ease; pointer-events: none; }
11
11
  #status[data-state="idle"] { opacity: 0; transition: opacity 0.8s ease 1.5s; }
12
12
  </style>
13
- <script type="module" crossorigin src="/_static/index-c3dec278.js"></script>
13
+ <script type="module" crossorigin src="/_static/index-d497fb6d.js"></script>
14
14
  </head>
15
15
  <body>
16
16
  <div id="app">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/cli",
3
- "version": "2.0.0-alpha.26",
3
+ "version": "2.0.0-alpha.28",
4
4
  "main": "dist/cli.bundle.cjs",
5
5
  "bin": {
6
6
  "galacean": "bin/galacean.js"
@@ -16,7 +16,19 @@
16
16
  "README.md"
17
17
  ],
18
18
  "publishConfig": {
19
- "registry": "https://registry.npmjs.org/"
19
+ "registry": "https://registry.npmjs.org/",
20
+ "main": "dist/cli.bundle.cjs",
21
+ "bin": {
22
+ "galacean": "bin/galacean.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "node build.mjs",
27
+ "build:tsc": "tsc -p tsconfig.build.json",
28
+ "prepublishOnly": "node build.mjs",
29
+ "update:basis-assets": "node scripts/update-basis-assets.mjs",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest"
20
32
  },
21
33
  "dependencies": {
22
34
  "chokidar": "^4.0.3",
@@ -25,32 +37,25 @@
25
37
  "sharp": "^0.33.0"
26
38
  },
27
39
  "devDependencies": {
40
+ "@editor/ai": "workspace:^",
41
+ "@editor/asset-bundle-utils": "workspace:*",
42
+ "@editor/builder": "workspace:*",
43
+ "@editor/cli-preview": "workspace:*",
44
+ "@editor/constants": "workspace:*",
45
+ "@editor/editor-api": "workspace:*",
46
+ "@editor/model": "workspace:*",
47
+ "@editor/storage": "workspace:*",
48
+ "@editor/vfs": "workspace:*",
28
49
  "@galacean/engine": "2.0.0-alpha.33",
29
50
  "@galacean/engine-shader": "2.0.0-alpha.33",
30
51
  "@galacean/engine-shader-compiler": "2.0.0-alpha.33",
52
+ "@galacean/tools-color-dilation": "workspace:*",
53
+ "@galacean/tools-ktx2-encoder": "workspace:*",
31
54
  "@gltf-transform/core": "^4.1.0",
32
55
  "@gltf-transform/extensions": "^4.1.0",
33
56
  "@types/node": "^22.10.2",
34
- "vitest": "^3.1.0",
35
- "@editor/ai": "^1.0.0",
36
- "@editor/cli-preview": "0.0.0",
37
- "@editor/constants": "2.0.3",
38
- "@editor/model": "2.0.3",
39
- "@editor/storage": "0.0.1",
40
- "@galacean/tools-color-dilation": "1.5.0-alpha.0",
41
- "@editor/vfs": "1.0.0",
42
- "@editor/asset-bundle-utils": "1.0.0",
43
- "@editor/builder": "1.0.0",
44
- "@editor/editor-api": "1.0.0",
45
- "@galacean/tools-ktx2-encoder": "1.5.0-alpha.0",
46
- "config": "1.0.1",
47
- "tsconfig": "1.0.1"
48
- },
49
- "scripts": {
50
- "build": "node build.mjs",
51
- "build:tsc": "tsc -p tsconfig.build.json",
52
- "update:basis-assets": "node scripts/update-basis-assets.mjs",
53
- "test": "vitest run",
54
- "test:watch": "vitest"
57
+ "config": "workspace:*",
58
+ "tsconfig": "workspace:*",
59
+ "vitest": "^3.1.0"
55
60
  }
56
- }
61
+ }
@@ -1 +0,0 @@
1
- var N=Object.defineProperty;var $=(p,e,t)=>e in p?N(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t;var f=(p,e,t)=>($(p,typeof e!="symbol"?e+"":e,t),t);import{y as j,bD as F,bE as V,bF as U,F as G,ai as K,V as z,b3 as H,b2 as b,j as Q,q as k,u as W,bG as D,bH as A,a1 as m,a2 as T,bI as J,C as O,bJ as w,bK as Y,aE as S,bL as q,e as E,bM as X,K as Z,ae as ee,ah as te,af as C,R as v,_ as ae,z as re,x as L,aC as _,n as se,o as ie}from"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import{M as ne}from"./MaterialInspector-8d466d59.js";import{A as oe}from"./AssetViewer-3847c058.js";import{E as g,s as x}from"./shader-data-utils-f0e4f5a3.js";class he extends oe{constructor(){super(...arguments);f(this,"_sphereRenderer",null);f(this,"_particleRenderer",null);f(this,"_asset",null);f(this,"_shaderReactionDisposer",null);f(this,"onShaderChange",()=>{const{_asset:t}=this;t.engineObject.shader.name==="Effect/Particle"?(this._particleRenderer.entity.isActive=!0,this._sphereRenderer.entity.isActive=!1,this._particleRenderer.setMaterial(t.engineObject)):(this._particleRenderer.entity.isActive=!1,this._sphereRenderer.entity.isActive=!0,this._sphereRenderer.setMaterial(t.engineObject))})}setViewAsset(t,r){if(!(t instanceof y))return;const i=r.createChild("material");this._asset=t;const a=this._sphereRenderer=i.createChild("mat").addComponent(j);a.mesh=F.createSphere(r.engine,1,32,!0);const n=this._particleRenderer=i.createChild("pat").addComponent(V);n.generator.main.duration=1e3,n.generator.main.startSpeed.constant=0,this._entity=i,r.addChild(this._entity),this.onShaderChange(),this._shaderReactionDisposer=U(()=>{var o,l;return(l=(o=this._asset)==null?void 0:o.shaderRef)==null?void 0:l.refId},()=>{this.onShaderChange()})}stopViewAsset(){var t;super.stopViewAsset(),(t=this._shaderReactionDisposer)==null||t.call(this),this._shaderReactionDisposer=null,this._asset=null}}class P{static update(e,t){if(!(t instanceof y))return;const r=t.engineObject;if(!r||!r.shader){this.entity&&this.sphereRenderer&&this.particleRenderer&&this.clear();return}this.entity?this.entity.isActive=!0:this.initScene(e),r.shader.name==="Effect/Particle"?(this.sphereRenderer.entity.isActive=!1,this.particleRenderer.entity.isActive=!0,this.particleRenderer.setMaterial(r),this.particleRenderer.generator._playTime=5):(this.particleRenderer.entity.isActive=!1,this.sphereRenderer.entity.isActive=!0,this.sphereRenderer.setMaterial(r))}static clear(){var e,t;(e=this.sphereRenderer)!=null&&e.entity&&(this.sphereRenderer.entity.isActive=!1),(t=this.particleRenderer)!=null&&t.entity&&(this.particleRenderer.entity.isActive=!1),this.entity&&(this.entity.isActive=!1)}static initScene(e){const t=this.entity=e.createChild("material"),r=this.sphereRenderer=t.createChild("mat").addComponent(j);r.mesh=F.createSphere(e.engine,2,64,!0),this.particleRenderer=t.createChild("pat").addComponent(V),this.particleRenderer.bounds.max.set(.5,.5,.5),this.particleRenderer.bounds.min.set(-.5,-.5,-.5)}}f(P,"entity",null),f(P,"sphereRenderer",null),f(P,"particleRenderer",null);function B(p){return p instanceof G?{x:p.x,y:p.y}:p instanceof K?{x:p.x,y:p.y,z:p.z}:p instanceof z?{x:p.x,y:p.y,z:p.z,w:p.w}:p instanceof H?{r:p.r,g:p.g,b:p.b,a:p.a}:p}function pe(p){switch(p){case b.Color:return"Color";case b.Float:return"Float";case b.Int:return"Integer";case b.Matrix:return"Matrix";case b.Texture:return"Texture";case b.TextureArray:return"TextureArray";case b.Vector2:return"Vector2";case b.Vector3:return"Vector3";case b.Vector4:return"Vector4"}}var ce=Object.defineProperty,de=Object.getOwnPropertyDescriptor,I=(p,e,t,r)=>{for(var i=r>1?void 0:r?de(e,t):e,a=p.length-1,n;a>=0;a--)(n=p[a])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&ce(e,t,i),i};let y=class extends Q{constructor(e){super(e);f(this,"acceptDragLayer",k.Texture);f(this,"shaderRef",{refId:null});f(this,"shaderDataKeys",new Set);f(this,"formConfig",null);f(this,"_autoSaveSuppressed",!1);W(this),D(this,{proxyConfigs:[]})}static initBuiltinMaterial(e,t){e.shader=t;const r=e.shaderData;switch(r.disableMacro("MATERIAL_NEED_WORLD_POS"),r.disableMacro("MATERIAL_OMIT_NORMAL"),r.disableMacro("MATERIAL_NEED_TILING_OFFSET"),r.disableMacro("MATERIAL_SUN_HIGH_QUALITY"),t.name){case"Unlit":r.enableMacro("MATERIAL_OMIT_NORMAL"),r.enableMacro("MATERIAL_NEED_TILING_OFFSET");break;case"PBR":case"bake-pbr":case"BlinnPhong":r.enableMacro("MATERIAL_NEED_WORLD_POS"),r.enableMacro("MATERIAL_NEED_TILING_OFFSET");break;case"Sky/SkyProcedural":r.enableMacro("MATERIAL_SUN_HIGH_QUALITY");break;case"Effect/Particle":r.enableMacro("MATERIAL_OMIT_NORMAL");break}}setAutoSaveSuppressed(e){this._autoSaveSuppressed=e}setRenderQueueType(e){this.engineObject.shaderData.setInt("renderQueueType",e)}setBlendStateEnabled(e){this.engineObject.shaderData.setInt("blendEnabled",e?1:0)}setDepthWriteEnabled(e){this.engineObject.shaderData.setInt("depthWriteEnabled",e?1:0)}setCullMode(e){this.engineObject.shaderData.setInt("rasterStateCullMode",e)}setBlendMode(e){const t=this.engineObject.shaderData;switch(e){case A.Normal:t.setInt("sourceColorBlendFactor",m.SourceAlpha),t.setInt("destinationColorBlendFactor",m.OneMinusSourceAlpha),t.setInt("sourceAlphaBlendFactor",m.One),t.setInt("destinationAlphaBlendFactor",m.OneMinusSourceAlpha),t.setInt("colorBlendOperation",T.Add),t.setInt("alphaBlendOperation",T.Add);break;case A.Additive:t.setInt("sourceColorBlendFactor",m.SourceAlpha),t.setInt("destinationColorBlendFactor",m.One),t.setInt("sourceAlphaBlendFactor",m.One),t.setInt("destinationAlphaBlendFactor",m.OneMinusSourceAlpha),t.setInt("colorBlendOperation",T.Add),t.setInt("alphaBlendOperation",T.Add);break}}bindShaderAsset(e,t){for(const r of this.shaderDataKeys)this.removePropertyChangeListener(r);return this.shaderDataKeys.clear(),e.onReady().then(async()=>{var i;if(this.isInitCompleted){if(e.shaderScriptRefId){const a=this.root.assetStore.getAsset(e.shaderScriptRefId.refId);a==null||a.onShaderChange(this._engineObject)}else e.builtinUIScript&&e.builtinUIScript.onMaterialShaderSwitched(this._engineObject);t=this._getMainData()}const r=e.properties?J(e.properties):[];e.isBuiltinShader()&&y.initBuiltinMaterial(this.engineObject,e.engineObject),t=t||this._getMainData(),await this._proxyShaderProps(r,t,this.isInitCompleted),this.refreshFormConfig(r,t),this.refreshAnimatableProperties(r),this.shaderRef&&this.root.assetStore.getAssetByRef(this.shaderRef).then(a=>{a!==e&&(a==null||a.removeReferencedMaterial(this))}).catch(()=>{}),e.addReferencedMaterial(this),this.shaderRef={refId:e.id},await this.applyBoundPathChange("shader",O.AssetPicker,this.shaderRef),(i=this.updateThumbnail)==null||i.call(this)})}async _proxyShaderProps(e,t,r=!0){var n;this.proxyConfigs=e;const i=(n=this.extraData)==null?void 0:n.disabledMacros,a=e.map(async o=>{var l;if(this.proxySetter(o),this._virualShaderProps(e),o.bundleType==="macro"){const s=o.macroInfo,h=t.macros.find(c=>c.name===o.prop);if(!w(this,o.prop)){let c;h!=null?(c=h.value,s&&(s.checked=!0)):i!=null&&i.includes(o.prop)?(c=void 0,s&&(s.checked=!1)):c=o.defaultValue,D(this,{[o.prop]:c})}if(r)if(h){const c=h.value??o.defaultValue;c==null?s==null||s.onSwitch(!0,this):await o.onChange(this,o.prop,c)}else!(i!=null&&i.includes(o.prop))&&(s!=null&&s.checked)&&(s==null||s.onSwitch(!0,this))}else{const s=t.shaderData[o.prop];let h=s?s.value:this[o.prop]??o.defaultValue;if(h!=null&&h.refId&&!this.root.assetStore.assets[h.refId]&&(h=void 0),((l=o.uiInfo)==null?void 0:l.type)===g.Color)if(o.uiInfo.mode==="hdr"){const c=h.intensity??1;c!==0&&(h.r/=c,h.g/=c,h.b/=c),h.intensity=c}else h.intensity=1;w(this,o.prop)||D(this,{[o.prop]:h}),r&&this.notifyPropertyChange(o.prop,!1)}});await Promise.all(a)}proxySetter(e){const{prop:t,onChange:r,bundleType:i}=e,a=async(n,o)=>{var s;const l=this._engineObject.shaderData;i==="macro"?l.enableMacro(t,n):await x(this,t,n,e.engineType??((s=e.uiInfo)==null?void 0:s.type)),await r(this,t,n),o!==!1&&!this._autoSaveSuppressed&&(await this.root.assetFacade.persistAssetMain(this.id),this.updateThumbnail())};this.addPropertyChangeListener(t,a),this.shaderDataKeys.add(t)}_virualShaderProps(e){const t=this;e.forEach(r=>{Y(t,r.prop)})}refreshFormConfig(e,t){var i,a,n,o,l;const r={root:[],groups:{}};if(t){for(const s of e)if(!((i=s.uiInfo)!=null&&i.hide)){if((a=s.uiInfo)!=null&&a.group){if((n=s.uiInfo)!=null&&n.group){let h=r.groups[s.uiInfo.group];h||(h={type:O.Group,property:s.uiInfo.group,children:[]},r.groups[s.uiInfo.group]=h);const c=s.uiInfo;c.property=s.prop,s.macroInfo&&(c.macroConfig=s.macroInfo),h.children.push(c)}}else{const h=s.uiInfo;h.property=s.prop,s.macroInfo&&(h.macroConfig=s.macroInfo),r.root.push(h)}s.bundleType==="macro"?this[s.prop]=((o=t.macros.find(h=>h.name===s.prop))==null?void 0:o.value)??s.defaultValue:this[s.prop]=((l=t.shaderData[s.prop])==null?void 0:l.value)??s.defaultValue}}this.formConfig=r}refreshAnimatableProperties(e){var t,r,i;this._additionAnimatableProperties.length=0;for(const a of e){if(!a.uiInfo||a.uiInfo.hide||a.bundleType==="macro")continue;let n={};if((a.setPath||a.getPath||a.valueType||a.interpolationType)&&(n={setPath:a.setPath,getPath:a.getPath,valueType:a.valueType,interpolationType:a.interpolationType}),!n.setPath&&!n.getPath&&a.engineType&&(a.bundleType==="shaderData"||!a.bundleType))switch(a.engineType){case g.Float:n={setPath:`shaderData.setFloat('${a.prop}', $value)`,getPath:`shaderData.getFloat('${a.prop}')`,valueType:S.Float};break;case g.Integer:n={setPath:`shaderData.setInt('${a.prop}', $value)`,getPath:`shaderData.getInt('${a.prop}')`,valueType:S.Float,interpolationType:q.Step};break;case g.Vector2:n={setPath:`shaderData.getVector2('${a.prop}')`,getPath:`shaderData.getVector2('${a.prop}')`,valueType:S.Vector2};break;case g.Vector3:n={setPath:`shaderData.getVector3('${a.prop}')`,getPath:`shaderData.getVector3('${a.prop}')`,valueType:S.Vector3};break;case g.Vector4:n={setPath:`shaderData.getVector4('${a.prop}')`,getPath:`shaderData.getVector4('${a.prop}')`,valueType:S.Vector4};break;case g.Color:n={setPath:`shaderData.getColor('${a.prop}')`,getPath:`shaderData.getColor('${a.prop}')`,valueType:S.Color};break;case g.Boolean:n={setPath:`shaderData.setBoolean('${a.prop}', $value)`,getPath:`shaderData.getBoolean('${a.prop}')`,valueType:S.Boolean};break;case g.Texture:n={setPath:`shaderData.setTexture('${a.prop}', $value)`,getPath:`shaderData.getTexture('${a.prop}')`,valueType:S.ReferResource};break}if(!n.setPath&&!n.getPath){if(a.bundleType==="other")continue;continue}this._additionAnimatableProperties.push({property:a.prop,label:(t=a.uiInfo)!=null&&t.label?E(a.uiInfo.label):a.prop,type:(r=a.uiInfo)==null?void 0:r.type,propertyProxyConfig:n}),(i=a.uiInfo)!=null&&i.label&&(n.label=E(a.uiInfo.label)),X(this,a.prop,n)}}async initByMain(e){var c;const t=JSON.parse(await e.text());let r=t.shaderRef;const i=t.shaderData,a=t.macros;if(!r&&typeof t.shader=="string"){const d=Object.values(this.root.assetStore.assets).find(u=>u.meta.type==="Shader"&&u.meta.builtinShaderName===t.shader);d&&(r={refId:d.id})}if(!r)throw"invalid material";this.shaderRef=r;const n=new Z(this.engine);this.setDragTempEntity(n);const o=await this.root.assetStore.getAssetByRef(r),l=o.engineObject??ee.find("Unlit"),s=new te(this.engine,l);this.bindEngineObject(s);const h=s.shaderData;if(a)for(const d of a)h.enableMacro(d.name,d.value);if(i)for(const d in i){const u=i[d];let R=u.value;if(u.type===g.Color){R={...u.value};const M=u.value.intensity??1;M!==0&&(R.r/=M,R.g/=M,R.b/=M)}x(this,d,R,u.type)}await this.bindShaderAsset(o,t),(c=this.updateThumbnail)==null||c.call(this),await this.applyBoundPathChange("name",O.Input,this.name),this._checkSchemaOnInit(t,o)}_checkSchemaOnInit(e,t){e.shader!==t.engineObject.name&&this.root.assetFacade.persistAssetMain(this.id)}initByEngineObject(e){const t=this;this.bindEngineObject(e),t.shader=e.shader.name,t._name=e.name??"";const i=Object.values(this.root.assetStore.assets).filter(h=>h.meta.type==="Shader"&&!!h.meta.builtinShaderName).find(h=>h.meta.builtinShaderName===e.shader.name);this.shaderRef={refId:i.id};const a=e.shaderData,n=new Set((i.properties??[]).map(h=>h.prop));if(n.has("isTransparent")&&(t.isTransparent=a.getInt("blendEnabled")===1),n.has("material_AlphaCutoff")&&(t.alphaCutoff=a.getFloat("material_AlphaCutoff")),n.has("renderFace"))switch(a.getInt("rasterStateCullMode")){case C.Back:t.renderFace=v.Front;break;case C.Front:t.renderFace=v.Back;break;case C.Off:t.renderFace=v.Double;break}n.has("blendMode")&&(t.blendMode=a.getInt("destinationColorBlendFactor")===m.One?A.Additive:A.Normal),a.getProperties().forEach(h=>{const c=a.getPropertyValue(h);if(c instanceof ae){const d=this.root.assetStore.engineObjectToAssetMap.get(c);this[h.name]=d==null?void 0:d.getCurrentRef()}else this[h.name]=B(c)});const l=this._getMainData(),s=i.properties?[...i.properties]:[];this._proxyShaderProps(s,l,!1),this.bindShaderAsset(i,l)}afterDelete(){var e;(e=this.engineObject)==null||e.destroy(!0)}rename(e){return this.root.assetFacade.persistAssetMain(this.id),super.rename(e)}_getMainData(e){var s,h,c;const t=[],r=(e??this.engineObject).shaderData;r.getMacros(t);const i=t.map(({name:d,value:u})=>u===void 0?{name:d}:{name:d,value:u}),a=[],n={};r.getProperties(a);for(const d of a){let u;if(d.type===b.Texture||d.type===b.TextureArray)u=this[d.name];else{const R=r.getPropertyValue(d);u=B(R),((s=this[d.name])==null?void 0:s.intensity)!=null&&(u.intensity=(h=this[d.name])==null?void 0:h.intensity)}u!=null&&(n[d.name]={type:pe(d.type),value:u})}const o=(c=this.shaderRef)!=null&&c.refId?this.root.assetStore.getAsset(this.shaderRef.refId):void 0,l=!!(o!=null&&o.builtinShaderName);return{name:this.name,shader:this.engineObject.shader.name,macros:i,shaderData:n,...l?{}:{shaderRef:this.shaderRef}}}getMainData(){return JSON.stringify(this._getMainData())}async initByCreation(){var l;const e=new re(this.engine),t=[];e.shaderData.getMacros(t);const r=t.map(({name:s,value:h})=>h===void 0?{name:s}:{name:s,value:h});this.bindEngineObject(e);const i=this.root.assetStore.getAsset("0000501"),a=i!=null&&i.properties?[...i.properties]:[],n={};for(const s of a)s.defaultValue&&(n[s.prop]={value:s.defaultValue,type:s.engineType??((l=s.uiInfo)==null?void 0:l.type)});const o={shaderData:n,name:this.name,shader:e.shader.name,macros:r};return this._proxyShaderProps(a,o,!1),o}async onSubAssetEdit(){var i;const e=await this.root.assetFacade.createAssetByAdd({assetType:"Material",name:`${this._name}-copied`});this.engineObject.cloneTo(e.engineObject),await e.applyBoundPathChange("name",O.Input,e.name),e.initByEngineObject(e.engineObject),e.updateThumbnail(),await this.root.assetFacade.persistAssetMain(e.id);const t=await this.root.assetStore.getAssetByRef({refId:this.mainId}),r=((i=t.engineObject.materials)==null?void 0:i.indexOf(this._engineObject))??-1;r>=0&&await t.replaceMaterial(r,e.getCurrentRef()),this.root.assetStore.selectAsset(e.id)}saveMainImmediately(){return!this.engineObject||!this.engineObject.shaderData?Promise.resolve(void 0):(this.root.projectStore.setSyncStatus("syncing"),super.saveMainImmediately().then(e=>(e&&this.root.projectStore.setSyncStatus("success"),e)).catch(e=>{throw this.root.projectStore.setSyncStatus("error"),e}))}async _onDrop(e,t){var i,a;const r="material_BaseTexture";if(r in this){const n=t.getCurrentRef();this[r]=n;const o=this.root.assetStore.getAsset((i=this.shaderRef)==null?void 0:i.refId),l=(a=o==null?void 0:o.properties)==null?void 0:a.find(s=>s.prop===r);l&&await l.onChange(this,r,n),await this.root.assetFacade.persistAssetMain(this.id)}this.dropping=!1}async onDropToViewport(){const{sceneStore:e,sceneUIStore:t}=this.root,r=t.hoveredEntityId;if(r){const i=e.getEntityModel(r);if(i){const a=i.getComponentByTypeName("MeshRenderer"),n=i.getComponentByTypeName("SkinnedMeshRenderer"),o=a||n;o&&this.root.componentFacade.updateComponent(i.id,o.id,{material:this.getCurrentRef()})}}this.root.projectStore.currentViewport.viewport.onDrop()}};I([L],y.prototype,"shaderRef",2);I([L.ref],y.prototype,"formConfig",2);I([_],y.prototype,"bindShaderAsset",1);I([_],y.prototype,"_proxyShaderProps",1);I([_],y.prototype,"proxySetter",1);I([_],y.prototype,"_virualShaderProps",1);I([_],y.prototype,"refreshAnimatableProperties",1);I([_],y.prototype,"_onDrop",1);y=I([se({type:"Material",label:E("asset.material.title"),loaderType:"Material",extname:"mat",importMenuConfig:{type:ie.Add},customInspector:ne,viewer:he,thumbnail:P,dragLayer:k.Material})],y);const Ie=Object.freeze(Object.defineProperty({__proto__:null,get MaterialAsset(){return y}},Symbol.toStringTag,{value:"Module"}));export{y as M,he as a,Ie as b};