@giro3d/piero 25.10.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +134 -0
  3. package/dist/Components.cjs.js +2605 -0
  4. package/dist/Components.es.js +43490 -0
  5. package/dist/assets/ParserWorker-Bd30oD5I.js +5 -0
  6. package/dist/assets/style.css +9 -0
  7. package/dist/basedecoder.cjs.js +1 -0
  8. package/dist/basedecoder.es.js +88 -0
  9. package/dist/decoder.cjs.js +1 -0
  10. package/dist/decoder.es.js +9 -0
  11. package/dist/deflate.cjs.js +1 -0
  12. package/dist/deflate.es.js +10 -0
  13. package/dist/index.cjs.js +93 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.es.js +65240 -0
  16. package/dist/jpeg.cjs.js +1 -0
  17. package/dist/jpeg.es.js +514 -0
  18. package/dist/lerc.cjs.js +1 -0
  19. package/dist/lerc.es.js +1027 -0
  20. package/dist/lzw.cjs.js +1 -0
  21. package/dist/lzw.es.js +84 -0
  22. package/dist/modules.cjs.js +2973 -0
  23. package/dist/modules.d.ts +2 -0
  24. package/dist/modules.es.js +87571 -0
  25. package/dist/packbits.cjs.js +1 -0
  26. package/dist/packbits.es.js +24 -0
  27. package/dist/pako.esm.cjs.js +1 -0
  28. package/dist/pako.esm.es.js +1053 -0
  29. package/dist/piero_logo.png +0 -0
  30. package/dist/piero_logo_compact.png +0 -0
  31. package/dist/raw.cjs.js +1 -0
  32. package/dist/raw.es.js +9 -0
  33. package/dist/sponsors/bpi_france.png +0 -0
  34. package/dist/sponsors/france_2030.png +0 -0
  35. package/dist/sponsors/france_relance.png +0 -0
  36. package/dist/sponsors/oslandia.png +0 -0
  37. package/dist/sponsors/ue_next_generation.png +0 -0
  38. package/dist/src/App.vue.d.ts +6 -0
  39. package/dist/src/api/BookmarkApi.d.ts +6 -0
  40. package/dist/src/api/DatasetApi.d.ts +61 -0
  41. package/dist/src/api/ViewApi.d.ts +4 -0
  42. package/dist/src/api/index.d.ts +4 -0
  43. package/dist/src/components/AlertToast.vue.d.ts +4 -0
  44. package/dist/src/components/AttributeGroup.vue.d.ts +7 -0
  45. package/dist/src/components/AttributeItem.vue.d.ts +6 -0
  46. package/dist/src/components/AttributePanel.vue.d.ts +14 -0
  47. package/dist/src/components/ColorFragment.vue.d.ts +6 -0
  48. package/dist/src/components/Configuration.d.ts +14 -0
  49. package/dist/src/components/CoordinateFragment.vue.d.ts +10 -0
  50. package/dist/src/components/DropdownView.vue.d.ts +13 -0
  51. package/dist/src/components/LinkFragment.vue.d.ts +10 -0
  52. package/dist/src/components/LoadingScreen.vue.d.ts +2 -0
  53. package/dist/src/components/MainView.vue.d.ts +5 -0
  54. package/dist/src/components/MinimapView.vue.d.ts +4 -0
  55. package/dist/src/components/ModalOverlay.vue.d.ts +17 -0
  56. package/dist/src/components/NavigationButtons.vue.d.ts +2 -0
  57. package/dist/src/components/OpacitySlider.vue.d.ts +10 -0
  58. package/dist/src/components/PanelContainer.vue.d.ts +10 -0
  59. package/dist/src/components/ProgressBar.vue.d.ts +14 -0
  60. package/dist/src/components/SearchOverlay.vue.d.ts +8 -0
  61. package/dist/src/components/SpinnerControl.vue.d.ts +2 -0
  62. package/dist/src/components/StatusBar.vue.d.ts +10 -0
  63. package/dist/src/components/SwitchToggle.vue.d.ts +17 -0
  64. package/dist/src/components/VisibilityControl.vue.d.ts +9 -0
  65. package/dist/src/components/atoms/ButtonArea.vue.d.ts +9 -0
  66. package/dist/src/components/atoms/ButtonWithIcon.vue.d.ts +11 -0
  67. package/dist/src/components/atoms/CompactList.vue.d.ts +9 -0
  68. package/dist/src/components/atoms/Icon.vue.d.ts +6 -0
  69. package/dist/src/components/atoms/IconList.vue.d.ts +9 -0
  70. package/dist/src/components/atoms/IconListButton.vue.d.ts +10 -0
  71. package/dist/src/components/atoms/ImportButton.vue.d.ts +13 -0
  72. package/dist/src/components/atoms/ListLabel.vue.d.ts +5 -0
  73. package/dist/src/components/atoms/ListLabelButton.vue.d.ts +11 -0
  74. package/dist/src/components/atoms/SectionCollapsible.vue.d.ts +20 -0
  75. package/dist/src/components/charts/BarChart.vue.d.ts +4 -0
  76. package/dist/src/components/charts/DoughnutChart.vue.d.ts +4 -0
  77. package/dist/src/components/panels/AboutPanel.vue.d.ts +2 -0
  78. package/dist/src/components/panels/AnalysisPanel.vue.d.ts +2 -0
  79. package/dist/src/components/panels/AnnotationItem.vue.d.ts +21 -0
  80. package/dist/src/components/panels/AnnotationPanel.vue.d.ts +2 -0
  81. package/dist/src/components/panels/BasemapItem.vue.d.ts +17 -0
  82. package/dist/src/components/panels/BookmarkItem.vue.d.ts +16 -0
  83. package/dist/src/components/panels/BookmarkPanel.vue.d.ts +2 -0
  84. package/dist/src/components/panels/DatagroupItem.vue.d.ts +18 -0
  85. package/dist/src/components/panels/DatasetItem.vue.d.ts +18 -0
  86. package/dist/src/components/panels/DatasetOrGroupItem.vue.d.ts +18 -0
  87. package/dist/src/components/panels/DatasetPanel.vue.d.ts +2 -0
  88. package/dist/src/components/panels/EmptyIndicator.vue.d.ts +6 -0
  89. package/dist/src/components/panels/LoadingIndicator.vue.d.ts +6 -0
  90. package/dist/src/components/panels/MeasurementItem.vue.d.ts +17 -0
  91. package/dist/src/components/panels/MeasurementPanel.vue.d.ts +2 -0
  92. package/dist/src/components/panels/OverlayItem.vue.d.ts +19 -0
  93. package/dist/src/components/panels/ShareBookmarkModal.vue.d.ts +5 -0
  94. package/dist/src/components/panels/analysis/ClippingBox.vue.d.ts +2 -0
  95. package/dist/src/components/panels/analysis/CrossSection.vue.d.ts +2 -0
  96. package/dist/src/components/panels/analysis/FloodingPlane.vue.d.ts +2 -0
  97. package/dist/src/components/panels/analysis/Statistics.vue.d.ts +2 -0
  98. package/dist/src/components/panels/analysis/ToolWrapper.vue.d.ts +20 -0
  99. package/dist/src/components/toolbar/ToolBar.vue.d.ts +9 -0
  100. package/dist/src/components/toolbar/ToolbarButton.vue.d.ts +12 -0
  101. package/dist/src/config-loader.d.ts +7 -0
  102. package/dist/src/constants.d.ts +7 -0
  103. package/dist/src/context.d.ts +35 -0
  104. package/dist/src/createPieroApp.d.ts +31 -0
  105. package/dist/src/events.d.ts +30 -0
  106. package/dist/src/giro3d/CameraControlsInspector.d.ts +17 -0
  107. package/dist/src/giro3d/EntityBuilder.d.ts +21 -0
  108. package/dist/src/giro3d/Graticule.d.ts +20 -0
  109. package/dist/src/giro3d/Grid.d.ts +11 -0
  110. package/dist/src/giro3d/LayerBuilder.d.ts +46 -0
  111. package/dist/src/giro3d/Measure3D.d.ts +19 -0
  112. package/dist/src/giro3d/Plane.d.ts +11 -0
  113. package/dist/src/giro3d/Skybox.d.ts +6 -0
  114. package/dist/src/giro3d/entities/FeatureCollectionEntity.d.ts +41 -0
  115. package/dist/src/giro3d/entities/PointCloudEntity.d.ts +45 -0
  116. package/dist/src/giro3d/entities/TiledPointCloudEntity.d.ts +13 -0
  117. package/dist/src/giro3d/entities/Tiles3dEntity.d.ts +11 -0
  118. package/dist/src/giro3d/entities/VectorLabelsEntity.d.ts +48 -0
  119. package/dist/src/giro3d/entities/VectorMeshEntity.d.ts +97 -0
  120. package/dist/src/giro3d/entities/VectorShapeEntity.d.ts +8 -0
  121. package/dist/src/giro3d/entities/flatPointCloud.d.ts +2 -0
  122. package/dist/src/giro3d/entities/tiledIfc.d.ts +2 -0
  123. package/dist/src/giro3d/entities/vector.d.ts +2 -0
  124. package/dist/src/giro3d/sources/GeopackageSource.d.ts +20 -0
  125. package/dist/src/giro3d/sources/ShapefileSource.d.ts +20 -0
  126. package/dist/src/giro3d/sources/mixins.d.ts +60 -0
  127. package/dist/src/index.d.ts +17 -0
  128. package/dist/src/loaders/csv.d.ts +3 -0
  129. package/dist/src/loaders/las.d.ts +3 -0
  130. package/dist/src/loaders/loader.d.ts +29 -0
  131. package/dist/src/loaders/loader.test.d.ts +1 -0
  132. package/dist/src/loaders/userData.d.ts +8 -0
  133. package/dist/src/loaders/vector.d.ts +4 -0
  134. package/dist/src/module.d.ts +11 -0
  135. package/dist/src/modules/CityJSONLoader.d.ts +10 -0
  136. package/dist/src/modules/IFCLoader.d.ts +9 -0
  137. package/dist/src/modules/PLYLoader.d.ts +9 -0
  138. package/dist/src/modules/PotreeLoader.d.ts +9 -0
  139. package/dist/src/modules/Tour.d.ts +17 -0
  140. package/dist/src/modules/cityjson/CityJSONEntity.d.ts +79 -0
  141. package/dist/src/modules/cityjson/CityJSONEntityInspector.d.ts +8 -0
  142. package/dist/src/modules/ifc/IfcEntity.d.ts +87 -0
  143. package/dist/src/modules/ifc/IfcEntityInspector.d.ts +7 -0
  144. package/dist/src/modules/ifc/IfcPropertyView.vue.d.ts +6 -0
  145. package/dist/src/modules/ifc/IfcSubtree.vue.d.ts +7 -0
  146. package/dist/src/modules/index.d.ts +6 -0
  147. package/dist/src/modules/ply/PlyEntity.d.ts +33 -0
  148. package/dist/src/providers/Alticoding.d.ts +32 -0
  149. package/dist/src/providers/BanProvider.d.ts +11 -0
  150. package/dist/src/providers/Geocoding.d.ts +7 -0
  151. package/dist/src/providers/IgnProvider.d.ts +11 -0
  152. package/dist/src/services/AnalysisManager.d.ts +10 -0
  153. package/dist/src/services/AnnotationManager.d.ts +48 -0
  154. package/dist/src/services/CameraController.d.ts +99 -0
  155. package/dist/src/services/DatasetManager.d.ts +27 -0
  156. package/dist/src/services/Giro3DManager.d.ts +42 -0
  157. package/dist/src/services/Highlighter.d.ts +11 -0
  158. package/dist/src/services/LayerManager.d.ts +37 -0
  159. package/dist/src/services/MeasureTool.d.ts +13 -0
  160. package/dist/src/services/MeasurementManager.d.ts +31 -0
  161. package/dist/src/services/MinimapController.d.ts +19 -0
  162. package/dist/src/services/Picker.d.ts +53 -0
  163. package/dist/src/services/analysis/ClippingBoxManager.d.ts +41 -0
  164. package/dist/src/services/analysis/CrossSectionManager.d.ts +9 -0
  165. package/dist/src/services/analysis/FloodingPlaneManager.d.ts +11 -0
  166. package/dist/src/stores/analysis.d.ts +1571 -0
  167. package/dist/src/stores/annotations.d.ts +60 -0
  168. package/dist/src/stores/bookmarks.d.ts +21 -0
  169. package/dist/src/stores/camera.d.ts +287 -0
  170. package/dist/src/stores/datasets.d.ts +49 -0
  171. package/dist/src/stores/giro3d.d.ts +45 -0
  172. package/dist/src/stores/layers.d.ts +40 -0
  173. package/dist/src/stores/measurement.d.ts +45 -0
  174. package/dist/src/stores/modules.d.ts +11 -0
  175. package/dist/src/stores/notifications.d.ts +8 -0
  176. package/dist/src/stores/statistics.d.ts +8 -0
  177. package/dist/src/types/Annotation.d.ts +35 -0
  178. package/dist/src/types/AnnotationMode.d.ts +7 -0
  179. package/dist/src/types/BaseLayer.d.ts +30 -0
  180. package/dist/src/types/Bookmark.d.ts +19 -0
  181. package/dist/src/types/CameraPosition.d.ts +7 -0
  182. package/dist/src/types/Configuration.d.ts +94 -0
  183. package/dist/src/types/Dataset.d.ts +78 -0
  184. package/dist/src/types/Feature.d.ts +13 -0
  185. package/dist/src/types/FloodingPlane.d.ts +14 -0
  186. package/dist/src/types/IFCTypes.d.ts +5 -0
  187. package/dist/src/types/LayerObject.d.ts +20 -0
  188. package/dist/src/types/Measure.d.ts +20 -0
  189. package/dist/src/types/MeasurementMode.d.ts +7 -0
  190. package/dist/src/types/Named.d.ts +5 -0
  191. package/dist/src/types/NavigationMode.d.ts +2 -0
  192. package/dist/src/types/Notification.d.ts +8 -0
  193. package/dist/src/types/OLGeometry.d.ts +1 -0
  194. package/dist/src/types/Overlay.d.ts +24 -0
  195. package/dist/src/types/VectorStyle.d.ts +31 -0
  196. package/dist/src/types/Viewbox.d.ts +7 -0
  197. package/dist/src/types/configuration/analysis.d.ts +26 -0
  198. package/dist/src/types/configuration/bookmark.d.ts +16 -0
  199. package/dist/src/types/configuration/camera.d.ts +19 -0
  200. package/dist/src/types/configuration/color.d.ts +18 -0
  201. package/dist/src/types/configuration/datasets/cityjson.d.ts +9 -0
  202. package/dist/src/types/configuration/datasets/core.d.ts +49 -0
  203. package/dist/src/types/configuration/datasets/featureCollection.d.ts +6 -0
  204. package/dist/src/types/configuration/datasets/ifc.d.ts +10 -0
  205. package/dist/src/types/configuration/datasets/index.d.ts +27 -0
  206. package/dist/src/types/configuration/datasets/layer.d.ts +43 -0
  207. package/dist/src/types/configuration/datasets/ply.d.ts +10 -0
  208. package/dist/src/types/configuration/datasets/pointCloud.d.ts +12 -0
  209. package/dist/src/types/configuration/datasets/potreePointCloud.d.ts +10 -0
  210. package/dist/src/types/configuration/datasets/tiledIfc.d.ts +9 -0
  211. package/dist/src/types/configuration/datasets/tiledPointCloud.d.ts +9 -0
  212. package/dist/src/types/configuration/datasets/vector.d.ts +34 -0
  213. package/dist/src/types/configuration/features.d.ts +2 -0
  214. package/dist/src/types/configuration/geographic.d.ts +51 -0
  215. package/dist/src/types/configuration/layers/core.d.ts +50 -0
  216. package/dist/src/types/configuration/layers/index.d.ts +49 -0
  217. package/dist/src/types/configuration/sources/bingMaps.d.ts +5 -0
  218. package/dist/src/types/configuration/sources/core/baseConfig.d.ts +70 -0
  219. package/dist/src/types/configuration/sources/core/tiled.d.ts +19 -0
  220. package/dist/src/types/configuration/sources/core/vector.d.ts +13 -0
  221. package/dist/src/types/configuration/sources/core/vectorTile.d.ts +8 -0
  222. package/dist/src/types/configuration/sources/customVector.d.ts +7 -0
  223. package/dist/src/types/configuration/sources/customVectorTile.d.ts +8 -0
  224. package/dist/src/types/configuration/sources/geojson.d.ts +5 -0
  225. package/dist/src/types/configuration/sources/geotiff.d.ts +8 -0
  226. package/dist/src/types/configuration/sources/gpx.d.ts +5 -0
  227. package/dist/src/types/configuration/sources/kml.d.ts +5 -0
  228. package/dist/src/types/configuration/sources/mvt.d.ts +10 -0
  229. package/dist/src/types/configuration/sources/osm.d.ts +5 -0
  230. package/dist/src/types/configuration/sources/stadiaMaps.d.ts +5 -0
  231. package/dist/src/types/configuration/sources/wms.d.ts +15 -0
  232. package/dist/src/types/configuration/sources/wmts.d.ts +15 -0
  233. package/dist/src/types/configuration/sources/xyz.d.ts +9 -0
  234. package/dist/src/types/utilities.d.ts +5 -0
  235. package/dist/src/utils/Components.d.ts +8 -0
  236. package/dist/src/utils/Configuration.d.ts +15 -0
  237. package/dist/src/utils/Download.d.ts +11 -0
  238. package/dist/src/utils/Fetcher.d.ts +77 -0
  239. package/dist/src/utils/Measure.d.ts +7 -0
  240. package/dist/src/utils/OLFeatures.d.ts +57 -0
  241. package/dist/src/utils/Projections.d.ts +10 -0
  242. package/dist/src/utils/Types.d.ts +11 -0
  243. package/dist/webimage.cjs.js +1 -0
  244. package/dist/webimage.es.js +19 -0
  245. package/package.json +100 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./basedecoder.cjs.js"),J=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Y=4017,Z=799,$=3406,N=2276,Q=1567,W=3784,R=5793,K=2896;function ne(q,l){let o=0;const u=[];let D=16;for(;D>0&&!q[D-1];)--D;u.push({children:[],index:0});let w=u[0],C;for(let t=0;t<D;t++){for(let h=0;h<q[t];h++){for(w=u.pop(),w.children[w.index]=l[o];w.index>0;)w=u.pop();for(w.index++,u.push(w);u.length<=t;)u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C;o++}t+1<D&&(u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C)}return u[0].children}function ce(q,l,o,u,D,w,C,t,h){const{mcusPerLine:F,progressive:c}=o,r=l;let b=l,i=0,d=0;function m(){if(d>0)return d--,i>>d&1;if(i=q[b++],i===255){const a=q[b++];if(a)throw new Error(`unexpected marker: ${(i<<8|a).toString(16)}`)}return d=7,i>>>7}function x(a){let f=a,p;for(;(p=m())!==null;){if(f=f[p],typeof f=="number")return f;if(typeof f!="object")throw new Error("invalid huffman sequence")}return null}function E(a){let f=a,p=0;for(;f>0;){const y=m();if(y===null)return;p=p<<1|y,--f}return p}function k(a){const f=E(a);return f>=1<<a-1?f:f+(-1<<a)+1}function v(a,f){const p=x(a.huffmanTableDC),y=p===0?0:k(p);a.pred+=y,f[0]=a.pred;let P=1;for(;P<64;){const T=x(a.huffmanTableAC),L=T&15,S=T>>4;if(L===0){if(S<15)break;P+=16}else{P+=S;const I=J[P];f[I]=k(L),P++}}}function A(a,f){const p=x(a.huffmanTableDC),y=p===0?0:k(p)<<h;a.pred+=y,f[0]=a.pred}function s(a,f){f[0]|=m()<<h}let n=0;function g(a,f){if(n>0){n--;return}let p=w;const y=C;for(;p<=y;){const P=x(a.huffmanTableAC),T=P&15,L=P>>4;if(T===0){if(L<15){n=E(L)+(1<<L)-1;break}p+=16}else{p+=L;const S=J[p];f[S]=k(T)*(1<<h),p++}}}let e=0,_;function te(a,f){let p=w;const y=C;let P=0;for(;p<=y;){const T=J[p],L=f[T]<0?-1:1;switch(e){case 0:{const S=x(a.huffmanTableAC),I=S&15;if(P=S>>4,I===0)P<15?(n=E(P)+(1<<P),e=4):(P=16,e=1);else{if(I!==1)throw new Error("invalid ACn encoding");_=k(I),e=P?2:3}continue}case 1:case 2:f[T]?f[T]+=(m()<<h)*L:(P--,P===0&&(e=e===2?3:0));break;case 3:f[T]?f[T]+=(m()<<h)*L:(f[T]=_<<h,e=0);break;case 4:f[T]&&(f[T]+=(m()<<h)*L);break}p++}e===4&&(n--,n===0&&(e=0))}function se(a,f,p,y,P){const T=p/F|0,L=p%F,S=T*a.v+y,I=L*a.h+P;f(a,a.blocks[S][I])}function oe(a,f,p){const y=p/a.blocksPerLine|0,P=p%a.blocksPerLine;f(a,a.blocks[y][P])}const V=u.length;let U,j,G,X,M,H;c?w===0?H=t===0?A:s:H=t===0?g:te:H=v;let B=0,z,O;V===1?O=u[0].blocksPerLine*u[0].blocksPerColumn:O=F*o.mcusPerColumn;const ee=D||O;for(;B<O;){for(j=0;j<V;j++)u[j].pred=0;if(n=0,V===1)for(U=u[0],M=0;M<ee;M++)oe(U,H,B),B++;else for(M=0;M<ee;M++){for(j=0;j<V;j++){U=u[j];const{h:a,v:f}=U;for(G=0;G<f;G++)for(X=0;X<a;X++)se(U,H,B,G,X)}if(B++,B===O)break}if(d=0,z=q[b]<<8|q[b+1],z<65280)throw new Error("marker was not found");if(z>=65488&&z<=65495)b+=2;else break}return b-r}function ie(q,l){const o=[],{blocksPerLine:u,blocksPerColumn:D}=l,w=u<<3,C=new Int32Array(64),t=new Uint8Array(64);function h(F,c,r){const b=l.quantizationTable;let i,d,m,x,E,k,v,A,s;const n=r;let g;for(g=0;g<64;g++)n[g]=F[g]*b[g];for(g=0;g<8;++g){const e=8*g;if(n[1+e]===0&&n[2+e]===0&&n[3+e]===0&&n[4+e]===0&&n[5+e]===0&&n[6+e]===0&&n[7+e]===0){s=R*n[0+e]+512>>10,n[0+e]=s,n[1+e]=s,n[2+e]=s,n[3+e]=s,n[4+e]=s,n[5+e]=s,n[6+e]=s,n[7+e]=s;continue}i=R*n[0+e]+128>>8,d=R*n[4+e]+128>>8,m=n[2+e],x=n[6+e],E=K*(n[1+e]-n[7+e])+128>>8,A=K*(n[1+e]+n[7+e])+128>>8,k=n[3+e]<<4,v=n[5+e]<<4,s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+128>>8,m=m*Q-x*W+128>>8,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[7+e]=i-A,n[1+e]=d+v,n[6+e]=d-v,n[2+e]=m+k,n[5+e]=m-k,n[3+e]=x+E,n[4+e]=x-E}for(g=0;g<8;++g){const e=g;if(n[1*8+e]===0&&n[2*8+e]===0&&n[3*8+e]===0&&n[4*8+e]===0&&n[5*8+e]===0&&n[6*8+e]===0&&n[7*8+e]===0){s=R*r[g+0]+8192>>14,n[0*8+e]=s,n[1*8+e]=s,n[2*8+e]=s,n[3*8+e]=s,n[4*8+e]=s,n[5*8+e]=s,n[6*8+e]=s,n[7*8+e]=s;continue}i=R*n[0*8+e]+2048>>12,d=R*n[4*8+e]+2048>>12,m=n[2*8+e],x=n[6*8+e],E=K*(n[1*8+e]-n[7*8+e])+2048>>12,A=K*(n[1*8+e]+n[7*8+e])+2048>>12,k=n[3*8+e],v=n[5*8+e],s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+2048>>12,m=m*Q-x*W+2048>>12,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0*8+e]=i+A,n[7*8+e]=i-A,n[1*8+e]=d+v,n[6*8+e]=d-v,n[2*8+e]=m+k,n[5*8+e]=m-k,n[3*8+e]=x+E,n[4*8+e]=x-E}for(g=0;g<64;++g){const e=128+(n[g]+8>>4);e<0?c[g]=0:e>255?c[g]=255:c[g]=e}}for(let F=0;F<D;F++){const c=F<<3;for(let r=0;r<8;r++)o.push(new Uint8Array(w));for(let r=0;r<u;r++){h(l.blocks[F][r],t,C);let b=0;const i=r<<3;for(let d=0;d<8;d++){const m=o[c+d];for(let x=0;x<8;x++)m[i+x]=t[b++]}}}return o}class le{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(l){let o=0;function u(){const t=l[o]<<8|l[o+1];return o+=2,t}function D(){const t=u(),h=l.subarray(o,o+t-2);return o+=h.length,h}function w(t){let h=0,F=0,c,r;for(r in t.components)t.components.hasOwnProperty(r)&&(c=t.components[r],h<c.h&&(h=c.h),F<c.v&&(F=c.v));const b=Math.ceil(t.samplesPerLine/8/h),i=Math.ceil(t.scanLines/8/F);for(r in t.components)if(t.components.hasOwnProperty(r)){c=t.components[r];const d=Math.ceil(Math.ceil(t.samplesPerLine/8)*c.h/h),m=Math.ceil(Math.ceil(t.scanLines/8)*c.v/F),x=b*c.h,E=i*c.v,k=[];for(let v=0;v<E;v++){const A=[];for(let s=0;s<x;s++)A.push(new Int32Array(64));k.push(A)}c.blocksPerLine=d,c.blocksPerColumn=m,c.blocks=k}t.maxH=h,t.maxV=F,t.mcusPerLine=b,t.mcusPerColumn=i}let C=u();if(C!==65496)throw new Error("SOI not found");for(C=u();C!==65497;){switch(C){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=D();C===65504&&t[0]===74&&t[1]===70&&t[2]===73&&t[3]===70&&t[4]===0&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),C===65518&&t[0]===65&&t[1]===100&&t[2]===111&&t[3]===98&&t[4]===101&&t[5]===0&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const h=u()+o-2;for(;o<h;){const F=l[o++],c=new Int32Array(64);if(F>>4)if(F>>4===1)for(let r=0;r<64;r++){const b=J[r];c[b]=u()}else throw new Error("DQT: invalid table spec");else for(let r=0;r<64;r++){const b=J[r];c[b]=l[o++]}this.quantizationTables[F&15]=c}break}case 65472:case 65473:case 65474:{u();const t={extended:C===65473,progressive:C===65474,precision:l[o++],scanLines:u(),samplesPerLine:u(),components:{},componentsOrder:[]},h=l[o++];let F;for(let c=0;c<h;c++){F=l[o];const r=l[o+1]>>4,b=l[o+1]&15,i=l[o+2];t.componentsOrder.push(F),t.components[F]={h:r,v:b,quantizationIdx:i},o+=3}w(t),this.frames.push(t);break}case 65476:{const t=u();for(let h=2;h<t;){const F=l[o++],c=new Uint8Array(16);let r=0;for(let i=0;i<16;i++,o++)c[i]=l[o],r+=c[i];const b=new Uint8Array(r);for(let i=0;i<r;i++,o++)b[i]=l[o];h+=17+r,F>>4?this.huffmanTablesAC[F&15]=ne(c,b):this.huffmanTablesDC[F&15]=ne(c,b)}break}case 65501:u(),this.resetInterval=u();break;case 65498:{u();const t=l[o++],h=[],F=this.frames[0];for(let d=0;d<t;d++){const m=F.components[l[o++]],x=l[o++];m.huffmanTableDC=this.huffmanTablesDC[x>>4],m.huffmanTableAC=this.huffmanTablesAC[x&15],h.push(m)}const c=l[o++],r=l[o++],b=l[o++],i=ce(l,o,F,h,this.resetInterval,c,r,b>>4,b&15);o+=i;break}case 65535:l[o]!==255&&o--;break;default:if(l[o-3]===255&&l[o-2]>=192&&l[o-2]<=254){o-=3;break}throw new Error(`unknown JPEG marker ${C.toString(16)}`)}C=u()}}getResult(){const{frames:l}=this;if(this.frames.length===0)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let c=0;c<this.frames.length;c++){const r=this.frames[c].components;for(const b of Object.keys(r))r[b].quantizationTable=this.quantizationTables[r[b].quantizationIdx],delete r[b].quantizationIdx}const o=l[0],{components:u,componentsOrder:D}=o,w=[],C=o.samplesPerLine,t=o.scanLines;for(let c=0;c<D.length;c++){const r=u[D[c]];w.push({lines:ie(o,r),scaleX:r.h/o.maxH,scaleY:r.v/o.maxV})}const h=new Uint8Array(C*t*w.length);let F=0;for(let c=0;c<t;++c)for(let r=0;r<C;++r)for(let b=0;b<w.length;++b){const i=w[b];h[F]=i.lines[0|c*i.scaleY][0|r*i.scaleX],++F}return h}}class ae extends re.BaseDecoder{constructor(l){super(),this.reader=new le,l.JPEGTables&&this.reader.parse(l.JPEGTables)}decodeBlock(l){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(l)),this.reader.getResult().buffer}}exports.default=ae;
