@arcgis/core 5.2.0-next.127 → 5.2.0-next.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebScene.js +1 -1
- package/applications/Components/imageryUtils.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +14 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/applications/WebEditor/sketchUtils.js +1 -1
- package/arcade/batchExec.js +1 -1
- package/arcade/geometry/adapters/dehydrated.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06da350b4ea25732f52b.js +1 -0
- package/assets/esri/core/workers/chunks/{67dcf9b873cb037b2647.js → 081c9ccaa5884c730a91.js} +1 -1
- package/assets/esri/core/workers/chunks/094102031cc77b20db74.js +1 -0
- package/assets/esri/core/workers/chunks/0b85c844af97b2fb0ba8.js +1 -0
- package/assets/esri/core/workers/chunks/{86d7a3ae672a51b75fcc.js → 0d44f793d3b0d33153ac.js} +1 -1
- package/assets/esri/core/workers/chunks/0de140199161fcd15a0c.js +1 -0
- package/assets/esri/core/workers/chunks/0deceece4b465f653f58.js +1 -0
- package/assets/esri/core/workers/chunks/111dc5653daa7f3e1001.js +1 -0
- package/assets/esri/core/workers/chunks/139e3da8ea081e21539e.js +1 -0
- package/assets/esri/core/workers/chunks/142bedebd37d747f84ba.js +1 -0
- package/assets/esri/core/workers/chunks/15dc28b4fa5b5110472b.js +1 -0
- package/assets/esri/core/workers/chunks/{dd02cc18ebebb90778c6.js → 17e2bfc7468c23e43bef.js} +1 -1
- package/assets/esri/core/workers/chunks/196d33f4d8e3a256ad94.js +1 -0
- package/assets/esri/core/workers/chunks/1a02c68de65a67ab6a67.js +1 -0
- package/assets/esri/core/workers/chunks/{4165eb86471ea3bbf364.js → 1aecf7106a21320e054e.js} +1 -1
- package/assets/esri/core/workers/chunks/1bc03b8065cbbbb06c87.js +1 -0
- package/assets/esri/core/workers/chunks/1beb32170d659bc43977.js +1 -0
- package/assets/esri/core/workers/chunks/20ee32fee219afbcfee3.js +1 -0
- package/assets/esri/core/workers/chunks/{9467744cb7d094a5067a.js → 21d2f5324db0b199060c.js} +1 -1
- package/assets/esri/core/workers/chunks/22abb9a74f6594f9db2a.js +1 -0
- package/assets/esri/core/workers/chunks/237795866c075880531b.js +1 -0
- package/assets/esri/core/workers/chunks/25e4da9c6837ab0fa585.js +1 -0
- package/assets/esri/core/workers/chunks/2a5fde737dc99627142e.js +1 -0
- package/assets/esri/core/workers/chunks/3412050ae63ff7dcaf36.js +1 -0
- package/assets/esri/core/workers/chunks/35316724c8d3cc39cf80.js +1 -0
- package/assets/esri/core/workers/chunks/354cc6cd2a56937f1747.js +1 -0
- package/assets/esri/core/workers/chunks/365ae479765ca9e47de4.js +1 -0
- package/assets/esri/core/workers/chunks/{8190fcb1dd10ad20feed.js → 36ef86701883a20dd6f6.js} +1 -1
- package/assets/esri/core/workers/chunks/3759e272a1d43534a190.js +1 -0
- package/assets/esri/core/workers/chunks/397ddcf0b8e858a17b70.js +1 -0
- package/assets/esri/core/workers/chunks/3a7a558e30b5cb81c801.js +1 -0
- package/assets/esri/core/workers/chunks/3c9405d310a1b08c901e.js +1 -0
- package/assets/esri/core/workers/chunks/{e10fe4c77b8dc4492092.js → 3ce53562926b05e71af5.js} +1 -1
- package/assets/esri/core/workers/chunks/3d174a84b785fc633a5a.js +1 -0
- package/assets/esri/core/workers/chunks/3d67fed3e53993c38b58.js +1 -0
- package/assets/esri/core/workers/chunks/42bdeeff55fb1a3f735f.js +1 -0
- package/assets/esri/core/workers/chunks/48f1532520b76fa7f0c2.js +1 -0
- package/assets/esri/core/workers/chunks/{00d9e41deecf5828975c.js → 4adc3822ed9f498f5653.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5f0fed415b5b155d57c.js → 51741ef8225d470716fe.js} +1 -1
- package/assets/esri/core/workers/chunks/5191e481d0e19a7f3888.js +1 -0
- package/assets/esri/core/workers/chunks/{7fcee3a1b900ddc9a5e3.js → 540acf6abdee9dbd453e.js} +1 -1
- package/assets/esri/core/workers/chunks/{d9b63cf111035b05cd2e.js → 5484b89adc53430226d5.js} +1 -1
- package/assets/esri/core/workers/chunks/55361b50ecfc98db2ffb.js +1 -0
- package/assets/esri/core/workers/chunks/58da7c41c1bcef2f4141.js +1 -0
- package/assets/esri/core/workers/chunks/5979bbefb09d132c008f.js +1 -0
- package/assets/esri/core/workers/chunks/{84db05e872dbf35c80a2.js → 5982c6a8459c1237b298.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a20f84b5f004a77a9f9.js → 5abfc4f447b01d6bf287.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c0dba437de0969a5b63.js → 5b9f88194433410bad5b.js} +1 -1
- package/assets/esri/core/workers/chunks/5f794f4e0113d5dd50ba.js +1 -0
- package/assets/esri/core/workers/chunks/62a30692e2a7612bafc1.js +1 -0
- package/assets/esri/core/workers/chunks/62aa7daad4ca7332854e.js +1 -0
- package/assets/esri/core/workers/chunks/66926c3686d5ef2d4692.js +29 -0
- package/assets/esri/core/workers/chunks/6994ba168465b77a36af.js +1 -0
- package/assets/esri/core/workers/chunks/6d0c6fda9100fe89f3cb.js +1 -0
- package/assets/esri/core/workers/chunks/72a898894438f177cd62.js +1 -0
- package/assets/esri/core/workers/chunks/78d4455237120103f639.js +1 -0
- package/assets/esri/core/workers/chunks/7fccf53aa751cd9dae57.js +1 -0
- package/assets/esri/core/workers/chunks/{26995de0c18bef8db590.js → 81327e10200065a0ccef.js} +1 -1
- package/assets/esri/core/workers/chunks/84a3fbe5d85a357f4e82.js +1 -0
- package/assets/esri/core/workers/chunks/862479729f2d036f606b.js +1 -0
- package/assets/esri/core/workers/chunks/89dad6c1bfd81e4d7f8e.js +1 -0
- package/assets/esri/core/workers/chunks/8a9aa6db11d0f643961c.js +1 -0
- package/assets/esri/core/workers/chunks/8dfea65341991e13ab71.js +1 -0
- package/assets/esri/core/workers/chunks/8e92925043dc49ed1018.js +1 -0
- package/assets/esri/core/workers/chunks/8f0b2b0ca239b01f44d0.js +1 -0
- package/assets/esri/core/workers/chunks/93a89168c18db88f60e7.js +1 -0
- package/assets/esri/core/workers/chunks/991c854a4459c82d4d93.js +1 -0
- package/assets/esri/core/workers/chunks/{f90cad9f007a11154c0d.js → 9b080d07699b56f06c5f.js} +1 -1
- package/assets/esri/core/workers/chunks/9cd69aa3880838a834f8.js +1 -0
- package/assets/esri/core/workers/chunks/{2ca49fb4590cc34a02bd.js → 9d87f38b16dda1ff7978.js} +1 -1
- package/assets/esri/core/workers/chunks/9fd1e5a2c0a261ed2a33.js +1 -0
- package/assets/esri/core/workers/chunks/a0a9c41400ae98df1912.js +1 -0
- package/assets/esri/core/workers/chunks/a189e520da39919cdcca.js +1 -0
- package/assets/esri/core/workers/chunks/a3a5cb664bdb1db190dd.js +1 -0
- package/assets/esri/core/workers/chunks/a63c456ecf018ec06778.js +1 -0
- package/assets/esri/core/workers/chunks/{842f993fa60b410cb613.js → a8322a978e33c7349fdf.js} +1 -1
- package/assets/esri/core/workers/chunks/{f479b4a4cee4bb2e046c.js → aa96eea0899757ab38c7.js} +1 -1
- package/assets/esri/core/workers/chunks/ab0b2a76247dfd56b92d.js +1 -0
- package/assets/esri/core/workers/chunks/ab7337b076d152a8eb9e.js +1 -0
- package/assets/esri/core/workers/chunks/ac0de274853a42d518a1.js +1 -0
- package/assets/esri/core/workers/chunks/ad372e399e20d5a3262d.js +1 -0
- package/assets/esri/core/workers/chunks/ae75b3e5320d03dff64c.js +1 -0
- package/assets/esri/core/workers/chunks/ae98530d5816306216b3.js +1 -0
- package/assets/esri/core/workers/chunks/afc94c4b9bc007fe310f.js +1 -0
- package/assets/esri/core/workers/chunks/afe54923339e957b71b9.js +1 -0
- package/assets/esri/core/workers/chunks/bbcac00362fef5e3956d.js +1 -0
- package/assets/esri/core/workers/chunks/{1302bf9718747cd9fdd9.js → bcee161dd1c4781d1998.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1f54b0079fb71a15612.js → bd231bc0624eb889ac14.js} +1 -1
- package/assets/esri/core/workers/chunks/c0075715fbe7bec10fc3.js +1 -0
- package/assets/esri/core/workers/chunks/c4e1e864fb8c119b2520.js +1 -0
- package/assets/esri/core/workers/chunks/c93cedf9e53da5aaa35b.js +1 -0
- package/assets/esri/core/workers/chunks/{2d592c935571de80a2e2.js → c9690810b198a97bc16d.js} +1 -1
- package/assets/esri/core/workers/chunks/cada517cc25fa37f778c.js +1 -0
- package/assets/esri/core/workers/chunks/cd1821bf601949674e02.js +1 -0
- package/assets/esri/core/workers/chunks/{1b42d163ef22e3565bb7.js → cf7b7e54cd87422ca62a.js} +1 -1
- package/assets/esri/core/workers/chunks/d1187ad6cc4959683819.js +1 -0
- package/assets/esri/core/workers/chunks/d195c57fc6de3560653d.js +1 -0
- package/assets/esri/core/workers/chunks/d7f830a06ded11f2fc80.js +1 -0
- package/assets/esri/core/workers/chunks/d877783815afd21dbe98.js +1 -0
- package/assets/esri/core/workers/chunks/db5181fcea96cc2ede3e.js +1 -0
- package/assets/esri/core/workers/chunks/{6e8187a77846239ed112.js → de28a86775235bd5d3c4.js} +2 -2
- package/assets/esri/core/workers/chunks/df6992416cba9539f1ed.js +1 -0
- package/assets/esri/core/workers/chunks/e4005d95a396e1af9ac2.js +1 -0
- package/assets/esri/core/workers/chunks/{668ec0bdfb2095e90c9e.js → e495697860f7207da4c7.js} +1 -1
- package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +1 -0
- package/assets/esri/core/workers/chunks/eec5a93dbc258a90b6de.js +1 -0
- package/assets/esri/core/workers/chunks/f163502c513205c892e7.js +1 -0
- package/assets/esri/core/workers/chunks/f287ec0fcb611f82ebb0.js +1 -0
- package/assets/esri/core/workers/chunks/{37ae52c71bf9c70fbb92.js → f2d45d15d0ba2537a4eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{d507d7d7a7282fc38e8d.js → f652d1db26fbdea1a79b.js} +1 -1
- package/assets/esri/core/workers/chunks/f6b38ed75baae198c19b.js +1 -0
- package/assets/esri/core/workers/chunks/{168b45c5d8233f23793e.js → f6cfc901267a229de7a1.js} +2 -2
- package/assets/esri/core/workers/chunks/f6d04d14323b926f1025.js +1 -0
- package/assets/esri/core/workers/chunks/f7ab606be37373312ebe.js +1 -0
- package/assets/esri/core/workers/chunks/{3b7dff15a0058ea29886.js → f92178ac6dc9abff304f.js} +1 -1
- package/assets/esri/core/workers/chunks/fc39593febef74a036f1.js +1 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/3ae1e25e-3aa6-4061-a016-a079159f9d65.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/41331c3c-3759-4462-8695-33c9a21b6a5b.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/94aa531e-7746-4df0-bb6e-349891f2eda5.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts.scss +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +7 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +5 -3
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ar.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bg.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ca.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.cs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.da.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.de.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.el.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.es.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.et.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.he.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hu.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.id.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.it.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ja.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ko.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lt.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.nl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.no.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ro.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ru.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.th.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.tr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.uk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.vi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/chunks/batchExec.js +2 -0
- package/config.js +1 -1
- package/core/units.js +1 -1
- package/geometry/HeightModelInfo.js +1 -1
- package/geometry/ellipsoidUtils.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/interfaces.d.ts +1 -0
- package/kernel.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/layers/graphics/hydrateGeometryJSON.js +2 -0
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/hydratedSpatialReference.js +2 -0
- package/layers/graphics/transferFeatures.js +2 -0
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/HeightModelInfoMixin.js +2 -0
- package/layers/mixins/SceneService.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/raster/datasets/DBFParser.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +1 -1
- package/layers/raster/datasets/RasterFactory.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/formats/JpgPlus.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/Raw.js +1 -1
- package/layers/support/arcadeUtils.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.js +1 -1
- package/popup/FeatureContentCollection.d.ts +2 -0
- package/popup/FeatureContentCollection.js +1 -1
- package/popup/support/featureUtils.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/loadArcade.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/vectorTiles/GeometryUtils.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/util.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/layerViewModuleImportUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/layers/GeospatialPDFLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/PBFDecoderWorker.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/DOMContainer.d.ts +18 -8
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/VideoView.d.ts +38 -0
- package/views/VideoView.js +1 -1
- package/views/View.d.ts +20 -2
- package/views/View.js +1 -1
- package/views/input/types.d.ts +19 -6
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/options/TooltipVisibleElements.d.ts +11 -1
- package/views/interactive/options/TooltipVisibleElements.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/assets/esri/core/workers/chunks/025da54eef112d7e8f66.js +0 -1
- package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +0 -1
- package/assets/esri/core/workers/chunks/04d4cd66485b622403d0.js +0 -1
- package/assets/esri/core/workers/chunks/05afa8c2b5929ce0545a.js +0 -1
- package/assets/esri/core/workers/chunks/09676cfa99b90fe0cc63.js +0 -1
- package/assets/esri/core/workers/chunks/0a2b7c691a577cb3d189.js +0 -1
- package/assets/esri/core/workers/chunks/0aadee0437fa061e4ff5.js +0 -1
- package/assets/esri/core/workers/chunks/0ccd4200c5a2a5de6e16.js +0 -1
- package/assets/esri/core/workers/chunks/1262918b2161d79851c0.js +0 -1
- package/assets/esri/core/workers/chunks/1406a884241809b62bff.js +0 -1
- package/assets/esri/core/workers/chunks/1c33aa349beea9a3792f.js +0 -1
- package/assets/esri/core/workers/chunks/1f135269aea3931e11b2.js +0 -1
- package/assets/esri/core/workers/chunks/2146c25c01c9fc11b16c.js +0 -1
- package/assets/esri/core/workers/chunks/24014f3701c31ee74bc2.js +0 -1
- package/assets/esri/core/workers/chunks/25a2e02677a74834c8b5.js +0 -1
- package/assets/esri/core/workers/chunks/2afce71e8b6ae86e0792.js +0 -1
- package/assets/esri/core/workers/chunks/2c7bb5c9751524687002.js +0 -1
- package/assets/esri/core/workers/chunks/2c7fc24649d91552e68a.js +0 -1
- package/assets/esri/core/workers/chunks/2ebad7e588b26e74cefe.js +0 -1
- package/assets/esri/core/workers/chunks/319434415d2c0561bc59.js +0 -1
- package/assets/esri/core/workers/chunks/39d71e83261bff46f6bf.js +0 -1
- package/assets/esri/core/workers/chunks/3aceedec9abfb2fdfa18.js +0 -1
- package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +0 -1
- package/assets/esri/core/workers/chunks/4327d2c39a660bd89da7.js +0 -1
- package/assets/esri/core/workers/chunks/462fd57af8ed7921d6ba.js +0 -1
- package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +0 -1
- package/assets/esri/core/workers/chunks/474d9541d387b31ad275.js +0 -1
- package/assets/esri/core/workers/chunks/48a2f68e06a2e90b77d0.js +0 -1
- package/assets/esri/core/workers/chunks/4a73f73f1698fad2df20.js +0 -1
- package/assets/esri/core/workers/chunks/4f464047c6f6c9486efd.js +0 -1
- package/assets/esri/core/workers/chunks/50c29d10ec53f0e48e8a.js +0 -1
- package/assets/esri/core/workers/chunks/526cc64ae46dec3fbeda.js +0 -1
- package/assets/esri/core/workers/chunks/550d4df0732352fa48b5.js +0 -1
- package/assets/esri/core/workers/chunks/56e97b98dcb8a3f2bcb7.js +0 -1
- package/assets/esri/core/workers/chunks/581285e4d7bbe1b7c27a.js +0 -1
- package/assets/esri/core/workers/chunks/58fb92775d668cfd295c.js +0 -1
- package/assets/esri/core/workers/chunks/5adf2792416b22cd602f.js +0 -1
- package/assets/esri/core/workers/chunks/5aee7739afb5160d4ace.js +0 -1
- package/assets/esri/core/workers/chunks/6006bd8a5ed945fa2776.js +0 -1
- package/assets/esri/core/workers/chunks/64ee22134fda2f09c094.js +0 -1
- package/assets/esri/core/workers/chunks/66ef6c034455abd61f39.js +0 -1
- package/assets/esri/core/workers/chunks/67678054342178b601cf.js +0 -1
- package/assets/esri/core/workers/chunks/6c82cbcd504c711a7450.js +0 -1
- package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +0 -1
- package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +0 -1
- package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +0 -1
- package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +0 -1
- package/assets/esri/core/workers/chunks/78085f804969c9282700.js +0 -1
- package/assets/esri/core/workers/chunks/7d6da4e89aa951e6523f.js +0 -1
- package/assets/esri/core/workers/chunks/80f16f5f15518013f7d0.js +0 -1
- package/assets/esri/core/workers/chunks/82ce034b5ba54de9b970.js +0 -29
- package/assets/esri/core/workers/chunks/8465e2c7221125fd3cc4.js +0 -1
- package/assets/esri/core/workers/chunks/87aaed3dfa903bdf853c.js +0 -1
- package/assets/esri/core/workers/chunks/892dc038d569cffd26dc.js +0 -1
- package/assets/esri/core/workers/chunks/8daed13400d9e63e65ae.js +0 -1
- package/assets/esri/core/workers/chunks/8f1c5f5e70d4b33d021d.js +0 -1
- package/assets/esri/core/workers/chunks/9020bd7a0e488d55ef14.js +0 -1
- package/assets/esri/core/workers/chunks/9d6a96e4c7ccedcb0c13.js +0 -1
- package/assets/esri/core/workers/chunks/9ec04faad97be55309b8.js +0 -1
- package/assets/esri/core/workers/chunks/a08385ebf1715414c1a6.js +0 -1
- package/assets/esri/core/workers/chunks/a3a33ffa34f4d645ddfe.js +0 -1
- package/assets/esri/core/workers/chunks/b396c4b4bb144200acc7.js +0 -1
- package/assets/esri/core/workers/chunks/b9c834e3c0701e9b14a2.js +0 -1
- package/assets/esri/core/workers/chunks/ba435cc73956d9c64a11.js +0 -1
- package/assets/esri/core/workers/chunks/bbfb80a6983574007ce5.js +0 -1
- package/assets/esri/core/workers/chunks/bcf2e5cf6b9c6d0442bb.js +0 -1
- package/assets/esri/core/workers/chunks/c35e9dee87937f483a3d.js +0 -1
- package/assets/esri/core/workers/chunks/c5b733c3a5b2680042a2.js +0 -1
- package/assets/esri/core/workers/chunks/c77496c350004ee66eb2.js +0 -1
- package/assets/esri/core/workers/chunks/cbeba973ef5593ffbba3.js +0 -1
- package/assets/esri/core/workers/chunks/ccaeabc3be07f3c96f50.js +0 -1
- package/assets/esri/core/workers/chunks/d25fb32a233d2128afbe.js +0 -1
- package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +0 -1
- package/assets/esri/core/workers/chunks/d5ef269ab0ee3744b05d.js +0 -1
- package/assets/esri/core/workers/chunks/dc92710a8fdfb9135e55.js +0 -1
- package/assets/esri/core/workers/chunks/dd4ecf81250cc001d040.js +0 -1
- package/assets/esri/core/workers/chunks/e0894a308c84d5c158b0.js +0 -1
- package/assets/esri/core/workers/chunks/e4016ae9cb8f16e3efc3.js +0 -1
- package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +0 -1
- package/assets/esri/core/workers/chunks/e6637f9176566382ed3e.js +0 -1
- package/assets/esri/core/workers/chunks/e6a4cef0af9be30ffe3d.js +0 -1
- package/assets/esri/core/workers/chunks/eaa7cb3ffa8c11706a09.js +0 -1
- package/assets/esri/core/workers/chunks/ed31ec586b754241474d.js +0 -1
- package/assets/esri/core/workers/chunks/ef6e52f9b656751eebaf.js +0 -1
- package/assets/esri/core/workers/chunks/f2fca9a3a40170996ea2.js +0 -1
- package/assets/esri/core/workers/chunks/f5d06cd6d30a5f742f73.js +0 -1
- package/assets/esri/core/workers/chunks/f71ec8a260405ed07958.js +0 -1
- package/assets/esri/core/workers/chunks/f91cab9904020cf25d50.js +0 -1
- package/assets/esri/core/workers/chunks/fb11ff3f2eae5f072560.js +0 -1
- package/assets/esri/core/workers/chunks/ff0e9f8d323eb1729650.js +0 -1
- /package/assets/esri/core/workers/chunks/{6e8187a77846239ed112.js.LICENSE.txt → de28a86775235bd5d3c4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{168b45c5d8233f23793e.js.LICENSE.txt → f6cfc901267a229de7a1.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as d}from"../../core/handleUtils.js";import{equalsShallow as c}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as g}from"../../core/maybe.js";import{EsriPromise as v}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as w}from"../../core/promiseUtils.js";import _ from"../../core/ReactiveMap.js";import{whenOnce as F,on as V,watch as S,syncAndInitial as b,initial as M,when as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as C}from"../../core/units.js";import{property as A,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as T}from"../../core/support/jsonUtils.js";import{UpdatingHandles as O}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import E from"../../geometry/Point.js";import{projectAsync as G}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as R}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as B}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import N from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as U}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as W,computePolygonForInspection as $,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as J}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as K}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Q,convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import Y from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ee}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as te,getInitialAngle as ie,convertPixelLocationToSphereVertex as ae,getUpdateElevationProps as re,adjustHorizonAngles as oe,convertOrientationToPixelLocation as se,getImageToWorldProperties as ne,getImageToWorldPanoramicProperties as le}from"../../layers/orientedImagery/transformations/utils.js";import de from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ce}from"../../layers/support/floorFilterUtils.js";import he from"../../layers/support/VideoElement.js";import ue from"../../views/MapView.js";import pe from"../../views/draw/Draw.js";import{scale as me}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ge}from"../../views/input/InputManager.js";import ve from"../PanoramicVideoViewer.js";import ye from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as fe,videoMapViewConstraint as we,fixedImageSize as _e,clockwiseDirections as Fe,videoFitScaleTolerance as Ve,videoExtent as Se,invalidCameraHeading as be,sectorsInOrder as Me,sampleExtent as Pe,sectorsRadii as Ie}from"./constants.js";import{isFeatureAttachment as Ce}from"./galleryUtils.js";import{crossSymbol as Ae,crossSymbol3D as ke,measurementPolygonSymbol as Te,polylineSymbolPanoramic as Oe,measurementPolylineSymbol as Le,cameraOverlaySymbol3D as Ee,cameraOverlaySymbol as Ge,diamondSymbol as je,diamondSymbol3D as Re,activeSourcePointSymbol as xe,sourcePointSymbol as Be}from"./symbols.js";import{registryKeys as De}from"./types.js";import{isNoAttachmentError as Ne,extractHorizonAnglesFromMedia as He,isTifOrMrf as ze,filterOILLayerView as Ue,assignElevationSampleToFeatures as qe,filterByZ as We,createPanoramicMedia as $e,createNonPanoramicMedia as Ze,isSceneView as Je,isGraphic as Ke,calculateSegment as Qe,calculateDirection as Xe}from"./utils.js";import{disableVideoZoomAndPan as Ye,getUpdatedConstraints as et,getUpdatedExtentPoints as tt,isSelectedPointWithinVideoFootprint as it,isVideoPixelWithinFrame as at}from"./videoViewerUtils.js";import rt from"./components/ImageViewer.js";import ot from"./components/NavigationNode.js";import st from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as nt}from"./navigation/errors.js";import{queryFeatureByObjectIds as lt}from"./navigation/queries.js";import{ImageMeasurementService as dt}from"./services/ImageMeasurementService.js";import ct from"./services/SuperimposeService.js";import{configureSketchTool as ht,extractFieldsFromDataCaptureLayer as ut,constructGraphicFromImageGeometry as pt}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as mt,imageSpaceToPoint as gt,pointToImageSpace as vt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as yt,restoreDefaultNavigationViewState as ft}from"./support/navigationViewStateUtils.js";import wt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as _t}from"./support/typeUtils.js";const Ft=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Vt=class extends(l(v)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=fe,this.cameraPitchThreshold=fe,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new o,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r}=this;if(this.emit("popup-close"),a&&r){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadCurrentFeatureMedia(a,i)}catch(o){y(o)||(this.loadImageError(o),h.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(a){y(a)||(this.loadImageError(a),h.getLogger(this).error("#loadIImage()","error occured while loading image",a))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new o,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new rt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new _,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new o,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new ue({map:new Map,attributionVisible:!1,constraints:we}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new rt,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new N({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new ct({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{const{imageToWorldProperties:e,mode:t,updateElevationProps:i}=this._transformationService;return"panoramic"===t&&e?{imageToWorldProperties:e,updateElevationProps:i}:null},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,i)=>this._transformationService.pixelToPointAtDistance(e,t,i)}),this._panoramicVideoViewer=new ve,this._panoramicViewer=new ye,this._panoramicMeasurementViewer=new ye,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new O,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const a=this.overlayedMapFeatures.get(e);a?.forEach(e=>{const a=e.attributes??{},r=Object.keys(a).find(e=>e.toLowerCase()===i.toLowerCase());(r?a[r]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return f(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:r,layerTimeExtent:o}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,r,o,t));try{await s,await this.selectBestFeature(e,t)}catch(a){y(a)||(h.getLogger(this).error("oriented-imagery-viewer:show-image",a),"NoFeatureFoundWithObjectIdError"===a.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",a.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null;const a=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!a(this._navigationManager)){m(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(f(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>{switch(this.mode){case"video":return"video-loaded"===this.state;case"panoramic-video":return this.panoramicVideoLoaded;default:return"image-loaded"===this.state}},t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:a,view:r}=this;if(this.emit("popup-close"),!(r&&e&&i&&a))return;const{attributes:o,geometry:s}=e,n=new t({geometry:s,attributes:o.toJSON(),origin:a.graphicOrigin,sourceLayer:a});this.emit("popup-open",{features:[n],location:o.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?_e:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:a,videoViewModel:r,_panoramicVideoViewer:o}=this;if("video"===a)return await(r?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===a){const r={feature:t,mode:a,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,r,o.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(De.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&("image-loaded"===this.state||"video-loaded"===this.state&&"video"===this.mode&&!!this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&"panoramic-video"===this.mode&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ge.DEFAULT),De.click)},this._createImageClickHandle=()=>{this.removeHandles(De.imageClick),this.videoViewModel?.syncMapImageConversionHandle();const{mapImageConversionToolState:e,mode:t,footprintExtent:i,panoramicVideoLoaded:a}=this,o="panoramic-video"===t?this._panoramicVideoViewer:this.activeViewer,s=o?.imageSize;if(!e||"none"===t||"video"===t||!s||!i)return;const n="panoramic-video"===t,l=this._getActiveFeatureForCurrentMode(),c=!n||a&&this.panoramicVideoPaused;if(!l||!c)return;const h=o.clickAction;this.clickAction="pixel-location";const u=d(()=>{this.clickAction=h});let p=null;const m=V(()=>o,"pixel-location",e=>{this.plotReferencePointOnImage(e),p?.abort(),p=r(async a=>{if(!e)return;const r=this._getActiveFeatureForCurrentMode();if(!r)return;const o={feature:r,mode:t,imageSize:s,footprintExtent:i};let l=n?await this.getMapPointForFeature(e,o,{signal:a}):await this._transformationService.pixelToMapPoint(e);const d=this.view?.spatialReference;l&&!te(!d,l.spatialReference.equals(d))&&(l=await G(l,d,{signal:a})),f(a),this.plotReferencePointOnGround(l)})});this.addHandles([m,u],De.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(De.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),De.triangularImageClick)},this._enablePan=()=>{this.removeHandles(De.videoPanHandles)},this._disablePan=()=>{this.removeHandles(De.videoPanHandles),this.addHandles(Ye(this.videoMapView),De.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const a=e.results.find(({graphic:e,graphic:{attributes:a}})=>i.includes(e)&&a&&!a[t.imageReferenceField]&&!a[t.imageGeometryField]);if(!a)return;const r=a.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadCurrentFeatureMedia=async(e,t)=>{"video"!==this.mode?"panoramic-video"!==this.mode?await this._loadImage(t):await this._loadVideo(t):await this._loadFlatVideo(e,t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);const i=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,i,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,i)=>{try{if(await F(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(a){y(a)||h.getLogger(this).error("failed to plot selected point on video",{error:a,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:a}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||a)return;const{depthImage:r}=t.attributes;if(!r)return;const o=(await(import("./services/DepthImageService.js"))).default;f(e),this.depthImage=new o({url:r});try{await this.depthImage.load(e)}catch(s){y(s)||(h.getLogger(this).error("error occurred while loading depth image",s),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:a}=this,r=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),i&&t&&"none"!==a&&"video"!==a&&"panoramic-video"!==a)try{if(await this.loadImageFromFeature(i,t,e),f(e),r)try{await this._restoreNavigationViewState(r,e)}catch(o){if(y(o))throw o;h.getLogger(this).warn("oriented-imagery-viewer:failed-to-restore-navigation-view-state",o)}await this.transformAndPlotSelectedLocation(e)}catch(o){y(o)||this.loadImageError(o)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:a}=this,r=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!r)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?D(l):new E(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=r;let t=0;d&&a&&(t=await ie(d,a)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),f(e)}catch(c){y(c)||this.loadImageError(c)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:a}=this;if("default"!==a&&"panoramic"!==a)return;let r;try{r=await wt(t.attributes,e,i),f(i)}catch(v){if(y(v))return;return Ne(v)?(h.getLogger(this).error(v),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(h.getLogger(this).error(v,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!r)return;const{mediaUrl:o,datasetFormat:s,rotation:n,searchParams:l,location:d,cameraHeading:c,matrix:u,cameraPitch:p,getDataSetFormatError:m}=r,g=`${t.attributes.objectId}`;try{let r=this._mediaPrefetcher?.getCachedMedia(g);if(!r){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}r=this._mediaPrefetcher?.getCachedMedia(g)}}if(r){if("panoramic"===a){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let a=0;return d&&this.selectedPoint&&(a=await ie(d,this.selectedPoint)-a),await e.loadMedia(r,i),this.selectedPoint?e.set({yaw:a,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,r,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&h.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===a?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await ie(d,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:s?.toUpperCase(),url:o,cameraHeading:c,matrix:u},i):await this.loadMediaSource({datasetFormat:s?.toUpperCase(),url:o,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:a}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==a&&"video"!==a&&"panoramic-video"!==a)try{await this.loadImageFromFeature(i,t,e),f(e)}catch(r){y(r)||this.loadImageError(r)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));f(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await(import("./adapters/view/MapViewAdapter.js"));f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=B(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:a,triangulatedMeasurementGraphic:r}=this;t&&i&&a&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;const{minScale:t}=this.videoMapView.constraints,i=this.videoMapView.scale<t-Ve,a=et(e);i&&!!a?(this._enablePan(),this.videoMapView.constraints.geometry=a):i?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:i,button:a,mapPoint:r}=e;if("mouse"===i&&0!==a||!r)return;e.stopPropagation(),e.preventDefault();const{view:o,layer:s}=this;if(o){if(s){if(this.shouldShowSelectedImage){const i=o.hitTest(e,{include:[s]});this._updatingHandles.addPromise(i);const a=await i;return f(t),await this._processHitTestResults(s,a,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}this.setMessage("noLayerSelected","info")}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await w(i),!e)return;const a=new E({...T(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:Ae}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("video"===this.mode)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(a)??null;else if("panoramic"===this.mode){const{imageSize:i,media:a}=this._panoramicViewer;if(!i||!a)return;const r=He(a),o=ae(e,...i,r);this._crossSymbol=new t({geometry:new E(o,j.WebMercator),symbol:ke}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([S(()=>this.view,()=>this.load(),b),S(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},M),S(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},M),S(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{const i=e[2],a=t?.[2];a&&!i&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},b),S(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},b),S(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},b),S(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},b),S(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},b),S(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},b),S(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),b),S(()=>this.currentBestFeature,async(e,t)=>{g(this._featureChangedTask),this._featureChangedTask=r(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),S(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=r(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),f(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},b),S(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{g(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=r(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),f(i),this._reorderTriangularSketchLayer()})},b),S(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),S(()=>this.mode,e=>{switch(this.removeHandles(De.interactionHandles),e){case"default":this.addHandles(S(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...b,equals:(e,t)=>i(e,t,c)}),De.interactionHandles);break;case"video":this.addHandles(S(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:Se,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...b,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),De.interactionHandles);break;case"panoramic":this.addHandles(S(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:a,vfov:r,hfov:o,pitch:s,yaw:n}=i;return e&&a&&!t.includes("loading")&&null!=r&&null!=o&&null!=s&&null!=n?[r,o,n,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,o]=e;this.currentNode&&(this.currentNode.currentHeading=a,this.currentNode.currentPitch=o),g(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:o},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),De.interactionHandles);break;case"panoramic-video":this.addHandles(S(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:a,vfov:r,hfov:o,pitch:s,yaw:n,viewModel:l}=i,d=l.closestFeature??e;return d&&a&&!t.includes("loading")&&null!=r&&null!=o&&null!=s&&null!=n?[r,o,n,s,d]:null},e=>{if(!e)return;const[t,i,a,o,s]=e;g(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:o,feature:s,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),f(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),De.interactionHandles)}},b),S(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)},b),S(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),S(()=>this.activeViewer,e=>{this.removeHandles(De.hittestHandles),e&&this.addHandles(V(()=>e,"hittest-response",this._handleImageHitTestResponse),De.hittestHandles)}),S(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),S(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),P(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=g(this._updateFootprintTask),this._clickTask=g(this._clickTask),this._navigationViewStateTask=g(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!ze(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return null!=this._pendingPanoramicNavigationViewState}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return ze(t)||Ce(t)}get imageLoaded(){return s(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===be}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Ue(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ce(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:a}=e;return 360===i||a?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:a,panoramicVideoPaused:r}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===a?.videoPaused||"panoramic-video"===e&&i&&r}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Me.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i,_navigationManager:a}=this;if(!this.isFulfilled()||t||!1===i?.finished||a?.navigating)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:a}})=>{const r=e?.trim();return ze(r)||Ce(r)?{url:r,objectId:t,rotation:(i??0)+(a??0)}:null}).filter(a)):null}get videoExtentPoints(){const e=tt(this.videoMapView.extent);return e.length?e:Se}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new N({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new N({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:a}=this;if(!i)throw Ft();ht(a,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Ft();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Ft();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Ft();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Ft();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Ft();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Ft();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const a=[],r=[],o=[];return e.forEach(e=>{const{layer:{coveragePercent:s},attributes:n}=e;let l;const{polygon:d,frustum:c}=W(n);if(l=d.clone(),n.isInspection&&(l=$(n)),s&&(l=Z(l,s)),i||!t||J(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,h=t.clone();h.z=s/Q(t.spatialReference),h.imageID=i,this.pointSources.push(h),l!==be&&(a.push(d),c&&r.push(c))}}),{features:o,polygons:a,frustums:r}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Me[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._scheduleCurrentBestFeatureUpdate(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const a=this._sectorData?.[t],r=a?.at(i);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(f(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:a}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(a))return;const{features:r,polygons:o,frustums:s}=this.filterByFootprints(a,t,i?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s);const n=await this.processElevationSample(o,r,i);f(i),await this._updateElevationOfSelectedPointAndLocations(r,t,n),f(i),qe(r,n);let l=r;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=We(r,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const d=this._processSuitableFeatures(l,t);this.updateSuitabilities(d,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:a,polygons:r}=this.filterByFootprints(e,t,!0);if(!a?.length)return;const o=await this.processElevationSample(r,a,i);return f(i),o}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:o}=this;if(!i||!a||!r||"none"===o)return;if(this.displayNewMeasurementButton=!1,"panoramic"===o&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===o){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const s=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;s&&this.sketch&&(this.sketch.polygonSymbol=Te(s),this.sketch.polylineSymbol="panoramic"===o?Oe:Le(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new pe({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:r,layer:o,mode:s,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:d,_panoramicVideoViewer:c}=this,h="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&o&&"none"!==s&&this.overlayGraphicsEnabled))return;const{polygon:g}=W(p.attributes);if(h?d?.removeOverlayGraphics(r.toArray()):u?c.removeManyGraphics(r.toArray()):i?.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await o.queryFeatures({where:I(`${o.objectIdField} <> ${p.attributes.objectId}`,I(o.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l}),v=await Promise.all(e.map(async e=>{const{attributes:i,geometry:a}=e;if("point"!==a?.type)return null;const r=await this._geometryToOverlayImageGeometry(a,p,m);if(!r)return null;const o="panoramic"===s||"panoramic-video"===s?Ee():Ge();return new t({attributes:i,symbol:o,geometry:r})}));r.addMany(v.filter(a)),h?d?.addOverlayGraphics(r.toArray()):u?c.addManyGraphics(r.toArray()):i?.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:r,mode:s,layer:n,videoViewModel:l,_panoramicVideoViewer:d}=this,c="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==s&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=W(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=ut(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:v}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),y=await Promise.all(v.map(async a=>{const o=a.symbol?.clone()??e.renderer?.getSymbol(a)?.clone(),{attributes:n,geometry:g}=a,{imageGeometryField:v,oiObjectIdField:y}=this;if(v&&y&&_t(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const a=u?d.horizonAngles:He(r?.media),h=pt(n,v,e,i,m,c?"default":s,o,a);if(!c)return h;const p=h.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:h.symbol,geometry:g,visible:h.visible}):null}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:a,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:o,geometry:_,visible:e.visible&&i}):null})),f=new o(y.filter(a));("video"!==s&&"panoramic-video"!==s||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:a,state:r,depthImage:o}=this,s=t?.imageSize;if(!s||!i||"none"===a||r.includes("loading"))return h.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!o?.loaded)return h.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>o.depthAt(e,{width:s[0],height:s[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return Me.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){return(await this._transformationService.pointToPixelForFeature([e],t,i))[0]}async getPixelLocationsForFeature(e,t,i){return await this._transformationService.pointToPixelForFeature(e,t,i)}async _getMapPointInViewSpatialReference(e,t){const i=await this.getMapPoint(e,t),a=this.view?.spatialReference;return await G(i,a,t)}async plotMapPoint(e){this.plotReferencePoint(e);const t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new E({...e.toJSON()}),symbol:je}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case"video":return void this._plotReferencePointOnVideo(e);case"panoramic-video":return void this._plotReferencePointOnPanoramicVideo(e);case"default":return void this._plotReferencePointOnDefaultImage(e);case"panoramic":return void this._plotReferencePointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const a=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(a);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(a);break;default:this.activeViewer?.removeManyGraphics(a)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=g(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:a}=t,r=i.get(e.id),o=r?.toArray();if(!r||!o?.length)return;const{addFeatureResults:s}=await this.saveDataCaptureFeatures(o),n=s.reduce((t,{objectId:i,globalId:a,error:r},s)=>{const n=o[s],{attributes:l}=n;return r?t.error.push(n):(i&&(l[e.objectIdField]=i),a&&e.globalIdField&&(l[e.globalIdField]=a),t.success.push(n)),t},{success:[],error:[]});a.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:r,dataCaptureLayer:o,mode:s}=this,l=i?.imageSize;if(!l||!r||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!o)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const d=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:a}=i;if(!a)return;const r=a.type,s=o.hasZ,n=o.geometryType,l=r!==n,d=l?await(import("./transformers.js")):null,c=d?.default[n],h=l?c?.(a):a;return h&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(h,t),i.geometry)?(s||mt(i.geometry),i):void 0})),c=d.filter(a);return o.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let i=0;const a=d.map(e=>{const a=t[i++];return e?a:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:a}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async restorePendingPanoramicNavigationViewState(e){const t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,"panoramic"===this.mode&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:a,currentBestFeature:r}=this;if(!i||!r||!a)return;const{attributes:{objectId:s}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],d=[];for(const o of n)`${o.getAttribute(a)}`==`${s}`?l.push(o):d.push(o);this.overlayGraphicsOnImage(e.id,new o(d)),this.collectionId=e.id;const c=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);f(t),c.addGraphics(l),h.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const a=i.ui.find("zoom");a&&(a.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const a=this.overlayedMapFeatures.get(e);a&&i&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:i,options:a}=e;let r=!1,o=!1;const s="video"===this.mode?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);o=s.extent.contains(e);break}}if(!r&&!o)return void this.clearReferencePointOnImage();const n="video"===this.mode||"panoramic-video"===this.mode?await this.getPixelLocationForFeature(i,{feature:t,mode:this.mode,imageSize:_e,footprintExtent:this.footprintExtent},a):await this._transformationService.pointToPixel(i,a);if(n)return f(a),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await U(e,t);i.features?.length&&(this.featureCache=i.features)}_plotReferencePointOnVideo(e){"video-loaded"===this.state&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){const i=this._panoramicVideoViewer,{imageSize:a,media:r}=i.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!a)return;this.clearReferencePointOnImage();const o=He(r),s=gt(e,"panoramic",a,o);this._referencePointOnImage=new t({geometry:s,symbol:Re.clone()}),i.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case"video":return this.videoViewModel?.closestFeature??this.currentBestFeature;case"panoramic-video":return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){const i=this._imageViewer,{imageSize:a}=i;if("image-loaded"!==this.state||!a)return;this.clearReferencePointOnImage();const r=gt(e,"default",a);this._referencePointOnImage=new t({geometry:r,symbol:je.clone()}),i.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){const i=this._panoramicViewer,{imageSize:a,media:r}=i;if("image-loaded"!==this.state||!a)return;this.clearReferencePointOnImage();const o=He(r),s=gt(e,"panoramic",a,o);this._referencePointOnImage=new t({geometry:s,symbol:Re.clone()}),i.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:a,layerTimeExtent:r,view:o}=this;if(!o)return;if(!i)return void this.setMessage("noLayerSelected","info");e.x=B(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await G(e,i.spatialReference),n=s.spatialReference.isGeographic?D(s):s,l=I("1=1",I(i.definitionExpression,a)),d=n.spatialReference.isGeographic?1:C(n.spatialReference),c={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/d:void 0,timeExtent:r}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:a}=this,r=i.at(0);if(!e||!t||!r||!i||a)return void(this._sectorData=null);this._sectorData={};const s={};this._featureToSector=s;for(const c of Me)this._sectorData[c]=new o;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),d=Math.max(...l);n.forEach(e=>{const{distance:t,angle:a,featureIndex:o}=e,n=t/d*Ie[2],l=Qe(t,d),c=Xe(a);if(!this._sectorData)return;const h=Ie[3]+n*Math.sin(a*Math.PI/180),u=Ie[3]+n*Math.cos(a*Math.PI/180);let p;const m=i.at(o),g=m===r,{cameraPitch:v}=m.attributes,y=v<5;if(g&&y)p=-90;else{const e=h-Ie[3],t=u-Ie[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),p=a}const f=""===l?c:`${l}_${c}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=y?null:{x:h,y:u,direction:c}),s[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:a,featureIndex:o,x:h,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;f(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new dt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(De.videoPlayerHandles),this.videoElement=new he({video:this.currentBestFeature.attributes.imagePath,georeference:new de({extent:new L(Pe)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new st({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const a=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?a:a[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...a}=e,r=$e(a);try{await r.load(t)}catch(s){if(y(s))return;if("unsupported-format"===s.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:r?.extension??"UNKNOWN FORMAT"})}const o=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await o.loadMedia(r,t),i&&o.set(i)}async loadMediaSource(e,t){const i=Ze(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const{unionExecuteMany:a}=await(import("../../geometry/operators/unionOperator.js")),r=a(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(o){y(o)||h.getLogger(this).error(o)}}async processElevationSample(e,t,i){const{elevationSource:a}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,i);return r||(a&&this.footprintExtent&&K(a)?await ee({extent:this.footprintExtent,lod:a.lod,url:a.url,rasterFunction:a.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:Je(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[a]}=t;if("graphic"!==a?.type)return this.beforeLoad(!1),this.emit("no-image-found"),void this.setMessage("noImageError","error");const r=a.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(r,i)}async _queryAndLoadByObjectId(e,t,i,a,r){this.displayMessage=null;const{response:o}=await lt(e,t,i,a,r);if(f(r),!o?.features?.length)throw new nt(t);const{attributes:s}=o.features[0];let n,l;if(s.orientedImageryType?.includes("360")){n=X(s.geometry);const{cameraHeading:e,farDistance:t,nearDistance:i}=s,a=[Math.sin(p(e)),Math.cos(p(e))],r=(t+i)/2;l=C(n.spatialReference),n.x+=r*a[0]/l,n.y+=r*a[1]/l,n.z=void 0}else{const e=W(s).polygon,t=E.fromJSON(R(e));n=X(t),l=C(n.spatialReference)}this.selectedPoint=n;const d={layerInstanceOrURL:e,point:n,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0,timeExtent:a}},c=await z(d,r);f(r);const{features:h}=c;return h.push(o.features[0]),await this.processFeatureResponse(c,n,{...r,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}async _restoreNavigationViewState(e,t){const i=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(f(t),"panoramic"===this.mode){const t=He(this._panoramicViewer.media);if(!t)return;yt({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:i})}ft({viewState:e,imageViewer:this._imageViewer,imageCenter:i})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,a){const{location:r,cameraHeight:o}=e[0].attributes,s=await re(r.spatialReference,r.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},a);f(a);const[n,...l]=await Y([t,...e.map(e=>e.attributes.geometry.clone())],s);f(a),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:a,cameraHeading:r,cameraPitch:o}=i;return new ot({geometry:t,attributes:i,currentHeading:a?0:r,currentPitch:a?0:o})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:a}}of e)t.contains(a)||i.push([a.x,a.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=me(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:a,currentCoverageVisible:r,isAdditionalPointSourcesVisible:o,mode:s,layer:n}=this;if(a&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await G(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===a.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:xe,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:Be,visible:o}))}"video"!==s&&"panoramic-video"!==s||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,a.geometry.spatialReference))}}_scheduleCurrentBestFeatureUpdate(e){g(this._navigationViewStateTask);const t=r(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!y(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),f(t),this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const i=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(i)a=-90;else{const t=e.x-Ie[3],i=e.y-Ie[3],r=i/Math.sqrt(t**2+i**2);let o=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(o*=-1),a=o}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=i?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector},"panoramic"===this.mode&&(await F(()=>"image-loaded"===this.state,t),f(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){"default"!==this.mode?"panoramic"===this.mode&&await this._capturePendingPanoramicNavigationViewState(e):await this._capturePendingDefaultNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{const{imageSize:t,imageRenderer:i}=this._imageViewer,a=i.center;if("image-loaded"!==this.state||!t[0]||!t[1]||!a)return void(this._pendingDefaultNavigationViewState=null);const r=vt(a,"default",t),o=await this._getMapPointInViewSpatialReference(r,e);f(e),this._pendingDefaultNavigationViewState={center:o,scale:i.scale}}catch(t){this._handlePendingNavigationViewStateCaptureError(t)}}async _capturePendingPanoramicNavigationViewState(e){const t=He(this._panoramicViewer.media);if(t)try{const{fov:i,imageSize:a,pitch:r,yaw:o}=this._panoramicViewer;if("image-loaded"!==this.state||!a||!i)return void(this._pendingPanoramicNavigationViewState=null);const[s,n]=oe(o,r,t),l=se(s,n,a[0],a[1]),d=await this._getMapPointInViewSpatialReference(l,e);f(e),this._pendingPanoramicNavigationViewState={center:d,fov:i}}catch(i){this._handlePendingNavigationViewStateCaptureError(i)}}_handlePendingNavigationViewStateCaptureError(e){if(y(e))throw e;h.getLogger(this).warn("oriented-imagery-viewer:failed-to-capture-navigation-view-state",e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:a}=this;if(!t||!i||!i.imageSize||"panoramic"!==a&&"default"!==a)return;const{imageSize:r}=i,{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let h=o.location;h.spatialReference.isGeographic&&(h=X(h));const u="default"===a?ne(o,r[0],r[1]):le(o,r[0],r[1]),p=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),m=(await(import("./services/TransformationService.js"))).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:a,imageSize:r,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:a}=this,r="video"===a||"panoramic-video"===a?_e:i?.imageSize;if(!t||!r||"none"===a)return;const{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let h=o.location;h.spatialReference.isGeographic&&(h=X(h));const u="default"===a||"video"===a?"default":"panoramic",p={..."default"===u?ne(o,r[0],r[1]):le(o,r[0],r[1]),cameraLocation:h},m=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),g=(await(import("./services/TransformationService.js"))).default,v={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:r,depthImageService:this.depthImage};this._transformationService=new g(v),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){if(this._crossSymbol){if("video"===this.mode)return this.videoViewModel?.clearSelectedPointOnVideo(),void(this._crossSymbol=null);this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)}else this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,i,a){this.displayMessage={key:e,type:t,data:i,map:a}}async transformAndPlotSelectedLocation(e){const{invalidCameraHeading:t,selectedPoint:i,activeViewer:a,videoElement:r}=this,o="video"===this.mode?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();const s="video"===this.mode?!0===r?.loaded&&!0===this.videoViewModel?.videoPaused:"image-loaded"===a?.state;if(!i||!o||!s||t)return;if("video"===this.mode){if(!await it(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:_e,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!at(n))return;f(e),await this.plotSelectedPointOnImage(n,e)}catch(l){y(l)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:l,selectedPoint:i,feature:o})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:a,currentBestFeature:r,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:d,mode:c}=this;if(!r)return;const{attributes:{objectId:h},elevationSample:u}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...a,o].filter(Ke);"3d"===l?.type&&u&&d?.updateGroundElevation&&(this._updateGroundElevation&&d.updateGroundElevation(e),"panoramic"===c&&this.bestFeatureCurrentFootprint&&d.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ae.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&d?.updateGroundElevation&&"panoramic"===c&&d.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:a,mode:r,view:o,state:s,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:d,depthImage:c}=this,h=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:d?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:h,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:c?.loaded??!1,layer:a,mode:r,panoramicCamera:e?.camera,state:s,superimposeViewEnabled:n&&l,view:o}),this.setMessage("superimposeImageDescription","info"),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){const e=null!=this._superimposePreviousCurrentCoverageVisible;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){null!=this._superimposePreviousCurrentCoverageVisible&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){const{currentBestFeature:e,mode:t}=this;if(!e||"default"!==t&&"panoramic"!==t)return;this._restoreSuperimposeMediaTask?.abort();const i=r(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=i,i.promise.finally(()=>{this._restoreSuperimposeMediaTask===i&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){if("superimposeImageDescription"===this.displayMessage?.key){!!this.currentBestFeature&&("default"===this.mode||"panoramic"===this.mode)?this.displayMessage=null:this.setMessage("onLoadMessage","info")}}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,a=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",a)};this._superimposeScheduleController=t,i.addEventListener("abort",a),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",a),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,r="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==r||r.interacting||r.navigating||this._updateSuperimposedImage()})}};e([A()],Vt.prototype,"activeLayer",null),e([A({readOnly:!0})],Vt.prototype,"activeViewer",null),e([A()],Vt.prototype,"activeTriangulatedViewer",null),e([A()],Vt.prototype,"accuracyParametersMissing",null),e([A()],Vt.prototype,"additionalFeatures",void 0),e([A({type:o.ofType(t)})],Vt.prototype,"additionalCameraLocations",void 0),e([A({type:o.ofType(t)})],Vt.prototype,"additionalFootprints",void 0),e([A()],Vt.prototype,"areaMeasurementResult",void 0),e([A()],Vt.prototype,"areaMeasurementAccuracy",void 0),e([A()],Vt.prototype,"bestFeatureAngle",void 0),e([A()],Vt.prototype,"bestFeatureCurrentFootprint",void 0),e([A({type:t})],Vt.prototype,"bestFeatureFootprint",void 0),e([A({type:Number})],Vt.prototype,"brightness",null),e([A()],Vt.prototype,"cameraHeadingThreshold",void 0),e([A()],Vt.prototype,"cameraPitchThreshold",void 0),e([A()],Vt.prototype,"clickAction",void 0),e([A()],Vt.prototype,"correctedLocationPointOnImage",void 0),e([A()],Vt.prototype,"videoViewModel",void 0),e([A()],Vt.prototype,"collectionId",void 0),e([A({type:Number})],Vt.prototype,"contrast",null),e([A()],Vt.prototype,"coverageFrustums",void 0),e([A()],Vt.prototype,"coveragePolygons",void 0),e([A()],Vt.prototype,"currentBestFeature",void 0),e([A()],Vt.prototype,"currentBestFeatureMeasurementImage",void 0),e([A()],Vt.prototype,"currentBestFeatureLocation",void 0),e([A()],Vt.prototype,"currentCoverageVisible",void 0),e([A()],Vt.prototype,"currentNode",null),e([A()],Vt.prototype,"depthImage",void 0),e([A()],Vt.prototype,"depthImageNotSupported",null),e([A()],Vt.prototype,"featureCache",void 0),e([A()],Vt.prototype,"navigationNodes",void 0),e([A({json:{write:!1}})],Vt.prototype,"determineWorkflowForFeature",void 0),e([A({json:{write:!1}})],Vt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([A()],Vt.prototype,"disabled",void 0),e([A()],Vt.prototype,"displayMessage",void 0),e([A()],Vt.prototype,"displayNewMeasurementButton",void 0),e([A()],Vt.prototype,"distanceMeasurementResult",void 0),e([A()],Vt.prototype,"distanceAccuracyArray",void 0),e([A()],Vt.prototype,"dataCaptureLayer",void 0),e([A({readOnly:!0})],Vt.prototype,"featureCount",null),e([A()],Vt.prototype,"features",void 0),e([A()],Vt.prototype,"groundCoordinates",void 0),e([A()],Vt.prototype,"groundCoordinatesAccuracy",void 0),e([A()],Vt.prototype,"groundCoordinatesAccuracyLoading",void 0),e([A()],Vt.prototype,"hasPendingPanoramicNavigationViewState",null),e([A()],Vt.prototype,"heightGraphic",void 0),e([A()],Vt.prototype,"heightMeasurementResult",void 0),e([A()],Vt.prototype,"heightMeasurementAccuracy",void 0),e([A({readOnly:!0})],Vt.prototype,"imageGalleryEnabled",null),e([A()],Vt.prototype,"imageGeometryField",void 0),e([A({readOnly:!0})],Vt.prototype,"imageLoaded",null),e([A()],Vt.prototype,"imageLocationToolState",void 0),e([A()],Vt.prototype,"initialVideoMapViewExtent",void 0),e([A({readOnly:!0})],Vt.prototype,"invalidCameraHeading",null),e([A()],Vt.prototype,"imagePointsInView",null),e([A()],Vt.prototype,"imageMeasurementViewer",void 0),e([A()],Vt.prototype,"isAdditionalCoverageVisible",void 0),e([A()],Vt.prototype,"isAdditionalPointSourcesVisible",void 0),e([A()],Vt.prototype,"layer",void 0),e([A()],Vt.prototype,"layerView",null),e([A({readOnly:!0})],Vt.prototype,"layerFloorFilterClause",null),e([A({readOnly:!0})],Vt.prototype,"layerTimeExtent",null),e([A({type:Number})],Vt.prototype,"localPort",void 0),e([A()],Vt.prototype,"locationPointOnImage",void 0),e([A()],Vt.prototype,"mapImageConversionToolState",void 0),e([A()],Vt.prototype,"measureType",void 0),e([A()],Vt.prototype,"measurementGraphic",void 0),e([A({readOnly:!0,value:"none"})],Vt.prototype,"mode",null),e([A()],Vt.prototype,"navigationMode",void 0),e([A()],Vt.prototype,"navigatorCurrentBestFeature",void 0),e([A()],Vt.prototype,"oiObjectIdField",void 0),e([A({type:o.ofType(t)})],Vt.prototype,"overlayedCameraLocations",void 0),e([A()],Vt.prototype,"overlayedMapFeatures",void 0),e([A()],Vt.prototype,"panoramicVideoLoaded",null),e([A()],Vt.prototype,"panoramicVideoPaused",null),e([A()],Vt.prototype,"pixelCoordinates",void 0),e([A()],Vt.prototype,"preserveAngle",void 0),e([A()],Vt.prototype,"pointSources",void 0),e([A({readOnly:!0})],Vt.prototype,"popupEnabled",null),e([A()],Vt.prototype,"preloadMedia",void 0),e([A()],Vt.prototype,"preloadMediaSize",void 0),e([A()],Vt.prototype,"previousFeatureAngle",void 0),e([A()],Vt.prototype,"referencePoint",null),e([A({readOnly:!0})],Vt.prototype,"sectorData",null),e([A()],Vt.prototype,"selectedPoint",void 0),e([A({type:Number})],Vt.prototype,"sharpness",null),e([A()],Vt.prototype,"shouldShowSelectedImage",void 0),e([A()],Vt.prototype,"superimposeViewEnabled",void 0),e([A()],Vt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([A()],Vt.prototype,"superimposeViewSupported",null),e([A()],Vt.prototype,"sketch",void 0),e([A()],Vt.prototype,"sketchTriangular",void 0),e([A()],Vt.prototype,"sketchTriangularGraphicsLayer",void 0),e([A()],Vt.prototype,"draw",void 0),e([A()],Vt.prototype,"drawAdapter",void 0),e([A()],Vt.prototype,"polylineDrawAction",void 0),e([A()],Vt.prototype,"scheduledFrameId",void 0),e([A()],Vt.prototype,"superimposeScheduledFrameId",void 0),e([A()],Vt.prototype,"superimposeDebounceTimeoutId",void 0),e([A()],Vt.prototype,"sketchAdapter",void 0),e([A({readOnly:!0})],Vt.prototype,"sketchGraphicsLayer",null),e([A({readOnly:!0})],Vt.prototype,"state",null),e([A({readOnly:!0})],Vt.prototype,"thumbnails",null),e([A()],Vt.prototype,"videoExtentPoints",null),e([A()],Vt.prototype,"triangularMeasurementActive",void 0),e([A()],Vt.prototype,"triangulatedDistanceMeasurement",void 0),e([A()],Vt.prototype,"triangulatedDistanceAccuracy",void 0),e([A()],Vt.prototype,"triangulatedAreaMeasurement",void 0),e([A()],Vt.prototype,"triangulatedAreaAccuracy",void 0),e([A()],Vt.prototype,"triangulatedMeasurementGraphic",void 0),e([A()],Vt.prototype,"triangulatedPoint",void 0),e([A()],Vt.prototype,"triangulatedMeasurementAdapter",void 0),e([A()],Vt.prototype,"updateFootprint",void 0),e([A()],Vt.prototype,"updateVideoFootprint",void 0),e([A()],Vt.prototype,"updateFootprintPanorama",void 0),e([A()],Vt.prototype,"updatingTriangularMeasurementState",void 0),e([A({value:null})],Vt.prototype,"view",null),e([A()],Vt.prototype,"videoElement",void 0),e([A()],Vt.prototype,"videoLayer",void 0),e([A()],Vt.prototype,"videoMapView",void 0),e([A()],Vt.prototype,"verticalFilterEnabled",void 0),e([A()],Vt.prototype,"_adapter",void 0),e([A()],Vt.prototype,"_defaultGraphicsLayer",null),e([A()],Vt.prototype,"_highlightedFeatureHandle",void 0),e([A()],Vt.prototype,"_imageViewer",void 0),e([A()],Vt.prototype,"_initialCurrentCoverageUpdate",void 0),e([A()],Vt.prototype,"_locationViewModel",void 0),e([A()],Vt.prototype,"_measurementService",void 0),e([A()],Vt.prototype,"_mediaPrefetcher",void 0),e([A()],Vt.prototype,"_navigationManager",void 0),e([A()],Vt.prototype,"_overlays",void 0),e([A()],Vt.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([A()],Vt.prototype,"_superimposeService",void 0),e([A({readOnly:!0})],Vt.prototype,"_overlaysView",null),e([A()],Vt.prototype,"_panoramicVideoViewer",void 0),e([A()],Vt.prototype,"_panoramicViewer",void 0),e([A()],Vt.prototype,"_panoramicMeasurementViewer",void 0),e([A()],Vt.prototype,"_referencePointOnGround",void 0),e([A()],Vt.prototype,"_referencePointOnImage",void 0),e([A()],Vt.prototype,"_referenceTransformationService",void 0),e([A()],Vt.prototype,"_sectorData",void 0),e([A()],Vt.prototype,"_transformationService",void 0),e([A()],Vt.prototype,"_featureToSector",void 0),e([A({readOnly:!0})],Vt.prototype,"_updatingHandles",void 0),e([A()],Vt.prototype,"footprintExtent",void 0),e([A()],Vt.prototype,"_featureChangedTask",void 0),Vt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Vt);const St=Vt;export{St as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as d}from"../../core/handleUtils.js";import{equalsShallow as c}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as g}from"../../core/maybe.js";import{EsriPromise as v}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as w}from"../../core/promiseUtils.js";import _ from"../../core/ReactiveMap.js";import{whenOnce as F,on as V,watch as S,syncAndInitial as b,initial as M,when as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as C}from"../../core/units.js";import{property as A,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as T}from"../../core/support/jsonUtils.js";import{UpdatingHandles as O}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import E from"../../geometry/Point.js";import{projectAsync as G}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as R}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as B}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import N from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as U}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as W,computePolygonForInspection as $,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as J}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as K}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Q,convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import Y from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ee}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as te,getInitialAngle as ie,convertPixelLocationToSphereVertex as ae,getUpdateElevationProps as re,adjustHorizonAngles as oe,convertOrientationToPixelLocation as se,getImageToWorldProperties as ne,getImageToWorldPanoramicProperties as le}from"../../layers/orientedImagery/transformations/utils.js";import de from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ce}from"../../layers/support/floorFilterUtils.js";import he from"../../layers/support/VideoElement.js";import ue from"../../views/MapView.js";import pe from"../../views/draw/Draw.js";import{scale as me}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ge}from"../../views/input/InputManager.js";import ve from"../PanoramicVideoViewer.js";import ye from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as fe,videoMapViewConstraint as we,fixedImageSize as _e,clockwiseDirections as Fe,videoFitScaleTolerance as Ve,videoExtent as Se,invalidCameraHeading as be,sectorsInOrder as Me,sampleExtent as Pe,sectorsRadii as Ie}from"./constants.js";import{isFeatureAttachment as Ce}from"./galleryUtils.js";import{crossSymbol as Ae,crossSymbol3D as ke,measurementPolygonSymbol as Te,polylineSymbolPanoramic as Oe,measurementPolylineSymbol as Le,cameraOverlaySymbol3D as Ee,cameraOverlaySymbol as Ge,diamondSymbol as je,diamondSymbol3D as Re,activeSourcePointSymbol as xe,sourcePointSymbol as Be}from"./symbols.js";import{registryKeys as De}from"./types.js";import{isNoAttachmentError as Ne,extractHorizonAnglesFromMedia as He,isDepthImage as ze,isTifOrMrf as Ue,filterOILLayerView as qe,assignElevationSampleToFeatures as We,filterByZ as $e,createPanoramicMedia as Ze,createNonPanoramicMedia as Je,isSceneView as Ke,isGraphic as Qe,calculateSegment as Xe,calculateDirection as Ye}from"./utils.js";import{disableVideoZoomAndPan as et,getUpdatedConstraints as tt,getUpdatedExtentPoints as it,isSelectedPointWithinVideoFootprint as at,isVideoPixelWithinFrame as rt}from"./videoViewerUtils.js";import ot from"./components/ImageViewer.js";import st from"./components/NavigationNode.js";import nt from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as lt}from"./navigation/errors.js";import{queryFeatureByObjectIds as dt}from"./navigation/queries.js";import{ImageMeasurementService as ct}from"./services/ImageMeasurementService.js";import ht from"./services/SuperimposeService.js";import{configureSketchTool as ut,extractFieldsFromDataCaptureLayer as pt,constructGraphicFromImageGeometry as mt}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as gt,imageSpaceToPoint as vt,pointToImageSpace as yt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as ft,restoreDefaultNavigationViewState as wt}from"./support/navigationViewStateUtils.js";import _t from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as Ft}from"./support/typeUtils.js";const Vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let St=class extends(l(v)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=fe,this.cameraPitchThreshold=fe,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new o,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r}=this;if(this.emit("popup-close"),a&&r){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadCurrentFeatureMedia(a,i)}catch(o){y(o)||(this.loadImageError(o),h.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(a){y(a)||(this.loadImageError(a),h.getLogger(this).error("#loadIImage()","error occured while loading image",a))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new o,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new ot,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new _,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new o,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new ue({map:new Map,attributionVisible:!1,constraints:we}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ot,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new N({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new ht({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{const{imageToWorldProperties:e,mode:t,updateElevationProps:i}=this._transformationService;return"panoramic"===t&&e?{imageToWorldProperties:e,updateElevationProps:i}:null},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,i)=>this._transformationService.pixelToPointAtDistance(e,t,i)}),this._panoramicVideoViewer=new ve,this._panoramicViewer=new ye,this._panoramicMeasurementViewer=new ye,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new O,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const a=this.overlayedMapFeatures.get(e);a?.forEach(e=>{const a=e.attributes??{},r=Object.keys(a).find(e=>e.toLowerCase()===i.toLowerCase());(r?a[r]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return f(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:r,layerTimeExtent:o}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,r,o,t));try{await s,await this.selectBestFeature(e,t)}catch(a){y(a)||(h.getLogger(this).error("oriented-imagery-viewer:show-image",a),"NoFeatureFoundWithObjectIdError"===a.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",a.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null;const a=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!a(this._navigationManager)){m(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(f(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>{switch(this.mode){case"video":return"video-loaded"===this.state;case"panoramic-video":return this.panoramicVideoLoaded;default:return"image-loaded"===this.state}},t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:a,view:r}=this;if(this.emit("popup-close"),!(r&&e&&i&&a))return;const{attributes:o,geometry:s}=e,n=new t({geometry:s,attributes:o.toJSON(),origin:a.graphicOrigin,sourceLayer:a});this.emit("popup-open",{features:[n],location:o.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?_e:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:a,videoViewModel:r,_panoramicVideoViewer:o}=this;if("video"===a)return await(r?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===a){const r={feature:t,mode:a,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,r,o.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(De.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&("image-loaded"===this.state||"video-loaded"===this.state&&"video"===this.mode&&!!this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&"panoramic-video"===this.mode&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ge.DEFAULT),De.click)},this._createImageClickHandle=()=>{this.removeHandles(De.imageClick),this.videoViewModel?.syncMapImageConversionHandle();const{mapImageConversionToolState:e,mode:t,footprintExtent:i,panoramicVideoLoaded:a}=this,o="panoramic-video"===t?this._panoramicVideoViewer:this.activeViewer,s=o?.imageSize;if(!e||"none"===t||"video"===t||!s||!i)return;const n="panoramic-video"===t,l=this._getActiveFeatureForCurrentMode(),c=!n||a&&this.panoramicVideoPaused;if(!l||!c)return;const h=o.clickAction;this.clickAction="pixel-location";const u=d(()=>{this.clickAction=h});let p=null;const m=V(()=>o,"pixel-location",e=>{this.plotReferencePointOnImage(e),p?.abort(),p=r(async a=>{if(!e)return;const r=this._getActiveFeatureForCurrentMode();if(!r)return;const o={feature:r,mode:t,imageSize:s,footprintExtent:i};let l=n?await this.getMapPointForFeature(e,o,{signal:a}):await this._transformationService.pixelToMapPoint(e);const d=this.view?.spatialReference;l&&!te(!d,l.spatialReference.equals(d))&&(l=await G(l,d,{signal:a})),f(a),this.plotReferencePointOnGround(l)})});this.addHandles([m,u],De.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(De.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),De.triangularImageClick)},this._enablePan=()=>{this.removeHandles(De.videoPanHandles)},this._disablePan=()=>{this.removeHandles(De.videoPanHandles),this.addHandles(et(this.videoMapView),De.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const a=e.results.find(({graphic:e,graphic:{attributes:a}})=>i.includes(e)&&a&&!a[t.imageReferenceField]&&!a[t.imageGeometryField]);if(!a)return;const r=a.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadCurrentFeatureMedia=async(e,t)=>{"video"!==this.mode?"panoramic-video"!==this.mode?await this._loadImage(t):await this._loadVideo(t):await this._loadFlatVideo(e,t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);const i=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,i,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,i)=>{try{if(await F(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(a){y(a)||h.getLogger(this).error("failed to plot selected point on video",{error:a,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:a}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||a)return;const{depthImage:r}=t.attributes;if(!r)return;const o=(await(import("./services/DepthImageService.js"))).default;f(e),this.depthImage=new o({url:r});try{await this.depthImage.load(e)}catch(s){y(s)||(h.getLogger(this).error("error occurred while loading depth image",s),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:a}=this,r=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),i&&t&&"none"!==a&&"video"!==a&&"panoramic-video"!==a)try{if(await this.loadImageFromFeature(i,t,e),f(e),r)try{await this._restoreNavigationViewState(r,e)}catch(o){if(y(o))throw o;h.getLogger(this).warn("oriented-imagery-viewer:failed-to-restore-navigation-view-state",o)}await this.transformAndPlotSelectedLocation(e)}catch(o){y(o)||this.loadImageError(o)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:a}=this,r=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!r)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?D(l):new E(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=r;let t=0;d&&a&&(t=await ie(d,a)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),f(e)}catch(c){y(c)||this.loadImageError(c)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:a}=this;if("default"!==a&&"panoramic"!==a)return;let r;try{r=await _t(t.attributes,e,i),f(i)}catch(v){if(y(v))return;return Ne(v)?(h.getLogger(this).error(v),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(h.getLogger(this).error(v,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!r)return;const{mediaUrl:o,datasetFormat:s,rotation:n,searchParams:l,location:d,cameraHeading:c,matrix:u,cameraPitch:p,getDataSetFormatError:m}=r,g=`${t.attributes.objectId}`;try{let r=this._mediaPrefetcher?.getCachedMedia(g);if(!r){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}r=this._mediaPrefetcher?.getCachedMedia(g)}}if(r){if("panoramic"===a){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let a=0;return d&&this.selectedPoint&&(a=await ie(d,this.selectedPoint)-a),await e.loadMedia(r,i),this.selectedPoint?e.set({yaw:a,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,r,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&h.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===a?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await ie(d,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:s?.toUpperCase(),url:o,cameraHeading:c,matrix:u},i):await this.loadMediaSource({datasetFormat:s?.toUpperCase(),url:o,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:a}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==a&&"video"!==a&&"panoramic-video"!==a)try{await this.loadImageFromFeature(i,t,e),f(e)}catch(r){y(r)||this.loadImageError(r)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));f(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await(import("./adapters/view/MapViewAdapter.js"));f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=B(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:a,triangulatedMeasurementGraphic:r}=this;t&&i&&a&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;const{minScale:t}=this.videoMapView.constraints,i=this.videoMapView.scale<t-Ve,a=tt(e);i&&!!a?(this._enablePan(),this.videoMapView.constraints.geometry=a):i?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:i,button:a,mapPoint:r}=e;if("mouse"===i&&0!==a||!r)return;e.stopPropagation(),e.preventDefault();const{view:o,layer:s}=this;if(o){if(s){if(this.shouldShowSelectedImage){const i=o.hitTest(e,{include:[s]});this._updatingHandles.addPromise(i);const a=await i;return f(t),await this._processHitTestResults(s,a,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}this.setMessage("noLayerSelected","info")}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await w(i),!e)return;const a=new E({...T(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:Ae}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("video"===this.mode)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(a)??null;else if("panoramic"===this.mode){const{imageSize:i,media:a}=this._panoramicViewer;if(!i||!a)return;const r=He(a),o=ae(e,...i,r);this._crossSymbol=new t({geometry:new E(o,j.WebMercator),symbol:ke}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([S(()=>this.view,()=>this.load(),b),S(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},M),S(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},M),S(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{const i=e[2],a=t?.[2];a&&!i&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},b),S(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},b),S(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},b),S(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},b),S(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},b),S(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},b),S(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),b),S(()=>this.currentBestFeature,async(e,t)=>{g(this._featureChangedTask),this._featureChangedTask=r(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),S(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=r(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),f(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},b),S(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{g(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=r(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),f(i),this._reorderTriangularSketchLayer()})},b),S(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),S(()=>this.mode,e=>{switch(this.removeHandles(De.interactionHandles),e){case"default":this.addHandles(S(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...b,equals:(e,t)=>i(e,t,c)}),De.interactionHandles);break;case"video":this.addHandles(S(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:Se,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...b,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),De.interactionHandles);break;case"panoramic":this.addHandles(S(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:a,vfov:r,hfov:o,pitch:s,yaw:n}=i;return e&&a&&!t.includes("loading")&&null!=r&&null!=o&&null!=s&&null!=n?[r,o,n,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,o]=e;this.currentNode&&(this.currentNode.currentHeading=a,this.currentNode.currentPitch=o),g(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:o},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),De.interactionHandles);break;case"panoramic-video":this.addHandles(S(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:a,vfov:r,hfov:o,pitch:s,yaw:n,viewModel:l}=i,d=l.closestFeature??e;return d&&a&&!t.includes("loading")&&null!=r&&null!=o&&null!=s&&null!=n?[r,o,n,s,d]:null},e=>{if(!e)return;const[t,i,a,o,s]=e;g(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:o,feature:s,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),f(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),De.interactionHandles)}},b),S(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)},b),S(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),S(()=>this.activeViewer,e=>{this.removeHandles(De.hittestHandles),e&&this.addHandles(V(()=>e,"hittest-response",this._handleImageHitTestResponse),De.hittestHandles)}),S(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(g(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),S(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),P(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=g(this._updateFootprintTask),this._clickTask=g(this._clickTask),this._navigationViewStateTask=g(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!ze(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return null!=this._pendingPanoramicNavigationViewState}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return Ue(t)||Ce(t)}get imageLoaded(){return s(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===be}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(qe(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ce(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:a}=e;return 360===i||a?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:a,panoramicVideoPaused:r}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===a?.videoPaused||"panoramic-video"===e&&i&&r}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Me.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i,_navigationManager:a}=this;if(!this.isFulfilled()||t||!1===i?.finished||a?.navigating)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:a}})=>{const r=e?.trim();return Ue(r)||Ce(r)?{url:r,objectId:t,rotation:(i??0)+(a??0)}:null}).filter(a)):null}get videoExtentPoints(){const e=it(this.videoMapView.extent);return e.length?e:Se}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new N({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new N({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:a}=this;if(!i)throw Vt();ut(a,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Vt();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const a=[],r=[],o=[];return e.forEach(e=>{const{layer:{coveragePercent:s},attributes:n}=e;let l;const{polygon:d,frustum:c}=W(n);if(l=d.clone(),n.isInspection&&(l=$(n)),s&&(l=Z(l,s)),i||!t||J(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,h=t.clone();h.z=s/Q(t.spatialReference),h.imageID=i,this.pointSources.push(h),l!==be&&(a.push(d),c&&r.push(c))}}),{features:o,polygons:a,frustums:r}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Me[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._scheduleCurrentBestFeatureUpdate(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const a=this._sectorData?.[t],r=a?.at(i);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(f(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:a}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(a))return;const{features:r,polygons:o,frustums:s}=this.filterByFootprints(a,t,i?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s);const n=await this.processElevationSample(o,r,i);f(i),await this._updateElevationOfSelectedPointAndLocations(r,t,n),f(i),We(r,n);let l=r;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=$e(r,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const d=this._processSuitableFeatures(l,t);this.updateSuitabilities(d,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:a,polygons:r}=this.filterByFootprints(e,t,!0);if(!a?.length)return;const o=await this.processElevationSample(r,a,i);return f(i),o}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:o}=this;if(!i||!a||!r||"none"===o)return;if(this.displayNewMeasurementButton=!1,"panoramic"===o&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===o){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const s=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;s&&this.sketch&&(this.sketch.polygonSymbol=Te(s),this.sketch.polylineSymbol="panoramic"===o?Oe:Le(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new pe({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:r,layer:o,mode:s,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:d,_panoramicVideoViewer:c}=this,h="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&o&&"none"!==s&&this.overlayGraphicsEnabled))return;const{polygon:g}=W(p.attributes);if(h?d?.removeOverlayGraphics(r.toArray()):u?c.removeManyGraphics(r.toArray()):i?.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await o.queryFeatures({where:I(`${o.objectIdField} <> ${p.attributes.objectId}`,I(o.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l}),v=await Promise.all(e.map(async e=>{const{attributes:i,geometry:a}=e;if("point"!==a?.type)return null;const r=await this._geometryToOverlayImageGeometry(a,p,m);if(!r)return null;const o="panoramic"===s||"panoramic-video"===s?Ee():Ge();return new t({attributes:i,symbol:o,geometry:r})}));r.addMany(v.filter(a)),h?d?.addOverlayGraphics(r.toArray()):u?c.addManyGraphics(r.toArray()):i?.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:r,mode:s,layer:n,videoViewModel:l,_panoramicVideoViewer:d}=this,c="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==s&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=W(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=pt(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:v}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),y=await Promise.all(v.map(async a=>{const o=a.symbol?.clone()??e.renderer?.getSymbol(a)?.clone(),{attributes:n,geometry:g}=a,{imageGeometryField:v,oiObjectIdField:y}=this;if(v&&y&&Ft(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const a=u?d.horizonAngles:He(r?.media),h=mt(n,v,e,i,m,c?"default":s,o,a);if(!c)return h;const p=h.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:h.symbol,geometry:g,visible:h.visible}):null}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:a,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:o,geometry:_,visible:e.visible&&i}):null})),f=new o(y.filter(a));("video"!==s&&"panoramic-video"!==s||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:a,state:r,depthImage:o}=this,s=t?.imageSize;if(!s||!i||"none"===a||r.includes("loading"))return h.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!o?.loaded)return h.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>o.depthAt(e,{width:s[0],height:s[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return Me.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){return(await this._transformationService.pointToPixelForFeature([e],t,i))[0]}async getPixelLocationsForFeature(e,t,i){return await this._transformationService.pointToPixelForFeature(e,t,i)}async _getMapPointInViewSpatialReference(e,t){const i=await this.getMapPoint(e,t),a=this.view?.spatialReference;return await G(i,a,t)}async plotMapPoint(e){this.plotReferencePoint(e);const t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new E({...e.toJSON()}),symbol:je}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case"video":return void this._plotReferencePointOnVideo(e);case"panoramic-video":return void this._plotReferencePointOnPanoramicVideo(e);case"default":return void this._plotReferencePointOnDefaultImage(e);case"panoramic":return void this._plotReferencePointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const a=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(a);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(a);break;default:this.activeViewer?.removeManyGraphics(a)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=g(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:a}=t,r=i.get(e.id),o=r?.toArray();if(!r||!o?.length)return;const{addFeatureResults:s}=await this.saveDataCaptureFeatures(o),n=s.reduce((t,{objectId:i,globalId:a,error:r},s)=>{const n=o[s],{attributes:l}=n;return r?t.error.push(n):(i&&(l[e.objectIdField]=i),a&&e.globalIdField&&(l[e.globalIdField]=a),t.success.push(n)),t},{success:[],error:[]});a.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:r,dataCaptureLayer:o,mode:s}=this,l=i?.imageSize;if(!l||!r||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!o)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const d=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:a}=i;if(!a)return;const r=a.type,s=o.hasZ,n=o.geometryType,l=r!==n,d=l?await(import("./transformers.js")):null,c=d?.default[n],h=l?c?.(a):a;return h&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(h,t),i.geometry)?(s||gt(i.geometry),i):void 0})),c=d.filter(a);return o.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let i=0;const a=d.map(e=>{const a=t[i++];return e?a:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:a}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async restorePendingPanoramicNavigationViewState(e){const t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,"panoramic"===this.mode&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:a,currentBestFeature:r}=this;if(!i||!r||!a)return;const{attributes:{objectId:s}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],d=[];for(const o of n)`${o.getAttribute(a)}`==`${s}`?l.push(o):d.push(o);this.overlayGraphicsOnImage(e.id,new o(d)),this.collectionId=e.id;const c=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);f(t),c.addGraphics(l),h.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const a=i.ui.find("zoom");a&&(a.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const a=this.overlayedMapFeatures.get(e);a&&i&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:i,options:a}=e;let r=!1,o=!1;const s="video"===this.mode?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);o=s.extent.contains(e);break}}if(!r&&!o)return void this.clearReferencePointOnImage();const n="video"===this.mode||"panoramic-video"===this.mode?await this.getPixelLocationForFeature(i,{feature:t,mode:this.mode,imageSize:_e,footprintExtent:this.footprintExtent},a):await this._transformationService.pointToPixel(i,a);if(n)return f(a),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await U(e,t);i.features?.length&&(this.featureCache=i.features)}_plotReferencePointOnVideo(e){"video-loaded"===this.state&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){const i=this._panoramicVideoViewer,{imageSize:a,media:r}=i.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!a)return;this.clearReferencePointOnImage();const o=He(r),s=vt(e,"panoramic",a,o);this._referencePointOnImage=new t({geometry:s,symbol:Re.clone()}),i.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case"video":return this.videoViewModel?.closestFeature??this.currentBestFeature;case"panoramic-video":return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){const i=this._imageViewer,{imageSize:a}=i;if("image-loaded"!==this.state||!a)return;this.clearReferencePointOnImage();const r=vt(e,"default",a);this._referencePointOnImage=new t({geometry:r,symbol:je.clone()}),i.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){const i=this._panoramicViewer,{imageSize:a,media:r}=i;if("image-loaded"!==this.state||!a)return;this.clearReferencePointOnImage();const o=He(r),s=vt(e,"panoramic",a,o);this._referencePointOnImage=new t({geometry:s,symbol:Re.clone()}),i.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:a,layerTimeExtent:r,view:o}=this;if(!o)return;if(!i)return void this.setMessage("noLayerSelected","info");e.x=B(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await G(e,i.spatialReference),n=s.spatialReference.isGeographic?D(s):s,l=I("1=1",I(i.definitionExpression,a)),d=n.spatialReference.isGeographic?1:C(n.spatialReference),c={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/d:void 0,timeExtent:r}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:a}=this,r=i.at(0);if(!e||!t||!r||!i||a)return void(this._sectorData=null);this._sectorData={};const s={};this._featureToSector=s;for(const c of Me)this._sectorData[c]=new o;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),d=Math.max(...l);n.forEach(e=>{const{distance:t,angle:a,featureIndex:o}=e,n=t/d*Ie[2],l=Xe(t,d),c=Ye(a);if(!this._sectorData)return;const h=Ie[3]+n*Math.sin(a*Math.PI/180),u=Ie[3]+n*Math.cos(a*Math.PI/180);let p;const m=i.at(o),g=m===r,{cameraPitch:v}=m.attributes,y=v<5;if(g&&y)p=-90;else{const e=h-Ie[3],t=u-Ie[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),p=a}const f=""===l?c:`${l}_${c}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=y?null:{x:h,y:u,direction:c}),s[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:a,featureIndex:o,x:h,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;f(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new ct({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(De.videoPlayerHandles),this.videoElement=new he({video:this.currentBestFeature.attributes.imagePath,georeference:new de({extent:new L(Pe)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new nt({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const a=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?a:a[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...a}=e,r=Ze(a);try{await r.load(t)}catch(s){if(y(s))return;if("unsupported-format"===s.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:r?.extension??"UNKNOWN FORMAT"})}const o=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await o.loadMedia(r,t),i&&o.set(i)}async loadMediaSource(e,t){const i=Je(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const{unionExecuteMany:a}=await(import("../../geometry/operators/unionOperator.js")),r=a(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(o){y(o)||h.getLogger(this).error(o)}}async processElevationSample(e,t,i){const{elevationSource:a}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,i);return r||(a&&this.footprintExtent&&K(a)?await ee({extent:this.footprintExtent,lod:a.lod,url:a.url,rasterFunction:a.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:Ke(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[a]}=t;if("graphic"!==a?.type)return this.beforeLoad(!1),this.emit("no-image-found"),void this.setMessage("noImageError","error");const r=a.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(r,i)}async _queryAndLoadByObjectId(e,t,i,a,r){this.displayMessage=null;const{response:o}=await dt(e,t,i,a,r);if(f(r),!o?.features?.length)throw new lt(t);const{attributes:s}=o.features[0];let n,l;if(s.orientedImageryType?.includes("360")){n=X(s.geometry);const{cameraHeading:e,farDistance:t,nearDistance:i}=s,a=[Math.sin(p(e)),Math.cos(p(e))],r=(t+i)/2;l=C(n.spatialReference),n.x+=r*a[0]/l,n.y+=r*a[1]/l,n.z=void 0}else{const e=W(s).polygon,t=E.fromJSON(R(e));n=X(t),l=C(n.spatialReference)}this.selectedPoint=n;const d={layerInstanceOrURL:e,point:n,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0,timeExtent:a}},c=await z(d,r);f(r);const{features:h}=c;return h.push(o.features[0]),await this.processFeatureResponse(c,n,{...r,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}async _restoreNavigationViewState(e,t){const i=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(f(t),"panoramic"===this.mode){const t=He(this._panoramicViewer.media);if(!t)return;ft({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:i})}wt({viewState:e,imageViewer:this._imageViewer,imageCenter:i})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,a){const{location:r,cameraHeight:o}=e[0].attributes,s=await re(r.spatialReference,r.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},a);f(a);const[n,...l]=await Y([t,...e.map(e=>e.attributes.geometry.clone())],s);f(a),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:a,cameraHeading:r,cameraPitch:o}=i;return new st({geometry:t,attributes:i,currentHeading:a?0:r,currentPitch:a?0:o})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:a}}of e)t.contains(a)||i.push([a.x,a.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=me(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:a,currentCoverageVisible:r,isAdditionalPointSourcesVisible:o,mode:s,layer:n}=this;if(a&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await G(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===a.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:xe,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:Be,visible:o}))}"video"!==s&&"panoramic-video"!==s||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,a.geometry.spatialReference))}}_scheduleCurrentBestFeatureUpdate(e){g(this._navigationViewStateTask);const t=r(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!y(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),f(t),this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const i=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(i)a=-90;else{const t=e.x-Ie[3],i=e.y-Ie[3],r=i/Math.sqrt(t**2+i**2);let o=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(o*=-1),a=o}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=i?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector},"panoramic"===this.mode&&(await F(()=>"image-loaded"===this.state,t),f(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){"default"!==this.mode?"panoramic"===this.mode&&await this._capturePendingPanoramicNavigationViewState(e):await this._capturePendingDefaultNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{const{imageSize:t,imageRenderer:i}=this._imageViewer,a=i.center;if("image-loaded"!==this.state||!t[0]||!t[1]||!a)return void(this._pendingDefaultNavigationViewState=null);const r=yt(a,"default",t),o=await this._getMapPointInViewSpatialReference(r,e);f(e),this._pendingDefaultNavigationViewState={center:o,scale:i.scale}}catch(t){this._handlePendingNavigationViewStateCaptureError(t)}}async _capturePendingPanoramicNavigationViewState(e){const t=He(this._panoramicViewer.media);if(t)try{const{fov:i,imageSize:a,pitch:r,yaw:o}=this._panoramicViewer;if("image-loaded"!==this.state||!a||!i)return void(this._pendingPanoramicNavigationViewState=null);const[s,n]=oe(o,r,t),l=se(s,n,a[0],a[1]),d=await this._getMapPointInViewSpatialReference(l,e);f(e),this._pendingPanoramicNavigationViewState={center:d,fov:i}}catch(i){this._handlePendingNavigationViewStateCaptureError(i)}}_handlePendingNavigationViewStateCaptureError(e){if(y(e))throw e;h.getLogger(this).warn("oriented-imagery-viewer:failed-to-capture-navigation-view-state",e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:a}=this;if(!t||!i||!i.imageSize||"panoramic"!==a&&"default"!==a)return;const{imageSize:r}=i,{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let h=o.location;h.spatialReference.isGeographic&&(h=X(h));const u="default"===a?ne(o,r[0],r[1]):le(o,r[0],r[1]),p=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),m=(await(import("./services/TransformationService.js"))).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:a,imageSize:r,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:a}=this,r="video"===a||"panoramic-video"===a?_e:i?.imageSize;if(!t||!r||"none"===a)return;const{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let h=o.location;h.spatialReference.isGeographic&&(h=X(h));const u="default"===a||"video"===a?"default":"panoramic",p={..."default"===u?ne(o,r[0],r[1]):le(o,r[0],r[1]),cameraLocation:h},m=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),g=(await(import("./services/TransformationService.js"))).default,v={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:r,depthImageService:this.depthImage};this._transformationService=new g(v),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){if(this._crossSymbol){if("video"===this.mode)return this.videoViewModel?.clearSelectedPointOnVideo(),void(this._crossSymbol=null);this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)}else this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,i,a){this.displayMessage={key:e,type:t,data:i,map:a}}async transformAndPlotSelectedLocation(e){const{invalidCameraHeading:t,selectedPoint:i,activeViewer:a,videoElement:r}=this,o="video"===this.mode?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();const s="video"===this.mode?!0===r?.loaded&&!0===this.videoViewModel?.videoPaused:"image-loaded"===a?.state;if(!i||!o||!s||t)return;if("video"===this.mode){if(!await at(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:_e,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!rt(n))return;f(e),await this.plotSelectedPointOnImage(n,e)}catch(l){y(l)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:l,selectedPoint:i,feature:o})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:a,currentBestFeature:r,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:d,mode:c}=this;if(!r)return;const{attributes:{objectId:h},elevationSample:u}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...a,o].filter(Qe);"3d"===l?.type&&u&&d?.updateGroundElevation&&(this._updateGroundElevation&&d.updateGroundElevation(e),"panoramic"===c&&this.bestFeatureCurrentFootprint&&d.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ae.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&d?.updateGroundElevation&&"panoramic"===c&&d.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:a,mode:r,view:o,state:s,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:d,depthImage:c}=this,h=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:d?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:h,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:c?.loaded??!1,layer:a,mode:r,panoramicCamera:e?.camera,state:s,superimposeViewEnabled:n&&l,view:o}),this.setMessage("superimposeImageDescription","info"),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){const e=null!=this._superimposePreviousCurrentCoverageVisible;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){null!=this._superimposePreviousCurrentCoverageVisible&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){const{currentBestFeature:e,mode:t}=this;if(!e||"default"!==t&&"panoramic"!==t)return;this._restoreSuperimposeMediaTask?.abort();const i=r(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=i,i.promise.finally(()=>{this._restoreSuperimposeMediaTask===i&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){if("superimposeImageDescription"===this.displayMessage?.key){!!this.currentBestFeature&&("default"===this.mode||"panoramic"===this.mode)?this.displayMessage=null:this.setMessage("onLoadMessage","info")}}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,a=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",a)};this._superimposeScheduleController=t,i.addEventListener("abort",a),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",a),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,r="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==r||r.interacting||r.navigating||this._updateSuperimposedImage()})}};e([A()],St.prototype,"activeLayer",null),e([A({readOnly:!0})],St.prototype,"activeViewer",null),e([A()],St.prototype,"activeTriangulatedViewer",null),e([A()],St.prototype,"accuracyParametersMissing",null),e([A()],St.prototype,"additionalFeatures",void 0),e([A({type:o.ofType(t)})],St.prototype,"additionalCameraLocations",void 0),e([A({type:o.ofType(t)})],St.prototype,"additionalFootprints",void 0),e([A()],St.prototype,"areaMeasurementResult",void 0),e([A()],St.prototype,"areaMeasurementAccuracy",void 0),e([A()],St.prototype,"bestFeatureAngle",void 0),e([A()],St.prototype,"bestFeatureCurrentFootprint",void 0),e([A({type:t})],St.prototype,"bestFeatureFootprint",void 0),e([A({type:Number})],St.prototype,"brightness",null),e([A()],St.prototype,"cameraHeadingThreshold",void 0),e([A()],St.prototype,"cameraPitchThreshold",void 0),e([A()],St.prototype,"clickAction",void 0),e([A()],St.prototype,"correctedLocationPointOnImage",void 0),e([A()],St.prototype,"videoViewModel",void 0),e([A()],St.prototype,"collectionId",void 0),e([A({type:Number})],St.prototype,"contrast",null),e([A()],St.prototype,"coverageFrustums",void 0),e([A()],St.prototype,"coveragePolygons",void 0),e([A()],St.prototype,"currentBestFeature",void 0),e([A()],St.prototype,"currentBestFeatureMeasurementImage",void 0),e([A()],St.prototype,"currentBestFeatureLocation",void 0),e([A()],St.prototype,"currentCoverageVisible",void 0),e([A()],St.prototype,"currentNode",null),e([A()],St.prototype,"depthImage",void 0),e([A()],St.prototype,"depthImageNotSupported",null),e([A()],St.prototype,"featureCache",void 0),e([A()],St.prototype,"navigationNodes",void 0),e([A({json:{write:!1}})],St.prototype,"determineWorkflowForFeature",void 0),e([A({json:{write:!1}})],St.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([A()],St.prototype,"disabled",void 0),e([A()],St.prototype,"displayMessage",void 0),e([A()],St.prototype,"displayNewMeasurementButton",void 0),e([A()],St.prototype,"distanceMeasurementResult",void 0),e([A()],St.prototype,"distanceAccuracyArray",void 0),e([A()],St.prototype,"dataCaptureLayer",void 0),e([A({readOnly:!0})],St.prototype,"featureCount",null),e([A()],St.prototype,"features",void 0),e([A()],St.prototype,"groundCoordinates",void 0),e([A()],St.prototype,"groundCoordinatesAccuracy",void 0),e([A()],St.prototype,"groundCoordinatesAccuracyLoading",void 0),e([A()],St.prototype,"hasPendingPanoramicNavigationViewState",null),e([A()],St.prototype,"heightGraphic",void 0),e([A()],St.prototype,"heightMeasurementResult",void 0),e([A()],St.prototype,"heightMeasurementAccuracy",void 0),e([A({readOnly:!0})],St.prototype,"imageGalleryEnabled",null),e([A()],St.prototype,"imageGeometryField",void 0),e([A({readOnly:!0})],St.prototype,"imageLoaded",null),e([A()],St.prototype,"imageLocationToolState",void 0),e([A()],St.prototype,"initialVideoMapViewExtent",void 0),e([A({readOnly:!0})],St.prototype,"invalidCameraHeading",null),e([A()],St.prototype,"imagePointsInView",null),e([A()],St.prototype,"imageMeasurementViewer",void 0),e([A()],St.prototype,"isAdditionalCoverageVisible",void 0),e([A()],St.prototype,"isAdditionalPointSourcesVisible",void 0),e([A()],St.prototype,"layer",void 0),e([A()],St.prototype,"layerView",null),e([A({readOnly:!0})],St.prototype,"layerFloorFilterClause",null),e([A({readOnly:!0})],St.prototype,"layerTimeExtent",null),e([A({type:Number})],St.prototype,"localPort",void 0),e([A()],St.prototype,"locationPointOnImage",void 0),e([A()],St.prototype,"mapImageConversionToolState",void 0),e([A()],St.prototype,"measureType",void 0),e([A()],St.prototype,"measurementGraphic",void 0),e([A({readOnly:!0,value:"none"})],St.prototype,"mode",null),e([A()],St.prototype,"navigationMode",void 0),e([A()],St.prototype,"navigatorCurrentBestFeature",void 0),e([A()],St.prototype,"oiObjectIdField",void 0),e([A({type:o.ofType(t)})],St.prototype,"overlayedCameraLocations",void 0),e([A()],St.prototype,"overlayedMapFeatures",void 0),e([A()],St.prototype,"panoramicVideoLoaded",null),e([A()],St.prototype,"panoramicVideoPaused",null),e([A()],St.prototype,"pixelCoordinates",void 0),e([A()],St.prototype,"preserveAngle",void 0),e([A()],St.prototype,"pointSources",void 0),e([A({readOnly:!0})],St.prototype,"popupEnabled",null),e([A()],St.prototype,"preloadMedia",void 0),e([A()],St.prototype,"preloadMediaSize",void 0),e([A()],St.prototype,"previousFeatureAngle",void 0),e([A()],St.prototype,"referencePoint",null),e([A({readOnly:!0})],St.prototype,"sectorData",null),e([A()],St.prototype,"selectedPoint",void 0),e([A({type:Number})],St.prototype,"sharpness",null),e([A()],St.prototype,"shouldShowSelectedImage",void 0),e([A()],St.prototype,"superimposeViewEnabled",void 0),e([A()],St.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([A()],St.prototype,"superimposeViewSupported",null),e([A()],St.prototype,"sketch",void 0),e([A()],St.prototype,"sketchTriangular",void 0),e([A()],St.prototype,"sketchTriangularGraphicsLayer",void 0),e([A()],St.prototype,"draw",void 0),e([A()],St.prototype,"drawAdapter",void 0),e([A()],St.prototype,"polylineDrawAction",void 0),e([A()],St.prototype,"scheduledFrameId",void 0),e([A()],St.prototype,"superimposeScheduledFrameId",void 0),e([A()],St.prototype,"superimposeDebounceTimeoutId",void 0),e([A()],St.prototype,"sketchAdapter",void 0),e([A({readOnly:!0})],St.prototype,"sketchGraphicsLayer",null),e([A({readOnly:!0})],St.prototype,"state",null),e([A({readOnly:!0})],St.prototype,"thumbnails",null),e([A()],St.prototype,"videoExtentPoints",null),e([A()],St.prototype,"triangularMeasurementActive",void 0),e([A()],St.prototype,"triangulatedDistanceMeasurement",void 0),e([A()],St.prototype,"triangulatedDistanceAccuracy",void 0),e([A()],St.prototype,"triangulatedAreaMeasurement",void 0),e([A()],St.prototype,"triangulatedAreaAccuracy",void 0),e([A()],St.prototype,"triangulatedMeasurementGraphic",void 0),e([A()],St.prototype,"triangulatedPoint",void 0),e([A()],St.prototype,"triangulatedMeasurementAdapter",void 0),e([A()],St.prototype,"updateFootprint",void 0),e([A()],St.prototype,"updateVideoFootprint",void 0),e([A()],St.prototype,"updateFootprintPanorama",void 0),e([A()],St.prototype,"updatingTriangularMeasurementState",void 0),e([A({value:null})],St.prototype,"view",null),e([A()],St.prototype,"videoElement",void 0),e([A()],St.prototype,"videoLayer",void 0),e([A()],St.prototype,"videoMapView",void 0),e([A()],St.prototype,"verticalFilterEnabled",void 0),e([A()],St.prototype,"_adapter",void 0),e([A()],St.prototype,"_defaultGraphicsLayer",null),e([A()],St.prototype,"_highlightedFeatureHandle",void 0),e([A()],St.prototype,"_imageViewer",void 0),e([A()],St.prototype,"_initialCurrentCoverageUpdate",void 0),e([A()],St.prototype,"_locationViewModel",void 0),e([A()],St.prototype,"_measurementService",void 0),e([A()],St.prototype,"_mediaPrefetcher",void 0),e([A()],St.prototype,"_navigationManager",void 0),e([A()],St.prototype,"_overlays",void 0),e([A()],St.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([A()],St.prototype,"_superimposeService",void 0),e([A({readOnly:!0})],St.prototype,"_overlaysView",null),e([A()],St.prototype,"_panoramicVideoViewer",void 0),e([A()],St.prototype,"_panoramicViewer",void 0),e([A()],St.prototype,"_panoramicMeasurementViewer",void 0),e([A()],St.prototype,"_referencePointOnGround",void 0),e([A()],St.prototype,"_referencePointOnImage",void 0),e([A()],St.prototype,"_referenceTransformationService",void 0),e([A()],St.prototype,"_sectorData",void 0),e([A()],St.prototype,"_transformationService",void 0),e([A()],St.prototype,"_featureToSector",void 0),e([A({readOnly:!0})],St.prototype,"_updatingHandles",void 0),e([A()],St.prototype,"footprintExtent",void 0),e([A()],St.prototype,"_featureChangedTask",void 0),St=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],St);const bt=St;export{bt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import r from"../../core/Logger.js";import{sectorsRadii as t}from"./constants.js";import n from"./support/NonPanoramicMedia.js";import e from"../PanoramicViewer/support/PanoramicMedia.js";function i(r){return"3d"===r?.type}function o(r){return"esri.Graphic"===r?.declaredClass}function a(r){return/(tiff|tif|mrf)$/i.test(r??"")}function s(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:t}=new URL(r);return/.*\.(tiff|tif|mrf)$/i.test(t??"")}function
|
|
2
|
+
import r from"../../core/Logger.js";import{sectorsRadii as t}from"./constants.js";import n from"./support/NonPanoramicMedia.js";import e from"../PanoramicViewer/support/PanoramicMedia.js";function i(r){return"3d"===r?.type}function o(r){return"esri.Graphic"===r?.declaredClass}function a(r){return/(tiff|tif|mrf)$/i.test(r??"")}function f(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:t}=new URL(r);return/.*\.(tiff|tif|mrf|dm)$/i.test(t??"")}function s(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:t}=new URL(r);return/.*\.(tiff|tif|mrf)$/i.test(t??"")}function u(r){return Math.abs(r)>=135?"WEST":r<-45&&r>-135?"SOUTH":r<=45?"EAST":"NORTH"}function c(r,n){const e=r/n*t[2];return e<=t[0]?"NEAR":e<=t[1]?"":"FAR"}const m=r=>t=>t.layer===r;function p(r){return"NoAttachmentError"===r?.name}const d=r=>`${r}:missing-property`,h=(r,t)=>`Property ${t} is missing in ${r}`,l=(t="esri.widgets.OrientedImageryViewer",n)=>{throw r.getLogger(t).error(n),n};function w(r,t){t&&r.forEach(r=>{r.elevationSample=t})}function g(r){return new e(r)}function P(r){return new n(r)}function R(r,t,n){return n?r.filter(({attributes:{location:r}})=>Math.abs((r.z??0)-(t.z??0))<n):r}function L(r){return!!r&&"esri.widgets.PanoramicViewer.support.PanoramicMedia"===r.declaredClass}function $(r){if(!L(r))return;const{horizonPitch:t,horizonRoll:n,horizonYaw:e}=r;return[t,n,e]}function y(r){return"TIFF"===r?.datasetFormat}export{w as assignElevationSampleToFeatures,u as calculateDirection,c as calculateSegment,P as createNonPanoramicMedia,g as createPanoramicMedia,$ as extractHorizonAnglesFromMedia,R as filterByZ,m as filterOILLayerView,h as getMissingPropertyErrorMessage,d as getMissingPropertyErrorName,f as isDepthImage,o as isGraphic,p as isNoAttachmentError,L as isPanoramicMedia,i as isSceneView,s as isTifOrMrf,y as isTiffRaster,l as logAndThrow,a as validateTifOrMrfExtension};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{EventedAccessor as l}from"../../core/Evented.js";import a from"../../core/Logger.js";import{mappedFind as n}from"../../core/maybe.js";import{eachAlways as u,after as c}from"../../core/promiseUtils.js";import{watch as h,initial as p,whenOnce as g}from"../../core/reactiveUtils.js";import{property as d,subclass as m}from"../../core/accessorSupport/decorators.js";import y from"../../geometry/Point.js";import f from"../../geometry/SpatialReference.js";import{getPointWithElevation as S}from"../../geometry/support/geometryUtils.js";import _ from"../../portal/Portal.js";import{isApiKeyApplicable as v}from"../../support/apiKeyUtils.js";import w from"../../symbols/PictureMarkerSymbol.js";import b from"../../symbols/SimpleFillSymbol.js";import x from"../../symbols/SimpleLineSymbol.js";import L from"../../symbols/TextSymbol.js";import{highlightsSupported as I}from"../../views/support/layerViewUtils.js";import T from"./LayerSearchSource.js";import E from"./LocatorSearchSource.js";import{SourceCollection as R}from"./types.js";import{isArcGISWorldGeocoder as F,meteredArcGISLocatorUrl as P,isProxiedArcGISWorldGeocoder as j,isMeteredArcGISWorldGeocoder as O}from"./support/locatorUtils.js";import{supported as C,getCurrentPosition as G,positionToPoint as A}from"../support/geolocationUtils.js";import{GoTo as N}from"../support/GoTo.js";function D(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const M="highlight",V=f.WGS84,J="esri/images/search/search-symbol-32.png",U=/<[\s\S]*?>/g,H=-1;let k=class extends(N(l)){constructor(e){super(e),this._defaultPopupTemplate=new s({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new R,this.defaultSymbols={point:new w({url:t(J),size:24,width:24,height:24}),polyline:new x({color:[130,130,130,1],width:2}),polygon:new b({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=_.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new R,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([h(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),p),h(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},p)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=H}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:H}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new R;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||C()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=C();if(e&&!t){const e=new i("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});a.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===H)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultLocation",null),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=(async()=>{try{const r=await this._createSuggestionForSearch(e);await this.when();const s=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,s,r);const i=this._getFirstResult(o.results),l=r.location&&i?i.name:r.text,a=l?.replaceAll(U,"");return this._set("searchTerm",a),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",o.results),this._set("resultCount",o.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",o),await this._selectFirstResult(i),o}finally{this._clearSearching()}})();return this._searching=r,r}async searchNearby(e){if(!this.locationEnabled){const e=new i("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw a.getLogger(this).error(e),e}const t=(async()=>{try{const t=await G(),r=await A({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new i("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw a.getLogger(this).error(t),t}const{view:t}=this,s=D(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new i("select:missing-source","Cannot select without a source.",{source:o});throw a.getLogger(this).error(e),e}const l=o instanceof T?this._getLayerSourcePopupTemplate(o):o.popupTemplate,n=o.resultSymbol||this._getDefaultSymbol(e),c=D(o,"resultGraphicEnabled")?!!o.resultGraphicEnabled:this.resultGraphicEnabled,h=D(o,"autoNavigate")?!!o.autoNavigate:this.autoNavigate,p=D(o,"popupEnabled")?!!o.popupEnabled:this.popupEnabled,g=p?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new i("select:missing-feature","Cannot select without a feature.",{feature:d});throw a.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:_}=d;let v=null;if(y){const{labelPointExecute:e}=await(import("../../geometry/operators/labelPointOperator.js"));v=e(y)}const w={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=v?S(v,t):Promise.resolve(v)},b=await u(w),x=b.layerViewQuery.value,E=b.elevationQuery.value;n instanceof L&&(n.text=e.name);const R=t&&h?e.target||e.extent:null,F=null!=R?this._goToSearchResult(R):Promise.resolve();await F;const P=x?d:new r({geometry:y,symbol:n,attributes:m,layer:f,sourceLayer:_,popupTemplate:g});return x&&I(x)&&!p&&this._highlightFeature({graphic:P,layerView:x}),!x&&c&&t&&t.graphics.push(P),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",P),this._set("resultLocation",E),this.emit("select-result",{popupEnabled:p,result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(){await g(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=u([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=F(e.url)&&v(e.url)?{url:P}:null,r=E.fromJSON({...e,...t}),s=r.url;if(F(s)||j(s)||O(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map(e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=T.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map(e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=T.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(e=>e.id===t.subLayer);if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new i("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return a.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return c(r,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof r&&e.geometry){const{labelPointExecute:t}=await(import("../../geometry/operators/labelPointOperator.js"));return t(e.geometry)}return e instanceof y?e:Array.isArray(e)&&2===e.length?new y({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&D(e,"key")&&D(e,"text")&&D(e,"sourceIndex"))return e;const t=await this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return n(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),a.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===H){const s=r&&D(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&D(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new i("search:no-sources-defined","At least one source is required.",{allSources:r});throw a.getLogger(this).error(e),e}return s===H?r.forEach((r,s)=>{o.push(this._getResultsFromSource(e,s,t))}):o.push(this._getResultsFromSource(e,s,t)),u(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new i("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw a.getLogger(this).error(e),e}return s===H?r.forEach((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))}):o.push(this._getSuggestionsFromSource(e,s,t)),u(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??V,l=D(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof T&&D(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=D(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=D(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||V,i=D(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof T&&D(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return D(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return n(this.results??[],({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(M)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,M)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([d()],k.prototype,"_searching",void 0),e([d()],k.prototype,"_updatingPromise",void 0),e([d({readOnly:!0,value:null})],k.prototype,"activeSource",null),e([d()],k.prototype,"activeSourceIndex",null),e([d()],k.prototype,"allPlaceholder",null),e([d({readOnly:!0})],k.prototype,"allSources",null),e([d()],k.prototype,"autoNavigate",void 0),e([d()],k.prototype,"autoSelect",void 0),e([d({type:s})],k.prototype,"defaultPopupTemplate",null),e([d({readOnly:!0})],k.prototype,"defaultSources",void 0),e([d()],k.prototype,"defaultSymbols",void 0),e([d()],k.prototype,"includeDefaultSources",void 0),e([d()],k.prototype,"locationEnabled",null),e([d()],k.prototype,"maxInputLength",void 0),e([d()],k.prototype,"maxResults",void 0),e([d()],k.prototype,"maxSuggestions",void 0),e([d()],k.prototype,"messages",void 0),e([d()],k.prototype,"minSuggestCharacters",void 0),e([d({readOnly:!0})],k.prototype,"placeholder",null),e([d()],k.prototype,"popupEnabled",void 0),e([d({type:s})],k.prototype,"popupTemplate",void 0),e([d({type:_})],k.prototype,"portal",void 0),e([d()],k.prototype,"resultCount",void 0),e([d()],k.prototype,"resultGraphicEnabled",void 0),e([d({readOnly:!0})],k.prototype,"resultGraphic",void 0),e([d({readOnly:!0})],k.prototype,"resultLocation",void 0),e([d({readOnly:!0})],k.prototype,"results",void 0),e([d({readOnly:!0})],k.prototype,"selectedSuggestion",void 0),e([d()],k.prototype,"searchAllEnabled",void 0),e([d({readOnly:!0})],k.prototype,"selectedResult",void 0),e([d()],k.prototype,"searchTerm",null),e([d({type:R})],k.prototype,"sources",void 0),e([d({readOnly:!0})],k.prototype,"state",null),e([d()],k.prototype,"suggestionDelay",void 0),e([d()],k.prototype,"suggestionCount",void 0),e([d({readOnly:!0})],k.prototype,"suggestions",void 0),e([d()],k.prototype,"suggestionsEnabled",void 0),e([d({readOnly:!0})],k.prototype,"updating",null),e([d()],k.prototype,"view",void 0),e([d()],k.prototype,"clear",null),k=e([m("esri.widgets.Search.SearchViewModel")],k);const B=k;export{B as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import s from"../../Graphic.js";import r from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{EventedAccessor as l}from"../../core/Evented.js";import a from"../../core/Logger.js";import{mappedFind as n}from"../../core/maybe.js";import{eachAlways as u,after as c}from"../../core/promiseUtils.js";import{watch as h,initial as p,whenOnce as g}from"../../core/reactiveUtils.js";import{property as d,subclass as m}from"../../core/accessorSupport/decorators.js";import y from"../../geometry/Point.js";import f from"../../geometry/SpatialReference.js";import{getPointWithElevation as S}from"../../geometry/support/geometryUtils.js";import{getPopupLayer as _}from"../../popup/support/featureUtils.js";import v from"../../portal/Portal.js";import{isApiKeyApplicable as w}from"../../support/apiKeyUtils.js";import b from"../../symbols/PictureMarkerSymbol.js";import x from"../../symbols/SimpleFillSymbol.js";import L from"../../symbols/SimpleLineSymbol.js";import I from"../../symbols/TextSymbol.js";import{highlightsSupported as T}from"../../views/support/layerViewUtils.js";import E from"./LayerSearchSource.js";import R from"./LocatorSearchSource.js";import{SourceCollection as F}from"./types.js";import{isSearchableLayer as P}from"./support/layerSearchUtils.js";import{isArcGISWorldGeocoder as j,meteredArcGISLocatorUrl as O,isProxiedArcGISWorldGeocoder as C,isMeteredArcGISWorldGeocoder as G}from"./support/locatorUtils.js";import{supported as A,getCurrentPosition as N,positionToPoint as D}from"../support/geolocationUtils.js";import{GoTo as M}from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const V="highlight",J=f.WGS84,H="esri/images/search/search-symbol-32.png",k=/<[\s\S]*?>/g,B=-1;let Q=class extends(M(l)){constructor(e){super(e),this._defaultPopupTemplate=new r({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new F,this.defaultSymbols={point:new b({url:t(H),size:24,width:24,height:24}),polyline:new L({color:[130,130,130,1],width:2}),polygon:new x({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=v.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new F,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([h(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),p),h(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},p)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=B}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:B}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:s}=this,r="function"==typeof s?s.call(null,{sources:e,defaultSources:t}):s?t.concat(e):e,o=this._get("allSources")||new F;return o.removeAll(),o.addMany(r.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||A()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=A();if(e&&!t){const e=new i("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});a.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:s}=this;if(t===B)return s??"";const r=e.at(t);return r?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultLocation",null),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const s=(async()=>{try{const s=await this._createSuggestionForSearch(e);await this.when();const r=await this._getResultsFromSources(s,t);if(t?.signal?.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:s.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,r,s);const i=this._getFirstResult(o.results),l=s.location&&i?i.name:s.text,a=l?.replaceAll(k,"");return this._set("searchTerm",a),(s.key&&"number"==typeof s.sourceIndex||s.location)&&this._set("selectedSuggestion",s),this._set("results",o.results),this._set("resultCount",o.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",o),await this._selectFirstResult(i),o}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new i("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw a.getLogger(this).error(e),e}const t=(async()=>{try{const t=await N(),s=await D({position:t,view:this.view},e);return await this.search(s,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new i("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw a.getLogger(this).error(t),t}const{view:t}=this,r=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=r?this.allSources.at(r):null;if(!o){const e=new i("select:missing-source","Cannot select without a source.",{source:o});throw a.getLogger(this).error(e),e}const l=o instanceof E?this._getLayerSourcePopupTemplate(o):o.popupTemplate,n=o.resultSymbol||this._getDefaultSymbol(e),c=U(o,"resultGraphicEnabled")?!!o.resultGraphicEnabled:this.resultGraphicEnabled,h=U(o,"autoNavigate")?!!o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?!!o.popupEnabled:this.popupEnabled,g=p?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new i("select:missing-feature","Cannot select without a feature.",{feature:d});throw a.getLogger(this).error(e),e}const{attributes:m,geometry:y}=d,f=_(d);let v=null;if(y){const{labelPointExecute:e}=await(import("../../geometry/operators/labelPointOperator.js"));v=e(y)}const w={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=v?S(v,t):Promise.resolve(v)},b=await u(w),x=b.layerViewQuery.value,L=b.elevationQuery.value;n instanceof I&&(n.text=e.name);const R=t&&h?e.target||e.extent:null,F=null!=R?this._goToSearchResult(R):Promise.resolve();await F;const P=x?d:new s({geometry:y,symbol:n,attributes:m,layer:f,origin:d.origin,popupTemplate:g});return x&&T(x)&&!p&&this._highlightFeature({graphic:P,layerView:x}),!x&&c&&t&&t.graphics.push(P),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",P),this._set("resultLocation",L),this.emit("select-result",{popupEnabled:p,result:e,source:o,sourceIndex:r}),e}async suggest(e,t,s){const r=e||this.searchTerm;this.emit("suggest-start",{searchTerm:r}),await this._suggestTimer(t,s);const o=await this._suggestImmediate(r,s);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(){await g(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const s=this._updatingPromise=u([e?.load(),t?.when()]);if(this.destroyed)return;if(await s,s!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=j(e.url)&&w(e.url)?{url:O}:null,s=R.fromJSON({...e,...t}),r=s.url;if(j(r)||C(r)||G(r)){const e=s.outFields??["Addr_type","Match_addr","StAddr","City"],t=(s.placeholder||this.messages?.placeholder)??"",r="number"==typeof s.defaultZoomScale?s.defaultZoomScale:2500;s.singleLineFieldName="SingleLine",s.outFields=e,s.placeholder=t,s.defaultZoomScale=r}return s.singleLineFieldName?s:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const s=this.view?.map;return e.map(e=>{const r=s.findLayerById(e.id);if(!r)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(r,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const s=this.view?.map;return e.map(e=>{if(!e.id)return;const r=s.findTableById(e.id);if(!r)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(r,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:s,hintText:r,layers:o,tables:i}=t;if(!s)return[];return[...this._getLayerSources(o,r),...this._getTableSources(i,r)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const s=e.allSublayers.find(e=>e.id===t.subLayer);if(!s)throw new Error;const r=await(s.createFeatureLayer?.());if(!r)throw new Error;return this._createdFeatureLayers.push(r),r}async _getBuildingSubLayer(e,t){await e.load();const s=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==s?.type)throw new Error;if(await s.load(),null==s.associatedLayer)throw new Error;return await s.associatedLayer.load(),s}async _getLayer(e,t){if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(s){const t=new i("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return a.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_suggestTimer(e,t){const s=null!=e?e:this.suggestionDelay;return c(s,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof s&&e.geometry){const{labelPointExecute:t}=await(import("../../geometry/operators/labelPointOperator.js"));return t(e.geometry)}return e instanceof y?e:Array.isArray(e)&&2===e.length?new y({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=await this._createLocationForSearch(e),s="string"==typeof e?e:this.searchTerm,{selectedSuggestion:r,selectedResult:o}=this,i=!e&&r&&o,l=i&&r.key===o.key&&r.sourceIndex===o.sourceIndex,a=i&&r.location;return l||a?r:{location:t,text:t?"":s,sourceIndex:null,key:null}}_getFirstResult(e){return n(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const s=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const r={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(r,s),r}_formatSourceResponse(e,t,s){const r=t?.value||[],o=t?.error,i=this.allSources.at(s);if(o){const t={sourceIndex:s,source:i,error:o};e.errors.push(t),a.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:s,source:i,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,s){if(t)if(e.activeSourceIndex===B){const r=s&&U(s,"sourceIndex")&&-1!==s.sourceIndex?s.sourceIndex:void 0;t.forEach((t,s)=>{const o=void 0!==r?r:s;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:s}=this,r=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!s.length){const e=new i("search:no-sources-defined","At least one source is required.",{allSources:s});throw a.getLogger(this).error(e),e}return r===B?s.forEach((s,r)=>{o.push(this._getResultsFromSource(e,r,t))}):o.push(this._getResultsFromSource(e,r,t)),u(o)}async _getSuggestionsFromSources(e,t){const{allSources:s,activeSourceIndex:r}=this,o=[];if(!s.length){const e=new i("suggest:no-sources-defined","At least one source is required.",{allSources:s});throw a.getLogger(this).error(e),e}return r===B?s.forEach((s,r)=>{o.push(this._getSuggestionsFromSource(e,r,t))}):o.push(this._getSuggestionsFromSource(e,r,t)),u(o)}async _getResultsFromSource(e,t,s){const r=null!=t?this.allSources.at(t):null;if(!r)return null;const{location:o=null}=e,i=this.view?.spatialReference??J,l=U(r,"maxResults")?r.maxResults:this.maxResults,a=!!(r instanceof E&&U(r,"exactMatch"))&&r.exactMatch,{view:n}=this;return r.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},s)}async _getSuggestionsFromSource(e,t,s){const r=this.allSources.at(t);if(!r)return null;e??="";const o=U(r,"suggestionsEnabled")?r.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(r,"minSuggestCharacters")?r.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||J,i=U(r,"maxSuggestions")?r.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(r instanceof E&&U(r,"exactMatch"))&&r.exactMatch;return r.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},s)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return n(this.results??[],({results:t,sourceIndex:s})=>{const r=t?.includes(e);return r?s:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const s={target:{target:e},options:{signal:t.signal}};e||(s.options.animate=!1),await this.callGoTo(s),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,s=e.feature?.geometry;if(null==s)return null;switch(s.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(V)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const s=_(e);return s?"building-component"===s.type||"subtype-sublayer"===s.type?null:(await t.when(),t.whenLayerView(s)):null}_highlightFeature(e){const{graphic:t,layerView:s}=e,{attributes:r}=t,o=_(t);if(!P(o))return;const{objectIdField:i}=o,l=(i&&r?.[i])??null,a=s.highlight(l??t);this.addHandles(a,V)}_setResultFloor(e){const{view:t}=this,s=e.feature?.attributes,r=_(e.feature);if(P(r)&&r.floorInfo?.floorField&&s){const e=s[r.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([d()],Q.prototype,"_searching",void 0),e([d()],Q.prototype,"_updatingPromise",void 0),e([d({readOnly:!0,value:null})],Q.prototype,"activeSource",null),e([d()],Q.prototype,"activeSourceIndex",null),e([d()],Q.prototype,"allPlaceholder",null),e([d({readOnly:!0})],Q.prototype,"allSources",null),e([d()],Q.prototype,"autoNavigate",void 0),e([d()],Q.prototype,"autoSelect",void 0),e([d({type:r})],Q.prototype,"defaultPopupTemplate",null),e([d({readOnly:!0})],Q.prototype,"defaultSources",void 0),e([d()],Q.prototype,"defaultSymbols",void 0),e([d()],Q.prototype,"includeDefaultSources",void 0),e([d()],Q.prototype,"locationEnabled",null),e([d()],Q.prototype,"maxInputLength",void 0),e([d()],Q.prototype,"maxResults",void 0),e([d()],Q.prototype,"maxSuggestions",void 0),e([d()],Q.prototype,"messages",void 0),e([d()],Q.prototype,"minSuggestCharacters",void 0),e([d({readOnly:!0})],Q.prototype,"placeholder",null),e([d()],Q.prototype,"popupEnabled",void 0),e([d({type:r})],Q.prototype,"popupTemplate",void 0),e([d({type:v})],Q.prototype,"portal",void 0),e([d()],Q.prototype,"resultCount",void 0),e([d()],Q.prototype,"resultGraphicEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"resultGraphic",void 0),e([d({readOnly:!0})],Q.prototype,"resultLocation",void 0),e([d({readOnly:!0})],Q.prototype,"results",void 0),e([d({readOnly:!0})],Q.prototype,"selectedSuggestion",void 0),e([d()],Q.prototype,"searchAllEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"selectedResult",void 0),e([d()],Q.prototype,"searchTerm",null),e([d({type:F})],Q.prototype,"sources",void 0),e([d({readOnly:!0})],Q.prototype,"state",null),e([d()],Q.prototype,"suggestionDelay",void 0),e([d()],Q.prototype,"suggestionCount",void 0),e([d({readOnly:!0})],Q.prototype,"suggestions",void 0),e([d()],Q.prototype,"suggestionsEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"updating",null),e([d()],Q.prototype,"view",void 0),e([d()],Q.prototype,"clear",null),Q=e([m("esri.widgets.Search.SearchViewModel")],Q);const Z=Q;export{Z as default};
|