@realsee/dnalogel 2.6.0 → 2.6.2-dev.0

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 (247) hide show
  1. package/dist/CruisePlugin/typing.d.ts +5 -4
  2. package/dist/GuideLinePlugin/typing.d.ts +5 -2
  3. package/dist/index.cjs.js +16 -16
  4. package/dist/index.js +31 -25
  5. package/dist/index.umd.js +2 -2
  6. package/docs/classes/CSS3DRender.html +31 -31
  7. package/docs/classes/CruisePluginController.html +26 -26
  8. package/docs/classes/Magnifier.html +20 -20
  9. package/docs/classes/ModelRoomLabelController.html +11 -11
  10. package/docs/classes/Object3DHelperController.html +24 -24
  11. package/docs/classes/PaintBrush.html +15 -15
  12. package/docs/classes/PanoMeasurePluginLine.html +23 -23
  13. package/docs/classes/PanoMeasurePluginModel.html +22 -22
  14. package/docs/classes/PanoMeasurePluginPoint.html +14 -14
  15. package/docs/classes/PanoMeasurePluginPolyline.html +26 -26
  16. package/docs/classes/PanoTagPluginController.html +41 -41
  17. package/docs/classes/Util.BetterTween.html +8 -8
  18. package/docs/classes/Util.FivePointSelector.html +12 -12
  19. package/docs/classes/Util.Interval.html +12 -12
  20. package/docs/classes/Util.Magnifier.html +17 -17
  21. package/docs/classes/Util.PointDomHelper.html +11 -11
  22. package/docs/classes/Util.PointHelper.html +11 -11
  23. package/docs/classes/Util.Rectangle.html +13 -13
  24. package/docs/enums/CameraMovementEffect.html +7 -7
  25. package/docs/enums/ContentType.html +16 -16
  26. package/docs/enums/DIRECTION.html +9 -9
  27. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +9 -9
  28. package/docs/enums/DimensionType.html +7 -7
  29. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +8 -8
  30. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +9 -9
  31. package/docs/enums/PaintBrushTypeEnum.html +8 -8
  32. package/docs/enums/PointType.html +7 -7
  33. package/docs/enums/Rotation.html +8 -8
  34. package/docs/functions/CSS3DRenderPlugin.html +4 -4
  35. package/docs/functions/CameraMovementPlugin.html +4 -4
  36. package/docs/functions/CruisePlugin.html +4 -4
  37. package/docs/functions/GuideLinePlugin.html +5 -5
  38. package/docs/functions/ItemLabelPlugin.html +4 -4
  39. package/docs/functions/MapviewFloorplanPlugin.html +4 -4
  40. package/docs/functions/ModelChassisCompassPlugin.html +4 -4
  41. package/docs/functions/ModelEntryDoorGuidePlugin.html +4 -4
  42. package/docs/functions/ModelFloorplanPlugin.html +4 -4
  43. package/docs/functions/ModelItemLabelPlugin.html +4 -4
  44. package/docs/functions/ModelRoomLabelPlugin.html +4 -4
  45. package/docs/functions/ModelTVVideoPlugin.html +4 -4
  46. package/docs/functions/ModelViewPlugin.html +4 -4
  47. package/docs/functions/Object3DHelperPlugin.html +4 -4
  48. package/docs/functions/PanoCompassPlugin.html +4 -4
  49. package/docs/functions/PanoCursorRaycasterPlugin.html +4 -4
  50. package/docs/functions/PanoDoorLabelPlugin.html +4 -4
  51. package/docs/functions/PanoFloorplanRadarPlugin.html +4 -4
  52. package/docs/functions/PanoMeasurePlugin.html +4 -4
  53. package/docs/functions/PanoRulerPlugin.html +4 -4
  54. package/docs/functions/PanoRulerProPlugin.html +4 -4
  55. package/docs/functions/PanoSpatialTagPlugin.html +4 -4
  56. package/docs/functions/PanoTagPlugin.html +4 -4
  57. package/docs/functions/TopviewFloorplanPlugin.html +4 -4
  58. package/docs/functions/Util.getCoordsFromClient.html +5 -5
  59. package/docs/functions/Util.getCoordsFromElement.html +5 -5
  60. package/docs/functions/Util.getFrameTime.html +5 -5
  61. package/docs/functions/Util.getIntersectFromRelativePosition.html +5 -5
  62. package/docs/functions/Util.getRaycasterFromFivePointer.html +5 -5
  63. package/docs/functions/Util.isNil.html +5 -5
  64. package/docs/functions/Util.nextFrame.html +5 -5
  65. package/docs/functions/Util.notNil.html +5 -5
  66. package/docs/functions/Util.requestAnimationFrameInterval.html +5 -5
  67. package/docs/functions/Util.tweenProgress.html +5 -5
  68. package/docs/functions/pluginFlag.html +5 -5
  69. package/docs/index.html +4 -4
  70. package/docs/interfaces/AddTagConfig.html +6 -6
  71. package/docs/interfaces/CSS3DRenderPluginEventMap.html +11 -11
  72. package/docs/interfaces/CSS3DRenderPluginState.html +8 -8
  73. package/docs/interfaces/CameraMovementPluginExportType.html +7 -7
  74. package/docs/interfaces/EventMap.html +15 -15
  75. package/docs/interfaces/FloorplanBounding.html +8 -8
  76. package/docs/interfaces/FloorplanData.html +10 -10
  77. package/docs/interfaces/FloorplanEntrance.html +11 -11
  78. package/docs/interfaces/FloorplanExtraObject.html +10 -10
  79. package/docs/interfaces/FloorplanExtraObject3D.html +8 -8
  80. package/docs/interfaces/FloorplanFloorData.html +9 -9
  81. package/docs/interfaces/FloorplanImagePosition.html +7 -7
  82. package/docs/interfaces/FloorplanObserver.html +9 -9
  83. package/docs/interfaces/FloorplanOutlineItem.html +9 -9
  84. package/docs/interfaces/FloorplanPosition.html +7 -7
  85. package/docs/interfaces/FloorplanRoomItem.html +13 -13
  86. package/docs/interfaces/FloorplanRoomLabelItem.html +7 -7
  87. package/docs/interfaces/FloorplanServerBounding.html +8 -8
  88. package/docs/interfaces/FloorplanServerComputedData.html +10 -10
  89. package/docs/interfaces/FloorplanServerData.html +7 -7
  90. package/docs/interfaces/FloorplanServerDoorItem.html +10 -10
  91. package/docs/interfaces/FloorplanServerDoorPosition.html +8 -8
  92. package/docs/interfaces/FloorplanServerEntrance.html +11 -11
  93. package/docs/interfaces/FloorplanServerFloorData.html +9 -9
  94. package/docs/interfaces/FloorplanServerImagePosition.html +7 -7
  95. package/docs/interfaces/FloorplanServerObserver.html +9 -9
  96. package/docs/interfaces/FloorplanServerOutlineItem.html +9 -9
  97. package/docs/interfaces/FloorplanServerPosition.html +7 -7
  98. package/docs/interfaces/FloorplanServerRoomItem.html +14 -14
  99. package/docs/interfaces/FloorplanServerRoomLabelItem.html +7 -7
  100. package/docs/interfaces/ItemLabelPluginData.html +6 -6
  101. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +11 -11
  102. package/docs/interfaces/ItemLabelPluginParametersType.html +9 -9
  103. package/docs/interfaces/MinMax.html +7 -7
  104. package/docs/interfaces/ModelChassisCompassPluginData.html +7 -7
  105. package/docs/interfaces/ModelChassisCompassPluginExportType.html +8 -8
  106. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +7 -7
  107. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +8 -8
  108. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +8 -8
  109. package/docs/interfaces/ModelItemLabelPluginData.html +6 -6
  110. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +11 -11
  111. package/docs/interfaces/ModelItemLabelPluginParametersType.html +7 -7
  112. package/docs/interfaces/ModelRoomLabelPluginData.html +6 -6
  113. package/docs/interfaces/ModelTVVideoPluginData.html +9 -9
  114. package/docs/interfaces/ModelTVVideoPluginExportType.html +8 -8
  115. package/docs/interfaces/ModelTVVideoPluginParameterType.html +6 -6
  116. package/docs/interfaces/ModelViewPluginExportType.html +11 -11
  117. package/docs/interfaces/Object3DHelperState.html +8 -8
  118. package/docs/interfaces/PaintBrushAction.html +12 -12
  119. package/docs/interfaces/PaintBrushConfigs.html +12 -12
  120. package/docs/interfaces/PaintBrushState.html +10 -10
  121. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +10 -10
  122. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +5 -5
  123. package/docs/interfaces/PanoMeasureParameterType.html +12 -12
  124. package/docs/interfaces/PanoMeasurePluginLineJson.html +8 -8
  125. package/docs/interfaces/PanoMeasurePluginOpenParameter.html +7 -7
  126. package/docs/interfaces/PanoMeasurePluginPointJson.html +7 -7
  127. package/docs/interfaces/PanoMeasurePluginPolylineJson.html +8 -8
  128. package/docs/interfaces/PanoRulerPluginExportType.html +10 -10
  129. package/docs/interfaces/PanoRulerPluginOptions.html +7 -7
  130. package/docs/interfaces/PanoRulerPluginParameterType.html +8 -8
  131. package/docs/interfaces/PanoRulerProPluginExportType.html +9 -9
  132. package/docs/interfaces/PanoRulerProPluginOptions.html +7 -7
  133. package/docs/interfaces/PanoRulerProPluginParameterType.html +7 -7
  134. package/docs/interfaces/PanoRulerProPluginState.html +8 -8
  135. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +5 -5
  136. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +5 -5
  137. package/docs/interfaces/PanoSpatialTagPluginData.html +11 -11
  138. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +10 -10
  139. package/docs/interfaces/PanoSpatialTagPluginExportType.html +13 -13
  140. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +10 -10
  141. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +13 -13
  142. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +11 -11
  143. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +10 -10
  144. package/docs/interfaces/Point.html +8 -8
  145. package/docs/interfaces/Room.html +9 -9
  146. package/docs/interfaces/RoomInfo.html +7 -7
  147. package/docs/interfaces/RoomLabel.html +14 -14
  148. package/docs/interfaces/RoomRules.html +5 -5
  149. package/docs/interfaces/Rooms.html +5 -5
  150. package/docs/interfaces/Scissor.html +9 -9
  151. package/docs/interfaces/State.html +8 -8
  152. package/docs/interfaces/TagCache.html +10 -10
  153. package/docs/interfaces/TagConfig.html +10 -10
  154. package/docs/interfaces/TagIconUrl.html +9 -9
  155. package/docs/interfaces/Tags.html +9 -9
  156. package/docs/interfaces/TemporaryState.html +6 -6
  157. package/docs/interfaces/Util.MagnifierParameter.html +11 -11
  158. package/docs/interfaces/Util.MouseGroupParameter.html +8 -8
  159. package/docs/modules/Util.html +5 -5
  160. package/docs/modules.html +4 -4
  161. package/docs/types/ArrayPosition.html +5 -5
  162. package/docs/types/AudioAppearance.html +5 -5
  163. package/docs/types/AudioTagTypeConfigKey.html +5 -5
  164. package/docs/types/CSS3DRenderExportType.html +5 -5
  165. package/docs/types/CSS3DRenderPluginExportType.html +5 -5
  166. package/docs/types/CSS3DRenderPluginParameterType.html +5 -5
  167. package/docs/types/Color.html +5 -5
  168. package/docs/types/ContentTypeConfigKey.html +5 -5
  169. package/docs/types/ContentTypeConfigKeySplit.html +5 -5
  170. package/docs/types/ContentTypeMap.html +5 -5
  171. package/docs/types/Create3DDomContainerReturnType.html +5 -5
  172. package/docs/types/Create3DElementReturnType.html +5 -5
  173. package/docs/types/CruisePluginExportType.html +5 -5
  174. package/docs/types/Direction-1.html +5 -5
  175. package/docs/types/Direction4.html +5 -5
  176. package/docs/types/FloorplanRuleLabels.html +5 -5
  177. package/docs/types/FloorplanServerRuleLabels.html +5 -5
  178. package/docs/types/GuideLinePluginExportType.html +5 -5
  179. package/docs/types/HelperEventMap.html +5 -5
  180. package/docs/types/LoadTagConfig.html +5 -5
  181. package/docs/types/MapviewFloorplanPluginParameterType.html +5 -5
  182. package/docs/types/MapviewFloorplanPluginReturnType.html +5 -5
  183. package/docs/types/MediaData.html +5 -5
  184. package/docs/types/MediaStore.html +5 -5
  185. package/docs/types/ModelEntryDoorGuidePluginParameterType.html +5 -5
  186. package/docs/types/ModelFloorplanPluginParameterType.html +5 -5
  187. package/docs/types/ModelFloorplanPluginReturnType.html +5 -5
  188. package/docs/types/ModelRoomLabelPluginParameters.html +5 -5
  189. package/docs/types/ModelRoomLabelPluginReturnType.html +5 -5
  190. package/docs/types/MoveArgs.html +5 -5
  191. package/docs/types/MoveOpts.html +5 -5
  192. package/docs/types/Object3DHelperEventMap.html +5 -5
  193. package/docs/types/ObjectFit.html +5 -5
  194. package/docs/types/PaintBrushEventMap.html +5 -5
  195. package/docs/types/PanoCompassPluginData.html +5 -5
  196. package/docs/types/PanoCompassPluginExportType.html +5 -5
  197. package/docs/types/PanoCompassPluginParameterType.html +5 -5
  198. package/docs/types/PanoFloorplanRadarPluginParameterType.html +5 -5
  199. package/docs/types/PanoFloorplanRadarPluginReturnType.html +5 -5
  200. package/docs/types/PanoIndex.html +5 -5
  201. package/docs/types/PanoMeasurePluginEvent.html +5 -5
  202. package/docs/types/PanoMeasureReturnType.html +5 -5
  203. package/docs/types/PanoSpatialTagPluginId.html +5 -5
  204. package/docs/types/PanoTagPluginExportInterface.html +5 -5
  205. package/docs/types/PanoTagPluginParamsInterface.html +5 -5
  206. package/docs/types/PlaneTag.html +5 -5
  207. package/docs/types/PlaneTagElement.html +5 -5
  208. package/docs/types/Point2DElement.html +5 -5
  209. package/docs/types/Point2DTag.html +5 -5
  210. package/docs/types/Point3DElement.html +5 -5
  211. package/docs/types/Point3DTag.html +5 -5
  212. package/docs/types/PointTag.html +5 -5
  213. package/docs/types/PointTagElement.html +5 -5
  214. package/docs/types/Position.html +5 -5
  215. package/docs/types/RotateArgs.html +5 -5
  216. package/docs/types/RotateOpts.html +5 -5
  217. package/docs/types/RuleLabelsKey.html +5 -5
  218. package/docs/types/RuleLabelsValue.html +5 -5
  219. package/docs/types/StickType.html +5 -5
  220. package/docs/types/Tag.html +5 -5
  221. package/docs/types/Tag2D.html +5 -5
  222. package/docs/types/Tag3D.html +5 -5
  223. package/docs/types/TagContentType.html +5 -5
  224. package/docs/types/TagDimensionType.html +5 -5
  225. package/docs/types/TagElement.html +5 -5
  226. package/docs/types/TagEvents.html +5 -5
  227. package/docs/types/TagHooks.html +5 -5
  228. package/docs/types/TagIconSize.html +5 -5
  229. package/docs/types/TagId.html +5 -5
  230. package/docs/types/TagPointType.html +5 -5
  231. package/docs/types/TopviewFloorplanPluginParameterType.html +5 -5
  232. package/docs/types/TopviewFloorplanPluginReturnType.html +5 -5
  233. package/docs/types/WorkCode.html +5 -5
  234. package/docs/variables/FLOOR_TYPE_MAP.html +5 -5
  235. package/docs/variables/PLUGIN.html +5 -5
  236. package/docs/variables/ROOM_FETILE_TYPE_MAP.html +5 -5
  237. package/docs/variables/ROOM_TYPE_MAP.html +5 -5
  238. package/docs/variables/VERSION.html +5 -5
  239. package/docs/variables/itemLabelPluginServerParams.html +5 -5
  240. package/docs/variables/modelItemLabelPluginServerParams.html +5 -5
  241. package/docs/variables/modelRoomLabelPluginServerParams.html +5 -5
  242. package/libs/CruisePlugin/Controller.js +38 -34
  243. package/libs/CruisePlugin/typing.d.ts +5 -4
  244. package/libs/GuideLinePlugin/Controller.js +60 -58
  245. package/libs/GuideLinePlugin/typing.d.ts +5 -2
  246. package/libs/PanoMeasurePlugin/Controller/ViewController.js +3 -3
  247. package/package.json +1 -1
package/dist/index.umd.js CHANGED
@@ -205,7 +205,7 @@ transition: all 500ms;
205
205
  <div class="PanoRulerPlugin-rule-label-name">${e.options.distanceText(g)}</div>
206
206
  </div>
207
207
  </div>