@@ -0,0 +1,514 @@
1
+ import { B as re } from "./basedecoder.es.js";
2
+ const O = new Int32Array([
3
+ 0,
4
+ 1,
5
+ 8,
6
+ 16,
7
+ 9,
8
+ 2,
9
+ 3,
10
+ 10,
11
+ 17,
12
+ 24,
13
+ 32,
14
+ 25,
15
+ 18,
16
+ 11,
17
+ 4,
18
+ 5,
19
+ 12,
20
+ 19,
21
+ 26,
22
+ 33,
23
+ 40,
24
+ 48,
25
+ 41,
26
+ 34,
27
+ 27,
28
+ 20,
29
+ 13,
30
+ 6,
31
+ 7,
32
+ 14,
33
+ 21,
34
+ 28,
35
+ 35,
36
+ 42,
37
+ 49,
38
+ 56,
39
+ 57,
40
+ 50,
41
+ 43,
42
+ 36,
43
+ 29,
44
+ 22,
45
+ 15,
46
+ 23,
47
+ 30,
48
+ 37,
49
+ 44,
50
+ 51,
51
+ 58,
52
+ 59,
53
+ 52,
54
+ 45,
55
+ 38,
56
+ 31,
57
+ 39,
58
+ 46,
59
+ 53,
60
+ 60,
61
+ 61,
62
+ 54,
63
+ 47,
64
+ 55,
65
+ 62,
66
+ 63
67
+ ]), Y = 4017, Z = 799, $ = 3406, N = 2276, Q = 1567, W = 3784, R = 5793, K = 2896;
68
+ function ne(q, l) {
69
+ let o = 0;
70
+ const u = [];
71
+ let T = 16;
72
+ for (; T > 0 && !q[T - 1]; )
73
+ --T;
74
+ u.push({ children: [], index: 0 });
75
+ let w = u[0], C;
76
+ for (let t = 0; t < T; t++) {
77
+ for (let h = 0; h < q[t]; h++) {
78
+ for (w = u.pop(), w.children[w.index] = l[o]; w.index > 0; )
79
+ w = u.pop();
80
+ for (w.index++, u.push(w); u.length <= t; )
81
+ u.push(C = { children: [], index: 0 }), w.children[w.index] = C.children, w = C;
82
+ o++;
83
+ }
84
+ t + 1 < T && (u.push(C = { children: [], index: 0 }), w.children[w.index] = C.children, w = C);
85
+ }
86
+ return u[0].children;
87
+ }
88
+ function ce(q, l, o, u, T, w, C, t, h) {
89
+ const { mcusPerLine: F, progressive: c } = o, r = l;
90
+ let b = l, i = 0, d = 0;
91
+ function m() {
92
+ if (d > 0)
93
+ return d--, i >> d & 1;
94
+ if (i = q[b++], i === 255) {
95
+ const a = q[b++];
96
+ if (a)
97
+ throw new Error(`unexpected marker: ${(i << 8 | a).toString(16)}`);
98
+ }
99
+ return d = 7, i >>> 7;
100
+ }
101
+ function x(a) {
102
+ let f = a, p;
103
+ for (; (p = m()) !== null; ) {
104
+ if (f = f[p], typeof f == "number")
105
+ return f;
106
+ if (typeof f != "object")
107
+ throw new Error("invalid huffman sequence");
108
+ }
109
+ return null;
110
+ }
111
+ function E(a) {
112
+ let f = a, p = 0;
113
+ for (; f > 0; ) {
114
+ const L = m();
115
+ if (L === null)
116
+ return;
117
+ p = p << 1 | L, --f;
118
+ }
119
+ return p;
120
+ }
121
+ function k(a) {
122
+ const f = E(a);
123
+ return f >= 1 << a - 1 ? f : f + (-1 << a) + 1;
124
+ }
125
+ function A(a, f) {
126
+ const p = x(a.huffmanTableDC), L = p === 0 ? 0 : k(p);
127
+ a.pred += L, f[0] = a.pred;
128
+ let D = 1;
129
+ for (; D < 64; ) {
130
+ const P = x(a.huffmanTableAC), y = P & 15, S = P >> 4;
131
+ if (y === 0) {
132
+ if (S < 15)
133
+ break;
134
+ D += 16;
135
+ } else {
136
+ D += S;
137
+ const I = O[D];
138
+ f[I] = k(y), D++;
139
+ }
140
+ }
141
+ }
142
+ function v(a, f) {
143
+ const p = x(a.huffmanTableDC), L = p === 0 ? 0 : k(p) << h;
144
+ a.pred += L, f[0] = a.pred;
145
+ }
146
+ function s(a, f) {
147
+ f[0] |= m() << h;
148
+ }
149
+ let n = 0;
150
+ function g(a, f) {
151
+ if (n > 0) {
152
+ n--;
153
+ return;
154
+ }
155
+ let p = w;
156
+ const L = C;
157
+ for (; p <= L; ) {
158
+ const D = x(a.huffmanTableAC), P = D & 15, y = D >> 4;
159
+ if (P === 0) {
160
+ if (y < 15) {
161
+ n = E(y) + (1 << y) - 1;
162
+ break;
163
+ }
164
+ p += 16;
165
+ } else {
166
+ p += y;
167
+ const S = O[p];
168
+ f[S] = k(P) * (1 << h), p++;
169
+ }
170
+ }
171
+ }
172
+ let e = 0, _;
173
+ function te(a, f) {
174
+ let p = w;
175
+ const L = C;
176
+ let D = 0;
177
+ for (; p <= L; ) {
178
+ const P = O[p], y = f[P] < 0 ? -1 : 1;
179
+ switch (e) {
180
+ case 0: {
181
+ const S = x(a.huffmanTableAC), I = S & 15;
182
+ if (D = S >> 4, I === 0)
183
+ D < 15 ? (n = E(D) + (1 << D), e = 4) : (D = 16, e = 1);
184
+ else {
185
+ if (I !== 1)
186
+ throw new Error("invalid ACn encoding");
187
+ _ = k(I), e = D ? 2 : 3;
188
+ }
189
+ continue;
190
+ }
191
+ case 1:
192
+ case 2:
193
+ f[P] ? f[P] += (m() << h) * y : (D--, D === 0 && (e = e === 2 ? 3 : 0));
194
+ break;
195
+ case 3:
196
+ f[P] ? f[P] += (m() << h) * y : (f[P] = _ << h, e = 0);
197
+ break;
198
+ case 4:
199
+ f[P] && (f[P] += (m() << h) * y);
200
+ break;
201
+ }
202
+ p++;
203
+ }
204
+ e === 4 && (n--, n === 0 && (e = 0));
205
+ }
206
+ function se(a, f, p, L, D) {
207
+ const P = p / F | 0, y = p % F, S = P * a.v + L, I = y * a.h + D;
208
+ f(a, a.blocks[S][I]);
209
+ }
210
+ function oe(a, f, p) {
211
+ const L = p / a.blocksPerLine | 0, D = p % a.blocksPerLine;
212
+ f(a, a.blocks[L][D]);
213
+ }
214
+ const V = u.length;
215
+ let U, j, G, X, B, H;
216
+ c ? w === 0 ? H = t === 0 ? v : s : H = t === 0 ? g : te : H = A;
217
+ let M = 0, z, J;
218
+ V === 1 ? J = u[0].blocksPerLine * u[0].blocksPerColumn : J = F * o.mcusPerColumn;
219
+ const ee = T || J;
220
+ for (; M < J; ) {
221
+ for (j = 0; j < V; j++)
222
+ u[j].pred = 0;
223
+ if (n = 0, V === 1)
224
+ for (U = u[0], B = 0; B < ee; B++)
225
+ oe(U, H, M), M++;
226
+ else
227
+ for (B = 0; B < ee; B++) {
228
+ for (j = 0; j < V; j++) {
229
+ U = u[j];
230
+ const { h: a, v: f } = U;
231
+ for (G = 0; G < f; G++)
232
+ for (X = 0; X < a; X++)
233
+ se(U, H, M, G, X);
234
+ }
235
+ if (M++, M === J)
236
+ break;
237
+ }
238
+ if (d = 0, z = q[b] << 8 | q[b + 1], z < 65280)
239
+ throw new Error("marker was not found");
240
+ if (z >= 65488 && z <= 65495)
241
+ b += 2;
242
+ else
243
+ break;
244
+ }
245
+ return b - r;
246
+ }
247
+ function ie(q, l) {
248
+ const o = [], { blocksPerLine: u, blocksPerColumn: T } = l, w = u << 3, C = new Int32Array(64), t = new Uint8Array(64);
249
+ function h(F, c, r) {
250
+ const b = l.quantizationTable;
251
+ let i, d, m, x, E, k, A, v, s;
252
+ const n = r;
253
+ let g;
254
+ for (g = 0; g < 64; g++)
255
+ n[g] = F[g] * b[g];
256
+ for (g = 0; g < 8; ++g) {
257
+ const e = 8 * g;
258
+ if (n[1 + e] === 0 && n[2 + e] === 0 && n[3 + e] === 0 && n[4 + e] === 0 && n[5 + e] === 0 && n[6 + e] === 0 && n[7 + e] === 0) {
259
+ s = R * n[0 + e] + 512 >> 10, n[0 + e] = s, n[1 + e] = s, n[2 + e] = s, n[3 + e] = s, n[4 + e] = s, n[5 + e] = s, n[6 + e] = s, n[7 + e] = s;
260
+ continue;
261
+ }
262
+ i = R * n[0 + e] + 128 >> 8, d = R * n[4 + e] + 128 >> 8, m = n[2 + e], x = n[6 + e], E = K * (n[1 + e] - n[7 + e]) + 128 >> 8, v = K * (n[1 + e] + n[7 + e]) + 128 >> 8, k = n[3 + e] << 4, A = n[5 + e] << 4, s = i - d + 1 >> 1, i = i + d + 1 >> 1, d = s, s = m * W + x * Q + 128 >> 8, m = m * Q - x * W + 128 >> 8, x = s, s = E - A + 1 >> 1, E = E + A + 1 >> 1, A = s, s = v + k + 1 >> 1, k = v - k + 1 >> 1, v = s, s = i - x + 1 >> 1, i = i + x + 1 >> 1, x = s, s = d - m + 1 >> 1, d = d + m + 1 >> 1, m = s, s = E * N + v * $ + 2048 >> 12, E = E * $ - v * N + 2048 >> 12, v = s, s = k * Z + A * Y + 2048 >> 12, k = k * Y - A * Z + 2048 >> 12, A = s, n[0 + e] = i + v, n[7 + e] = i - v, n[1 + e] = d + A, n[6 + e] = d - A, n[2 + e] = m + k, n[5 + e] = m - k, n[3 + e] = x + E, n[4 + e] = x - E;
263
+ }
264
+ for (g = 0; g < 8; ++g) {
265
+ const e = g;
266
+ if (n[1 * 8 + e] === 0 && n[2 * 8 + e] === 0 && n[3 * 8 + e] === 0 && n[4 * 8 + e] === 0 && n[5 * 8 + e] === 0 && n[6 * 8 + e] === 0 && n[7 * 8 + e] === 0) {
267
+ s = R * r[g + 0] + 8192 >> 14, n[0 * 8 + e] = s, n[1 * 8 + e] = s, n[2 * 8 + e] = s, n[3 * 8 + e] = s, n[4 * 8 + e] = s, n[5 * 8 + e] = s, n[6 * 8 + e] = s, n[7 * 8 + e] = s;
268
+ continue;
269
+ }
270
+ i = R * n[0 * 8 + e] + 2048 >> 12, d = R * n[4 * 8 + e] + 2048 >> 12, m = n[2 * 8 + e], x = n[6 * 8 + e], E = K * (n[1 * 8 + e] - n[7 * 8 + e]) + 2048 >> 12, v = K * (n[1 * 8 + e] + n[7 * 8 + e]) + 2048 >> 12, k = n[3 * 8 + e], A = n[5 * 8 + e], s = i - d + 1 >> 1, i = i + d + 1 >> 1, d = s, s = m * W + x * Q + 2048 >> 12, m = m * Q - x * W + 2048 >> 12, x = s, s = E - A + 1 >> 1, E = E + A + 1 >> 1, A = s, s = v + k + 1 >> 1, k = v - k + 1 >> 1, v = s, s = i - x + 1 >> 1, i = i + x + 1 >> 1, x = s, s = d - m + 1 >> 1, d = d + m + 1 >> 1, m = s, s = E * N + v * $ + 2048 >> 12, E = E * $ - v * N + 2048 >> 12, v = s, s = k * Z + A * Y + 2048 >> 12, k = k * Y - A * Z + 2048 >> 12, A = s, n[0 * 8 + e] = i + v, n[7 * 8 + e] = i - v, n[1 * 8 + e] = d + A, n[6 * 8 + e] = d - A, n[2 * 8 + e] = m + k, n[5 * 8 + e] = m - k, n[3 * 8 + e] = x + E, n[4 * 8 + e] = x - E;
271
+ }
272
+ for (g = 0; g < 64; ++g) {
273
+ const e = 128 + (n[g] + 8 >> 4);
274
+ e < 0 ? c[g] = 0 : e > 255 ? c[g] = 255 : c[g] = e;
275
+ }
276
+ }
277
+ for (let F = 0; F < T; F++) {
278
+ const c = F << 3;
279
+ for (let r = 0; r < 8; r++)
280
+ o.push(new Uint8Array(w));
281
+ for (let r = 0; r < u; r++) {
282
+ h(l.blocks[F][r], t, C);
283
+ let b = 0;
284
+ const i = r << 3;
285
+ for (let d = 0; d < 8; d++) {
286
+ const m = o[c + d];
287
+ for (let x = 0; x < 8; x++)
288
+ m[i + x] = t[b++];
289
+ }
290
+ }
291
+ }
292
+ return o;
293
+ }
294
+ class le {
295
+ constructor() {
296
+ this.jfif = null, this.adobe = null, this.quantizationTables = [], this.huffmanTablesAC = [], this.huffmanTablesDC = [], this.resetFrames();
297
+ }
298
+ resetFrames() {
299
+ this.frames = [];
300
+ }
301
+ parse(l) {
302
+ let o = 0;
303
+ function u() {
304
+ const t = l[o] << 8 | l[o + 1];
305
+ return o += 2, t;
306
+ }
307
+ function T() {
308
+ const t = u(), h = l.subarray(o, o + t - 2);
309
+ return o += h.length, h;
310
+ }
311
+ function w(t) {
312
+ let h = 0, F = 0, c, r;
313
+ for (r in t.components)
314
+ t.components.hasOwnProperty(r) && (c = t.components[r], h < c.h && (h = c.h), F < c.v && (F = c.v));
315
+ const b = Math.ceil(t.samplesPerLine / 8 / h), i = Math.ceil(t.scanLines / 8 / F);
316
+ for (r in t.components)
317
+ if (t.components.hasOwnProperty(r)) {
318
+ c = t.components[r];
319
+ const d = Math.ceil(Math.ceil(t.samplesPerLine / 8) * c.h / h), m = Math.ceil(Math.ceil(t.scanLines / 8) * c.v / F), x = b * c.h, E = i * c.v, k = [];
320
+ for (let A = 0; A < E; A++) {
321
+ const v = [];
322
+ for (let s = 0; s < x; s++)
323
+ v.push(new Int32Array(64));
324
+ k.push(v);
325
+ }
326
+ c.blocksPerLine = d, c.blocksPerColumn = m, c.blocks = k;
327
+ }
328
+ t.maxH = h, t.maxV = F, t.mcusPerLine = b, t.mcusPerColumn = i;
329
+ }
330
+ let C = u();
331
+ if (C !== 65496)
332
+ throw new Error("SOI not found");
333
+ for (C = u(); C !== 65497; ) {
334
+ switch (C) {
335
+ case 65280:
336
+ break;
337
+ case 65504:
338
+ case 65505:
339
+ case 65506:
340
+ case 65507:
341
+ case 65508:
342
+ case 65509:
343
+ case 65510:
344
+ case 65511:
345
+ case 65512:
346
+ case 65513:
347
+ case 65514:
348
+ case 65515:
349
+ case 65516:
350
+ case 65517:
351
+ case 65518:
352
+ case 65519:
353
+ case 65534: {
354
+ const t = T();
355
+ C === 65504 && t[0] === 74 && t[1] === 70 && t[2] === 73 && t[3] === 70 && t[4] === 0 && (this.jfif = {
356
+ version: { major: t[5], minor: t[6] },
357
+ densityUnits: t[7],
358
+ xDensity: t[8] << 8 | t[9],
359
+ yDensity: t[10] << 8 | t[11],
360
+ thumbWidth: t[12],
361
+ thumbHeight: t[13],
362
+ thumbData: t.subarray(14, 14 + 3 * t[12] * t[13])
363
+ }), C === 65518 && t[0] === 65 && t[1] === 100 && t[2] === 111 && t[3] === 98 && t[4] === 101 && t[5] === 0 && (this.adobe = {
364
+ version: t[6],
365
+ flags0: t[7] << 8 | t[8],
366
+ flags1: t[9] << 8 | t[10],
367
+ transformCode: t[11]
368
+ });
369
+ break;
370
+ }
371
+ case 65499: {
372
+ const h = u() + o - 2;
373
+ for (; o < h; ) {
374
+ const F = l[o++], c = new Int32Array(64);
375
+ if (F >> 4)
376
+ if (F >> 4 === 1)
377
+ for (let r = 0; r < 64; r++) {
378
+ const b = O[r];
379
+ c[b] = u();
380
+ }
381
+ else
382
+ throw new Error("DQT: invalid table spec");
383
+ else for (let r = 0; r < 64; r++) {
384
+ const b = O[r];
385
+ c[b] = l[o++];
386
+ }
387
+ this.quantizationTables[F & 15] = c;
388
+ }
389
+ break;
390
+ }
391
+ case 65472:
392
+ case 65473:
393
+ case 65474: {
394
+ u();
395
+ const t = {
396
+ extended: C === 65473,
397
+ progressive: C === 65474,
398
+ precision: l[o++],
399
+ scanLines: u(),
400
+ samplesPerLine: u(),
401
+ components: {},
402
+ componentsOrder: []
403
+ }, h = l[o++];
404
+ let F;
405
+ for (let c = 0; c < h; c++) {
406
+ F = l[o];
407
+ const r = l[o + 1] >> 4, b = l[o + 1] & 15, i = l[o + 2];
408
+ t.componentsOrder.push(F), t.components[F] = {
409
+ h: r,
410
+ v: b,
411
+ quantizationIdx: i
412
+ }, o += 3;
413
+ }
414
+ w(t), this.frames.push(t);
415
+ break;
416
+ }
417
+ case 65476: {
418
+ const t = u();
419
+ for (let h = 2; h < t; ) {
420
+ const F = l[o++], c = new Uint8Array(16);
421
+ let r = 0;
422
+ for (let i = 0; i < 16; i++, o++)
423
+ c[i] = l[o], r += c[i];
424
+ const b = new Uint8Array(r);
425
+ for (let i = 0; i < r; i++, o++)
426
+ b[i] = l[o];
427
+ h += 17 + r, F >> 4 ? this.huffmanTablesAC[F & 15] = ne(
428
+ c,
429
+ b
430
+ ) : this.huffmanTablesDC[F & 15] = ne(
431
+ c,
432
+ b
433
+ );
434
+ }
435
+ break;
436
+ }
437
+ case 65501:
438
+ u(), this.resetInterval = u();
439
+ break;
440
+ case 65498: {
441
+ u();
442
+ const t = l[o++], h = [], F = this.frames[0];
443
+ for (let d = 0; d < t; d++) {
444
+ const m = F.components[l[o++]], x = l[o++];
445
+ m.huffmanTableDC = this.huffmanTablesDC[x >> 4], m.huffmanTableAC = this.huffmanTablesAC[x & 15], h.push(m);
446
+ }
447
+ const c = l[o++], r = l[o++], b = l[o++], i = ce(
448
+ l,
449
+ o,
450
+ F,
451
+ h,
452
+ this.resetInterval,
453
+ c,
454
+ r,
455
+ b >> 4,
456
+ b & 15
457
+ );
458
+ o += i;
459
+ break;
460
+ }
461
+ case 65535:
462
+ l[o] !== 255 && o--;
463
+ break;
464
+ default:
465
+ if (l[o - 3] === 255 && l[o - 2] >= 192 && l[o - 2] <= 254) {
466
+ o -= 3;
467
+ break;
468
+ }
469
+ throw new Error(`unknown JPEG marker ${C.toString(16)}`);
470
+ }
471
+ C = u();
472
+ }
473
+ }
474
+ getResult() {
475
+ const { frames: l } = this;
476
+ if (this.frames.length === 0)
477
+ throw new Error("no frames were decoded");
478
+ this.frames.length > 1 && console.warn("more than one frame is not supported");
479
+ for (let c = 0; c < this.frames.length; c++) {
480
+ const r = this.frames[c].components;
481
+ for (const b of Object.keys(r))
482
+ r[b].quantizationTable = this.quantizationTables[r[b].quantizationIdx], delete r[b].quantizationIdx;
483
+ }
484
+ const o = l[0], { components: u, componentsOrder: T } = o, w = [], C = o.samplesPerLine, t = o.scanLines;
485
+ for (let c = 0; c < T.length; c++) {
486
+ const r = u[T[c]];
487
+ w.push({
488
+ lines: ie(o, r),
489
+ scaleX: r.h / o.maxH,
490
+ scaleY: r.v / o.maxV
491
+ });
492
+ }
493
+ const h = new Uint8Array(C * t * w.length);
494
+ let F = 0;
495
+ for (let c = 0; c < t; ++c)
496
+ for (let r = 0; r < C; ++r)
497
+ for (let b = 0; b < w.length; ++b) {
498
+ const i = w[b];
499
+ h[F] = i.lines[0 | c * i.scaleY][0 | r * i.scaleX], ++F;
500
+ }
501
+ return h;
502
+ }
503
+ }
504
+ class fe extends re {
505
+ constructor(l) {
506
+ super(), this.reader = new le(), l.JPEGTables && this.reader.parse(l.JPEGTables);
507
+ }
508
+ decodeBlock(l) {
509
+ return this.reader.resetFrames(), this.reader.parse(new Uint8Array(l)), this.reader.getResult().buffer;
510
+ }
511
+ }
512
+ export {
513
+ fe as default
514
+ };