208
- `,w=document.createElement("div");return w.setAttribute("class","PanoRulerPlugin-rule"),w.setAttribute("data-name",A),w.setAttribute("style","display: none"),w.innerHTML=v,w},o=document.createElement("div");o.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML=$u,o.appendChild(s);const r={},a=(A,g)=>{if(e.loaded)throw new Error("\u6807\u5C3A\u88AB\u91CD\u590D\u521D\u59CB\u5316\uFF01");const v=tf(A,i),w=i.work;if(!w)return!1;for(const y in g){const I=g[y],{standingPosition:E}=w.observers[0],C=I.map(({x:L,z:D,observers:T})=>{const N=T.length>0?A.rooms[A.observers[T[0]]].name:"",G=v[N]?v[N].floor:null;let X=1/0,j={index:0,x:E.x,y:E.y,z:E.z};T.forEach(_=>{if(!w.observers[_])return;const{standingPosition:q}=w.observers[_],ue={index:_,x:q.x,y:q.y,z:q.z},he=ef({x:L,z:D},ue);G?he<X&&Math.abs(ue.y-G)<.3&&(X=he,j=ue):he<X&&(X=he,j=ue)});const P=new F.Vector3(L,j.y,D);Object.assign(P,{observers:T});const O=v[N]?v[N].roof:null,R=O?new F.Vector3(L,O,D):null;return R&&Object.assign(R,{observers:T}),{origin:P,vertical:R}});r[y]={origins:C.map(L=>L.origin),rules:[]};for(const{origin:L,vertical:D}of C){if(!D)continue;const T=n(y,L.distanceTo(D));o.append(T),r[y].rules.push({vertical:!0,rule:[L,D],$element:T})}for(let L=0;L<C.length;L++){let D=L+1;D>=C.length&&(D=0);const{origin:T}=C[L],{origin:N}=C[D],G=n(y,T.distanceTo(N));o.append(G),r[y].rules.push({vertical:!1,rule:[T,N],$element:G})}}return e.loaded=!0,!0},l=(A,g,v)=>U(this,null,function*(){const w=A||t.roomInfo,y=g||t.roomRules;if(!w||!y)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");return e.loaded=!1,e.options=H(H({},e.options),v||{}),i.model.loaded?a(w,y):yield new Promise(I=>i.once("modelLoaded",()=>I(a(w,y))))});t.roomInfo&&t.roomRules&&l(t.roomInfo,t.roomRules);const c=(A,g,v,w)=>{const y=[[{x:0,y:0},{x:v,y:0}],[{x:0,y:0},{x:0,y:w}],[{x:v,y:0},{x:v,y:w}],[{x:0,y:w},{x:v,y:w}]],I=[];for(let E=0;E<y.length;E++){const C=Ks([A,g],[y[E][0],y[E][1]],!0);C&&I.push(C)}return I.length===0?!1:I},d=()=>{var T;const A=(T=i.getElement())==null?void 0:T.parentElement;if(!A||!e.loaded||Object.keys(r).length<=0)return;const{panoIndex:g,camera:v,currentMode:w}=i;if(g===void 0)return;let y;for(const N in r)N.split(",").indexOf(g.toString())>=0&&(y=N);if(!y){for(const N in r)for(const{$element:G}of r[N].rules)G.style.display="none";return}const I=v.position,E=v.getWorldDirection(new F.Vector3),C=A.clientWidth,L=A.clientHeight;if(w!==fe.Five.Mode.Panorama){for(const N in r)for(const{$element:G}of r[N].rules)G.style.display="none";return}for(const N in r)for(const{$element:G}of r[N].rules)G.style.display=N===y?"block":"none";const[D]=r[y].origins.slice().filter(N=>N.observers.indexOf(g)>=0).sort((N,G)=>{const X=N.clone().setY(0).sub(I).normalize().angleTo(E.clone().setY(0)),j=G.clone().setY(0).sub(I).normalize().angleTo(E.clone().setY(0));return X-j});for(const{rule:N,vertical:G,$element:X}of r[y].rules){const[j,P]=N,O=X.querySelector(".PanoRulerPlugin-rule-line");if(!O)return;if(!D){X.style.display="none";continue}if(j!==D&&P!==D){X.style.display="none";continue}if(j.distanceTo(P)<.3){X.style.display="none";continue}if(j.observers.indexOf(g)===-1||P.observers.indexOf(g)===-1){X.style.display="none";continue}if(j.clone().sub(I).normalize().angleTo(E)>Math.PI/2){X.style.display="none";continue}if(P.clone().sub(I).normalize().angleTo(E)>Math.PI/2){X.style.display="none";continue}const Z=j.distanceTo(P);if(P.clone().sub(P.clone().sub(j).divide(new F.Vector3(2,2,2))).distanceTo(I)/Z>8){X.style.display="none";continue}const ue=j.clone().project(v),he=(ue.x+1)/2*C,Ae=(-ue.y+1)/2*L,ke=P.clone().project(v),Ve=(ke.x+1)/2*C,Fe=(-ke.y+1)/2*L,ce=Math.sqrt(Math.pow(Ve-he,2)+Math.pow(Fe-Ae,2));let ye=ce,Ee=50;const de=c({x:~~he,y:~~Ae},{x:~~Ve,y:~~Fe},C,L);if(de&&de.length===1&&(D===j?(ye=Math.sqrt(Math.pow(de[0].x-he,2)+Math.pow(de[0].y-Ae,2)),Ee=ye/ce*50):D===P&&(ye=Math.sqrt(Math.pow(de[0].x-Ve,2)+Math.pow(de[0].y-Fe,2)),Ee=100-ye/ce*50)),de&&de.length===2){const Dt={x:(de[0].x+de[1].x)/2,y:(de[0].y+de[1].y)/2};Ee=Math.sqrt(Math.pow(Dt.x-he,2)+Math.pow(Dt.y-Ae,2))/ce*100}const Nt=(Math.PI/2-Math.atan2(Ve-he,Ae-Fe))/Math.PI*180,be=O.querySelector(".PanoRulerPlugin-rule-label"),xt=be.children[0].clientWidth;xt>=ce||xt/2>=Ee/100*ce||xt/2>=(1-Ee/100)*ce?O.style.display="none":(O.style.display="block",O.style.width=ce+"px",O.style.left=he+"px",O.style.top=Ae+"px",O.style.transform=`rotate(${-Nt}deg)`,be.style.left=`${Ee}%`)}},f=()=>$s(d),u=()=>{var A,g;return e.loaded?(e.enable||(o.setAttribute("class","PanoRulerPlugin"+(e.options.className?" "+e.options.className:"")),(g=(A=i.getElement())==null?void 0:A.parentElement)==null||g.append(o),d(),i.on("modeChange",d),i.on("cameraUpdate",f),e.enable=!0),!0):!1},h=()=>(e.enable&&(i.off("modeChange",d),i.off("cameraUpdate",f),o&&o.remove(),e.enable=!1),!0);function p(A){if(A.distanceText&&A.distanceText!==e.options.distanceText){const g=A.distanceText;e.options.distanceText=g,Object.values(r).forEach(v=>{v.rules.forEach(w=>{const[y,I]=w.rule,E=y.distanceTo(I),C=w.$element.querySelector(".PanoRulerPlugin-rule-label-name");!C||(C.innerText=g(E))})})}}return{enable:u,disable:h,load:l,state:e,changeConfigs:p}};function of(i){le(i,"svelte-1h27ktp",".PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1.5s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp em.svelte-1h27ktp{display:block;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-1h27ktp.svelte-1h27ktp{display:flex;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;align-items:center}.em-solid.svelte-1h27ktp.svelte-1h27ktp{height:100%;background:#ffffff}.em-dotted.svelte-1h27ktp.svelte-1h27ktp{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-1h27ktp.svelte-1h27ktp{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-1h27ktp.svelte-1h27ktp{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;animation:svelte-1h27ktp-viewport-rule-label 0.25s ease 1s;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@keyframes svelte-1h27ktp-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-1h27ktp-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-1h27ktp-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}")}function er(i,t,e){const n=i.slice();return n[6]=t[e],n}function sf(i){let t,e=i[0].children,n=[];for(let o=0;o<e.length;o+=1)n[o]=tr(er(i,e,o));return{c(){t=V("div");for(let o=0;o<n.length;o+=1)n[o].c();b(t,"class","rule-mixed-line svelte-1h27ktp")},m(o,s){B(o,t,s);for(let r=0;r<n.length;r+=1)n[r].m(t,null)},p(o,s){if(s&9){e=o[0].children;let r;for(r=0;r<e.length;r+=1){const a=er(o,e,r);n[r]?n[r].p(a,s):(n[r]=tr(a),n[r].c(),n[r].m(t,null))}for(;r<n.length;r+=1)n[r].d(1);n.length=e.length}},d(o){o&&z(t),lt(n,o)}}}function rf(i){let t,e;return{c(){t=V("em"),b(t,"class",e=Oe(i[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3])},m(n,o){B(n,t,o)},p(n,o){o&1&&e!==(e=Oe(n[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),o&8&&b(t,"style",n[3])},d(n){n&&z(t)}}}function tr(i){let t,e,n=`${i[6].width}px`;return{c(){t=V("div"),b(t,"class",e=Oe(i[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3]),M(t,"width",n)},m(o,s){B(o,t,s)},p(o,s){s&1&&e!==(e=Oe(o[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),s&8&&b(t,"style",o[3]),s&1&&n!==(n=`${o[6].width}px`)&&M(t,"width",n)},d(o){o&&z(t)}}}function af(i){let t,e,n,o,s=i[0].labelElement+"",r,a,l=`${i[0].labelOffset}%`,c=`${i[0].width}px`,d=`${i[0].left}px`,f=`${i[0].top}px`,u=`rotate(${i[0].rotateDeg}deg)`;function h(g,v){return g[0].children.length===0?rf:sf}let p=h(i),A=p(i);return{c(){t=V("div"),A.c(),e=te(),n=V("div"),o=V("div"),r=Ie(s),b(o,"class","PanoRulerPlugin-rule-label-name svelte-1h27ktp"),Se(()=>i[4].call(o)),b(n,"class","PanoRulerPlugin-rule-label svelte-1h27ktp"),M(n,"left",l),b(t,"class","PanoRulerPlugin-rule-line svelte-1h27ktp"),M(t,"width",c),M(t,"left",d),M(t,"top",f),M(t,"transform",u),M(t,"display",i[0].visible&&i[2]?"block":"none")},m(g,v){B(g,t,v),A.m(t,null),Q(t,e),Q(t,n),Q(n,o),Q(o,r),a=At(o,i[4].bind(o))},p(g,[v]){p===(p=h(g))&&A?A.p(g,v):(A.d(1),A=p(g),A&&(A.c(),A.m(t,e))),v&1&&s!==(s=g[0].labelElement+"")&&Le(r,s),v&1&&l!==(l=`${g[0].labelOffset}%`)&&M(n,"left",l),v&1&&c!==(c=`${g[0].width}px`)&&M(t,"width",c),v&1&&d!==(d=`${g[0].left}px`)&&M(t,"left",d),v&1&&f!==(f=`${g[0].top}px`)&&M(t,"top",f),v&1&&u!==(u=`rotate(${g[0].rotateDeg}deg)`)&&M(t,"transform",u),v&5&&M(t,"display",g[0].visible&&g[2]?"block":"none")},i:J,o:J,d(g){g&&z(t),A.d(),a()}}}function lf(i,t,e){let n,{rulerItemProp:o}=t,s=!0,r,a="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=";function l(){r=this.offsetWidth,e(1,r)}return i.$$set=c=>{"rulerItemProp"in c&&e(0,o=c.rulerItemProp)},i.$$.update=()=>{i.$$.dirty&3&&(r>=o.width||r/2>=o.labelOffset/100*o.width||r/2>=(1-o.labelOffset/100)*o.width?e(2,s=!1):e(2,s=!0))},e(3,n=`--background-image: url(${a})`),[o,r,s,n,l]}class cf extends se{constructor(t){super(),oe(this,t,lf,af,ie,{rulerItemProp:0},of)}}function nr(i,t,e){const n=i.slice();return n[12]=t[e],n}function ir(i){let t,e;return t=new cf({props:{rulerItemProp:i[12]}}),{c(){ee(t.$$.fragment)},m(n,o){K(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.rulerItemProp=n[12]),t.$set(s)},i(n){e||(k(t.$$.fragment,n),e=!0)},o(n){S(t.$$.fragment,n),e=!1},d(n){$(t,n)}}}function df(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=ir(nr(i,n,r));const s=r=>S(o[r],1,1,()=>{o[r]=null});return{c(){t=V("div");for(let r=0;r<o.length;r+=1)o[r].c()},m(r,a){B(r,t,a);for(let l=0;l<o.length;l+=1)o[l].m(t,null);e=!0},p(r,[a]){if(a&1){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=nr(r,n,l);o[l]?(o[l].p(c,a),k(o[l],1)):(o[l]=ir(c),o[l].c(),k(o[l],1),o[l].m(t,null))}for(re(),l=n.length;l<o.length;l+=1)s(l);ae()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)k(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)S(o[a]);e=!1},d(r){r&&z(t),lt(o,r)}}}function uf(i,t,e){var A,g,v,w;let{five:n}=t,{rulerDatas:o}=t,{options:s}=t,r=[];const a=((g=(A=n.getElement())==null?void 0:A.parentElement)==null?void 0:g.clientWidth)||0,l=((w=(v=n.getElement())==null?void 0:v.parentElement)==null?void 0:w.clientHeight)||0,c=(y,I)=>{const E=[[{x:0,y:0},{x:a,y:0}],[{x:0,y:0},{x:0,y:l}],[{x:a,y:0},{x:a,y:l}],[{x:0,y:l},{x:a,y:l}]],C=[];for(let L=0;L<E.length;L++){const D=Ks([y,I],[E[L][0],E[L][1]],!0);D&&C.push(D)}return C.length===0?!1:C},d=(y,I)=>{const E=y.clone().project(n.camera),C=(E.x+1)/2*a,L=(-E.y+1)/2*l,D=I.clone().project(n.camera),T=(D.x+1)/2*a,N=(-D.y+1)/2*l,G=Math.sqrt(Math.pow(T-C,2)+Math.pow(N-L,2));return{startLeft:C,startTop:L,endLeft:T,endTop:N,distance:G}},f=(y,I,E)=>{const C=n.camera.position,L=n.camera.getWorldDirection(new F.Vector3),D=y.clone().sub(C).normalize().angleTo(L),T=I.clone().sub(C).normalize().angleTo(L),N=y.distanceTo(I),X=I.clone().sub(I.clone().sub(y).divide(new F.Vector3(2,2,2))).distanceTo(C),{startLeft:j,startTop:P,endLeft:O,endTop:R,distance:W}=d(y,I),_=-((Math.PI/2-Math.atan2(O-j,P-R))/Math.PI)*180;let q=!0;E||(q=!1),!qe(y,E)&&!qe(I,E)&&(q=!1),N<.3&&(q=!1),D>Math.PI/2&&(q=!1),T>Math.PI/2&&(q=!1),X/N>8&&(q=!1);let ue=50,he=W;const Ae=c({x:~~j,y:~~P},{x:~~O,y:~~R});if(Ae&&Ae.length===1&&(qe(y,E)?(he=Math.sqrt(Math.pow(Ae[0].x-j,2)+Math.pow(Ae[0].y-P,2)),ue=he/W*50):qe(I,E)&&(he=Math.sqrt(Math.pow(Ae[0].x-O,2)+Math.pow(Ae[0].y-R,2)),ue=100-he/W*50)),Ae&&Ae.length===2){const ke={x:(Ae[0].x+Ae[1].x)/2,y:(Ae[0].y+Ae[1].y)/2};ue=Math.sqrt(Math.pow(ke.x-j,2)+Math.pow(ke.y-P,2))/W*100}return{startLeft:j,startTop:P,distance:W,deg:_,visible:q,labelOffset:ue,ruleLength:N}},u=()=>{const y=n.panoIndex,I=o.find(G=>G.panoIndex===y);if(!I)return e(0,r=[]);if(n.currentMode!==fe.Five.Mode.Panorama)return e(0,r=[]);const E=n.camera.position,C=n.camera.getWorldDirection(new F.Vector3),L=I.lines.map(G=>new F.Vector3(G.start[0],-G.start[1],-G.start[2])),D=I.lines.map(G=>new F.Vector3(G.end[0],-G.end[1],-G.end[2])),[T]=L.concat(D).sort((G,X)=>{const j=G.clone().setY(0).sub(E).normalize().angleTo(C.clone().setY(0)),P=X.clone().setY(0).sub(E).normalize().angleTo(C.clone().setY(0));return j-P}),N=I.lines.map(G=>{var he,Ae;const X=G.start,j=G.end,{startLeft:P,startTop:O,distance:R,deg:W,visible:Z,labelOffset:_,ruleLength:q}=f(new F.Vector3(X[0],-X[1],-X[2]),new F.Vector3(j[0],-j[1],-j[2]),T),ue=[];return G.children&&((he=G.children)==null?void 0:he.length)>0&&((Ae=G.children)==null||Ae.forEach(ke=>{const Ve=ke.start,Fe=ke.end,{distance:ce}=d(new F.Vector3(Ve[0],-Ve[1],-Ve[2]),new F.Vector3(Fe[0],-Fe[1],-Fe[2]));ue.push({width:ce,state:ke.state})})),{width:R,left:P,top:O,rotateDeg:W,state:G.state,children:ue,labelOffset:_,visible:Z,labelElement:s.distanceText(q)}});e(0,r=N)},h=()=>$n(u),p=_i(u,80);return Je(()=>{u(),n.on("panoArrived",u),n.on("modeChange",u),n.on("cameraDirectionUpdate",h),n.on("movingToPano",h),n.on("mouseWheel",()=>p()),n.on("pinchGesture",()=>p())}),bt(()=>{n.off("panoArrived",u),n.off("modeChange",u),n.off("cameraDirectionUpdate",h),n.off("movingToPano",h),n.off("mouseWheel",()=>p()),n.off("pinchGesture",()=>p())}),i.$$set=y=>{"five"in y&&e(1,n=y.five),"rulerDatas"in y&&e(2,o=y.rulerDatas),"options"in y&&e(3,s=y.options)},[r,n,o,s]}class ff extends se{constructor(t){super(),oe(this,t,uf,df,ie,{five:1,rulerDatas:2,options:3})}}class hf{constructor(t,e){m(this,"five");m(this,"container",document.createElement("div"));m(this,"panoRulerProData");m(this,"rulerItems");m(this,"state",{enabled:!1,loaded:!1,options:{className:"",distanceText:t=>`${t.toFixed(1)}m`}});var n,o;this.five=t,this.container.classList.add("panoRulerProPlugin-container"),this.container.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;"),e&&(e.data&&this.load(e.data),this.state.options=H(H({},this.state.options),e.options||{}),(n=e.options)!=null&&n.className&&this.container.classList.add((o=e.options)==null?void 0:o.className)),this.five.once("modelLoaded",()=>U(this,null,function*(){var s,r;(r=(s=this.five.getElement())==null?void 0:s.parentNode)==null||r.append(this.container)})),this.five.once("dispose",()=>this.dispose())}load(t){return U(this,null,function*(){if(!this.five.work)return;const e=t.data;if(!e)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");this.panoRulerProData=e,this.state.loaded=!0})}enable(){return this.state.loaded?(this.state.enabled||(this.state.enabled=!0,this.render()),!0):!1}disable(){return this.state.enabled&&(this.state.enabled=!1,this.render()),!0}render(){return U(this,null,function*(){var t;if(this.state.enabled){if(!this.panoRulerProData||!this.container)return;this.rulerItems=new ff({target:this.container,props:{five:this.five,rulerDatas:this.panoRulerProData,options:this.state.options}})}else(t=this.rulerItems)==null||t.$destroy(),this.rulerItems=void 0})}dispose(){this.container&&(this.rulerItems.$destroy(),this.rulerItems=void 0),this.container.remove()}}const mf=(i,t)=>new hf(i,t),pf="data:image/png;base64,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";function gf(){const i=document.createElement("div"),t=document.createElement("i"),e=document.createElement("span");return i.appendChild(t),i.appendChild(e),i.style.position="relative",i.style.width="100%",i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="center",i.style.marginTop=`${150/16}rem`,i.style.opacity="0",i.style.transition="opacity 1000ms linear",t.style.display="block",t.style.width=`${134/16}rem`,t.style.height=`${22/16}rem`,t.style.backgroundSize="100%",t.style.backgroundRepeat="no-repeat",t.style.backgroundImage=`url(${pf})`,e.style.marginTop=`${10/16}rem`,e.style.fontSize=`${16/16}rem`,e.style.color="#fff",e.style.opacity="0.7",e.style.textShadow="0 2px 16px rgb(22 34 83 / 24%)",e.style.fontWeight="bold",{appendTo(n){n.appendChild(i)},dispose(){i.remove()},setRoom(n){e.innerHTML=n.name+" "+Math.floor(n.size/1e6)+"\u33A1"},show(){i.style.opacity="1"},hide(){i.style.opacity="0"}}}const Af=new x.TextureLoader;function or(i){return U(this,null,function*(){return new Promise((t,e)=>{Af.load(i,t,void 0,e)}).then(t=>(t.encoding=x.sRGBEncoding,t))})}const si={userAction:!0};class vf extends jt{constructor(e,n){super(e);m(this,"state",{visible:!0,enabled:!0,config:{compassImageUrl:"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",entryDoorImageUrl:"//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png"}});m(this,"data");m(this,"group",new x.Group);m(this,"roomInfoInstance");m(this,"roomInfoWrapperInstance");m(this,"compassMeshTween");m(this,"compassMesh");m(this,"entryDoorMesh");m(this,"dispose",()=>{var e,n,o,s;this.five.scene.remove(this.group),this.group.remove(...this.group.children),(n=(e=this.compassMesh)==null?void 0:e.material.map)==null||n.dispose(),(s=(o=this.entryDoorMesh)==null?void 0:o.material.map)==null||s.dispose(),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_addEventListener",()=>{this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_removeEventListener",()=>{this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_enable",()=>{this.five.scene.add(this.group),this.init(),this.onFivePanoArrived(this.five.panoIndex||0),this._addEventListener()});m(this,"_disable",()=>{this._clearCompassIfNeed(),this._clearEntryDoorIfNeed(),this.five.scene.remove(this.group),this._removeEventListener()});m(this,"_toggleVisible",()=>{this.group.visible=this.state.visible,this.five.needsRender=!0});m(this,"_clearCompassIfNeed",()=>{var e;this.compassMesh&&(this.group.remove(this.compassMesh),(e=this.compassMesh.material.map)==null||e.dispose(),this.compassMesh=null)});m(this,"_clearEntryDoorIfNeed",()=>{var e;this.entryDoorMesh&&(this.group.remove(this.entryDoorMesh),(e=this.entryDoorMesh.material.map)==null||e.dispose(),this.entryDoorMesh=null),this.roomInfoInstance&&(this.roomInfoInstance.dispose(),this.roomInfoInstance=null),this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.dispose(),this.roomInfoWrapperInstance=null)});m(this,"onFivePanoWillArrive",e=>{var n,o;e!==this.five.panoIndex&&((n=this.compassMeshTween)==null||n.dispose(),(o=this.compassMesh)==null||o.material.setValues({opacity:0}))});m(this,"onFivePanoArrived",e=>{var o,s,r,a,l,c,d;const n=(r=(s=(o=this.five.work)==null?void 0:o.observers)==null?void 0:s[e])==null?void 0:r.standingPosition;if(this.compassMesh&&(this.compassMesh.position.copy(n.clone().setY(n.y+.01)),this.compassMesh.material.opacity===0&&((a=this.compassMeshTween)==null||a.dispose(),this.compassMeshTween=Xs(1e3).onUpdate(({progress:f})=>{var u;(u=this.compassMesh)==null||u.material.setValues({opacity:f}),this.five.needsRender=!0}).play())),this.entryDoorMesh){const u=new x.Vector3(this.data.entrance.position.x,this.data.entrance.position.y,this.data.entrance.position.z).clone().setY(n.y).sub(n).normalize(),h=n.clone().add(u.clone().multiplyScalar(.7)).setY(n.y+.01);this.entryDoorMesh.rotation.z=new x.Vector3(0,0,-1).angleTo(u),this.entryDoorMesh.position.copy(h),((l=this.data)==null?void 0:l.room_observers[e].room.type)===1?(c=this.entryDoorMesh)==null||c.material.setValues({opacity:1}):(d=this.entryDoorMesh)==null||d.material.setValues({opacity:0})}this.roomInfoInstance&&this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.position.copy(n.clone().setY(n.y+.01)),this.roomInfoInstance.setRoom(this.data.room_observers[e].room)),this.five.needsRender=!0});m(this,"onFiveCameraDirectionUpdate",({longitude:e,latitude:n})=>{var o,s;!this.roomInfoWrapperInstance||(this.roomInfoWrapperInstance.css3DObject.rotation.z=e,n>.66&&this.five.getCurrentState().mode==="Panorama"?(o=this.roomInfoInstance)==null||o.show():(s=this.roomInfoInstance)==null||s.hide())});m(this,"onFiveModeChange",(e,n,o,s,r)=>{e!==n&&this.setState({visible:e===fe.Five.Mode.Panorama},{userAction:r})});this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.setState({visible:!0,enabled:!0,config:H(H({},this.state.config),n||{})})}enable(e=si){this.setState({enabled:!0},e)}disable(e=si){this.setState({enabled:!1},e)}show(e=si){if(!!this.state.enabled)return this.setState({visible:!0},e),Promise.resolve()}hide(e=si){if(!!this.state.enabled)return this.setState({visible:!1},e),Promise.resolve()}setState(e,n={userAction:!0}){var s,r;const o=JSON.parse(JSON.stringify(this.state));this.state={visible:(s=e.visible)!=null?s:o.visible,enabled:(r=e.enabled)!=null?r:o.enabled,config:H(H({},o.config),e.config||{})},this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n.userAction}),e.enabled===!0&&(this._enable(),this.hooks.emit("enable",n)),e.enabled===!1&&(this._disable(),this.hooks.emit("disable",n)),e.visible===!1&&(this._toggleVisible(),this.hooks.emit("hide",n)),e.visible===!0&&(this._toggleVisible(),this.hooks.emit("show",n)),e.config&&this.init()}load(e,n,o=!0){return U(this,null,function*(){const s=yield this.formatData(e);JSON.stringify(this.data)!==JSON.stringify(s)&&(this.hooks.emit("dataChange",s,this.data),this.data=H({},s),this.init(),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",this.data))})}formatData(e){return e.version&&e.data?Promise.resolve(e.data):Promise.resolve(e)}init(){return U(this,null,function*(){var o,s,r,a;const e=(s=(o=this.data)==null?void 0:o.north_rad)!=null?s:null;this._clearCompassIfNeed(),e!==null&&(this.compassMesh=yield this.loadCompassMesh(),this.compassMesh.rotateX(-Math.PI/2),this.compassMesh.rotateZ(e-Math.PI/2),this.group.add(this.compassMesh));const n=(a=(r=this.data)==null?void 0:r.entrance)!=null?a:null;this._clearEntryDoorIfNeed(),n!==null&&(this.entryDoorMesh=yield this.loadEntryDoorMesh(),this.roomInfoWrapperInstance=this.loadRoomInfo(),this.roomInfoInstance=gf(),this.entryDoorMesh.rotateX(-Math.PI/2),this.roomInfoWrapperInstance&&this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container),this.group.add(this.entryDoorMesh)),this.onFivePanoArrived(this.five.panoIndex||0),this.five.needsRender=!0})}loadCompassMesh(){return U(this,null,function*(){const e=this.state.config.compassImageUrl,n=yield or(e),o=new x.CircleGeometry(.7,32),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:0,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-mesh",r})}loadEntryDoorMesh(){return U(this,null,function*(){const e=this.state.config.entryDoorImageUrl,n=yield or(e),o=new x.PlaneGeometry(.2,.16),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:.8,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-entry-door",r})}loadRoomInfo(){const e=[new x.Vector3(-.7,0,-.7),new x.Vector3(.7,0,-.7),new x.Vector3(.7,0,.7),new x.Vector3(-.7,0,.7)];return Jt(this.five).create3DDomContainer(e)}}const bf=(i,t)=>new vf(i,t);function ri(i,t,e){const n=i[t],o=i[e];n===void 0||o===void 0||(i[t]=o,i[e]=n)}function yf(i,t,e){const n=e/2;for(let o=1;o<=n;o++){const s=e-(o-1);for(let r=1;r<=t;r++){const a=(o-1)*t+r-1,l=(s-1)*t+r-1;ri(i,a*4+0,l*4+0),ri(i,a*4+1,l*4+1),ri(i,a*4+2,l*4+2),ri(i,a*4+3,l*4+3)}}}class sr{constructor(t,e){m(this,"width");m(this,"height");m(this,"containerDom");m(this,"hooks",new fe.Subscribe);m(this,"canvas",document.createElement("canvas"));m(this,"five");m(this,"scale");m(this,"config");m(this,"offset",{x:0,y:0});m(this,"context");m(this,"renderCenter",new x.Vector3);m(this,"hammer");m(this,"state",{enabled:!1});m(this,"offsetRange");m(this,"isPanning",!1);m(this,"onPanstart",()=>{this.isPanning=!0,this.canvas.style.boxShadow="0 2px 30px 0 rgba(0,0,0,0.20)"});m(this,"onPan",t=>{if(!this.isPanning||!this.offsetRange||this.hooks.emit("wantsPanGesture",t))return;const{translateX:n,translateY:o}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${n}px, ${o}px, 100px)`});m(this,"onPanend",t=>{if(this.isPanning=!1,this.canvas.style.boxShadow="none",!this.offsetRange)return;const{translateX:e,translateY:n}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${e}px, ${n}px, 100px)`,this.offset={x:e,y:n}});var o,s,r;if(!t.renderer)throw new Error("Five Render \u672A\u521D\u59CB\u5316");this.five=t,this.scale=(o=e==null?void 0:e.scale)!=null?o:2,this.width=(s=e==null?void 0:e.width)!=null?s:190,this.height=(r=e==null?void 0:e.height)!=null?r:190,this.config={dragEnabled:(e==null?void 0:e.dragEnabled)||!1,autoFixPCPosition:(e==null?void 0:e.autoFixPCPosition)||!1,initialPosition:(e==null?void 0:e.initialPosition)||{left:"0",top:"0"}};const n=this.canvas.getContext("2d");if(!n)throw new Error("CANNOT CREATE CONTEXT2D");this.context=n,this.config.dragEnabled&&(this.hammer=new dn.default(this.canvas),this.hammer.on("pan",this.onPan),this.hammer.on("panstart",this.onPanstart),this.hammer.on("panend",this.onPanend)),this.initStyle()}dispose(){var t;this.clear(),this.disable(),(t=this.hammer)==null||t.destroy()}enable(){if(!this.state.enabled)return this.state.enabled=!0,this.containerDom&&this._appendTo(this.containerDom),this}disable(){if(!!this.state.enabled)return this.state.enabled=!1,this.canvas.remove(),this}appendTo(t){return this.containerDom=t,this.state.enabled&&this._appendTo(t),this}clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}renderWithPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}renderWithScreenPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}resetOffset(){this.offset={x:0,y:0},this.canvas.style.transform=`translate3d(${0}px, ${0}px, 100px)`}getCurrentState(){return{enabled:this.state.enabled}}getRenderCenter(){return this.renderCenter}_appendTo(t){if(this.resetOffset(),t.appendChild(this.canvas),!this.offsetRange){const e=this.canvas.getBoundingClientRect(),n=t.getBoundingClientRect(),o=n.right-e.right,s=n.bottom-e.bottom,r=n.left-e.left,a=n.top-e.top;this.offsetRange={min:{x:r,y:a},max:{x:o,y:s}}}}autoFixPCPosition(){if(!this.containerDom)return;const{width:t,height:e}=this,[n,o,s]=(()=>{if(this.renderCenter instanceof x.Vector3){const r=this.renderCenter.clone().project(this.five.camera);return[(r.x+1)/2*this.containerDom.clientWidth,-(r.x-1)/2*this.containerDom.clientWidth,-(r.y-1)/2*this.containerDom.clientHeight]}else return[this.renderCenter.x,this.containerDom.clientWidth-this.renderCenter.x,this.renderCenter.y]})();n<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=90+"px"):s<183?(this.canvas.style.top=90+"px",this.canvas.style.left=-t/2+"px"):o<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=-t-90+"px"):(this.canvas.style.left=-t/2+"px",this.canvas.style.top=-e-90+"px"),this.canvas.style.transform=`translate3d(${n}px, ${s}px, 10px)`,this.offset={x:n,y:s}}render(){if(!this.five.renderer||!this.containerDom)return;const{scale:t,context:e,width:n,height:o}=this,s=this.five.renderer.getSize(new x.Vector2),[r,a]=(()=>{if(this.renderCenter instanceof x.Vector3){const g=this.renderCenter.clone().project(this.five.camera);return[(g.x+1)/2*s.x,(g.y+1)/2*s.y]}else return[this.renderCenter.x,s.y-this.renderCenter.y]})(),l=1,c=n/t,d=o/t,f=l*t,u=this.five.getPixels(r-c/2,a-c/2,c,d,f),h=Math.floor(n*l),p=Math.floor(o*l);yf(u,h,p);const A=new ImageData(h,p);A.data.set(u),e.putImageData(A,0,0)}initStyle(){const t=this.canvas;t.classList.add("five-plugin__magnifier"),t.style.position="absolute",t.style.pointerEvents="all",t.style.borderRadius="50%",t.style.zIndex="99";const e=1;t.setAttribute("width",(this.width*e).toString()),t.setAttribute("height",(this.height*e).toString()),t.style.border="2px solid rgba(255,255,255,0.20)",t.style.width=this.width+"px",t.style.height=this.height+"px",t.style.top=this.config.initialPosition.top,t.style.left=this.config.initialPosition.left,t.style.transform="translate(0,0,100px)",this.config.dragEnabled&&(this.canvas.style.cursor="pointer")}getPanOffset(t,e){const{min:{x:n,y:o},max:{x:s,y:r}}=e,a=this.offset.x+t.deltaX,l=this.offset.y+t.deltaY,c=Math.min(Math.max(a,n),s),d=Math.min(Math.max(l,o),r);return{translateX:c,translateY:d}}}class wf{constructor(t){m(this,"edges",[]);m(this,"five");m(this,"onModelLoaded",()=>{!this.five.model||(this.edges=this.five.model.getEdges())});this.five=t,this.five.model.loaded?this.onModelLoaded():this.five.on("modelLoaded",this.onModelLoaded)}dispose(){}getAdsorbentPoint(t){if(this.edges.length===0)return null;let e=1/0,n;return this.edges.forEach(o=>{const s=o.closestPointToPoint(t.point,!0,new F.Vector3),r=s.distanceTo(t.point);r<e&&(n=s,e=r)}),e>.1?null:n||null}}function Cf(i,t){for(let e=0,n=t.length;e<n;e++)if(i===t[e])return t.splice(e,1)[0]}class Xe{constructor(t){m(this,"id");m(this,"lines");m(this,"position");m(this,"type","point");this.id=He(),this.lines=[],this.position=new F.Vector3,t instanceof F.Vector3?this.position.copy(t):this.position.fromArray(t)}toJson(){return{id:this.id,position:this.position.toArray()}}addLine(t){this.lines.push(t)}removeLine(t){Cf(t,this.lines)}clone(){return new Xe(this.position)}}class ai{constructor(t){m(this,"id",He());m(this,"lines",[]);m(this,"points",[]);m(this,"visiblePanoIndexes");m(this,"model");m(this,"type","polyline");m(this,"hook",new fe.Subscribe);this.model=t.model}addLine(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0\u7EBF\u6BB5"));return}const e=this.getLastPoint(),n=e&&t.findAnotherPoint(e);e?e&&n?(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t)):console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u65E0\u6CD5\u4E0E\u5F53\u524D\u6298\u7EBF\u8FDB\u884C\u8FDE\u63A5")):(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t))}removeLine(t){if(this.lines.length!==0){if(!this.isLastLine(t)){console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u4E0D\u662F\u5F53\u524D\u6298\u7EBF\u7684\u6700\u540E\u4E00\u6BB5"));return}this.lines.pop(),this.lines.length===0?this.points.slice(0,this.points.length):this.points.pop(),this.hook.emit("lineRemoved",t)}}isLastLine(t){const e=this.getLastLine();return e?t.id===e.id:!1}getLastLine(){return this.lines.slice(-1)[0]}clear(){this.lines.slice(0,this.lines.length),this.points.slice(0,this.points.length)}overlapWith(t){return t.type==="point"?this.includes(t):t.type==="line"?t.points.some(e=>this.includes(e)):t.type==="polyline"?t.points.some(e=>this.includes(e)):!0}includes(t){return t.type==="point"?this.points.find(({id:e})=>e===t.id)!==void 0:t.type==="line"?this.lines.find(({id:e})=>e===t.id)!==void 0:!1}isEmpty(){return this.points.length===0}getLastPoint(){return this.points.slice(-1)[0]}toJson(){return{id:this.id,lines:this.lines.map(t=>t.toJson()),visiblePanoIndexes:this.visiblePanoIndexes}}getPointByID(t){return this.points.find(({id:e})=>e===t)}fromJson(t){this.clear(),this.id=t.id;const{getPoint:e,getAllPoints:n}=r(),o=t.lines.map(a=>{const[l,c]=a.points,d=e(l),f=e(c);if(!d||!f)throw new Error("\u7EBF\u4E0A\u7684\u70B9\u4E0D\u5B58\u5728");const u=new Qt(d,f,this.model);return u.id=a.id,u.text=a.text,u}),s=n();this.points.push(...s),this.lines.push(...o),this.visiblePanoIndexes=t.visiblePanoIndexes;function r(){const a=new Map;function l(d){const f=a.get(d.id);if(f)return f;const u=new Xe(d.position);return u.id=d.id,a.set(d.id,u),u}function c(){return Array.from(a.values())}return{getPoint:l,getAllPoints:c}}return this}replace(t){this.id=t.id,this.clear(),this.lines.push(...t.lines),this.points.push(...t.points)}}const Pf=1,If=3,Ef=new F.Color(16777215),kf=new F.Color(6522623),xf=new F.Color(16777215),Df=new F.Color(6522623),Lf=6,Sf=8,Mf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==",rr=new F.TextureLoader().load(Mf),ar={pointTexture:rr,pointSize:Lf,lineWidth:Pf,lineColor:Ef,pointColor:xf,lineRenderOrder:20,pointsRenderOrder:20};pe(H({},ar),{dashed:!0});const zf={pointTexture:rr,pointSize:Sf,lineWidth:If,lineColor:kf,pointColor:Df,lineRenderOrder:10,pointsRenderOrder:10};function Bf(i,t,e){var d,f,u,h,p;const n=(d=e==null?void 0:e.lineWidth)!=null?d:2,o=(f=e==null?void 0:e.lineColor)!=null?f:new F.Color(16777215),s=(u=e==null?void 0:e.pointSize)!=null?u:5,r=(h=e==null?void 0:e.lineRenderOrder)!=null?h:10,a=(p=e==null?void 0:e.lineRenderOrder)!=null?p:20,l=new Pn.Line(i,t);l.setMaterial({linewidth:n,color:o}),l.line.material.depthTest=!1,l.line.material.transparent=!0,l.line.renderOrder=r,l.points.renderOrder=a;const c=l.points.material;return c.depthTest=!1,c.size=s,e!=null&&e.pointColor&&c.color.set(e.pointColor).convertSRGBToLinear(),e!=null&&e.pointTexture&&(c.map=e.pointTexture),l}function lr(i,t){const[e,n]=i.points,o=t==="light"?zf:ar,s=Bf(e.position,n.position,o);return s.name="normalLine_"+i.id,s}function It(i){const{x:t,y:e,z:n}=i;return!(Math.abs(t)>1||Math.abs(e)>1||Math.abs(n)>1)}function Tf(){const i=document.createElement("div");return i.setAttribute("style","backdrop-filter: blur(4px);-webkit-backdrop-filter: blur(4px);-webkit-tap-highlight-color: rgba(0,0,0,0);"),i.style.width="max-content",i.style.padding="3px 6px",i.style.lineHeight="1",i.style.textAlign="center",i.style.transform="translate(-50%, -50%)",i.style.borderRadius="100px",i.style.fontSize="14px",i.style.color="#fff",i.style.background="rgba(195,195,195,0.70)",i.style.border="0.5px solid rgba(255,255,255,0.6)",i.style.cursor="pointer",i}function Vf(i){const t=document.createElement("div");return t.id="distance_"+i.id,t.classList.add("five-plugin-measure__distance"),t.style.opacity="0",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="0",t.style.height="0",t.style.transform="translate3d(0, 0, 0)",t.style.transformOrigin="left top",t}function jf(i){let t=!0;const{line:e}=i,n=e.id,o=Tf(),s=Vf(e),r=i.userDistanceItem,a=new F.Vector3(0,0,0),l={lineID:n,ndcPosition:a,update:u,appendTo:h,remove:p,highlight:d,unHighlight:f,getCurrentContent:A,setItemSelectable:g};s.style.pointerEvents=t?"all":"none",r!=null&&r.element?s.appendChild(r.element):s.appendChild(o);function c(){var v;(v=i.clickCallback)==null||v.call(i,l)}function d(){if(r)return r.highlight();o.style.border="0.5px solid #95AEFF",o.style.background="linear-gradient(90deg, #95AEFF 0%, #6386FF 100%)"}function f(){if(r)return r.unHighlight();o.style.border="0.5px solid rgba(255,255,255,0.6)",o.style.background="rgba(195,195,195,0.70)"}function u(v){if(e.mesh.visible===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const w=v.getElement();if(!w)return;const y=w.clientWidth,I=w.clientHeight,E=y/2,C=I/2;if(e.points.length<2)return;const[L,D]=e.points,T=L.position.clone().project(v.camera),N=D.position.clone().project(v.camera),G=T.clone().lerp(N,.5),X=new F.Vector2(T.x*E,T.y*C),j=new F.Vector2(N.x*E,N.y*C),P=X.distanceTo(j);if((()=>!(Math.abs(T.z)>1||Math.abs(N.z)>1||!It(T)&&!It(N)||!It(G)||P===0))()===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const R=(G.x+1)/2*y,W=-(G.y-1)/2*I,_=-(Math.atan((X.y-j.y)/(X.x-j.x))*180)/Math.PI,q=s.parentElement&&o.clientWidth>P?-20:0;s.style.transform=`translate(${R}px, ${W}px) rotate(${_}deg) translateY(${q}px)`,s.style.opacity="1",s.style.pointerEvents=t?"all":"none",r&&r.update({line:e,polyline:e.getPolyline()});const ue=A();o.innerText=ue}function h(v){v.appendChild(s),s.addEventListener("click",c)}function p(){o.removeEventListener("click",c),s.remove()}function A(){var L,D,T;if(e.points.length<2)return"";const[v,w]=e.points,y=v.position.clone().distanceTo(w.position),I=(L=i.line.text)!=null?L:i.line.model.config.defaultText,E=(T=(D=i.line.model.config)==null?void 0:D.getDistanceText)==null?void 0:T.call(D,y),C=I!=null?I:E;return C!=null?C:y.toFixed(2)+"m"}function g(v){t=v}return l}class Qt{constructor(t,e,n){m(this,"id");m(this,"selected",!1);m(this,"text");m(this,"type","line");m(this,"model");m(this,"mesh");m(this,"points");m(this,"lightMesh");m(this,"hook");m(this,"distanceItem");m(this,"polyline");var o;if(this.id=He(),this.model=n,t.id===e.id)throw new Error("\u65E0\u6548\u7684\u7EBF\u6BB5, \u4E00\u4E2A\u70B9\u65E0\u6CD5\u6784\u6210\u7EBF\u6BB5");typeof n.config.defaultText=="string"&&(this.text=n.config.defaultText),this.hook=new fe.Subscribe,this.points=[t,e],this.mesh=lr(this,"normal"),this.lightMesh=lr(this,"light"),this.distanceItem=jf({line:this,clickCallback:()=>this.hook.emit("selected",this),userDistanceItem:(o=this.model.config)!=null&&o.userDistanceItemCreator?this.model.config.userDistanceItemCreator():void 0}),t.lines.push(this),e.lines.push(this)}clear(){this.selected=!1,this.polyline=void 0}isEmpty(){return this.points.length===0}getPolyline(){if(this.polyline)return this.polyline;const t=this.model.polylines.find(e=>e.lines.includes(this));if(t)return this.polyline=t,t}findAnotherPoint(t){return this.points.find(({id:e})=>e!==t.id)}setText(t){this.text=t,this.hook.emit("textChanged",t)}toJson(){return{id:this.id,points:this.points.map(t=>t.toJson()),text:this.text}}clone(){const t=new Qt(this.points[0].clone(),this.points[1].clone(),this.model);return t.text=this.text,t}}class li{constructor(t){m(this,"config");m(this,"polylines",[]);m(this,"hook",new fe.Subscribe);this.config=t}addPolyline(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0 polyline"));return}this.polylines.push(t),this.hook.emit("polylineAdded",t)}replacePolylineByID(t,e){const n=this.getPolylineByID(t);n==null||n.replace(e)}removePolyline(t){const e=this.polylines.findIndex(({id:n})=>n===t.id);if(e===-1){console.error(new Error("polyline \u4E0D\u5B58\u5728"));return}this.polylines.splice(e,1),this.hook.emit("polylineRemoved",t)}getPolylineByID(t){return this.polylines.find(e=>e.id===t)}getPolylineByLine(t){return this.polylines.find(e=>e.includes(t))}getLineByID(t){return this.getAllLines().find(e=>e.id===t)}getAllLines(){return this.polylines.map(t=>t.lines).flat(1)}getAllPoints(){return this.polylines.map(t=>t.points).flat(1)}includes(t){return this.polylines.find(({id:e})=>e===t.id)!==void 0}clear(){this.polylines.forEach(t=>this.hook.emit("polylineRemoved",t)),this.polylines.splice(0,this.polylines.length)}getClosestPoint(){}parse(t){this.clear(),this.polylines.push(...t.polylines.map(e=>new ai({model:this}).fromJson(e))),this.polylines.forEach(e=>this.hook.emit("polylineAdded",e))}toJson(){return{polylines:this.polylines.map(t=>t.toJson()).filter(t=>t.lines.length>0)}}}const ci=i=>i.preventDefault();class di{constructor(t){m(this,"model");m(this,"five");m(this,"group");m(this,"config");m(this,"dashed");m(this,"disposed",!1);m(this,"isMobile");m(this,"mouseGroup");m(this,"container");m(this,"fiveHelper");m(this,"hook");m(this,"magnifier");m(this,"userDistanceItemCreator");m(this,"updateDistanceUI",()=>{this.dashed.distanceItem.update(this.five),this.model.getAllLines().forEach(t=>t.distanceItem.update(this.five))});var n,o;this.five=t.five,this.hook=t.hook,this.model=t.model,this.config=t.config,this.magnifier=t.magnifier,this.container=t.container,this.fiveHelper=t.fiveHelper,this.isMobile=(o=(n=t.openParams)==null?void 0:n.isMobile)!=null?o:!1,this.userDistanceItemCreator=t.userDistanceItemCreator,this.group=t.group,this.mouseGroup=t.mouseGroup,this.dashed=new Qt(new Xe([0,0,0]),new Xe([0,0,0]),this.model),this.dashed.distanceItem.setItemSelectable(!1),this.dashed.mesh.setMaterial({dashed:!0,dashScale:100}),this.dashed.mesh.name="dashLine";const e=this.five.getElement();e&&(e.addEventListener("touchstart",ci),e.addEventListener("contextmenu",ci))}removeLine(t){this.group.remove(t.mesh,t.lightMesh),t.distanceItem.remove(),this.five.needsRender=!0}updateMouseGroup(t,e){if(!t)return this.mouseGroup;const n=this.fiveHelper.getAdsorbentPoint(t),o=n||t.point;if(this.mouseGroup.position.copy(o),e)this.mouseGroup.quaternion.copy(e.quaternion);else if(t.face){const r=t.face.normal.clone().multiplyScalar(.05),l=t.point.clone().add(r).clone().add(r);this.mouseGroup.lookAt(l)}return this.mouseGroup}dispose(){this.disposed=!0,this.magnifier.disable(),this.model.getAllLines().forEach(e=>this.removeLine(e));const t=this.five.getElement();t&&(t.removeEventListener("touchstart",ci),t.removeEventListener("contextmenu",ci))}}function Zi(i){const{x:t,y:e}=i.center,{clientWidth:n,clientHeight:o}=i.target,s=i.target.getBoundingClientRect(),r=new F.Vector2(t,e).sub(new F.Vector2(s.left,s.top)),a=new F.Vector2(r.x/n*2-1,-(r.y/o)*2+1);return{point:r,ndcPoint:a}}function qi(i,t){const e=Zi(t).ndcPoint,n=new F.Raycaster;return n.setFromCamera(e,i.camera),i.model.intersectRaycaster(n)}class ui extends di{constructor(e){var o;super(e);m(this,"type","edit");m(this,"polyline");m(this,"pressPoint");m(this,"hasAppendDashed",!1);m(this,"hasAppendMouseGroup",!1);m(this,"fiveElement");m(this,"lastPoint",null);m(this,"hammer");m(this,"onIntersectionUpdate",_i((e,n)=>{var s;this.hasAppendMouseGroup===!1&&(this.group.add(this.mouseGroup),this.magnifier.appendTo(this.container),this.magnifier.enable(),this.hasAppendMouseGroup=!0);const o=this.updateMouseGroup(e,n).position;(s=this.pressPoint)==null||s.position.copy(o),this.updateDashed(),requestAnimationFrame(()=>this.magnifier.renderWithPoint(this.mouseGroup.position)),this.five.needsRender=!0},20));m(this,"revoke",()=>{if(this.polyline.lines.length===0&&this.lastPoint){this.lastPoint=null,this.hasAppendDashed=!1,this.dashed.distanceItem.remove(),this.group.remove(this.dashed.mesh),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.needsRender=!0;return}if(this.polyline.lines.length===0&&!this.lastPoint||!this.lastPoint)return;const e=this.polyline.lines[this.polyline.lines.length-1],n=e.findAnotherPoint(this.lastPoint);!n||(this.lastPoint=n,this.hook.emit("anchorChange",n.position),this.group.remove(e.mesh),this.polyline.removeLine(e),this.hasAppendMouseGroup=!1,this.mouseGroup.position.copy(this.lastPoint.position),this.group.remove(this.mouseGroup),e.distanceItem.remove(),this.updateDashed(),this.magnifier.disable(),this.five.needsRender=!0)});m(this,"onMouseLeave",()=>{this.magnifier.disable(),this.group.remove(this.mouseGroup),this.hasAppendMouseGroup=!1,this.lastPoint&&(this.mouseGroup.position.copy(this.lastPoint.position),this.updateDashed())});m(this,"onLineChanged",()=>{this.hook.emit("editedPolylineChange",this.polyline)});m(this,"onPress",e=>{const[n]=qi(this.five,e);if(!(n!=null&&n.face))return;const o=new Xe(n.point);this.pressPoint=o,this.onIntersectionUpdate(n)});m(this,"onPan",e=>{if(!this.pressPoint)return;const[n]=qi(this.five,e);!(n!=null&&n.face)||this.onIntersectionUpdate(n)});m(this,"onPanEnd",e=>{!this.pressPoint||this.onTap(e)});m(this,"onTap",e=>{this.hasAppendDashed||(this.dashed.distanceItem.appendTo(this.container),this.group.add(this.dashed.mesh)),this.hasAppendDashed=!0;const[n]=qi(this.five,e);this.updateMouseGroup(n);const o=new Xe(this.mouseGroup.position),s=this.lastPoint;if(o&&(this.lastPoint=o),o&&s){const r=new Qt(s,o,this.model);r.distanceItem.setItemSelectable(!1),r.distanceItem.appendTo(this.container),this.polyline.addLine(r),this.group.add(r.mesh),r.distanceItem.update(this.five)}this.pressPoint=void 0,this.hasAppendMouseGroup=!1,this.magnifier.disable(),this.group.remove(this.mouseGroup),this.updateDashed(),this.five.needsRender=!0,this.hook.emit("anchorChange",o.position)});m(this,"onWantsTapGesture",()=>!1);m(this,"onWantsToMoveToPano",()=>!1);m(this,"onWantsPanGesture",()=>this.pressPoint?!1:void 0);m(this,"onCameraUpdate",()=>{this.updateDistanceUI(),this.dashed.distanceItem.update(this.five)});m(this,"updateDashed",()=>{!this.lastPoint||(this.dashed.points[0].position.copy(this.lastPoint.position),this.dashed.points[1].position.copy(this.mouseGroup.position),this.dashed.mesh.setPoints(this.lastPoint.position,this.mouseGroup.position),this.dashed.distanceItem.update(this.five),this.hook.emit("editedDashedLineChange",this.dashed))});this.model=new li(this.config),this.polyline=new ai({model:this.model}),this.model.addPolyline(this.polyline),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsPanGesture",this.onWantsPanGesture),this.five.on("wantsTapGesture",this.onWantsTapGesture),this.five.on("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.on("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.on("lineAdded",this.onLineChanged),this.polyline.hook.on("lineRemoved",this.onLineChanged);const n=this.five.getElement();if(n){this.fiveElement=n;const s=new dn.default(n);this.hammer=s,s.on("tap",this.onTap),s.on("pan",this.onPan),s.on("press",this.onPress),s.on("panend",this.onPanEnd)}this.five.helperVisible=!1,(o=this.fiveElement)==null||o.addEventListener("mouseleave",this.onMouseLeave),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.refresh()}dispose(){var e,n;super.dispose(),this.five.helperVisible=!0,this.group.remove(this.mouseGroup,this.dashed.mesh),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.onWantsPanGesture),this.five.off("wantsTapGesture",this.onWantsTapGesture),this.five.off("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.off("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.off("lineAdded",this.onLineChanged),this.polyline.hook.off("lineRemoved",this.onLineChanged),(e=this.hammer)==null||e.destroy(),(n=this.fiveElement)==null||n.removeEventListener("mouseleave",this.onMouseLeave),this.magnifier.dispose(),this.dashed.distanceItem.remove(),this.five.needsRender=!0}getEditingLines(){return this.polyline.lines}}class cr extends di{constructor(e){super(e);m(this,"type","view");m(this,"hammer");m(this,"polylineRemoved",e=>{e.lines.forEach(n=>this.removeLine(n)),this.hook.emit("selectedChange",this.model.getAllLines().filter(n=>n.selected).map(n=>n))});m(this,"polylineAdded",e=>{const n=this.five.getCurrentState().panoIndex;e.lines.forEach(o=>{e.visiblePanoIndexes&&!e.visiblePanoIndexes.includes(n)&&(o.mesh.visible=!1),o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)})});m(this,"onCameraUpdate",()=>{this.updateDistanceUI()});m(this,"onFivePanoWillArrive",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)||n.lines.forEach(o=>{o.mesh.visible=!1,o.distanceItem.update(this.five)})})});m(this,"onFivePanoArrived",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)&&n.lines.forEach(o=>{o.mesh.visible=!0,o.distanceItem.update(this.five)})})});this.model.getAllLines().forEach(o=>{o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)});const n=this.five.getElement();if(n){const o=new dn.default(n);this.hammer=o}this.updateDistanceUI(),this.five.needsRender=!0,this.model.hook.on("polylineAdded",this.polylineAdded),this.model.hook.on("polylineRemoved",this.polylineRemoved),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive)}dispose(){var e;super.dispose(),this.model.hook.off("polylineAdded",this.polylineAdded),this.model.hook.off("polylineRemoved",this.polylineRemoved),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.needsRender=!0,this.hook.emit("selectedChange",[]),(e=this.hammer)==null||e.destroy()}}const Qf=`
208
+ `,w=document.createElement("div");return w.setAttribute("class","PanoRulerPlugin-rule"),w.setAttribute("data-name",A),w.setAttribute("style","display: none"),w.innerHTML=v,w},o=document.createElement("div");o.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML=$u,o.appendChild(s);const r={},a=(A,g)=>{if(e.loaded)throw new Error("\u6807\u5C3A\u88AB\u91CD\u590D\u521D\u59CB\u5316\uFF01");const v=tf(A,i),w=i.work;if(!w)return!1;for(const y in g){const I=g[y],{standingPosition:E}=w.observers[0],C=I.map(({x:L,z:D,observers:T})=>{const N=T.length>0?A.rooms[A.observers[T[0]]].name:"",G=v[N]?v[N].floor:null;let X=1/0,j={index:0,x:E.x,y:E.y,z:E.z};T.forEach(_=>{if(!w.observers[_])return;const{standingPosition:q}=w.observers[_],ue={index:_,x:q.x,y:q.y,z:q.z},he=ef({x:L,z:D},ue);G?he<X&&Math.abs(ue.y-G)<.3&&(X=he,j=ue):he<X&&(X=he,j=ue)});const P=new F.Vector3(L,j.y,D);Object.assign(P,{observers:T});const O=v[N]?v[N].roof:null,R=O?new F.Vector3(L,O,D):null;return R&&Object.assign(R,{observers:T}),{origin:P,vertical:R}});r[y]={origins:C.map(L=>L.origin),rules:[]};for(const{origin:L,vertical:D}of C){if(!D)continue;const T=n(y,L.distanceTo(D));o.append(T),r[y].rules.push({vertical:!0,rule:[L,D],$element:T})}for(let L=0;L<C.length;L++){let D=L+1;D>=C.length&&(D=0);const{origin:T}=C[L],{origin:N}=C[D],G=n(y,T.distanceTo(N));o.append(G),r[y].rules.push({vertical:!1,rule:[T,N],$element:G})}}return e.loaded=!0,!0},l=(A,g,v)=>U(this,null,function*(){const w=A||t.roomInfo,y=g||t.roomRules;if(!w||!y)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");return e.loaded=!1,e.options=H(H({},e.options),v||{}),i.model.loaded?a(w,y):yield new Promise(I=>i.once("modelLoaded",()=>I(a(w,y))))});t.roomInfo&&t.roomRules&&l(t.roomInfo,t.roomRules);const c=(A,g,v,w)=>{const y=[[{x:0,y:0},{x:v,y:0}],[{x:0,y:0},{x:0,y:w}],[{x:v,y:0},{x:v,y:w}],[{x:0,y:w},{x:v,y:w}]],I=[];for(let E=0;E<y.length;E++){const C=Ks([A,g],[y[E][0],y[E][1]],!0);C&&I.push(C)}return I.length===0?!1:I},d=()=>{var T;const A=(T=i.getElement())==null?void 0:T.parentElement;if(!A||!e.loaded||Object.keys(r).length<=0)return;const{panoIndex:g,camera:v,currentMode:w}=i;if(g===void 0)return;let y;for(const N in r)N.split(",").indexOf(g.toString())>=0&&(y=N);if(!y){for(const N in r)for(const{$element:G}of r[N].rules)G.style.display="none";return}const I=v.position,E=v.getWorldDirection(new F.Vector3),C=A.clientWidth,L=A.clientHeight;if(w!==fe.Five.Mode.Panorama){for(const N in r)for(const{$element:G}of r[N].rules)G.style.display="none";return}for(const N in r)for(const{$element:G}of r[N].rules)G.style.display=N===y?"block":"none";const[D]=r[y].origins.slice().filter(N=>N.observers.indexOf(g)>=0).sort((N,G)=>{const X=N.clone().setY(0).sub(I).normalize().angleTo(E.clone().setY(0)),j=G.clone().setY(0).sub(I).normalize().angleTo(E.clone().setY(0));return X-j});for(const{rule:N,vertical:G,$element:X}of r[y].rules){const[j,P]=N,O=X.querySelector(".PanoRulerPlugin-rule-line");if(!O)return;if(!D){X.style.display="none";continue}if(j!==D&&P!==D){X.style.display="none";continue}if(j.distanceTo(P)<.3){X.style.display="none";continue}if(j.observers.indexOf(g)===-1||P.observers.indexOf(g)===-1){X.style.display="none";continue}if(j.clone().sub(I).normalize().angleTo(E)>Math.PI/2){X.style.display="none";continue}if(P.clone().sub(I).normalize().angleTo(E)>Math.PI/2){X.style.display="none";continue}const Z=j.distanceTo(P);if(P.clone().sub(P.clone().sub(j).divide(new F.Vector3(2,2,2))).distanceTo(I)/Z>8){X.style.display="none";continue}const ue=j.clone().project(v),he=(ue.x+1)/2*C,Ae=(-ue.y+1)/2*L,ke=P.clone().project(v),Ve=(ke.x+1)/2*C,Fe=(-ke.y+1)/2*L,ce=Math.sqrt(Math.pow(Ve-he,2)+Math.pow(Fe-Ae,2));let ye=ce,Ee=50;const de=c({x:~~he,y:~~Ae},{x:~~Ve,y:~~Fe},C,L);if(de&&de.length===1&&(D===j?(ye=Math.sqrt(Math.pow(de[0].x-he,2)+Math.pow(de[0].y-Ae,2)),Ee=ye/ce*50):D===P&&(ye=Math.sqrt(Math.pow(de[0].x-Ve,2)+Math.pow(de[0].y-Fe,2)),Ee=100-ye/ce*50)),de&&de.length===2){const Dt={x:(de[0].x+de[1].x)/2,y:(de[0].y+de[1].y)/2};Ee=Math.sqrt(Math.pow(Dt.x-he,2)+Math.pow(Dt.y-Ae,2))/ce*100}const Nt=(Math.PI/2-Math.atan2(Ve-he,Ae-Fe))/Math.PI*180,be=O.querySelector(".PanoRulerPlugin-rule-label"),xt=be.children[0].clientWidth;xt>=ce||xt/2>=Ee/100*ce||xt/2>=(1-Ee/100)*ce?O.style.display="none":(O.style.display="block",O.style.width=ce+"px",O.style.left=he+"px",O.style.top=Ae+"px",O.style.transform=`rotate(${-Nt}deg)`,be.style.left=`${Ee}%`)}},f=()=>$s(d),u=()=>{var A,g;return e.loaded?(e.enable||(o.setAttribute("class","PanoRulerPlugin"+(e.options.className?" "+e.options.className:"")),(g=(A=i.getElement())==null?void 0:A.parentElement)==null||g.append(o),d(),i.on("modeChange",d),i.on("cameraUpdate",f),e.enable=!0),!0):!1},h=()=>(e.enable&&(i.off("modeChange",d),i.off("cameraUpdate",f),o&&o.remove(),e.enable=!1),!0);function p(A){if(A.distanceText&&A.distanceText!==e.options.distanceText){const g=A.distanceText;e.options.distanceText=g,Object.values(r).forEach(v=>{v.rules.forEach(w=>{const[y,I]=w.rule,E=y.distanceTo(I),C=w.$element.querySelector(".PanoRulerPlugin-rule-label-name");!C||(C.innerText=g(E))})})}}return{enable:u,disable:h,load:l,state:e,changeConfigs:p}};function of(i){le(i,"svelte-1h27ktp",".PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp.svelte-1h27ktp::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-1h27ktp-viewport-rule-point 0.1s 1.5s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-1h27ktp em.svelte-1h27ktp{display:block;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-1h27ktp.svelte-1h27ktp{display:flex;height:0.0625rem;animation:svelte-1h27ktp-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;align-items:center}.em-solid.svelte-1h27ktp.svelte-1h27ktp{height:100%;background:#ffffff}.em-dotted.svelte-1h27ktp.svelte-1h27ktp{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-1h27ktp.svelte-1h27ktp{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-1h27ktp.svelte-1h27ktp{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;animation:svelte-1h27ktp-viewport-rule-label 0.25s ease 1s;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@keyframes svelte-1h27ktp-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-1h27ktp-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-1h27ktp-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}")}function er(i,t,e){const n=i.slice();return n[6]=t[e],n}function sf(i){let t,e=i[0].children,n=[];for(let o=0;o<e.length;o+=1)n[o]=tr(er(i,e,o));return{c(){t=V("div");for(let o=0;o<n.length;o+=1)n[o].c();b(t,"class","rule-mixed-line svelte-1h27ktp")},m(o,s){B(o,t,s);for(let r=0;r<n.length;r+=1)n[r].m(t,null)},p(o,s){if(s&9){e=o[0].children;let r;for(r=0;r<e.length;r+=1){const a=er(o,e,r);n[r]?n[r].p(a,s):(n[r]=tr(a),n[r].c(),n[r].m(t,null))}for(;r<n.length;r+=1)n[r].d(1);n.length=e.length}},d(o){o&&z(t),lt(n,o)}}}function rf(i){let t,e;return{c(){t=V("em"),b(t,"class",e=Oe(i[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3])},m(n,o){B(n,t,o)},p(n,o){o&1&&e!==(e=Oe(n[0].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),o&8&&b(t,"style",n[3])},d(n){n&&z(t)}}}function tr(i){let t,e,n=`${i[6].width}px`;return{c(){t=V("div"),b(t,"class",e=Oe(i[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp"),b(t,"style",i[3]),M(t,"width",n)},m(o,s){B(o,t,s)},p(o,s){s&1&&e!==(e=Oe(o[6].state?"em-solid":"em-dotted")+" svelte-1h27ktp")&&b(t,"class",e),s&8&&b(t,"style",o[3]),s&1&&n!==(n=`${o[6].width}px`)&&M(t,"width",n)},d(o){o&&z(t)}}}function af(i){let t,e,n,o,s=i[0].labelElement+"",r,a,l=`${i[0].labelOffset}%`,c=`${i[0].width}px`,d=`${i[0].left}px`,f=`${i[0].top}px`,u=`rotate(${i[0].rotateDeg}deg)`;function h(g,v){return g[0].children.length===0?rf:sf}let p=h(i),A=p(i);return{c(){t=V("div"),A.c(),e=te(),n=V("div"),o=V("div"),r=Ie(s),b(o,"class","PanoRulerPlugin-rule-label-name svelte-1h27ktp"),Se(()=>i[4].call(o)),b(n,"class","PanoRulerPlugin-rule-label svelte-1h27ktp"),M(n,"left",l),b(t,"class","PanoRulerPlugin-rule-line svelte-1h27ktp"),M(t,"width",c),M(t,"left",d),M(t,"top",f),M(t,"transform",u),M(t,"display",i[0].visible&&i[2]?"block":"none")},m(g,v){B(g,t,v),A.m(t,null),Q(t,e),Q(t,n),Q(n,o),Q(o,r),a=At(o,i[4].bind(o))},p(g,[v]){p===(p=h(g))&&A?A.p(g,v):(A.d(1),A=p(g),A&&(A.c(),A.m(t,e))),v&1&&s!==(s=g[0].labelElement+"")&&Le(r,s),v&1&&l!==(l=`${g[0].labelOffset}%`)&&M(n,"left",l),v&1&&c!==(c=`${g[0].width}px`)&&M(t,"width",c),v&1&&d!==(d=`${g[0].left}px`)&&M(t,"left",d),v&1&&f!==(f=`${g[0].top}px`)&&M(t,"top",f),v&1&&u!==(u=`rotate(${g[0].rotateDeg}deg)`)&&M(t,"transform",u),v&5&&M(t,"display",g[0].visible&&g[2]?"block":"none")},i:J,o:J,d(g){g&&z(t),A.d(),a()}}}function lf(i,t,e){let n,{rulerItemProp:o}=t,s=!0,r,a="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=";function l(){r=this.offsetWidth,e(1,r)}return i.$$set=c=>{"rulerItemProp"in c&&e(0,o=c.rulerItemProp)},i.$$.update=()=>{i.$$.dirty&3&&(r>=o.width||r/2>=o.labelOffset/100*o.width||r/2>=(1-o.labelOffset/100)*o.width?e(2,s=!1):e(2,s=!0))},e(3,n=`--background-image: url(${a})`),[o,r,s,n,l]}class cf extends se{constructor(t){super(),oe(this,t,lf,af,ie,{rulerItemProp:0},of)}}function nr(i,t,e){const n=i.slice();return n[12]=t[e],n}function ir(i){let t,e;return t=new cf({props:{rulerItemProp:i[12]}}),{c(){ee(t.$$.fragment)},m(n,o){K(t,n,o),e=!0},p(n,o){const s={};o&1&&(s.rulerItemProp=n[12]),t.$set(s)},i(n){e||(k(t.$$.fragment,n),e=!0)},o(n){S(t.$$.fragment,n),e=!1},d(n){$(t,n)}}}function df(i){let t,e,n=i[0],o=[];for(let r=0;r<n.length;r+=1)o[r]=ir(nr(i,n,r));const s=r=>S(o[r],1,1,()=>{o[r]=null});return{c(){t=V("div");for(let r=0;r<o.length;r+=1)o[r].c()},m(r,a){B(r,t,a);for(let l=0;l<o.length;l+=1)o[l].m(t,null);e=!0},p(r,[a]){if(a&1){n=r[0];let l;for(l=0;l<n.length;l+=1){const c=nr(r,n,l);o[l]?(o[l].p(c,a),k(o[l],1)):(o[l]=ir(c),o[l].c(),k(o[l],1),o[l].m(t,null))}for(re(),l=n.length;l<o.length;l+=1)s(l);ae()}},i(r){if(!e){for(let a=0;a<n.length;a+=1)k(o[a]);e=!0}},o(r){o=o.filter(Boolean);for(let a=0;a<o.length;a+=1)S(o[a]);e=!1},d(r){r&&z(t),lt(o,r)}}}function uf(i,t,e){var A,g,v,w;let{five:n}=t,{rulerDatas:o}=t,{options:s}=t,r=[];const a=((g=(A=n.getElement())==null?void 0:A.parentElement)==null?void 0:g.clientWidth)||0,l=((w=(v=n.getElement())==null?void 0:v.parentElement)==null?void 0:w.clientHeight)||0,c=(y,I)=>{const E=[[{x:0,y:0},{x:a,y:0}],[{x:0,y:0},{x:0,y:l}],[{x:a,y:0},{x:a,y:l}],[{x:0,y:l},{x:a,y:l}]],C=[];for(let L=0;L<E.length;L++){const D=Ks([y,I],[E[L][0],E[L][1]],!0);D&&C.push(D)}return C.length===0?!1:C},d=(y,I)=>{const E=y.clone().project(n.camera),C=(E.x+1)/2*a,L=(-E.y+1)/2*l,D=I.clone().project(n.camera),T=(D.x+1)/2*a,N=(-D.y+1)/2*l,G=Math.sqrt(Math.pow(T-C,2)+Math.pow(N-L,2));return{startLeft:C,startTop:L,endLeft:T,endTop:N,distance:G}},f=(y,I,E)=>{const C=n.camera.position,L=n.camera.getWorldDirection(new F.Vector3),D=y.clone().sub(C).normalize().angleTo(L),T=I.clone().sub(C).normalize().angleTo(L),N=y.distanceTo(I),X=I.clone().sub(I.clone().sub(y).divide(new F.Vector3(2,2,2))).distanceTo(C),{startLeft:j,startTop:P,endLeft:O,endTop:R,distance:W}=d(y,I),_=-((Math.PI/2-Math.atan2(O-j,P-R))/Math.PI)*180;let q=!0;E||(q=!1),!qe(y,E)&&!qe(I,E)&&(q=!1),N<.3&&(q=!1),D>Math.PI/2&&(q=!1),T>Math.PI/2&&(q=!1),X/N>8&&(q=!1);let ue=50,he=W;const Ae=c({x:~~j,y:~~P},{x:~~O,y:~~R});if(Ae&&Ae.length===1&&(qe(y,E)?(he=Math.sqrt(Math.pow(Ae[0].x-j,2)+Math.pow(Ae[0].y-P,2)),ue=he/W*50):qe(I,E)&&(he=Math.sqrt(Math.pow(Ae[0].x-O,2)+Math.pow(Ae[0].y-R,2)),ue=100-he/W*50)),Ae&&Ae.length===2){const ke={x:(Ae[0].x+Ae[1].x)/2,y:(Ae[0].y+Ae[1].y)/2};ue=Math.sqrt(Math.pow(ke.x-j,2)+Math.pow(ke.y-P,2))/W*100}return{startLeft:j,startTop:P,distance:W,deg:_,visible:q,labelOffset:ue,ruleLength:N}},u=()=>{const y=n.panoIndex,I=o.find(G=>G.panoIndex===y);if(!I)return e(0,r=[]);if(n.currentMode!==fe.Five.Mode.Panorama)return e(0,r=[]);const E=n.camera.position,C=n.camera.getWorldDirection(new F.Vector3),L=I.lines.map(G=>new F.Vector3(G.start[0],-G.start[1],-G.start[2])),D=I.lines.map(G=>new F.Vector3(G.end[0],-G.end[1],-G.end[2])),[T]=L.concat(D).sort((G,X)=>{const j=G.clone().setY(0).sub(E).normalize().angleTo(C.clone().setY(0)),P=X.clone().setY(0).sub(E).normalize().angleTo(C.clone().setY(0));return j-P}),N=I.lines.map(G=>{var he,Ae;const X=G.start,j=G.end,{startLeft:P,startTop:O,distance:R,deg:W,visible:Z,labelOffset:_,ruleLength:q}=f(new F.Vector3(X[0],-X[1],-X[2]),new F.Vector3(j[0],-j[1],-j[2]),T),ue=[];return G.children&&((he=G.children)==null?void 0:he.length)>0&&((Ae=G.children)==null||Ae.forEach(ke=>{const Ve=ke.start,Fe=ke.end,{distance:ce}=d(new F.Vector3(Ve[0],-Ve[1],-Ve[2]),new F.Vector3(Fe[0],-Fe[1],-Fe[2]));ue.push({width:ce,state:ke.state})})),{width:R,left:P,top:O,rotateDeg:W,state:G.state,children:ue,labelOffset:_,visible:Z,labelElement:s.distanceText(q)}});e(0,r=N)},h=()=>$n(u),p=_i(u,80);return Je(()=>{u(),n.on("panoArrived",u),n.on("modeChange",u),n.on("cameraDirectionUpdate",h),n.on("movingToPano",h),n.on("mouseWheel",()=>p()),n.on("pinchGesture",()=>p())}),bt(()=>{n.off("panoArrived",u),n.off("modeChange",u),n.off("cameraDirectionUpdate",h),n.off("movingToPano",h),n.off("mouseWheel",()=>p()),n.off("pinchGesture",()=>p())}),i.$$set=y=>{"five"in y&&e(1,n=y.five),"rulerDatas"in y&&e(2,o=y.rulerDatas),"options"in y&&e(3,s=y.options)},[r,n,o,s]}class ff extends se{constructor(t){super(),oe(this,t,uf,df,ie,{five:1,rulerDatas:2,options:3})}}class hf{constructor(t,e){m(this,"five");m(this,"container",document.createElement("div"));m(this,"panoRulerProData");m(this,"rulerItems");m(this,"state",{enabled:!1,loaded:!1,options:{className:"",distanceText:t=>`${t.toFixed(1)}m`}});var n,o;this.five=t,this.container.classList.add("panoRulerProPlugin-container"),this.container.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;"),e&&(e.data&&this.load(e.data),this.state.options=H(H({},this.state.options),e.options||{}),(n=e.options)!=null&&n.className&&this.container.classList.add((o=e.options)==null?void 0:o.className)),this.five.once("modelLoaded",()=>U(this,null,function*(){var s,r;(r=(s=this.five.getElement())==null?void 0:s.parentNode)==null||r.append(this.container)})),this.five.once("dispose",()=>this.dispose())}load(t){return U(this,null,function*(){if(!this.five.work)return;const e=t.data;if(!e)throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");this.panoRulerProData=e,this.state.loaded=!0})}enable(){return this.state.loaded?(this.state.enabled||(this.state.enabled=!0,this.render()),!0):!1}disable(){return this.state.enabled&&(this.state.enabled=!1,this.render()),!0}render(){return U(this,null,function*(){var t;if(this.state.enabled){if(!this.panoRulerProData||!this.container)return;this.rulerItems=new ff({target:this.container,props:{five:this.five,rulerDatas:this.panoRulerProData,options:this.state.options}})}else(t=this.rulerItems)==null||t.$destroy(),this.rulerItems=void 0})}dispose(){this.container&&(this.rulerItems.$destroy(),this.rulerItems=void 0),this.container.remove()}}const mf=(i,t)=>new hf(i,t),pf="data:image/png;base64,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";function gf(){const i=document.createElement("div"),t=document.createElement("i"),e=document.createElement("span");return i.appendChild(t),i.appendChild(e),i.style.position="relative",i.style.width="100%",i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="center",i.style.marginTop=`${150/16}rem`,i.style.opacity="0",i.style.transition="opacity 1000ms linear",t.style.display="block",t.style.width=`${134/16}rem`,t.style.height=`${22/16}rem`,t.style.backgroundSize="100%",t.style.backgroundRepeat="no-repeat",t.style.backgroundImage=`url(${pf})`,e.style.marginTop=`${10/16}rem`,e.style.fontSize=`${16/16}rem`,e.style.color="#fff",e.style.opacity="0.7",e.style.textShadow="0 2px 16px rgb(22 34 83 / 24%)",e.style.fontWeight="bold",{appendTo(n){n.appendChild(i)},dispose(){i.remove()},setRoom(n){e.innerHTML=n.name+" "+Math.floor(n.size/1e6)+"\u33A1"},show(){i.style.opacity="1"},hide(){i.style.opacity="0"}}}const Af=new x.TextureLoader;function or(i){return U(this,null,function*(){return new Promise((t,e)=>{Af.load(i,t,void 0,e)}).then(t=>(t.encoding=x.sRGBEncoding,t))})}const si={userAction:!0};class vf extends jt{constructor(e,n){super(e);m(this,"state",{visible:!0,enabled:!0,config:{compassImageUrl:"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",entryDoorImageUrl:"//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png"}});m(this,"data");m(this,"group",new x.Group);m(this,"roomInfoInstance");m(this,"roomInfoWrapperInstance");m(this,"compassMeshTween");m(this,"compassMesh");m(this,"entryDoorMesh");m(this,"dispose",()=>{var e,n,o,s;this.five.scene.remove(this.group),this.group.remove(...this.group.children),(n=(e=this.compassMesh)==null?void 0:e.material.map)==null||n.dispose(),(s=(o=this.entryDoorMesh)==null?void 0:o.material.map)==null||s.dispose(),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_addEventListener",()=>{this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_removeEventListener",()=>{this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)});m(this,"_enable",()=>{this.five.scene.add(this.group),this.init(),this.onFivePanoArrived(this.five.panoIndex||0),this._addEventListener()});m(this,"_disable",()=>{this._clearCompassIfNeed(),this._clearEntryDoorIfNeed(),this.five.scene.remove(this.group),this._removeEventListener()});m(this,"_toggleVisible",()=>{this.group.visible=this.state.visible,this.five.needsRender=!0});m(this,"_clearCompassIfNeed",()=>{var e;this.compassMesh&&(this.group.remove(this.compassMesh),(e=this.compassMesh.material.map)==null||e.dispose(),this.compassMesh=null)});m(this,"_clearEntryDoorIfNeed",()=>{var e;this.entryDoorMesh&&(this.group.remove(this.entryDoorMesh),(e=this.entryDoorMesh.material.map)==null||e.dispose(),this.entryDoorMesh=null),this.roomInfoInstance&&(this.roomInfoInstance.dispose(),this.roomInfoInstance=null),this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.dispose(),this.roomInfoWrapperInstance=null)});m(this,"onFivePanoWillArrive",e=>{var n,o;e!==this.five.panoIndex&&((n=this.compassMeshTween)==null||n.dispose(),(o=this.compassMesh)==null||o.material.setValues({opacity:0}))});m(this,"onFivePanoArrived",e=>{var o,s,r,a,l,c,d;const n=(r=(s=(o=this.five.work)==null?void 0:o.observers)==null?void 0:s[e])==null?void 0:r.standingPosition;if(this.compassMesh&&(this.compassMesh.position.copy(n.clone().setY(n.y+.01)),this.compassMesh.material.opacity===0&&((a=this.compassMeshTween)==null||a.dispose(),this.compassMeshTween=Xs(1e3).onUpdate(({progress:f})=>{var u;(u=this.compassMesh)==null||u.material.setValues({opacity:f}),this.five.needsRender=!0}).play())),this.entryDoorMesh){const u=new x.Vector3(this.data.entrance.position.x,this.data.entrance.position.y,this.data.entrance.position.z).clone().setY(n.y).sub(n).normalize(),h=n.clone().add(u.clone().multiplyScalar(.7)).setY(n.y+.01);this.entryDoorMesh.rotation.z=new x.Vector3(0,0,-1).angleTo(u),this.entryDoorMesh.position.copy(h),((l=this.data)==null?void 0:l.room_observers[e].room.type)===1?(c=this.entryDoorMesh)==null||c.material.setValues({opacity:1}):(d=this.entryDoorMesh)==null||d.material.setValues({opacity:0})}this.roomInfoInstance&&this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.position.copy(n.clone().setY(n.y+.01)),this.roomInfoInstance.setRoom(this.data.room_observers[e].room)),this.five.needsRender=!0});m(this,"onFiveCameraDirectionUpdate",({longitude:e,latitude:n})=>{var o,s;!this.roomInfoWrapperInstance||(this.roomInfoWrapperInstance.css3DObject.rotation.z=e,n>.66&&this.five.getCurrentState().mode==="Panorama"?(o=this.roomInfoInstance)==null||o.show():(s=this.roomInfoInstance)==null||s.hide())});m(this,"onFiveModeChange",(e,n,o,s,r)=>{e!==n&&this.setState({visible:e===fe.Five.Mode.Panorama},{userAction:r})});this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.setState({visible:!0,enabled:!0,config:H(H({},this.state.config),n||{})})}enable(e=si){this.setState({enabled:!0},e)}disable(e=si){this.setState({enabled:!1},e)}show(e=si){if(!!this.state.enabled)return this.setState({visible:!0},e),Promise.resolve()}hide(e=si){if(!!this.state.enabled)return this.setState({visible:!1},e),Promise.resolve()}setState(e,n={userAction:!0}){var s,r;const o=JSON.parse(JSON.stringify(this.state));this.state={visible:(s=e.visible)!=null?s:o.visible,enabled:(r=e.enabled)!=null?r:o.enabled,config:H(H({},o.config),e.config||{})},this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:n.userAction}),e.enabled===!0&&(this._enable(),this.hooks.emit("enable",n)),e.enabled===!1&&(this._disable(),this.hooks.emit("disable",n)),e.visible===!1&&(this._toggleVisible(),this.hooks.emit("hide",n)),e.visible===!0&&(this._toggleVisible(),this.hooks.emit("show",n)),e.config&&this.init()}load(e,n,o=!0){return U(this,null,function*(){const s=yield this.formatData(e);JSON.stringify(this.data)!==JSON.stringify(s)&&(this.hooks.emit("dataChange",s,this.data),this.data=H({},s),this.init(),n&&this.setState(n,{userAction:o}),this.hooks.emit("dataLoaded",this.data))})}formatData(e){return e.version&&e.data?Promise.resolve(e.data):Promise.resolve(e)}init(){return U(this,null,function*(){var o,s,r,a;const e=(s=(o=this.data)==null?void 0:o.north_rad)!=null?s:null;this._clearCompassIfNeed(),e!==null&&(this.compassMesh=yield this.loadCompassMesh(),this.compassMesh.rotateX(-Math.PI/2),this.compassMesh.rotateZ(e-Math.PI/2),this.group.add(this.compassMesh));const n=(a=(r=this.data)==null?void 0:r.entrance)!=null?a:null;this._clearEntryDoorIfNeed(),n!==null&&(this.entryDoorMesh=yield this.loadEntryDoorMesh(),this.roomInfoWrapperInstance=this.loadRoomInfo(),this.roomInfoInstance=gf(),this.entryDoorMesh.rotateX(-Math.PI/2),this.roomInfoWrapperInstance&&this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container),this.group.add(this.entryDoorMesh)),this.onFivePanoArrived(this.five.panoIndex||0),this.five.needsRender=!0})}loadCompassMesh(){return U(this,null,function*(){const e=this.state.config.compassImageUrl,n=yield or(e),o=new x.CircleGeometry(.7,32),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:0,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-mesh",r})}loadEntryDoorMesh(){return U(this,null,function*(){const e=this.state.config.entryDoorImageUrl,n=yield or(e),o=new x.PlaneGeometry(.2,.16),s=new x.MeshBasicMaterial({map:n,transparent:!0,opacity:.8,depthTest:!1}),r=new x.Mesh(o,s);return r.name="pano-compass-entry-door",r})}loadRoomInfo(){const e=[new x.Vector3(-.7,0,-.7),new x.Vector3(.7,0,-.7),new x.Vector3(.7,0,.7),new x.Vector3(-.7,0,.7)];return Jt(this.five).create3DDomContainer(e)}}const bf=(i,t)=>new vf(i,t);function ri(i,t,e){const n=i[t],o=i[e];n===void 0||o===void 0||(i[t]=o,i[e]=n)}function yf(i,t,e){const n=e/2;for(let o=1;o<=n;o++){const s=e-(o-1);for(let r=1;r<=t;r++){const a=(o-1)*t+r-1,l=(s-1)*t+r-1;ri(i,a*4+0,l*4+0),ri(i,a*4+1,l*4+1),ri(i,a*4+2,l*4+2),ri(i,a*4+3,l*4+3)}}}class sr{constructor(t,e){m(this,"width");m(this,"height");m(this,"containerDom");m(this,"hooks",new fe.Subscribe);m(this,"canvas",document.createElement("canvas"));m(this,"five");m(this,"scale");m(this,"config");m(this,"offset",{x:0,y:0});m(this,"context");m(this,"renderCenter",new x.Vector3);m(this,"hammer");m(this,"state",{enabled:!1});m(this,"offsetRange");m(this,"isPanning",!1);m(this,"onPanstart",()=>{this.isPanning=!0,this.canvas.style.boxShadow="0 2px 30px 0 rgba(0,0,0,0.20)"});m(this,"onPan",t=>{if(!this.isPanning||!this.offsetRange||this.hooks.emit("wantsPanGesture",t))return;const{translateX:n,translateY:o}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${n}px, ${o}px, 100px)`});m(this,"onPanend",t=>{if(this.isPanning=!1,this.canvas.style.boxShadow="none",!this.offsetRange)return;const{translateX:e,translateY:n}=this.getPanOffset(t,this.offsetRange);this.canvas.style.transform=`translate3d(${e}px, ${n}px, 100px)`,this.offset={x:e,y:n}});var o,s,r;if(!t.renderer)throw new Error("Five Render \u672A\u521D\u59CB\u5316");this.five=t,this.scale=(o=e==null?void 0:e.scale)!=null?o:2,this.width=(s=e==null?void 0:e.width)!=null?s:190,this.height=(r=e==null?void 0:e.height)!=null?r:190,this.config={dragEnabled:(e==null?void 0:e.dragEnabled)||!1,autoFixPCPosition:(e==null?void 0:e.autoFixPCPosition)||!1,initialPosition:(e==null?void 0:e.initialPosition)||{left:"0",top:"0"}};const n=this.canvas.getContext("2d");if(!n)throw new Error("CANNOT CREATE CONTEXT2D");this.context=n,this.config.dragEnabled&&(this.hammer=new dn.default(this.canvas),this.hammer.on("pan",this.onPan),this.hammer.on("panstart",this.onPanstart),this.hammer.on("panend",this.onPanend)),this.initStyle()}dispose(){var t;this.clear(),this.disable(),(t=this.hammer)==null||t.destroy()}enable(){if(!this.state.enabled)return this.state.enabled=!0,this.containerDom&&this._appendTo(this.containerDom),this}disable(){if(!!this.state.enabled)return this.state.enabled=!1,this.canvas.remove(),this}appendTo(t){return this.containerDom=t,this.state.enabled&&this._appendTo(t),this}clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}renderWithPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}renderWithScreenPoint(t){!this.containerDom||!this.state.enabled||(this.renderCenter=t,this.render(),this.config.autoFixPCPosition&&this.autoFixPCPosition())}resetOffset(){this.offset={x:0,y:0},this.canvas.style.transform=`translate3d(${0}px, ${0}px, 100px)`}getCurrentState(){return{enabled:this.state.enabled}}getRenderCenter(){return this.renderCenter}_appendTo(t){if(this.resetOffset(),t.appendChild(this.canvas),!this.offsetRange){const e=this.canvas.getBoundingClientRect(),n=t.getBoundingClientRect(),o=n.right-e.right,s=n.bottom-e.bottom,r=n.left-e.left,a=n.top-e.top;this.offsetRange={min:{x:r,y:a},max:{x:o,y:s}}}}autoFixPCPosition(){if(!this.containerDom)return;const{width:t,height:e}=this,[n,o,s]=(()=>{if(this.renderCenter instanceof x.Vector3){const r=this.renderCenter.clone().project(this.five.camera);return[(r.x+1)/2*this.containerDom.clientWidth,-(r.x-1)/2*this.containerDom.clientWidth,-(r.y-1)/2*this.containerDom.clientHeight]}else return[this.renderCenter.x,this.containerDom.clientWidth-this.renderCenter.x,this.renderCenter.y]})();n<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=90+"px"):s<183?(this.canvas.style.top=90+"px",this.canvas.style.left=-t/2+"px"):o<183?(this.canvas.style.top=-e/2+"px",this.canvas.style.left=-t-90+"px"):(this.canvas.style.left=-t/2+"px",this.canvas.style.top=-e-90+"px"),this.canvas.style.transform=`translate3d(${n}px, ${s}px, 10px)`,this.offset={x:n,y:s}}render(){if(!this.five.renderer||!this.containerDom)return;const{scale:t,context:e,width:n,height:o}=this,s=this.five.renderer.getSize(new x.Vector2),[r,a]=(()=>{if(this.renderCenter instanceof x.Vector3){const g=this.renderCenter.clone().project(this.five.camera);return[(g.x+1)/2*s.x,(g.y+1)/2*s.y]}else return[this.renderCenter.x,s.y-this.renderCenter.y]})(),l=1,c=n/t,d=o/t,f=l*t,u=this.five.getPixels(r-c/2,a-c/2,c,d,f),h=Math.floor(n*l),p=Math.floor(o*l);yf(u,h,p);const A=new ImageData(h,p);A.data.set(u),e.putImageData(A,0,0)}initStyle(){const t=this.canvas;t.classList.add("five-plugin__magnifier"),t.style.position="absolute",t.style.pointerEvents="all",t.style.borderRadius="50%",t.style.zIndex="99";const e=1;t.setAttribute("width",(this.width*e).toString()),t.setAttribute("height",(this.height*e).toString()),t.style.border="2px solid rgba(255,255,255,0.20)",t.style.width=this.width+"px",t.style.height=this.height+"px",t.style.top=this.config.initialPosition.top,t.style.left=this.config.initialPosition.left,t.style.transform="translate(0,0,100px)",this.config.dragEnabled&&(this.canvas.style.cursor="pointer")}getPanOffset(t,e){const{min:{x:n,y:o},max:{x:s,y:r}}=e,a=this.offset.x+t.deltaX,l=this.offset.y+t.deltaY,c=Math.min(Math.max(a,n),s),d=Math.min(Math.max(l,o),r);return{translateX:c,translateY:d}}}class wf{constructor(t){m(this,"edges",[]);m(this,"five");m(this,"onModelLoaded",()=>{!this.five.model||(this.edges=this.five.model.getEdges())});this.five=t,this.five.model.loaded?this.onModelLoaded():this.five.on("modelLoaded",this.onModelLoaded)}dispose(){}getAdsorbentPoint(t){if(this.edges.length===0)return null;let e=1/0,n;return this.edges.forEach(o=>{const s=o.closestPointToPoint(t.point,!0,new F.Vector3),r=s.distanceTo(t.point);r<e&&(n=s,e=r)}),e>.1?null:n||null}}function Cf(i,t){for(let e=0,n=t.length;e<n;e++)if(i===t[e])return t.splice(e,1)[0]}class Xe{constructor(t){m(this,"id");m(this,"lines");m(this,"position");m(this,"type","point");this.id=He(),this.lines=[],this.position=new F.Vector3,t instanceof F.Vector3?this.position.copy(t):this.position.fromArray(t)}toJson(){return{id:this.id,position:this.position.toArray()}}addLine(t){this.lines.push(t)}removeLine(t){Cf(t,this.lines)}clone(){return new Xe(this.position)}}class ai{constructor(t){m(this,"id",He());m(this,"lines",[]);m(this,"points",[]);m(this,"visiblePanoIndexes");m(this,"model");m(this,"type","polyline");m(this,"hook",new fe.Subscribe);this.model=t.model}addLine(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0\u7EBF\u6BB5"));return}const e=this.getLastPoint(),n=e&&t.findAnotherPoint(e);e?e&&n?(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t)):console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u65E0\u6CD5\u4E0E\u5F53\u524D\u6298\u7EBF\u8FDB\u884C\u8FDE\u63A5")):(this.lines.push(t),this.points.push(...t.points),this.hook.emit("lineAdded",t))}removeLine(t){if(this.lines.length!==0){if(!this.isLastLine(t)){console.error(new Error("\u4F20\u5165\u7EBF\u6BB5\u4E0D\u662F\u5F53\u524D\u6298\u7EBF\u7684\u6700\u540E\u4E00\u6BB5"));return}this.lines.pop(),this.lines.length===0?this.points.slice(0,this.points.length):this.points.pop(),this.hook.emit("lineRemoved",t)}}isLastLine(t){const e=this.getLastLine();return e?t.id===e.id:!1}getLastLine(){return this.lines.slice(-1)[0]}clear(){this.lines.slice(0,this.lines.length),this.points.slice(0,this.points.length)}overlapWith(t){return t.type==="point"?this.includes(t):t.type==="line"?t.points.some(e=>this.includes(e)):t.type==="polyline"?t.points.some(e=>this.includes(e)):!0}includes(t){return t.type==="point"?this.points.find(({id:e})=>e===t.id)!==void 0:t.type==="line"?this.lines.find(({id:e})=>e===t.id)!==void 0:!1}isEmpty(){return this.points.length===0}getLastPoint(){return this.points.slice(-1)[0]}toJson(){return{id:this.id,lines:this.lines.map(t=>t.toJson()),visiblePanoIndexes:this.visiblePanoIndexes}}getPointByID(t){return this.points.find(({id:e})=>e===t)}fromJson(t){this.clear(),this.id=t.id;const{getPoint:e,getAllPoints:n}=r(),o=t.lines.map(a=>{const[l,c]=a.points,d=e(l),f=e(c);if(!d||!f)throw new Error("\u7EBF\u4E0A\u7684\u70B9\u4E0D\u5B58\u5728");const u=new Qt(d,f,this.model);return u.id=a.id,u.text=a.text,u}),s=n();this.points.push(...s),this.lines.push(...o),this.visiblePanoIndexes=t.visiblePanoIndexes;function r(){const a=new Map;function l(d){const f=a.get(d.id);if(f)return f;const u=new Xe(d.position);return u.id=d.id,a.set(d.id,u),u}function c(){return Array.from(a.values())}return{getPoint:l,getAllPoints:c}}return this}replace(t){this.id=t.id,this.clear(),this.lines.push(...t.lines),this.points.push(...t.points)}}const Pf=1,If=3,Ef=new F.Color(16777215),kf=new F.Color(6522623),xf=new F.Color(16777215),Df=new F.Color(6522623),Lf=6,Sf=8,Mf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==",rr=new F.TextureLoader().load(Mf),ar={pointTexture:rr,pointSize:Lf,lineWidth:Pf,lineColor:Ef,pointColor:xf,lineRenderOrder:20,pointsRenderOrder:20};pe(H({},ar),{dashed:!0});const zf={pointTexture:rr,pointSize:Sf,lineWidth:If,lineColor:kf,pointColor:Df,lineRenderOrder:10,pointsRenderOrder:10};function Bf(i,t,e){var d,f,u,h,p;const n=(d=e==null?void 0:e.lineWidth)!=null?d:2,o=(f=e==null?void 0:e.lineColor)!=null?f:new F.Color(16777215),s=(u=e==null?void 0:e.pointSize)!=null?u:5,r=(h=e==null?void 0:e.lineRenderOrder)!=null?h:10,a=(p=e==null?void 0:e.lineRenderOrder)!=null?p:20,l=new Pn.Line(i,t);l.setMaterial({linewidth:n,color:o}),l.line.material.depthTest=!1,l.line.material.transparent=!0,l.line.renderOrder=r,l.points.renderOrder=a;const c=l.points.material;return c.depthTest=!1,c.size=s,e!=null&&e.pointColor&&c.color.set(e.pointColor).convertSRGBToLinear(),e!=null&&e.pointTexture&&(c.map=e.pointTexture),l}function lr(i,t){const[e,n]=i.points,o=t==="light"?zf:ar,s=Bf(e.position,n.position,o);return s.name="normalLine_"+i.id,s}function It(i){const{x:t,y:e,z:n}=i;return!(Math.abs(t)>1||Math.abs(e)>1||Math.abs(n)>1)}function Tf(){const i=document.createElement("div");return i.setAttribute("style","backdrop-filter: blur(4px);-webkit-backdrop-filter: blur(4px);-webkit-tap-highlight-color: rgba(0,0,0,0);"),i.style.width="max-content",i.style.padding="3px 6px",i.style.lineHeight="1",i.style.textAlign="center",i.style.transform="translate(-50%, -50%)",i.style.borderRadius="100px",i.style.fontSize="14px",i.style.color="#fff",i.style.background="rgba(195,195,195,0.70)",i.style.border="0.5px solid rgba(255,255,255,0.6)",i.style.cursor="pointer",i}function Vf(i){const t=document.createElement("div");return t.id="distance_"+i.id,t.classList.add("five-plugin-measure__distance"),t.style.opacity="0",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="0",t.style.height="0",t.style.transform="translate3d(0, 0, 0)",t.style.transformOrigin="left top",t}function jf(i){let t=!0;const{line:e}=i,n=e.id,o=Tf(),s=Vf(e),r=i.userDistanceItem,a=new F.Vector3(0,0,0),l={lineID:n,ndcPosition:a,update:u,appendTo:h,remove:p,highlight:d,unHighlight:f,getCurrentContent:A,setItemSelectable:g};s.style.pointerEvents=t?"all":"none",r!=null&&r.element?s.appendChild(r.element):s.appendChild(o);function c(){var v;(v=i.clickCallback)==null||v.call(i,l)}function d(){if(r)return r.highlight();o.style.border="0.5px solid #95AEFF",o.style.background="linear-gradient(90deg, #95AEFF 0%, #6386FF 100%)"}function f(){if(r)return r.unHighlight();o.style.border="0.5px solid rgba(255,255,255,0.6)",o.style.background="rgba(195,195,195,0.70)"}function u(v){if(e.mesh.visible===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const w=v.getElement();if(!w)return;const y=w.clientWidth,I=w.clientHeight,E=y/2,C=I/2;if(e.points.length<2)return;const[L,D]=e.points,T=L.position.clone().project(v.camera),N=D.position.clone().project(v.camera),G=T.clone().lerp(N,.5),X=new F.Vector2(T.x*E,T.y*C),j=new F.Vector2(N.x*E,N.y*C),P=X.distanceTo(j);if((()=>!(Math.abs(T.z)>1||Math.abs(N.z)>1||!It(T)&&!It(N)||!It(G)||P===0))()===!1){s.style.opacity="0",s.style.pointerEvents="none";return}const R=(G.x+1)/2*y,W=-(G.y-1)/2*I,_=-(Math.atan((X.y-j.y)/(X.x-j.x))*180)/Math.PI,q=s.parentElement&&o.clientWidth>P?-20:0;s.style.transform=`translate(${R}px, ${W}px) rotate(${_}deg) translateY(${q}px)`,s.style.opacity="1",s.style.pointerEvents=t?"all":"none",r&&r.update({line:e,polyline:e.getPolyline()});const ue=A();o.innerText=ue}function h(v){v.appendChild(s),s.addEventListener("click",c)}function p(){o.removeEventListener("click",c),s.remove()}function A(){var L,D,T;if(e.points.length<2)return"";const[v,w]=e.points,y=v.position.clone().distanceTo(w.position),I=(L=i.line.text)!=null?L:i.line.model.config.defaultText,E=(T=(D=i.line.model.config)==null?void 0:D.getDistanceText)==null?void 0:T.call(D,y),C=I!=null?I:E;return C!=null?C:y.toFixed(2)+"m"}function g(v){t=v}return l}class Qt{constructor(t,e,n){m(this,"id");m(this,"selected",!1);m(this,"text");m(this,"type","line");m(this,"model");m(this,"mesh");m(this,"points");m(this,"lightMesh");m(this,"hook");m(this,"distanceItem");m(this,"polyline");var o;if(this.id=He(),this.model=n,t.id===e.id)throw new Error("\u65E0\u6548\u7684\u7EBF\u6BB5, \u4E00\u4E2A\u70B9\u65E0\u6CD5\u6784\u6210\u7EBF\u6BB5");typeof n.config.defaultText=="string"&&(this.text=n.config.defaultText),this.hook=new fe.Subscribe,this.points=[t,e],this.mesh=lr(this,"normal"),this.lightMesh=lr(this,"light"),this.distanceItem=jf({line:this,clickCallback:()=>this.hook.emit("selected",this),userDistanceItem:(o=this.model.config)!=null&&o.userDistanceItemCreator?this.model.config.userDistanceItemCreator():void 0}),t.lines.push(this),e.lines.push(this)}clear(){this.selected=!1,this.polyline=void 0}isEmpty(){return this.points.length===0}getPolyline(){if(this.polyline)return this.polyline;const t=this.model.polylines.find(e=>e.lines.includes(this));if(t)return this.polyline=t,t}findAnotherPoint(t){return this.points.find(({id:e})=>e!==t.id)}setText(t){this.text=t,this.hook.emit("textChanged",t)}toJson(){return{id:this.id,points:this.points.map(t=>t.toJson()),text:this.text}}clone(){const t=new Qt(this.points[0].clone(),this.points[1].clone(),this.model);return t.text=this.text,t}}class li{constructor(t){m(this,"config");m(this,"polylines",[]);m(this,"hook",new fe.Subscribe);this.config=t}addPolyline(t){if(this.includes(t)){console.error(new Error("\u4E0D\u80FD\u91CD\u590D\u6DFB\u52A0 polyline"));return}this.polylines.push(t),this.hook.emit("polylineAdded",t)}replacePolylineByID(t,e){const n=this.getPolylineByID(t);n==null||n.replace(e)}removePolyline(t){const e=this.polylines.findIndex(({id:n})=>n===t.id);if(e===-1){console.error(new Error("polyline \u4E0D\u5B58\u5728"));return}this.polylines.splice(e,1),this.hook.emit("polylineRemoved",t)}getPolylineByID(t){return this.polylines.find(e=>e.id===t)}getPolylineByLine(t){return this.polylines.find(e=>e.includes(t))}getLineByID(t){return this.getAllLines().find(e=>e.id===t)}getAllLines(){return this.polylines.map(t=>t.lines).flat(1)}getAllPoints(){return this.polylines.map(t=>t.points).flat(1)}includes(t){return this.polylines.find(({id:e})=>e===t.id)!==void 0}clear(){this.polylines.forEach(t=>this.hook.emit("polylineRemoved",t)),this.polylines.splice(0,this.polylines.length)}getClosestPoint(){}parse(t){this.clear(),this.polylines.push(...t.polylines.map(e=>new ai({model:this}).fromJson(e))),this.polylines.forEach(e=>this.hook.emit("polylineAdded",e))}toJson(){return{polylines:this.polylines.map(t=>t.toJson()).filter(t=>t.lines.length>0)}}}const ci=i=>i.preventDefault();class di{constructor(t){m(this,"model");m(this,"five");m(this,"group");m(this,"config");m(this,"dashed");m(this,"disposed",!1);m(this,"isMobile");m(this,"mouseGroup");m(this,"container");m(this,"fiveHelper");m(this,"hook");m(this,"magnifier");m(this,"userDistanceItemCreator");m(this,"updateDistanceUI",()=>{this.dashed.distanceItem.update(this.five),this.model.getAllLines().forEach(t=>t.distanceItem.update(this.five))});var n,o;this.five=t.five,this.hook=t.hook,this.model=t.model,this.config=t.config,this.magnifier=t.magnifier,this.container=t.container,this.fiveHelper=t.fiveHelper,this.isMobile=(o=(n=t.openParams)==null?void 0:n.isMobile)!=null?o:!1,this.userDistanceItemCreator=t.userDistanceItemCreator,this.group=t.group,this.mouseGroup=t.mouseGroup,this.dashed=new Qt(new Xe([0,0,0]),new Xe([0,0,0]),this.model),this.dashed.distanceItem.setItemSelectable(!1),this.dashed.mesh.setMaterial({dashed:!0,dashScale:100}),this.dashed.mesh.name="dashLine";const e=this.five.getElement();e&&(e.addEventListener("touchstart",ci),e.addEventListener("contextmenu",ci))}removeLine(t){this.group.remove(t.mesh,t.lightMesh),t.distanceItem.remove(),this.five.needsRender=!0}updateMouseGroup(t,e){if(!t)return this.mouseGroup;const n=this.fiveHelper.getAdsorbentPoint(t),o=n||t.point;if(this.mouseGroup.position.copy(o),e)this.mouseGroup.quaternion.copy(e.quaternion);else if(t.face){const r=t.face.normal.clone().multiplyScalar(.05),l=t.point.clone().add(r).clone().add(r);this.mouseGroup.lookAt(l)}return this.mouseGroup}dispose(){this.disposed=!0,this.magnifier.disable(),this.model.getAllLines().forEach(e=>this.removeLine(e));const t=this.five.getElement();t&&(t.removeEventListener("touchstart",ci),t.removeEventListener("contextmenu",ci))}}function Zi(i){const{x:t,y:e}=i.center,{clientWidth:n,clientHeight:o}=i.target,s=i.target.getBoundingClientRect(),r=new F.Vector2(t,e).sub(new F.Vector2(s.left,s.top)),a=new F.Vector2(r.x/n*2-1,-(r.y/o)*2+1);return{point:r,ndcPoint:a}}function qi(i,t){const e=Zi(t).ndcPoint,n=new F.Raycaster;return n.setFromCamera(e,i.camera),i.model.intersectRaycaster(n)}class ui extends di{constructor(e){var o;super(e);m(this,"type","edit");m(this,"polyline");m(this,"pressPoint");m(this,"hasAppendDashed",!1);m(this,"hasAppendMouseGroup",!1);m(this,"fiveElement");m(this,"lastPoint",null);m(this,"hammer");m(this,"onIntersectionUpdate",_i((e,n)=>{var s;this.hasAppendMouseGroup===!1&&(this.group.add(this.mouseGroup),this.magnifier.appendTo(this.container),this.magnifier.enable(),this.hasAppendMouseGroup=!0);const o=this.updateMouseGroup(e,n).position;(s=this.pressPoint)==null||s.position.copy(o),this.updateDashed(),requestAnimationFrame(()=>this.magnifier.renderWithPoint(this.mouseGroup.position)),this.five.needsRender=!0},20));m(this,"revoke",()=>{if(this.polyline.lines.length===0&&this.lastPoint){this.lastPoint=null,this.hasAppendDashed=!1,this.dashed.distanceItem.remove(),this.group.remove(this.dashed.mesh),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.needsRender=!0;return}if(this.polyline.lines.length===0&&!this.lastPoint||!this.lastPoint)return;const e=this.polyline.lines[this.polyline.lines.length-1],n=e.findAnotherPoint(this.lastPoint);!n||(this.lastPoint=n,this.hook.emit("anchorChange",n.position),this.group.remove(e.mesh),this.polyline.removeLine(e),this.hasAppendMouseGroup=!1,this.mouseGroup.position.copy(this.lastPoint.position),this.group.remove(this.mouseGroup),e.distanceItem.remove(),this.updateDashed(),this.magnifier.disable(),this.five.needsRender=!0)});m(this,"onMouseLeave",()=>{this.magnifier.disable(),this.group.remove(this.mouseGroup),this.hasAppendMouseGroup=!1,this.lastPoint&&(this.mouseGroup.position.copy(this.lastPoint.position),this.updateDashed())});m(this,"onLineChanged",()=>{this.hook.emit("editedPolylineChange",this.polyline)});m(this,"onPress",e=>{const[n]=qi(this.five,e);if(!(n!=null&&n.face))return;const o=new Xe(n.point);this.pressPoint=o,this.onIntersectionUpdate(n)});m(this,"onPan",e=>{if(!this.pressPoint)return;const[n]=qi(this.five,e);!(n!=null&&n.face)||this.onIntersectionUpdate(n)});m(this,"onPanEnd",e=>{!this.pressPoint||this.onTap(e)});m(this,"onTap",e=>{this.hasAppendDashed||(this.dashed.distanceItem.appendTo(this.container),this.group.add(this.dashed.mesh)),this.hasAppendDashed=!0;const[n]=qi(this.five,e);this.updateMouseGroup(n);const o=new Xe(this.mouseGroup.position),s=this.lastPoint;if(o&&(this.lastPoint=o),o&&s){const r=new Qt(s,o,this.model);r.distanceItem.setItemSelectable(!1),r.distanceItem.appendTo(this.container),this.polyline.addLine(r),this.group.add(r.mesh),r.distanceItem.update(this.five)}this.pressPoint=void 0,this.hasAppendMouseGroup=!1,this.magnifier.disable(),this.group.remove(this.mouseGroup),this.updateDashed(),this.five.needsRender=!0,this.hook.emit("anchorChange",o.position)});m(this,"onWantsTapGesture",()=>!1);m(this,"onWantsToMoveToPano",()=>!1);m(this,"onWantsPanGesture",()=>this.pressPoint?!1:void 0);m(this,"onCameraUpdate",()=>{this.updateDistanceUI(),this.dashed.distanceItem.update(this.five)});m(this,"updateDashed",()=>{!this.lastPoint||(this.dashed.points[0].position.copy(this.lastPoint.position),this.dashed.points[1].position.copy(this.mouseGroup.position),this.dashed.mesh.setPoints(this.lastPoint.position,this.mouseGroup.position),this.dashed.distanceItem.update(this.five),this.hook.emit("editedDashedLineChange",this.dashed))});this.model=new li(this.config),this.polyline=new ai({model:this.model}),this.model.addPolyline(this.polyline),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsPanGesture",this.onWantsPanGesture),this.five.on("wantsTapGesture",this.onWantsTapGesture),this.five.on("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.on("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.on("lineAdded",this.onLineChanged),this.polyline.hook.on("lineRemoved",this.onLineChanged);const n=this.five.getElement();if(n){this.fiveElement=n;const s=new dn.default(n);this.hammer=s,s.on("tap",this.onTap),s.on("pan",this.onPan),s.on("press",this.onPress),s.on("panend",this.onPanEnd)}this.five.helperVisible=!1,(o=this.fiveElement)==null||o.addEventListener("mouseleave",this.onMouseLeave),this.hook.emit("anchorChange",null),this.hook.emit("editedDashedLineChange",null),this.five.refresh()}dispose(){var e,n;super.dispose(),this.five.helperVisible=!0,this.group.remove(this.mouseGroup,this.dashed.mesh),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.onWantsPanGesture),this.five.off("wantsTapGesture",this.onWantsTapGesture),this.five.off("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.off("intersectionOnModelUpdate",this.onIntersectionUpdate),this.polyline.hook.off("lineAdded",this.onLineChanged),this.polyline.hook.off("lineRemoved",this.onLineChanged),(e=this.hammer)==null||e.destroy(),(n=this.fiveElement)==null||n.removeEventListener("mouseleave",this.onMouseLeave),this.magnifier.dispose(),this.dashed.distanceItem.remove(),this.five.needsRender=!0}getEditingLines(){return this.polyline.lines}}class cr extends di{constructor(e){super(e);m(this,"type","view");m(this,"hammer");m(this,"polylineRemoved",e=>{e.lines.forEach(n=>this.removeLine(n)),this.hook.emit("selectedChange",this.model.getAllLines().filter(n=>n.selected).map(n=>n))});m(this,"polylineAdded",e=>{const n=this.five.getCurrentState().panoIndex;e.lines.forEach(o=>{e.visiblePanoIndexes&&!e.visiblePanoIndexes.includes(n)&&(o.mesh.visible=!1),o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)})});m(this,"onCameraUpdate",()=>{this.updateDistanceUI()});m(this,"onFivePanoWillArrive",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)||n.lines.forEach(o=>{o.mesh.visible=!1,o.distanceItem.update(this.five)})})});m(this,"onFivePanoArrived",e=>{this.model.polylines.forEach(n=>{!n.visiblePanoIndexes||n.visiblePanoIndexes.includes(e)&&n.lines.forEach(o=>{o.mesh.visible=!0,o.distanceItem.update(this.five)})})});this.model.getAllLines().forEach(o=>{o.distanceItem.appendTo(this.container),o.distanceItem.update(this.five),this.group.add(o.mesh)});const n=this.five.getElement();if(n){const o=new dn.default(n);this.hammer=o}this.onFivePanoWillArrive(this.five.getCurrentState().panoIndex),this.onFivePanoArrived(this.five.getCurrentState().panoIndex),this.updateDistanceUI(),this.five.needsRender=!0,this.model.hook.on("polylineAdded",this.polylineAdded),this.model.hook.on("polylineRemoved",this.polylineRemoved),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive)}dispose(){var e;super.dispose(),this.model.hook.off("polylineAdded",this.polylineAdded),this.model.hook.off("polylineRemoved",this.polylineRemoved),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.needsRender=!0,this.hook.emit("selectedChange",[]),(e=this.hammer)==null||e.destroy()}}const Qf=`
209
209
  <svg class="fpm__delete-icon" width="16px" height="17px" viewBox="0 0 16 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
210
210
  <defs>
211
211
  <linearGradient x1="22.185491%" y1="100%" x2="66.8316686%" y2="6.67239121%" id="linearGradient-1">
@@ -527,7 +527,7 @@ void main() {
527
527
  width: 100%;
528
528
  height: 100%;
529
529
  z-index: 5;
530
- `,e.container.style.pointerEvents="none";const n=g=>(e.wrapper=g,g.appendChild(e.container),l(),!0),o=g=>{e.itemLabels=tm(g),l()},s=()=>(e.enabled||(e.enabled=!0,l()),!0),r=()=>(e.enabled&&(e.enabled=!1,l()),!0),a=()=>{d(),e.container.remove()},l=()=>{var g;if(!!e.wrapper){if(!e.enabled||!e.fiveModeEnabled){(g=e.app)==null||g.$destroy(),e.app=void 0;return}e.app?e.app.$set({five:i,itemLabels:e.itemLabels}):e.app=new em({target:e.container,props:{five:i,modelOcclusionEnable:e.modelOcclusionEnable,onlyVisibleInPanorama:e.onlyVisibleInPanorama,itemLabels:e.itemLabels,wrapper:e.wrapper,hooks:e.hooks,displayStrategyType:e.displayStrategyType,maxVisibleDistance:e.maxVisibleDistance}})}},c=()=>{i.on("modeChange",f),i.once("dispose",a)},d=()=>{i.off("modeChange",f)},f=g=>{if(g!==fe.Five.Mode.Panorama){e.fiveModeEnabled=!1,r();return}i.once("initAnimationEnded",()=>{e.fiveModeEnabled=!0,s()})};return c(),{appendTo:n,load:o,enable:s,disable:r,dispose:a,hooks:e.hooks}},om={name:"ItemLabelPlugin",version:0};class sm extends Kn{constructor(e){super(e);m(this,"state");m(this,"container");m(this,"enabled");this.five=e,this.five.once("dispose",this.dispose),this.enabled=!0,this.state=this.initState()}enable(e){this.enabled=!0,this.updateState(pe(H({},e),{userAction:!0}))}disable(e){this.enabled=!1,this.updateState(pe(H({},e),{userAction:!0}))}show(e){if(!!this.state.enabled)return this.setState(pe(H({},this.state),{visible:!0}),e),Promise.resolve()}hide(e){if(!!this.state.enabled)return this.setState(pe(H({},this.state),{visible:!1}),e),Promise.resolve()}dispose(){this.container.remove()}setState(e,n){if(!this.enabled)return;const o=H({},this.state);this.state=H(H(H({},this.state),e),n),this.stateChangedCallback(o,n)}get visible(){return this.five.state.mode===fe.Five.Mode.Panorama}appendTo(e){!this.enabled||(this.container=e,this.render())}updateState(e){this.setState(pe(H({},this.state),{enabled:this.enabled,visible:this.visible}),e)}}function rm(i){le(i,"svelte-wpy7pz",'.plugin-DoorLabelPlugin-item.svelte-wpy7pz.svelte-wpy7pz{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;transition:opacity 0.3s ease}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz{position:absolute;top:50%;left:50%;border-radius:0.125rem;background:rgba(0, 0, 0, 0.35);line-height:0.75rem;padding:0.375rem;white-space:nowrap;font-size:0.75rem;font-style:normal;color:white;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:transform ease 1s, background ease 0.3s, color ease 0.3s}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz::after{content:"";display:block;position:absolute;top:-0.0625rem;left:-0.0625rem;bottom:-0.0625rem;right:-0.0625rem;border-radius:0.125rem;border:0.0625rem solid rgba(0, 0, 0, 0);-o-border-image:url("//vrlab-image4.ljcdn.com/release/web/highlightCarouseal-border-image.14b51834.png") 4;border-image:url("//vrlab-image4.ljcdn.com/release/web/highlightCarouseal-border-image.14b51834.png") 4;transition:opacity ease 0.3s}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz:active,.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz:focus{background:rgba(0, 0, 0, 0.5);color:rgba(255, 255, 255, 0.5)}.plugin-DoorLabelPlugin-icon.svelte-wpy7pz.svelte-wpy7pz{background:url("//vrlab-image4.ljcdn.com/release/web/DoorLabel-icon.de1304ae.svg") no-repeat;background-size:100%;display:inline-block;width:0.625rem;height:0.625rem;margin-left:0.25rem;transform-origin:center}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].left.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].right.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].right.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].back.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].back.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].back.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].right.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].left.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].left.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz{color:#f9eac1}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{background:url("//vrlab-image4.ljcdn.com/release/web/arrow.6e8ec00e.svg") no-repeat}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz:active,.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz:focus{background:rgba(0, 0, 0, 0.5);color:rgba(249, 234, 193, 0.5)}')}function am(i){let t,e,n,o,s,r,a,l;return{c(){t=V("div"),e=V("div"),n=V("span"),n.textContent=`${i[8]}`,o=te(),s=V("i"),b(n,"class","plugin-DoorLabelPlugin-txt svelte-wpy7pz"),b(s,"class","plugin-DoorLabelPlugin-icon svelte-wpy7pz"),b(e,"class",r=Oe(Ue.default("plugin-DoorLabelPlugin-cnt",i[0].toward))+" svelte-wpy7pz"),b(e,"style",`transform: ${i[6]||"initial"};pointer-events: ${i[5]?"auto":"none"};opacity: ${i[5]?1:0}`),b(e,"data-camera-toward",i[7]),b(t,"style",`left: ${i[3]||0}%;top: ${i[4]||0}%;opacity: ${i[5]?1:0}`),b(t,"class","plugin-DoorLabelPlugin-item svelte-wpy7pz")},m(c,d){B(c,t,d),Q(t,e),Q(e,n),Q(e,o),Q(e,s),i[10](t),a||(l=Me(e,"click",i[9]),a=!0)},p(c,[d]){d&1&&r!==(r=Oe(Ue.default("plugin-DoorLabelPlugin-cnt",c[0].toward))+" svelte-wpy7pz")&&b(e,"class",r)},i:J,o:J,d(c){c&&z(t),i[10](null),a=!1,l()}}}function lm(i,t,e){let{props:n}=t,{onClick:o}=t,s,{left:r,top:a,inSight:l,transform:c,panoIndex:d,cameraToward:f,name:u}=n,h=0;const p=()=>{if(!r||!a||!l||!s)return;const v=s.current.clientWidth/window.innerWidth*100,w=s.current.clientHeight/window.innerHeight*100;if(r<=v/2||r>=100-v/2||a<=w/2||a>=100-w/2)return;d!==h&&(console.log("panoDoorLabelPlugin",d,"\u89E6\u53D1\u57CB\u70B9"),h=d)},A=v=>{o&&o()};function g(v){ze[v?"unshift":"push"](()=>{s=v,e(2,s)})}return i.$$set=v=>{"props"in v&&e(0,n=v.props),"onClick"in v&&e(1,o=v.onClick)},p(),[n,o,s,r,a,l,c,f,u,A,g]}class cm extends se{constructor(t){super(),oe(this,t,lm,am,ie,{props:0,onClick:1},rm)}}function dm(i,t){const e=Math.abs(i.top+i.height/2-t.top-t.height/2),n=Math.abs(i.left+i.width/2-t.left-t.width/2),o=(i.height+t.height)/2,s=(i.width+t.width)/2;return!(e>o&&n>s)}function um(i){const{camera:t}=i,e=t.getWorldDirection(new F.Vector3);let n=Math.atan(e.z/e.x)*180/Math.PI,o="";return e.x<0&&(n+=180),n<0&&(n+=360),n>315||n<=45?o="right":n>45&&n<=135?o="back":n>135&&n<=225?o="left":n>225&&n<=315&&(o="forward"),o}function fm(i,t){return Math.sqrt(Math.pow(i.z-t.z,2)+Math.pow(i.x-t.x,2))}function hm(i){const t=Math.PI/4;return i>-t&&i<=t?"left":i>t*3||i<=-t*3?"right":i>-t*3&&i<=-t?"forward":i>t&&i<=t*3?"back":""}const mm={userAction:!0};class pm extends sm{constructor(e){super(e);m(this,"MinVisibledistance",1.8);m(this,"MaxVisibledistance",5);m(this,"OffsetHeight",-1.3);m(this,"rooms");m(this,"floorplanServerData");m(this,"doorLabelItems");m(this,"visibleLabelMap",new Map);m(this,"labelItems",[]);m(this,"doorLabels");m(this,"roomObservers");m(this,"loadData",(e,n)=>{n&&(this.MaxVisibledistance=n.MaxVisibledistance,this.MinVisibledistance=n.MinVisibledistance,this.OffsetHeight=n.OffsetHeight),this.doorLabelItems&&this.doorLabelItems.length>0&&this.doorLabelItems.forEach(o=>{o.$destroy()}),this.labelItems=[],this.doorLabels=[],this.doorLabelItems=[],this.floorplanServerData=e,typeof this.five.ready=="function"?this.five.ready().then(()=>this.initData()):this.five.once("panoArrived",()=>{this.initData()})});m(this,"initRoomObservers",()=>{var s,r;const e=this.floorplanServerData.computed_data.floor_datas||[],o=(((r=(s=this.five)==null?void 0:s.work)==null?void 0:r.observers)||[]).map(a=>{const l=a.panoIndex,c=a.floorIndex,d=e==null?void 0:e.find(f=>f.floor_index===c);if(d){const f=d.rooms.find(u=>u.observer_indexs.includes(l));if(f)return{panoIndex:l,floorIndex:c,name:f.name}}}).filter(Boolean);this.roomObservers=o});m(this,"hideAllLabels",()=>{this.labelItems.forEach(e=>{e.visible=!1,e.inSight=!1}),this.render()});m(this,"fixDoorVisibleAndPosition",()=>{this.initRoomObservers();const{panoIndex:e}=this.five;if(!this.visible||this.five.model.empty||e===null||!this.roomObservers.find(a=>a.panoIndex===e))return;const n=this.roomObservers.find(a=>a.panoIndex===e),s=this.five.work.observers.find(a=>a.panoIndex===e).position.clone(),r=(()=>{if(this.visibleLabelMap.has(e))return this.visibleLabelMap.get(e);{const a=[];return this.doorLabels.forEach((l,c)=>{if(l.roomName===n.name)return;const d=l.position.clone(),f=d.distanceTo(s);if(f<this.MinVisibledistance||f>this.MaxVisibledistance)return;const u=new F.Raycaster,h=d.clone().sub(s).normalize();u.set(s,h);const[p]=this.five.model.intersectRaycaster(u);p&&p.distance+.1<f||a.push(c)}),this.visibleLabelMap.set(e,a),a}})();this.labelItems.forEach((a,l)=>{a.visible=r.includes(l)}),this.fixDoorPosition()});m(this,"fixDoorPosition",()=>{var d,f,u,h,p,A,g,v,w,y,I,E;const{panoIndex:e,camera:n}=this.five;if(e===null)return;if(this.five.currentMode!=="Panorama")return this.hideAllLabels();const o=this.five.getElement(),s=o.clientWidth,r=o.clientHeight,a=n.getWorldDirection(new F.Vector3),l=[],c=[...this.labelItems];if(c.forEach((C,L)=>{if(C.visible){const D=n.position.distanceTo(C.position),T=C.position.clone().add(new F.Vector3(0,this.OffsetHeight,0)),G=T.clone().sub(n.position).normalize().angleTo(a),X=T.clone().project(n),j=(X.x+1)/2.2*100,P=(-X.y+1)/2.2*100,O=j>=0&&j<=100&&P>=0&&P<=100&&D>this.MinVisibledistance&&D<=this.MaxVisibledistance;C.left=j,C.top=P,C.inSight=O&&G<Math.PI/2,C.cameraToward=um(this.five),O?l.push({disFromCameraToLabel:D,left:j,top:P,index:L}):C.transform="translate(-50%, -50%)"}else C.inSight=!1}),l.length>1){let C=0;l.sort((L,D)=>D.disFromCameraToLabel-L.disFromCameraToLabel);for(let L=1;L<l.length;L++){const{index:D,left:T,top:N}=l[L-1],{index:G,left:X,top:j}=l[L],P=this.container.children[D],O=this.container.children[G];if(!P||!O)return;const R={left:s*T/100,top:r*N/100,width:(u=(f=(d=P.children)==null?void 0:d[0])==null?void 0:f.clientWidth)!=null?u:0,height:(A=(p=(h=P.children)==null?void 0:h[0])==null?void 0:p.clientHeight)!=null?A:0},W={left:s*X/100,top:r*j/100,width:(w=(v=(g=O.children)==null?void 0:g[0])==null?void 0:v.clientWidth)!=null?w:0,height:(E=(I=(y=O.children)==null?void 0:y[0])==null?void 0:I.clientHeight)!=null?E:0};dm(R,W)&&(C++,c[D].transform=`translate(-50%, ${(C-1)*100-50}%)`,c[G].transform=`translate(-50%, ${C*100-50}%)`)}}this.labelItems=c,this.render()});m(this,"onClick",(e,n)=>{if(!this.roomObservers)return;const{work:o}=this.five;let s,r,a=1/0;for(const l of o.observers)if(this.roomObservers.find(d=>d.panoIndex===l.panoIndex&&d.name===e)){const d=l.standingPosition,f=n.distanceTo(d);f<a&&(s=l.panoIndex,r=d.clone().sub(n).normalize(),a=f)}if(r!==null&&s!==null){const l={};if(a>0){const d=new F.Vector3(0,0,-1),f=r.clone(),u=new F.Quaternion;u.setFromUnitVectors(d,f);const h=new F.Euler;h.setFromQuaternion(u,"YXZ"),l.longitude=h.y}this.five.emit("wantsToMoveToPano",s,{},!0)||this.five.moveToPano(s,{longitude:l.longitude})}});m(this,"initData",()=>{var s;this.doorLabels=[];const e=this.five.panoIndex,n=this.floorplanServerData.computed_data.observers[e].floor_index,o=n!==void 0&&((s=this.floorplanServerData.computed_data.floor_datas[n])==null?void 0:s.rooms);this.rooms=o,this.rooms&&this.rooms.length>0&&this.rooms.forEach(r=>{var c;const a=(c=this.floorplanServerData.computed_data.doors)==null?void 0:c.filter(d=>!!(d&&d.name===r.name)),l=this.five.work.observers.filter((d,f)=>!!r.observer_indexs.find(u=>u===f));a&&a.forEach(d=>{const f=d.position;let u=1/0,h;l.forEach(A=>{const g=A.standingPosition,v={x:g.x,y:g.y,z:g.z},w=fm(f,v);w<u&&(u=w,h=v)}),h&&(f.y=h.y+.01);const p=new F.Vector3(f.x,f.y,f.z);p.add(new F.Vector3(-.2,1.8,0).applyEuler(new F.Euler(0,d.rad,0))),this.doorLabels.push({roomName:r.name,name:d.name,position:p,toward:hm(d.rad)})})}),this.labelItems=this.doorLabels.map(r=>pe(H({},r),{left:0,top:0,visible:!1,inSight:!1,transform:"",cameraToward:""})),this.five.on("wantsToMoveToPano",this.hideAllLabels),this.five.on("modelLoaded",this.fixDoorVisibleAndPosition),this.five.on("panoArrived",this.fixDoorVisibleAndPosition),this.five.on("initAnimationEnded",this.fixDoorPosition),this.five.on("cameraUpdate",this.fixDoorPosition),this.five.on("mouseWheel",this.fixDoorPosition),this.five.on("pinchGesture",this.fixDoorPosition),this.fixDoorVisibleAndPosition()})}stateChangedCallback(e,n){if(this.hooks.hasListener("stateChange")){const o={state:this.state,prevState:e,userAction:n?n.userAction:mm.userAction};this.hooks.emit("stateChange",o)}}render(){if(!this.enabled){this.doorLabelItems&&this.doorLabelItems.length>0&&this.doorLabelItems.forEach(e=>{e==null||e.$destroy()}),this.doorLabels=void 0;return}this.doorLabelItems&&this.doorLabelItems.forEach(e=>{e.$destroy()}),this.doorLabelItems=[],this.labelItems.forEach(e=>{this.doorLabelItems.push(new cm({target:this.container,props:{props:e,onClick:()=>{this.onClick(e.name,e.position)}}}))})}initState(){return{enabled:!0,visible:!0}}dispose(){this&&this.five&&(this.five.off("wantsToMoveToPano",this.hideAllLabels),this.five.off("modelLoaded",this.fixDoorVisibleAndPosition),this.five.off("panoArrived",this.fixDoorVisibleAndPosition),this.five.off("initAnimationEnded",this.fixDoorPosition),this.five.off("cameraUpdate",this.fixDoorPosition),this.five.off("mouseWheel",this.fixDoorPosition),this.five.off("pinchGesture",this.fixDoorPosition),super.dispose())}}const gm=i=>new pm(i),Am=2,vm=3,bm=3,ym=2;function wm(i,t){var r,a,l;if(i.length<2)return console.warn("positionList length must be greater than 1"),[];const e=(r=t==null?void 0:t.unitWidth)!=null?r:.5,n=(a=t==null?void 0:t.unitHeight)!=null?a:.5,o=(l=t==null?void 0:t.skipPanoIndexMesh)!=null?l:!1,s=new x.CatmullRomCurve3(i,!1,"catmullrom",1);if(o){const c=Math.ceil(s.getLength()/n*1.5),d=s.getPoints(c),f=[];let u=0;const h=i;return h.forEach((p,A)=>{let g=0,v=99999999;d.forEach((C,L)=>{const D=C.distanceTo(p);D<v&&(g=L,v=D)});const w=d[g+1],y=w==null?void 0:w.distanceTo(p),I=d[g-1],E=I==null?void 0:I.distanceTo(p);if(g>u&&g-u>1){let C=g;I!==void 0&&E>.8&&(C=g+1),I!==void 0&&E>.2&&E<.3?C=g:v>.2&&v<.3&&(C=g+1);let L=u;if(w!==void 0&&y>.2&&y<.3?L=u+1:v>.2&&v<.3&&(L=u),d[L]&&d[L+1]){const N=h[A-1];if(N)if(N.equals(d[L]))L+=1;else{const G=new F.Vector3().subVectors(d[L+1],d[L]),X=new F.Vector3().subVectors(N,d[L]);G.angleTo(X)<Math.PI/2&&(L+=1)}}if(C<L||C-L<=1)return;const D=d.slice(L,C),T=Fr(D,e,n);f.push(T),u=g}}),f}else{const c=Math.ceil(s.getLength()),d=s.getPoints(c);return[Fr(d,e,n)]}}function Fr(i,t,e){const n=t/2,o=e/t,s=i.length,r=kl.default(i.map(v=>[v.x,v.z])),l=(i.length-1)*Am*vm,c=2*s,d=c*bm,f=c*ym,u=new Uint32Array(l),h=new Float32Array(d),p=new Float32Array(f);i.forEach((v,w)=>{});let A=0;for(let v=0;v<i.length;v++){const[w,y]=r[v][0],I=i[v],{x:E,y:C,z:L}=I,D=new F.Vector3(E+w*n,C+.05,L+y*n);h[v*6+0]=D.x,h[v*6+1]=D.y,h[v*6+2]=D.z;const T=new F.Vector3(E-w*n,C+.05,L-y*n);h[v*6+3]=T.x,h[v*6+4]=T.y,h[v*6+5]=T.z,A+=v>0?i[v-1].clone().sub(i[v]).length():0;const N=A/t/o;p[v*4+0]=0,p[v*4+1]=N,p[v*4+2]=1,p[v*4+3]=N,v!==i.length-1&&(u[v*6+0]=v*2+0,u[v*6+1]=v*2+2,u[v*6+2]=v*2+1,u[v*6+3]=v*2+2,u[v*6+4]=v*2+3,u[v*6+5]=v*2+1)}const g=new x.BufferGeometry;return g.setAttribute("position",new x.BufferAttribute(h,3)),g.setAttribute("uv",new x.BufferAttribute(p,2)),g.setIndex(new x.BufferAttribute(u,1)),g}function Cm(i){const t=new x.TextureLoader().load(i.textureUrl);return t.wrapS=t.wrapT=x.RepeatWrapping,t.encoding=x.sRGBEncoding,new x.MeshBasicMaterial({color:16777215,map:t,transparent:!0,opacity:.8})}function Pm(i){return!Ye(i)}function Ye(i){return i!=null}const Gr="v1.0.1",Hr="GuideLinePlugin",eo=`${Hr}@${Gr}`,Nr=i=>`${eo}--${i}`;class Wr extends jt{constructor(e,n){super(e,n);m(this,"state",{visible:!1,enabled:!0,disposed:!1});m(this,"data");m(this,"linesGroup");m(this,"disposedErrorLog",()=>{console.error(`${eo} is disposed`)});m(this,"actionWhenEnabled",e=>{if(this.state.enabled)return e()});Object.assign(window,{[`__${Hr}_DEBUG__`]:this})}load(e,n,o=!0){return U(this,null,function*(){const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.hooks.emit("dataChange",r,s),this.data=r,this.linesGroup&&this.five.scene.remove(this.linesGroup);const a=this.getLinesGroup(r.routes);!a||(this.linesGroup=a,yield this.waitFiveModelLoaded(),this.five.scene.add(a),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),n&&this.setState(n),this.five.needsRender=!0,this.hooks.emit("dataLoaded",r),console.log(`${eo} loaded`,r))})}formatData(e){return U(this,null,function*(){return typeof e=="object"&&e!==null&&e.version&&e.data?e.data:e})}show(e){return U(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return U(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return this.disposedErrorLog();const o=H({},this.state);this.state=H(H({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),qe(o,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0}),this.five.needsRender=!0)}handleEnable(e,n=!0){this.linesGroup&&(e?(this.five.scene.add(this.linesGroup),this.actionWhenEnabled(()=>this.hooks.emit("enable",{userAction:n}))):(this.five.scene.remove(this.linesGroup),this.hooks.emit("disable",{userAction:n})))}handleVisible(e,n=!0){this.linesGroup&&(e?(this.linesGroup.visible=!0,this.actionWhenEnabled(()=>this.hooks.emit("show",{userAction:n}))):(this.linesGroup.visible=!1,this.actionWhenEnabled(()=>this.hooks.emit("hide",{userAction:n}))))}handleDispose(){this.linesGroup&&this.five.scene.add(this.linesGroup)}getLinesGroup(e){const n=e.map(this.getLine.bind(this)).filter(Ye),o=new x.Group;if(o.name=Nr("route-group"),n.length!==0)return o.add(...n),o}getLine(e){var a,l,c,d;const n=new x.Group,o=e.panoIndexList.map(f=>{var u;return(u=this.five.work.observers[f])==null?void 0:u.standingPosition}).filter(Ye),s=wm(o,{skipPanoIndexMesh:(a=e.skipPanoIndexMesh)!=null?a:!0,unitWidth:(l=e.unitWidth)!=null?l:.6,unitHeight:(c=e.unitHeight)!=null?c:.4});if(!s)return;const r=Cm({textureUrl:(d=e.arrowTextureUrl)!=null?d:this.staticPrefix+"/release/web/arrow6.b6ce0c62.png"});return s.forEach(f=>{const u=new x.Mesh(f,r);u.name=Nr("route-line-mesh"),n.add(u)}),n}waitFiveModelLoaded(){return U(this,null,function*(){return new Promise(e=>{if(this.five.model.loaded){e();return}this.five.once("modelLoaded",()=>{e()})})})}}m(Wr,"lasestVersion",Gr);const _r=(i,t)=>new Wr(i,t);function Xr(i){const t=Math.abs(Math.cos(i.latitude));return new x.Vector3(-Math.sin(i.longitude)*t,-Math.sin(i.latitude),-Math.cos(i.longitude)*t)}function Im(i,t){const e=Xr(i),n=Xr(t);return e.angleTo(n)}const Em=i=>U(this,null,function*(){try{i().then(()=>{},()=>{}).catch(()=>{})}catch(t){}}),fi=Math.PI*2;function km(i){return i>=0&&i<fi?i:(i%fi+fi)%fi}function xm(i){return{longitude:km(-Math.atan2(i.x,-i.z)),latitude:-Math.asin(i.y/1)}}function Dm(i,t,e,n){const o=-i/e,s=i;return o*n+s}function Lm(i){return new Promise(t=>{setTimeout(()=>{t()},i)})}const Yr="v1.0.6",Ur="CruisePlugin",hi=`${Ur}@${Yr}`,Jr=()=>{console.error(`${hi} is disposed`)},Sm=()=>{console.warn(`${hi} is disabled`)},Mm=()=>{console.error(`${hi} is disabled`)},to=new Map;class no extends jt{constructor(e,n){super(e,n);m(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});m(this,"data");m(this,"config");m(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,disposers:[],modeChanging:!1});m(this,"GuideLine");this.config=n,Object.assign(window,{[`__${Ur}_DEBUG__`]:this});const o=this.setFiveLinearUpdateCamera.bind(this),s=this.setFiveOriginUpdateCamera.bind(this);this.hooks.on("play",o),this.hooks.on("broke",s),this.hooks.on("end",s),this.hooks.on("pause",s),this.privateState.disposers.push(()=>{this.hooks.off("play",o),this.hooks.off("broke",s),this.hooks.off("end",s),this.hooks.off("pause",s)})}load(e,n,o){return U(this,null,function*(){var d,f,u,h,p;if(this.state.disposed)return Jr();this.privateState.fiveOriginGetProgress||(f=(d=this.five.controller)==null?void 0:d.cameraMotion)!=null&&f.getProgress||(yield this.waitFiveLoaded(),this.privateState.fiveOriginGetProgress=(h=(u=this.five.controller)==null?void 0:u.cameraMotion)==null?void 0:h.getProgress),this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.data=r,this.hooks.emit("dataChange",r,s);let a=[],l;const c=this.data.keyframes.filter(A=>A.data.panoIndex!==void 0);c.filter((A,g)=>{var v;return A.data.panoIndex!==((v=c[g-1])==null?void 0:v.data.panoIndex)}).map(A=>A.data.panoIndex).forEach(A=>{var v,w;const g=(v=this.five.work.observers[A])==null?void 0:v.floorIndex;if(g!==void 0)if(l===g){const y=a.length-1;a[y]=[...(w=a[y])!=null?w:[],A]}else{l=g;const y=a.length;a[y]=[A]}}),this.GuideLine||(this.GuideLine=_r(this.five,this.config)),(p=this.GuideLine)==null||p.load({routes:a.map(A=>({panoIndexList:A}))}),this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed),n&&this.setState(n,{userAction:o}),console.log(`${hi} loaded`,r),this.hooks.emit("dataLoaded",r)})}play(e){this.setState({playing:!0},e)}playFrom(e){const{index:n,id:o,userAction:s}=e;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:n,playFromId:o})}playFromStart(e){return this.playFrom(pe(H({},e),{index:0}))}pause(e){this.setState({playing:!1},e)}show(e){return U(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return U(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return Jr();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return Mm();const o=H({},this.state);this.state=H(H({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),e.playing!==void 0&&e.playing!==o.playing&&this.changePlayState(e.playing,n),e.speed!==void 0&&e.speed!==o.speed&&this.changeSpeed(e.speed,n==null?void 0:n.userAction),qe(o,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0})}formatData(e){return U(this,null,function*(){this.five.work||(yield this.waitFiveLoaded());const n=this.five.work.observers,o=(()=>{const s=e;return typeof s=="object"&&s!==null&&s.version&&s.data?s.data:s})();if(o.keyframes)return{keyframesId:He(),keyframes:o.keyframes.map((s,r)=>{var c;const a=o.keyframes[r+1],l=(()=>!a||a.start===void 0||s.end===void 0?0:a.start-s.end)();return H({id:(c=s.uuid)!=null?c:He(),moveIndex:r,stay:l,index:r},s)})};if(o.panoIndexList){let s=[];const{moveEffect:r,moveToFirstPanoEffect:a,moveToFirstPanoDuration:l}=o;return this.privateState.moveToFirstPanoEffect=a,this.privateState.moveToFirstPanoDuration=l,o.panoIndexList.forEach((c,d)=>{const f=(()=>{var g,v,w,y;const u=o.panoIndexList.slice(d).find(I=>I!==c);if(u===void 0)return;const h=(g=n[c])==null?void 0:g.position,p=(v=n[u])==null?void 0:v.position;if(!p||!h||((w=n[c])==null?void 0:w.floorIndex)!==((y=n[u])==null?void 0:y.floorIndex))return;const A=new x.Vector3().subVectors(p,h);return xm(A)})();o.moveType===void 0||o.moveType==="justMove"?s.push({moveIndex:d,stay:o.stay,data:H({effect:"Move",panoIndex:c,moveEffect:r},f!=null?f:{})}):o.moveType==="moveAndRotate"&&(s.push({moveIndex:d,stay:o.stay,data:{effect:"Move",panoIndex:c,moveEffect:r}}),f&&s.push({moveIndex:d,stay:o.stay,data:H({effect:"Rotate",panoIndex:c},f)}))}),{keyframesId:He(),keyframes:s.map((c,d)=>H({id:He(),index:d},c))}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handleEnable(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.enable(),this.hooks.emit("enable",{userAction:n})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:n}),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}changePlayState(e,n){this.actionIfStateIsEnabled(()=>{var o;return this.hooks.emit("playStateChange",e?"playing":"pause",{userAction:(o=n==null?void 0:n.userAction)!=null?o:!0})}),e?this.handlePlay(n):this.handlePause(n),this.state.playing=e}handlePlay(e){return U(this,null,function*(){var h;const{data:n,state:o,privateState:s,hooks:r}=this;if(s.playing||!(n!=null&&n.keyframes)||(n==null?void 0:n.keyframes.length)===0)return;const a=He();s.playId=a,s.playing=!0,s.broke=!1;const l=n.keyframes,c=this.getPauseData();(e==null?void 0:e.notEmitEvent)!==!0&&r.emit("play",{userAction:(h=e==null?void 0:e.userAction)!=null?h:!0});let d=!1;const u=yield(()=>U(this,null,function*(){var p,A;if((e==null?void 0:e.playFromIndex)!==void 0)return e.playFromIndex;if((e==null?void 0:e.playFromId)!==void 0)return(p=this.data)==null?void 0:p.keyframes.findIndex(g=>g.id===e.playFromId);if(c!=null&&c.keyframeId){const g=(A=this.data)==null?void 0:A.keyframes.find(v=>v.id===c.keyframeId);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),g){if(g.data.effect==="Move")return g.index;if(g.data.effect==="Rotate"){const v=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(g,{duration:v}),d=!0,g.index+1}}}}))();this.clearPauseData();for(const p of l){if(s.broke||!o.playing||!s.playing||a!==s.playId)return;if(!(u!==void 0&&p.index<u))try{r.emit("playIndexChange",p.index,p),yield this.playKeyframe(p,{moveEffect:d===!1?s.moveToFirstPanoEffect:void 0,duration:d===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),p.stay&&(yield Lm(p.stay)),d===!1&&(d=!0)}catch(A){return Promise.resolve("broke")}}o.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),r.emit("end"),this.clearPauseData())})}handlePause(e){var r;const{state:n,privateState:o,hooks:s}=this;n.playing=!1,o.playing!==!1&&(o.playing=!1,this.setPauseData(),o.broke||this.forceInteruptUpdateCamera(),(e==null?void 0:e.notEmitEvent)!==!0&&s.emit("pause",{userAction:(r=e==null?void 0:e.userAction)!=null?r:!0}))}playKeyframe(e,n){return U(this,null,function*(){var s;const{privateState:o}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==e.id&&(this.privateState.currentPlayKeyframe={keyframe:e}),o.currentPlayQueue.push(this.getPlayPromise(e,n)),this.actionPromiseQueue()})}addInterruptListener(e){const n=()=>{this.privateState.modeChanging||e()},o=e;return this.five.once("gesture",o),this.five.once("wantsChangeMode",n),()=>{this.five.off("gesture",o),this.five.once("wantsChangeMode",n)}}getPlayPromise(e,n){return U(this,null,function*(){var s;const o=e.data;if(n.duration=(s=n==null?void 0:n.duration)!=null?s:e.start!==void 0&&e.end!==void 0?e.end-e.start:void 0,!!o)return new Promise((r,a)=>{let l=!1;this.addInterruptListener(()=>{if(!l)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),l=!0,a(new Error("play is interupted"))});try{if(l)return;const c=()=>{r(),l=!0};switch(o.effect){case"Move":this.move(o,n).then(c);break;case"Rotate":this.rotate(o,n).then(c);break;default:this.rotate(o,n).then(c)}}catch(c){}})})}actionPromiseQueue(){return U(this,null,function*(){const{privateState:e}=this;return new Promise((n,o)=>{if(e.currentPlayQueue.length===0){n();return}const s=e.currentPlayQueue.shift();if(!s){n();return}s.then(n,o)}).then(()=>e.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(e,n){return U(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode(e);else if(e.panoIndex!==this.five.panoIndex)yield this.changePano(e,n);else return Promise.resolve()})}rotate(e,n){return U(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode({mode:e.mode,panoIndex:e.panoIndex});else if(e.panoIndex&&e.panoIndex!==this.five.panoIndex)return yield this.changePano(e,n);yield this.updateCamera(e,n)})}updateCamera(e,n){return U(this,null,function*(){const{five:o,privateState:s,state:r}=this,a=(()=>{var u,h;const d=(u=r.config)==null?void 0:u.speedConfig,f=(h=e.rotateSpeed)!=null?h:d==null?void 0:d.rotateSpeed;if((d==null?void 0:d.rotateSpeedUnit)===void 0)return f;if(f!==void 0)return d.rotateSpeedUnit==="rad/ms"?f:f/1e3})(),l=(()=>{if(n.duration)return n.duration;if(a){const d=this.five.getCurrentState();return Im(d,e)/a}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=l);const c=this.getSpeededDuration(l);return new Promise(d=>{Em(()=>o.updateCamera(e,c)),setTimeout(()=>d(),c)})})}changePano(e,n){return U(this,null,function*(){const{five:o,privateState:s,state:r}=this;if(typeof e.panoIndex!="number"||e.panoIndex===o.panoIndex)return;const a=o.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var u,h;const d=(u=r.config)==null?void 0:u.speedConfig,f=(h=e.moveSpeed)!=null?h:d==null?void 0:d.moveSpeed;if((d==null?void 0:d.moveSpeedUnit)===void 0)return f;if(f!==void 0)return d.moveSpeedUnit==="m/ms"?f:f/1e3})(),c=(()=>{if(n!=null&&n.duration)return n.duration;if(l&&typeof o.panoIndex=="number"&&typeof e.panoIndex=="number"){const d=o.work.observers[o.panoIndex].position,f=o.work.observers[e.panoIndex].position;return d.distanceTo(f)/l}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(d=>{var f,u,h;o.moveToPano(e.panoIndex,{latitude:e.latitude,longitude:e.longitude,fov:e.fov,duration:this.getSpeededDuration(c),effect:(h=(u=n==null?void 0:n.moveEffect)!=null?u:(f=this.state.config)==null?void 0:f.moveEffect)!=null?h:e.moveEffect,moveCancelCallback:()=>d(),moveEndCallback:()=>d()}),a&&o.once("panoArrived",()=>d())}),a&&(this.privateState.modeChanging=!1)})}changeSpeed(e,n=!0){const{state:o,privateState:s,hooks:r}=this,{currentPlayKeyframe:a}=s;if(r.emit("speedChange",e,{userAction:n}),o.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getSpeededDuration(e){return e/this.state.speed}getProgress(){return this.five.controller.cameraMotion.progress}changeMode(e,n){return U(this,null,function*(){e.mode&&e.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(e.mode,e,n),this.privateState.modeChanging=!1)})}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return to.get((n=this.data)==null?void 0:n.keyframesId)}setPauseData(){var e,n,o,s;if((e=this.data)!=null&&e.keyframesId)return to.set((n=this.data)==null?void 0:n.keyframesId,{keyframeId:(o=this.privateState.currentPlayKeyframe)==null?void 0:o.keyframe.id,fiveState:this.five.getCurrentState(),duration:(s=this.privateState.currentPlayKeyframe)==null?void 0:s.originDuration,playedProgress:this.getProgress()})}clearPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return to.delete((n=this.data)==null?void 0:n.keyframesId)}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}handleDispose(){var e,n;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(e=this.GuideLine)==null||e.dispose(),this.GuideLine=void 0,(n=this.privateState.disposers)==null||n.forEach(o=>o==null?void 0:o())}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&Sm()}waitFiveLoaded(){return U(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}setFiveLinearUpdateCamera(){!this.privateState.fiveOriginGetProgress||(this.five.controller.cameraMotion.getProgress=e=>{const n=this.five.controller.cameraMotion,o=e-n.startTime;return o<0?0:o>=n.duration?1:1-Dm(1,n.startVelocity,n.duration,o)})}setFiveOriginUpdateCamera(){!this.privateState.fiveOriginGetProgress||(this.five.controller.cameraMotion.getProgress=this.privateState.fiveOriginGetProgress)}}m(no,"PluginVersion",Yr);const zm=i=>new no(i);function Bm(i){le(i,"svelte-xuejcm",".line.svelte-xuejcm{position:absolute;pointer-events:none}.line.vertical.svelte-xuejcm{transform:rotate(-90deg) translate3d(0.03125rem, 0, 0.625rem);transform-origin:0 0}.line.horizontal.svelte-xuejcm{transform:translate3d(0, -0.03125rem, 0.625rem)}.straight-line.svelte-xuejcm{display:block;width:100%;height:100%;overflow:visible}")}function Zr(i){let t,e,n,o,s,r,a,l=i[3]&&qr(i);return{c(){t=V("div"),e=ve("svg"),n=ve("defs"),o=ve("linearGradient"),s=ve("stop"),r=ve("stop"),l&&l.c(),b(s,"offset","25%"),b(s,"stop-color",i[5]),b(s,"stop-opacity","1"),b(r,"offset","100%"),b(r,"stop-color",i[5]),b(r,"stop-opacity","0.5"),b(o,"x1",.5),b(o,"y1",.5),b(o,"x2",i[8]),b(o,"y2",.5),b(o,"id",i[10]),b(o,"gradientUnits","userSpaceOnUse"),b(e,"class","straight-line svelte-xuejcm"),b(e,"viewBox",a="0 0 "+i[8]+" "+i[7]),b(e,"preserveAspectRatio","none"),b(t,"class","line svelte-xuejcm"),ne(t,"vertical",i[9]),ne(t,"horizontal",!i[9]),M(t,"width",i[8]+"px"),M(t,"height",i[7]+"px")},m(c,d){B(c,t,d),Q(t,e),Q(e,n),Q(n,o),Q(o,s),Q(o,r),l&&l.m(e,null)},p(c,d){d&32&&b(s,"stop-color",c[5]),d&32&&b(r,"stop-color",c[5]),d&256&&b(o,"x2",c[8]),c[3]?l?(l.p(c,d),d&8&&k(l,1)):(l=qr(c),l.c(),k(l,1),l.m(e,null)):l&&(re(),S(l,1,1,()=>{l=null}),ae()),d&384&&a!==(a="0 0 "+c[8]+" "+c[7])&&b(e,"viewBox",a),d&512&&ne(t,"vertical",c[9]),d&512&&ne(t,"horizontal",!c[9]),d&256&&M(t,"width",c[8]+"px"),d&128&&M(t,"height",c[7]+"px")},d(c){c&&z(t),l&&l.d()}}}function qr(i){let t,e,n,o,s;return{c(){t=ve("path"),b(t,"fill","none"),b(t,"stroke",e=i[4]?`url(#${i[10]})`:i[5]),b(t,"stroke-width",1),b(t,"d",i[6])},m(r,a){B(r,t,a),s=!0},p(r,a){i=r,(!s||a&48&&e!==(e=i[4]?`url(#${i[10]})`:i[5]))&&b(t,"stroke",e),(!s||a&64)&&b(t,"d",i[6])},i(r){s||(r&&Se(()=>{o&&o.end(1),n=Bt(t,Jn,{duration:i[2],delay:i[0],easing:gt}),n.start()}),s=!0)},o(r){n&&n.invalidate(),r&&(o=qt(t,Jn,{duration:i[2],delay:i[1],easing:gt})),s=!1},d(r){r&&z(t),r&&o&&o.end()}}}function Tm(i){let t,e=i[8]&&Zr(i);return{c(){e&&e.c(),t=me()},m(n,o){e&&e.m(n,o),B(n,t,o)},p(n,[o]){n[8]?e?e.p(n,o):(e=Zr(n),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:J,o:J,d(n){e&&e.d(n),n&&z(t)}}}function Vm(i,t,e){let n,o,s,r,{inDelay:a=0}=t,{outDelay:l=0}=t,{duration:c=1e3}=t,{unfolded:d}=t,{length:f}=t,{direction:u="horizontal"}=t,{useLinearColor:h=!1}=t,{color:p="white"}=t;const A=He();return i.$$set=g=>{"inDelay"in g&&e(0,a=g.inDelay),"outDelay"in g&&e(1,l=g.outDelay),"duration"in g&&e(2,c=g.duration),"unfolded"in g&&e(3,d=g.unfolded),"length"in g&&e(11,f=g.length),"direction"in g&&e(12,u=g.direction),"useLinearColor"in g&&e(4,h=g.useLinearColor),"color"in g&&e(5,p=g.color)},i.$$.update=()=>{i.$$.dirty&4096&&e(9,n=u==="vertical"),i.$$.dirty&2048&&e(8,o=f),i.$$.dirty&2048&&e(6,r=`M0.5 0.5 H ${f}`)},e(7,s=1),[a,l,c,d,h,p,r,s,o,n,A,f,u]}class io extends se{constructor(t){super(),oe(this,t,Vm,Tm,ie,{inDelay:0,outDelay:1,duration:2,unfolded:3,length:11,direction:12,useLinearColor:4,color:5},Bm)}}function jm(i){le(i,"svelte-faoauy",".shadow.svelte-faoauy{position:absolute}")}function Kr(i){let t,e,n,o,s;return{c(){t=V("div"),b(t,"class","shadow svelte-faoauy"),b(t,"style",e=`
530
+ `,e.container.style.pointerEvents="none";const n=g=>(e.wrapper=g,g.appendChild(e.container),l(),!0),o=g=>{e.itemLabels=tm(g),l()},s=()=>(e.enabled||(e.enabled=!0,l()),!0),r=()=>(e.enabled&&(e.enabled=!1,l()),!0),a=()=>{d(),e.container.remove()},l=()=>{var g;if(!!e.wrapper){if(!e.enabled||!e.fiveModeEnabled){(g=e.app)==null||g.$destroy(),e.app=void 0;return}e.app?e.app.$set({five:i,itemLabels:e.itemLabels}):e.app=new em({target:e.container,props:{five:i,modelOcclusionEnable:e.modelOcclusionEnable,onlyVisibleInPanorama:e.onlyVisibleInPanorama,itemLabels:e.itemLabels,wrapper:e.wrapper,hooks:e.hooks,displayStrategyType:e.displayStrategyType,maxVisibleDistance:e.maxVisibleDistance}})}},c=()=>{i.on("modeChange",f),i.once("dispose",a)},d=()=>{i.off("modeChange",f)},f=g=>{if(g!==fe.Five.Mode.Panorama){e.fiveModeEnabled=!1,r();return}i.once("initAnimationEnded",()=>{e.fiveModeEnabled=!0,s()})};return c(),{appendTo:n,load:o,enable:s,disable:r,dispose:a,hooks:e.hooks}},om={name:"ItemLabelPlugin",version:0};class sm extends Kn{constructor(e){super(e);m(this,"state");m(this,"container");m(this,"enabled");this.five=e,this.five.once("dispose",this.dispose),this.enabled=!0,this.state=this.initState()}enable(e){this.enabled=!0,this.updateState(pe(H({},e),{userAction:!0}))}disable(e){this.enabled=!1,this.updateState(pe(H({},e),{userAction:!0}))}show(e){if(!!this.state.enabled)return this.setState(pe(H({},this.state),{visible:!0}),e),Promise.resolve()}hide(e){if(!!this.state.enabled)return this.setState(pe(H({},this.state),{visible:!1}),e),Promise.resolve()}dispose(){this.container.remove()}setState(e,n){if(!this.enabled)return;const o=H({},this.state);this.state=H(H(H({},this.state),e),n),this.stateChangedCallback(o,n)}get visible(){return this.five.state.mode===fe.Five.Mode.Panorama}appendTo(e){!this.enabled||(this.container=e,this.render())}updateState(e){this.setState(pe(H({},this.state),{enabled:this.enabled,visible:this.visible}),e)}}function rm(i){le(i,"svelte-wpy7pz",'.plugin-DoorLabelPlugin-item.svelte-wpy7pz.svelte-wpy7pz{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;transition:opacity 0.3s ease}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz{position:absolute;top:50%;left:50%;border-radius:0.125rem;background:rgba(0, 0, 0, 0.35);line-height:0.75rem;padding:0.375rem;white-space:nowrap;font-size:0.75rem;font-style:normal;color:white;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:transform ease 1s, background ease 0.3s, color ease 0.3s}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz::after{content:"";display:block;position:absolute;top:-0.0625rem;left:-0.0625rem;bottom:-0.0625rem;right:-0.0625rem;border-radius:0.125rem;border:0.0625rem solid rgba(0, 0, 0, 0);-o-border-image:url("//vrlab-image4.ljcdn.com/release/web/highlightCarouseal-border-image.14b51834.png") 4;border-image:url("//vrlab-image4.ljcdn.com/release/web/highlightCarouseal-border-image.14b51834.png") 4;transition:opacity ease 0.3s}.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz:active,.plugin-DoorLabelPlugin-cnt.svelte-wpy7pz.svelte-wpy7pz:focus{background:rgba(0, 0, 0, 0.5);color:rgba(255, 255, 255, 0.5)}.plugin-DoorLabelPlugin-icon.svelte-wpy7pz.svelte-wpy7pz{background:url("//vrlab-image4.ljcdn.com/release/web/DoorLabel-icon.de1304ae.svg") no-repeat;background-size:100%;display:inline-block;width:0.625rem;height:0.625rem;margin-left:0.25rem;transform-origin:center}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].left.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].right.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=forward].right.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].back.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=right].back.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].back.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=left].forward.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].right.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(90deg)}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].left.svelte-wpy7pz .plugin-DoorLabelPlugin-txt.svelte-wpy7pz{order:1}.plugin-DoorLabelPlugin-cnt[data-camera-toward=back].left.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{transform:rotate(-90deg);margin-left:0;margin-right:0.25rem;order:0}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz{color:#f9eac1}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz .plugin-DoorLabelPlugin-icon.svelte-wpy7pz{background:url("//vrlab-image4.ljcdn.com/release/web/arrow.6e8ec00e.svg") no-repeat}.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz:active,.plugin-DoorLabelPlugin-cnt--customBrand.svelte-wpy7pz.svelte-wpy7pz:focus{background:rgba(0, 0, 0, 0.5);color:rgba(249, 234, 193, 0.5)}')}function am(i){let t,e,n,o,s,r,a,l;return{c(){t=V("div"),e=V("div"),n=V("span"),n.textContent=`${i[8]}`,o=te(),s=V("i"),b(n,"class","plugin-DoorLabelPlugin-txt svelte-wpy7pz"),b(s,"class","plugin-DoorLabelPlugin-icon svelte-wpy7pz"),b(e,"class",r=Oe(Ue.default("plugin-DoorLabelPlugin-cnt",i[0].toward))+" svelte-wpy7pz"),b(e,"style",`transform: ${i[6]||"initial"};pointer-events: ${i[5]?"auto":"none"};opacity: ${i[5]?1:0}`),b(e,"data-camera-toward",i[7]),b(t,"style",`left: ${i[3]||0}%;top: ${i[4]||0}%;opacity: ${i[5]?1:0}`),b(t,"class","plugin-DoorLabelPlugin-item svelte-wpy7pz")},m(c,d){B(c,t,d),Q(t,e),Q(e,n),Q(e,o),Q(e,s),i[10](t),a||(l=Me(e,"click",i[9]),a=!0)},p(c,[d]){d&1&&r!==(r=Oe(Ue.default("plugin-DoorLabelPlugin-cnt",c[0].toward))+" svelte-wpy7pz")&&b(e,"class",r)},i:J,o:J,d(c){c&&z(t),i[10](null),a=!1,l()}}}function lm(i,t,e){let{props:n}=t,{onClick:o}=t,s,{left:r,top:a,inSight:l,transform:c,panoIndex:d,cameraToward:f,name:u}=n,h=0;const p=()=>{if(!r||!a||!l||!s)return;const v=s.current.clientWidth/window.innerWidth*100,w=s.current.clientHeight/window.innerHeight*100;if(r<=v/2||r>=100-v/2||a<=w/2||a>=100-w/2)return;d!==h&&(console.log("panoDoorLabelPlugin",d,"\u89E6\u53D1\u57CB\u70B9"),h=d)},A=v=>{o&&o()};function g(v){ze[v?"unshift":"push"](()=>{s=v,e(2,s)})}return i.$$set=v=>{"props"in v&&e(0,n=v.props),"onClick"in v&&e(1,o=v.onClick)},p(),[n,o,s,r,a,l,c,f,u,A,g]}class cm extends se{constructor(t){super(),oe(this,t,lm,am,ie,{props:0,onClick:1},rm)}}function dm(i,t){const e=Math.abs(i.top+i.height/2-t.top-t.height/2),n=Math.abs(i.left+i.width/2-t.left-t.width/2),o=(i.height+t.height)/2,s=(i.width+t.width)/2;return!(e>o&&n>s)}function um(i){const{camera:t}=i,e=t.getWorldDirection(new F.Vector3);let n=Math.atan(e.z/e.x)*180/Math.PI,o="";return e.x<0&&(n+=180),n<0&&(n+=360),n>315||n<=45?o="right":n>45&&n<=135?o="back":n>135&&n<=225?o="left":n>225&&n<=315&&(o="forward"),o}function fm(i,t){return Math.sqrt(Math.pow(i.z-t.z,2)+Math.pow(i.x-t.x,2))}function hm(i){const t=Math.PI/4;return i>-t&&i<=t?"left":i>t*3||i<=-t*3?"right":i>-t*3&&i<=-t?"forward":i>t&&i<=t*3?"back":""}const mm={userAction:!0};class pm extends sm{constructor(e){super(e);m(this,"MinVisibledistance",1.8);m(this,"MaxVisibledistance",5);m(this,"OffsetHeight",-1.3);m(this,"rooms");m(this,"floorplanServerData");m(this,"doorLabelItems");m(this,"visibleLabelMap",new Map);m(this,"labelItems",[]);m(this,"doorLabels");m(this,"roomObservers");m(this,"loadData",(e,n)=>{n&&(this.MaxVisibledistance=n.MaxVisibledistance,this.MinVisibledistance=n.MinVisibledistance,this.OffsetHeight=n.OffsetHeight),this.doorLabelItems&&this.doorLabelItems.length>0&&this.doorLabelItems.forEach(o=>{o.$destroy()}),this.labelItems=[],this.doorLabels=[],this.doorLabelItems=[],this.floorplanServerData=e,typeof this.five.ready=="function"?this.five.ready().then(()=>this.initData()):this.five.once("panoArrived",()=>{this.initData()})});m(this,"initRoomObservers",()=>{var s,r;const e=this.floorplanServerData.computed_data.floor_datas||[],o=(((r=(s=this.five)==null?void 0:s.work)==null?void 0:r.observers)||[]).map(a=>{const l=a.panoIndex,c=a.floorIndex,d=e==null?void 0:e.find(f=>f.floor_index===c);if(d){const f=d.rooms.find(u=>u.observer_indexs.includes(l));if(f)return{panoIndex:l,floorIndex:c,name:f.name}}}).filter(Boolean);this.roomObservers=o});m(this,"hideAllLabels",()=>{this.labelItems.forEach(e=>{e.visible=!1,e.inSight=!1}),this.render()});m(this,"fixDoorVisibleAndPosition",()=>{this.initRoomObservers();const{panoIndex:e}=this.five;if(!this.visible||this.five.model.empty||e===null||!this.roomObservers.find(a=>a.panoIndex===e))return;const n=this.roomObservers.find(a=>a.panoIndex===e),s=this.five.work.observers.find(a=>a.panoIndex===e).position.clone(),r=(()=>{if(this.visibleLabelMap.has(e))return this.visibleLabelMap.get(e);{const a=[];return this.doorLabels.forEach((l,c)=>{if(l.roomName===n.name)return;const d=l.position.clone(),f=d.distanceTo(s);if(f<this.MinVisibledistance||f>this.MaxVisibledistance)return;const u=new F.Raycaster,h=d.clone().sub(s).normalize();u.set(s,h);const[p]=this.five.model.intersectRaycaster(u);p&&p.distance+.1<f||a.push(c)}),this.visibleLabelMap.set(e,a),a}})();this.labelItems.forEach((a,l)=>{a.visible=r.includes(l)}),this.fixDoorPosition()});m(this,"fixDoorPosition",()=>{var d,f,u,h,p,A,g,v,w,y,I,E;const{panoIndex:e,camera:n}=this.five;if(e===null)return;if(this.five.currentMode!=="Panorama")return this.hideAllLabels();const o=this.five.getElement(),s=o.clientWidth,r=o.clientHeight,a=n.getWorldDirection(new F.Vector3),l=[],c=[...this.labelItems];if(c.forEach((C,L)=>{if(C.visible){const D=n.position.distanceTo(C.position),T=C.position.clone().add(new F.Vector3(0,this.OffsetHeight,0)),G=T.clone().sub(n.position).normalize().angleTo(a),X=T.clone().project(n),j=(X.x+1)/2.2*100,P=(-X.y+1)/2.2*100,O=j>=0&&j<=100&&P>=0&&P<=100&&D>this.MinVisibledistance&&D<=this.MaxVisibledistance;C.left=j,C.top=P,C.inSight=O&&G<Math.PI/2,C.cameraToward=um(this.five),O?l.push({disFromCameraToLabel:D,left:j,top:P,index:L}):C.transform="translate(-50%, -50%)"}else C.inSight=!1}),l.length>1){let C=0;l.sort((L,D)=>D.disFromCameraToLabel-L.disFromCameraToLabel);for(let L=1;L<l.length;L++){const{index:D,left:T,top:N}=l[L-1],{index:G,left:X,top:j}=l[L],P=this.container.children[D],O=this.container.children[G];if(!P||!O)return;const R={left:s*T/100,top:r*N/100,width:(u=(f=(d=P.children)==null?void 0:d[0])==null?void 0:f.clientWidth)!=null?u:0,height:(A=(p=(h=P.children)==null?void 0:h[0])==null?void 0:p.clientHeight)!=null?A:0},W={left:s*X/100,top:r*j/100,width:(w=(v=(g=O.children)==null?void 0:g[0])==null?void 0:v.clientWidth)!=null?w:0,height:(E=(I=(y=O.children)==null?void 0:y[0])==null?void 0:I.clientHeight)!=null?E:0};dm(R,W)&&(C++,c[D].transform=`translate(-50%, ${(C-1)*100-50}%)`,c[G].transform=`translate(-50%, ${C*100-50}%)`)}}this.labelItems=c,this.render()});m(this,"onClick",(e,n)=>{if(!this.roomObservers)return;const{work:o}=this.five;let s,r,a=1/0;for(const l of o.observers)if(this.roomObservers.find(d=>d.panoIndex===l.panoIndex&&d.name===e)){const d=l.standingPosition,f=n.distanceTo(d);f<a&&(s=l.panoIndex,r=d.clone().sub(n).normalize(),a=f)}if(r!==null&&s!==null){const l={};if(a>0){const d=new F.Vector3(0,0,-1),f=r.clone(),u=new F.Quaternion;u.setFromUnitVectors(d,f);const h=new F.Euler;h.setFromQuaternion(u,"YXZ"),l.longitude=h.y}this.five.emit("wantsToMoveToPano",s,{},!0)||this.five.moveToPano(s,{longitude:l.longitude})}});m(this,"initData",()=>{var s;this.doorLabels=[];const e=this.five.panoIndex,n=this.floorplanServerData.computed_data.observers[e].floor_index,o=n!==void 0&&((s=this.floorplanServerData.computed_data.floor_datas[n])==null?void 0:s.rooms);this.rooms=o,this.rooms&&this.rooms.length>0&&this.rooms.forEach(r=>{var c;const a=(c=this.floorplanServerData.computed_data.doors)==null?void 0:c.filter(d=>!!(d&&d.name===r.name)),l=this.five.work.observers.filter((d,f)=>!!r.observer_indexs.find(u=>u===f));a&&a.forEach(d=>{const f=d.position;let u=1/0,h;l.forEach(A=>{const g=A.standingPosition,v={x:g.x,y:g.y,z:g.z},w=fm(f,v);w<u&&(u=w,h=v)}),h&&(f.y=h.y+.01);const p=new F.Vector3(f.x,f.y,f.z);p.add(new F.Vector3(-.2,1.8,0).applyEuler(new F.Euler(0,d.rad,0))),this.doorLabels.push({roomName:r.name,name:d.name,position:p,toward:hm(d.rad)})})}),this.labelItems=this.doorLabels.map(r=>pe(H({},r),{left:0,top:0,visible:!1,inSight:!1,transform:"",cameraToward:""})),this.five.on("wantsToMoveToPano",this.hideAllLabels),this.five.on("modelLoaded",this.fixDoorVisibleAndPosition),this.five.on("panoArrived",this.fixDoorVisibleAndPosition),this.five.on("initAnimationEnded",this.fixDoorPosition),this.five.on("cameraUpdate",this.fixDoorPosition),this.five.on("mouseWheel",this.fixDoorPosition),this.five.on("pinchGesture",this.fixDoorPosition),this.fixDoorVisibleAndPosition()})}stateChangedCallback(e,n){if(this.hooks.hasListener("stateChange")){const o={state:this.state,prevState:e,userAction:n?n.userAction:mm.userAction};this.hooks.emit("stateChange",o)}}render(){if(!this.enabled){this.doorLabelItems&&this.doorLabelItems.length>0&&this.doorLabelItems.forEach(e=>{e==null||e.$destroy()}),this.doorLabels=void 0;return}this.doorLabelItems&&this.doorLabelItems.forEach(e=>{e.$destroy()}),this.doorLabelItems=[],this.labelItems.forEach(e=>{this.doorLabelItems.push(new cm({target:this.container,props:{props:e,onClick:()=>{this.onClick(e.name,e.position)}}}))})}initState(){return{enabled:!0,visible:!0}}dispose(){this&&this.five&&(this.five.off("wantsToMoveToPano",this.hideAllLabels),this.five.off("modelLoaded",this.fixDoorVisibleAndPosition),this.five.off("panoArrived",this.fixDoorVisibleAndPosition),this.five.off("initAnimationEnded",this.fixDoorPosition),this.five.off("cameraUpdate",this.fixDoorPosition),this.five.off("mouseWheel",this.fixDoorPosition),this.five.off("pinchGesture",this.fixDoorPosition),super.dispose())}}const gm=i=>new pm(i),Am=2,vm=3,bm=3,ym=2;function wm(i,t){var r,a,l;if(i.length<2)return console.warn("positionList length must be greater than 1"),[];const e=(r=t==null?void 0:t.unitWidth)!=null?r:.5,n=(a=t==null?void 0:t.unitHeight)!=null?a:.5,o=(l=t==null?void 0:t.skipPanoIndexMesh)!=null?l:!1,s=new x.CatmullRomCurve3(i,!1,"catmullrom",1);if(o){const c=Math.ceil(s.getLength()/n*1.5),d=s.getPoints(c),f=[];let u=0;const h=i;return h.forEach((p,A)=>{let g=0,v=99999999;d.forEach((C,L)=>{const D=C.distanceTo(p);D<v&&(g=L,v=D)});const w=d[g+1],y=w==null?void 0:w.distanceTo(p),I=d[g-1],E=I==null?void 0:I.distanceTo(p);if(g>u&&g-u>1){let C=g;I!==void 0&&E>.8&&(C=g+1),I!==void 0&&E>.2&&E<.3?C=g:v>.2&&v<.3&&(C=g+1);let L=u;if(w!==void 0&&y>.2&&y<.3?L=u+1:v>.2&&v<.3&&(L=u),d[L]&&d[L+1]){const N=h[A-1];if(N)if(N.equals(d[L]))L+=1;else{const G=new F.Vector3().subVectors(d[L+1],d[L]),X=new F.Vector3().subVectors(N,d[L]);G.angleTo(X)<Math.PI/2&&(L+=1)}}if(C<L||C-L<=1)return;const D=d.slice(L,C),T=Fr(D,e,n);f.push(T),u=g}}),f}else{const c=Math.ceil(s.getLength()),d=s.getPoints(c);return[Fr(d,e,n)]}}function Fr(i,t,e){const n=t/2,o=e/t,s=i.length,r=kl.default(i.map(v=>[v.x,v.z])),l=(i.length-1)*Am*vm,c=2*s,d=c*bm,f=c*ym,u=new Uint32Array(l),h=new Float32Array(d),p=new Float32Array(f);i.forEach((v,w)=>{});let A=0;for(let v=0;v<i.length;v++){const[w,y]=r[v][0],I=i[v],{x:E,y:C,z:L}=I,D=new F.Vector3(E+w*n,C+.05,L+y*n);h[v*6+0]=D.x,h[v*6+1]=D.y,h[v*6+2]=D.z;const T=new F.Vector3(E-w*n,C+.05,L-y*n);h[v*6+3]=T.x,h[v*6+4]=T.y,h[v*6+5]=T.z,A+=v>0?i[v-1].clone().sub(i[v]).length():0;const N=A/t/o;p[v*4+0]=0,p[v*4+1]=N,p[v*4+2]=1,p[v*4+3]=N,v!==i.length-1&&(u[v*6+0]=v*2+0,u[v*6+1]=v*2+2,u[v*6+2]=v*2+1,u[v*6+3]=v*2+2,u[v*6+4]=v*2+3,u[v*6+5]=v*2+1)}const g=new x.BufferGeometry;return g.setAttribute("position",new x.BufferAttribute(h,3)),g.setAttribute("uv",new x.BufferAttribute(p,2)),g.setIndex(new x.BufferAttribute(u,1)),g}function Cm(i){const t=new x.TextureLoader().load(i.textureUrl);return t.wrapS=t.wrapT=x.RepeatWrapping,t.encoding=x.sRGBEncoding,new x.MeshBasicMaterial({color:16777215,map:t,transparent:!0,opacity:.8})}function Pm(i){return!Ye(i)}function Ye(i){return i!=null}const Gr="v1.1.0",Hr="GuideLinePlugin",eo=`${Hr}@${Gr}`,Nr=i=>`${eo}--${i}`;class Wr extends jt{constructor(e,n){super(e,n);m(this,"state",{visible:!1,enabled:!0,disposed:!1});m(this,"data");m(this,"linesGroup");m(this,"disposedErrorLog",()=>{console.error(`${eo} is disposed`)});m(this,"actionWhenEnabled",e=>{if(this.state.enabled)return e()});Object.assign(window,{[`__${Hr}_DEBUG__`]:this})}load(e,n,o=!0){return U(this,null,function*(){const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.hooks.emit("dataChange",r,s),this.data=r,this.linesGroup&&this.five.scene.remove(this.linesGroup);const a=this.getLinesGroup(r.routes,r.config);!a||(this.linesGroup=a,yield this.waitFiveModelLoaded(),this.five.scene.add(a),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),n&&this.setState(n),this.five.needsRender=!0,this.hooks.emit("dataLoaded",r),console.log(`${eo} loaded`,r))})}formatData(e){return U(this,null,function*(){return typeof e=="object"&&e!==null&&e.version&&e.data?e.data:e})}show(e){return U(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return U(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return this.disposedErrorLog();const o=H({},this.state);this.state=H(H({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),qe(o,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0}),this.five.needsRender=!0)}handleEnable(e,n=!0){this.linesGroup&&(e?(this.five.scene.add(this.linesGroup),this.actionWhenEnabled(()=>this.hooks.emit("enable",{userAction:n}))):(this.five.scene.remove(this.linesGroup),this.hooks.emit("disable",{userAction:n})))}handleVisible(e,n=!0){this.linesGroup&&(e?(this.linesGroup.visible=!0,this.actionWhenEnabled(()=>this.hooks.emit("show",{userAction:n}))):(this.linesGroup.visible=!1,this.actionWhenEnabled(()=>this.hooks.emit("hide",{userAction:n}))))}handleDispose(){this.linesGroup&&this.five.scene.add(this.linesGroup)}getLinesGroup(e,n){const o=e.map(r=>this.getLine(r,n)).filter(Ye),s=new x.Group;if(s.name=Nr("route-group"),o.length!==0)return s.add(...o),s}getLine(e,n){var l,c,d,f,u,h,p,A;const o=new x.Group,s=e.panoIndexList.map(g=>{var v;return(v=this.five.work.observers[g])==null?void 0:v.standingPosition}).filter(Ye),r=wm(s,{skipPanoIndexMesh:(c=(l=e.skipPanoIndexMesh)!=null?l:n==null?void 0:n.skipPanoIndexMesh)!=null?c:!0,unitWidth:(f=(d=e.unitWidth)!=null?d:n.unitWidth)!=null?f:.6,unitHeight:(h=(u=e.unitHeight)!=null?u:n.unitHeight)!=null?h:.4});if(!r)return;const a=Cm({textureUrl:(A=(p=e.arrowTextureUrl)!=null?p:n.arrowTextureUrl)!=null?A:this.staticPrefix+"/release/web/arrow6.b6ce0c62.png"});return r.forEach(g=>{const v=new x.Mesh(g,a);v.name=Nr("route-line-mesh"),o.add(v)}),o}waitFiveModelLoaded(){return U(this,null,function*(){return new Promise(e=>{if(this.five.model.loaded){e();return}this.five.once("modelLoaded",()=>{e()})})})}}m(Wr,"lasestVersion",Gr);const _r=(i,t)=>new Wr(i,t);function Xr(i){const t=Math.abs(Math.cos(i.latitude));return new x.Vector3(-Math.sin(i.longitude)*t,-Math.sin(i.latitude),-Math.cos(i.longitude)*t)}function Im(i,t){const e=Xr(i),n=Xr(t);return e.angleTo(n)}const Em=i=>U(this,null,function*(){try{i().then(()=>{},()=>{}).catch(()=>{})}catch(t){}}),fi=Math.PI*2;function km(i){return i>=0&&i<fi?i:(i%fi+fi)%fi}function xm(i){return{longitude:km(-Math.atan2(i.x,-i.z)),latitude:-Math.asin(i.y/1)}}function Dm(i,t,e,n){const o=-i/e,s=i;return o*n+s}function Lm(i){return new Promise(t=>{setTimeout(()=>{t()},i)})}const Yr="v1.0.6",Ur="CruisePlugin",hi=`${Ur}@${Yr}`,Jr=()=>{console.error(`${hi} is disposed`)},Sm=()=>{console.warn(`${hi} is disabled`)},Mm=()=>{console.error(`${hi} is disabled`)},to=new Map;class no extends jt{constructor(e,n){super(e,n);m(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});m(this,"data");m(this,"config");m(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,disposers:[],modeChanging:!1});m(this,"GuideLine");this.config=n,Object.assign(window,{[`__${Ur}_DEBUG__`]:this});const o=this.setFiveLinearUpdateCamera.bind(this),s=this.setFiveOriginUpdateCamera.bind(this);this.hooks.on("play",o),this.hooks.on("broke",s),this.hooks.on("end",s),this.hooks.on("pause",s),this.privateState.disposers.push(()=>{this.hooks.off("play",o),this.hooks.off("broke",s),this.hooks.off("end",s),this.hooks.off("pause",s)})}load(e,n,o){return U(this,null,function*(){var d,f,u,h,p;if(this.state.disposed)return Jr();this.privateState.fiveOriginGetProgress||(f=(d=this.five.controller)==null?void 0:d.cameraMotion)!=null&&f.getProgress||(yield this.waitFiveLoaded(),this.privateState.fiveOriginGetProgress=(h=(u=this.five.controller)==null?void 0:u.cameraMotion)==null?void 0:h.getProgress),this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,r=yield this.formatData(e);this.data=r,this.hooks.emit("dataChange",r,s);let a=[],l;const c=this.data.keyframes.filter(A=>A.data.panoIndex!==void 0);c.filter((A,g)=>{var v;return A.data.panoIndex!==((v=c[g-1])==null?void 0:v.data.panoIndex)}).map(A=>A.data.panoIndex).forEach(A=>{var v,w;const g=(v=this.five.work.observers[A])==null?void 0:v.floorIndex;if(g!==void 0)if(l===g){const y=a.length-1;a[y]=[...(w=a[y])!=null?w:[],A]}else{l=g;const y=a.length;a[y]=[A]}}),this.GuideLine||(this.GuideLine=_r(this.five,this.config)),(p=this.GuideLine)==null||p.load({routes:a.map(A=>({panoIndexList:A})),config:r.guildPluginOptions}),this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed),n&&this.setState(n,{userAction:o}),console.log(`${hi} loaded`,r),this.hooks.emit("dataLoaded",r)})}play(e){this.setState({playing:!0},e)}playFrom(e){const{index:n,id:o,userAction:s}=e;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:n,playFromId:o})}playFromStart(e){return this.playFrom(pe(H({},e),{index:0}))}pause(e){this.setState({playing:!1},e)}show(e){return U(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return U(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,n){var s;if(this.state.disposed)return Jr();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return Mm();const o=H({},this.state);this.state=H(H({},this.state),e),e.disposed!==void 0&&e.disposed!==o.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==o.visible&&this.handleVisible(e.visible,n==null?void 0:n.userAction),e.enabled!==void 0&&e.enabled!==o.enabled&&this.handleEnable(e.enabled,n==null?void 0:n.userAction),e.playing!==void 0&&e.playing!==o.playing&&this.changePlayState(e.playing,n),e.speed!==void 0&&e.speed!==o.speed&&this.changeSpeed(e.speed,n==null?void 0:n.userAction),qe(o,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:(s=n==null?void 0:n.userAction)!=null?s:!0})}formatData(e){return U(this,null,function*(){this.five.work||(yield this.waitFiveLoaded());const n=this.five.work.observers,o=(()=>{const s=e;return typeof s=="object"&&s!==null&&s.version&&s.data?s.data:s})();if(o.keyframes)return{keyframesId:He(),keyframes:o.keyframes.map((s,r)=>{var c;const a=o.keyframes[r+1],l=(()=>!a||a.start===void 0||s.end===void 0?0:a.start-s.end)();return pe(H({id:(c=s.uuid)!=null?c:He(),moveIndex:r,stay:l,index:r},s),{guildPluginOptions:o.guildPluginOptions})})};if(o.panoIndexList){let s=[];const{moveEffect:r,moveToFirstPanoEffect:a,moveToFirstPanoDuration:l}=o;return this.privateState.moveToFirstPanoEffect=a,this.privateState.moveToFirstPanoDuration=l,o.panoIndexList.forEach((c,d)=>{const f=(()=>{var g,v,w,y;const u=o.panoIndexList.slice(d).find(I=>I!==c);if(u===void 0)return;const h=(g=n[c])==null?void 0:g.position,p=(v=n[u])==null?void 0:v.position;if(!p||!h||((w=n[c])==null?void 0:w.floorIndex)!==((y=n[u])==null?void 0:y.floorIndex))return;const A=new x.Vector3().subVectors(p,h);return xm(A)})();o.moveType===void 0||o.moveType==="justMove"?s.push({moveIndex:d,stay:o.stay,data:H({effect:"Move",panoIndex:c,moveEffect:r},f!=null?f:{})}):o.moveType==="moveAndRotate"&&(s.push({moveIndex:d,stay:o.stay,data:{effect:"Move",panoIndex:c,moveEffect:r}}),f&&s.push({moveIndex:d,stay:o.stay,data:H({effect:"Rotate",panoIndex:c},f)}))}),{keyframesId:He(),keyframes:s.map((c,d)=>H({id:He(),index:d},c)),guildPluginOptions:o.guildPluginOptions}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handleEnable(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.enable(),this.hooks.emit("enable",{userAction:n})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:n}),this.hooks.emit("disable",{userAction:n})),this.state.enabled=e}handleVisible(e,n=!0){var o,s;e?((o=this.GuideLine)==null||o.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:n}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:n}))),this.state.visible=e}changePlayState(e,n){this.actionIfStateIsEnabled(()=>{var o;return this.hooks.emit("playStateChange",e?"playing":"pause",{userAction:(o=n==null?void 0:n.userAction)!=null?o:!0})}),e?this.handlePlay(n):this.handlePause(n),this.state.playing=e}handlePlay(e){return U(this,null,function*(){var h;const{data:n,state:o,privateState:s,hooks:r}=this;if(s.playing||!(n!=null&&n.keyframes)||(n==null?void 0:n.keyframes.length)===0)return;const a=He();s.playId=a,s.playing=!0,s.broke=!1;const l=n.keyframes,c=this.getPauseData();(e==null?void 0:e.notEmitEvent)!==!0&&r.emit("play",{userAction:(h=e==null?void 0:e.userAction)!=null?h:!0});let d=!1;const u=yield(()=>U(this,null,function*(){var p,A;if((e==null?void 0:e.playFromIndex)!==void 0)return e.playFromIndex;if((e==null?void 0:e.playFromId)!==void 0)return(p=this.data)==null?void 0:p.keyframes.findIndex(g=>g.id===e.playFromId);if(c!=null&&c.keyframeId){const g=(A=this.data)==null?void 0:A.keyframes.find(v=>v.id===c.keyframeId);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),g){if(g.data.effect==="Move")return g.index;if(g.data.effect==="Rotate"){const v=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(g,{duration:v}),d=!0,g.index+1}}}}))();this.clearPauseData();for(const p of l){if(s.broke||!o.playing||!s.playing||a!==s.playId)return;if(!(u!==void 0&&p.index<u))try{r.emit("playIndexChange",p.index,p),yield this.playKeyframe(p,{moveEffect:d===!1?s.moveToFirstPanoEffect:void 0,duration:d===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),p.stay&&(yield Lm(p.stay)),d===!1&&(d=!0)}catch(A){return Promise.resolve("broke")}}o.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),r.emit("end"),this.clearPauseData())})}handlePause(e){var r;const{state:n,privateState:o,hooks:s}=this;n.playing=!1,o.playing!==!1&&(o.playing=!1,this.setPauseData(),o.broke||this.forceInteruptUpdateCamera(),(e==null?void 0:e.notEmitEvent)!==!0&&s.emit("pause",{userAction:(r=e==null?void 0:e.userAction)!=null?r:!0}))}playKeyframe(e,n){return U(this,null,function*(){var s;const{privateState:o}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==e.id&&(this.privateState.currentPlayKeyframe={keyframe:e}),o.currentPlayQueue.push(this.getPlayPromise(e,n)),this.actionPromiseQueue()})}addInterruptListener(e){const n=()=>{this.privateState.modeChanging||e()},o=e;return this.five.once("gesture",o),this.five.once("wantsChangeMode",n),()=>{this.five.off("gesture",o),this.five.once("wantsChangeMode",n)}}getPlayPromise(e,n){return U(this,null,function*(){var s;const o=e.data;if(n.duration=(s=n==null?void 0:n.duration)!=null?s:e.start!==void 0&&e.end!==void 0?e.end-e.start:void 0,!!o)return new Promise((r,a)=>{let l=!1;this.addInterruptListener(()=>{if(!l)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),l=!0,a(new Error("play is interupted"))});try{if(l)return;const c=()=>{r(),l=!0};switch(o.effect){case"Move":this.move(o,n).then(c);break;case"Rotate":this.rotate(o,n).then(c);break;default:this.rotate(o,n).then(c)}}catch(c){}})})}actionPromiseQueue(){return U(this,null,function*(){const{privateState:e}=this;return new Promise((n,o)=>{if(e.currentPlayQueue.length===0){n();return}const s=e.currentPlayQueue.shift();if(!s){n();return}s.then(n,o)}).then(()=>e.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(e,n){return U(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode(e);else if(e.panoIndex!==this.five.panoIndex)yield this.changePano(e,n);else return Promise.resolve()})}rotate(e,n){return U(this,null,function*(){if(e.mode&&e.mode!==this.five.currentMode)yield this.changeMode({mode:e.mode,panoIndex:e.panoIndex});else if(e.panoIndex&&e.panoIndex!==this.five.panoIndex)return yield this.changePano(e,n);yield this.updateCamera(e,n)})}updateCamera(e,n){return U(this,null,function*(){const{five:o,privateState:s,state:r}=this,a=(()=>{var u,h;const d=(u=r.config)==null?void 0:u.speedConfig,f=(h=e.rotateSpeed)!=null?h:d==null?void 0:d.rotateSpeed;if((d==null?void 0:d.rotateSpeedUnit)===void 0)return f;if(f!==void 0)return d.rotateSpeedUnit==="rad/ms"?f:f/1e3})(),l=(()=>{if(n.duration)return n.duration;if(a){const d=this.five.getCurrentState();return Im(d,e)/a}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=l);const c=this.getSpeededDuration(l);return new Promise(d=>{Em(()=>o.updateCamera(e,c)),setTimeout(()=>d(),c)})})}changePano(e,n){return U(this,null,function*(){const{five:o,privateState:s,state:r}=this;if(typeof e.panoIndex!="number"||e.panoIndex===o.panoIndex)return;const a=o.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var u,h;const d=(u=r.config)==null?void 0:u.speedConfig,f=(h=e.moveSpeed)!=null?h:d==null?void 0:d.moveSpeed;if((d==null?void 0:d.moveSpeedUnit)===void 0)return f;if(f!==void 0)return d.moveSpeedUnit==="m/ms"?f:f/1e3})(),c=(()=>{if(n!=null&&n.duration)return n.duration;if(l&&typeof o.panoIndex=="number"&&typeof e.panoIndex=="number"){const d=o.work.observers[o.panoIndex].position,f=o.work.observers[e.panoIndex].position;return d.distanceTo(f)/l}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(d=>{var f,u,h;o.moveToPano(e.panoIndex,{latitude:e.latitude,longitude:e.longitude,fov:e.fov,duration:this.getSpeededDuration(c),effect:(h=(u=n==null?void 0:n.moveEffect)!=null?u:(f=this.state.config)==null?void 0:f.moveEffect)!=null?h:e.moveEffect,moveCancelCallback:()=>d(),moveEndCallback:()=>d()}),a&&o.once("panoArrived",()=>d())}),a&&(this.privateState.modeChanging=!1)})}changeSpeed(e,n=!0){const{state:o,privateState:s,hooks:r}=this,{currentPlayKeyframe:a}=s;if(r.emit("speedChange",e,{userAction:n}),o.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getSpeededDuration(e){return e/this.state.speed}getProgress(){return this.five.controller.cameraMotion.progress}changeMode(e,n){return U(this,null,function*(){e.mode&&e.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(e.mode,e,n),this.privateState.modeChanging=!1)})}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return to.get((n=this.data)==null?void 0:n.keyframesId)}setPauseData(){var e,n,o,s;if((e=this.data)!=null&&e.keyframesId)return to.set((n=this.data)==null?void 0:n.keyframesId,{keyframeId:(o=this.privateState.currentPlayKeyframe)==null?void 0:o.keyframe.id,fiveState:this.five.getCurrentState(),duration:(s=this.privateState.currentPlayKeyframe)==null?void 0:s.originDuration,playedProgress:this.getProgress()})}clearPauseData(){var e,n;if((e=this.data)!=null&&e.keyframesId)return to.delete((n=this.data)==null?void 0:n.keyframesId)}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}handleDispose(){var e,n;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(e=this.GuideLine)==null||e.dispose(),this.GuideLine=void 0,(n=this.privateState.disposers)==null||n.forEach(o=>o==null?void 0:o())}actionIfStateIsEnabled(e,n){if(this.state.enabled)return e();n!=null&&n.warnLog&&Sm()}waitFiveLoaded(){return U(this,null,function*(){return new Promise(e=>{if(this.five.work){e();return}this.five.once("loaded",()=>{e()})})})}setFiveLinearUpdateCamera(){!this.privateState.fiveOriginGetProgress||(this.five.controller.cameraMotion.getProgress=e=>{const n=this.five.controller.cameraMotion,o=e-n.startTime;return o<0?0:o>=n.duration?1:1-Dm(1,n.startVelocity,n.duration,o)})}setFiveOriginUpdateCamera(){!this.privateState.fiveOriginGetProgress||(this.five.controller.cameraMotion.getProgress=this.privateState.fiveOriginGetProgress)}}m(no,"PluginVersion",Yr);const zm=i=>new no(i);function Bm(i){le(i,"svelte-xuejcm",".line.svelte-xuejcm{position:absolute;pointer-events:none}.line.vertical.svelte-xuejcm{transform:rotate(-90deg) translate3d(0.03125rem, 0, 0.625rem);transform-origin:0 0}.line.horizontal.svelte-xuejcm{transform:translate3d(0, -0.03125rem, 0.625rem)}.straight-line.svelte-xuejcm{display:block;width:100%;height:100%;overflow:visible}")}function Zr(i){let t,e,n,o,s,r,a,l=i[3]&&qr(i);return{c(){t=V("div"),e=ve("svg"),n=ve("defs"),o=ve("linearGradient"),s=ve("stop"),r=ve("stop"),l&&l.c(),b(s,"offset","25%"),b(s,"stop-color",i[5]),b(s,"stop-opacity","1"),b(r,"offset","100%"),b(r,"stop-color",i[5]),b(r,"stop-opacity","0.5"),b(o,"x1",.5),b(o,"y1",.5),b(o,"x2",i[8]),b(o,"y2",.5),b(o,"id",i[10]),b(o,"gradientUnits","userSpaceOnUse"),b(e,"class","straight-line svelte-xuejcm"),b(e,"viewBox",a="0 0 "+i[8]+" "+i[7]),b(e,"preserveAspectRatio","none"),b(t,"class","line svelte-xuejcm"),ne(t,"vertical",i[9]),ne(t,"horizontal",!i[9]),M(t,"width",i[8]+"px"),M(t,"height",i[7]+"px")},m(c,d){B(c,t,d),Q(t,e),Q(e,n),Q(n,o),Q(o,s),Q(o,r),l&&l.m(e,null)},p(c,d){d&32&&b(s,"stop-color",c[5]),d&32&&b(r,"stop-color",c[5]),d&256&&b(o,"x2",c[8]),c[3]?l?(l.p(c,d),d&8&&k(l,1)):(l=qr(c),l.c(),k(l,1),l.m(e,null)):l&&(re(),S(l,1,1,()=>{l=null}),ae()),d&384&&a!==(a="0 0 "+c[8]+" "+c[7])&&b(e,"viewBox",a),d&512&&ne(t,"vertical",c[9]),d&512&&ne(t,"horizontal",!c[9]),d&256&&M(t,"width",c[8]+"px"),d&128&&M(t,"height",c[7]+"px")},d(c){c&&z(t),l&&l.d()}}}function qr(i){let t,e,n,o,s;return{c(){t=ve("path"),b(t,"fill","none"),b(t,"stroke",e=i[4]?`url(#${i[10]})`:i[5]),b(t,"stroke-width",1),b(t,"d",i[6])},m(r,a){B(r,t,a),s=!0},p(r,a){i=r,(!s||a&48&&e!==(e=i[4]?`url(#${i[10]})`:i[5]))&&b(t,"stroke",e),(!s||a&64)&&b(t,"d",i[6])},i(r){s||(r&&Se(()=>{o&&o.end(1),n=Bt(t,Jn,{duration:i[2],delay:i[0],easing:gt}),n.start()}),s=!0)},o(r){n&&n.invalidate(),r&&(o=qt(t,Jn,{duration:i[2],delay:i[1],easing:gt})),s=!1},d(r){r&&z(t),r&&o&&o.end()}}}function Tm(i){let t,e=i[8]&&Zr(i);return{c(){e&&e.c(),t=me()},m(n,o){e&&e.m(n,o),B(n,t,o)},p(n,[o]){n[8]?e?e.p(n,o):(e=Zr(n),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:J,o:J,d(n){e&&e.d(n),n&&z(t)}}}function Vm(i,t,e){let n,o,s,r,{inDelay:a=0}=t,{outDelay:l=0}=t,{duration:c=1e3}=t,{unfolded:d}=t,{length:f}=t,{direction:u="horizontal"}=t,{useLinearColor:h=!1}=t,{color:p="white"}=t;const A=He();return i.$$set=g=>{"inDelay"in g&&e(0,a=g.inDelay),"outDelay"in g&&e(1,l=g.outDelay),"duration"in g&&e(2,c=g.duration),"unfolded"in g&&e(3,d=g.unfolded),"length"in g&&e(11,f=g.length),"direction"in g&&e(12,u=g.direction),"useLinearColor"in g&&e(4,h=g.useLinearColor),"color"in g&&e(5,p=g.color)},i.$$.update=()=>{i.$$.dirty&4096&&e(9,n=u==="vertical"),i.$$.dirty&2048&&e(8,o=f),i.$$.dirty&2048&&e(6,r=`M0.5 0.5 H ${f}`)},e(7,s=1),[a,l,c,d,h,p,r,s,o,n,A,f,u]}class io extends se{constructor(t){super(),oe(this,t,Vm,Tm,ie,{inDelay:0,outDelay:1,duration:2,unfolded:3,length:11,direction:12,useLinearColor:4,color:5},Bm)}}function jm(i){le(i,"svelte-faoauy",".shadow.svelte-faoauy{position:absolute}")}function Kr(i){let t,e,n,o,s;return{c(){t=V("div"),b(t,"class","shadow svelte-faoauy"),b(t,"style",e=`
531
531
  left:${_e(i[5])};
532
532
  bottom:${_e(i[6])};
533
533
  box-shadow: 0 0 ${_e(i[10])} ${_e(i[11])} rgba(0, 0, 0, ${i[12]});