@arcgis/core 4.31.0-next.20240619 → 4.31.0-next.20240621
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
- package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
- package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
- package/assets/esri/core/workers/chunks/{d7c0728bdd9a7fd1d701.js → 9d677af08238d9e09e72.js} +36 -25
- package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
- package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
- package/assets/esri/core/workers/chunks/cf1530abe2842f3d8eb0.js +1 -0
- package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
- package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/chunks/CheckerBoard.glsl.js +9 -6
- package/chunks/ComponentShader.glsl.js +23 -23
- package/chunks/HUDMaterial.glsl.js +29 -33
- package/chunks/HighlightApply.glsl.js +150 -23
- package/chunks/HighlightDownsample.glsl.js +25 -12
- package/chunks/ImageMaterial.glsl.js +1 -2
- package/chunks/LineMarker.glsl.js +30 -30
- package/chunks/RibbonLine.glsl.js +42 -42
- package/chunks/ShadowHighlight.glsl.js +15 -6
- package/chunks/Terrain.glsl.js +6 -3
- package/interfaces.d.ts +50 -14
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/Highlights.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/support/HighlightOptionsBase.js +5 -0
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +18 -7
- package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +5 -0
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/support/HighlightDefaults.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/constants.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/24484bd0185ea0f79760.js +0 -1
- package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
- package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
- package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
- package/chunks/HighlightBlur.glsl.js +0 -25
- package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +0 -5
package/widgets/Print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as a}from"../core/lang.js";import{watch as i}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{reArcGISOnlineDomain as p}from"../portal/support/urlUtils.js";import{getToken as d}from"../rest/utils.js";import{toJSON as u}from"../rest/support/fileFormat.js";import m from"./Widget.js";import h from"./Print/FileLink.js";import b from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{isRTL as v,isActivationKey as w}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";import{formatNumber as C}from"../intl/number.js";const O=t.ofType(h),k="MAP_ONLY";var I;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(I||(I={}));const $="esri-print",L=`${$}__advanced-options-button`,S={base:$,headerTitle:`${$}__header-title`,layoutTabList:`${$}__layout-tab-list`,layoutTab:`${$}__layout-tab`,layoutSection:`${$}__layout-section`,mapOnlySection:`${$}__map-only-section`,panelItemsCentered:`${$}__panel-items--centered`,loader:`${$}__loader`,advancedOptionsButton:L,advancedOptionsButtonContainer:`${L}-container`,advancedOptionsButtonTitle:`${L}-title`,advancedOptionsButtonIconOpened:`${L}-icon--opened`,advancedOptionsButtonIconClosed:`${L}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${L}-icon--closed-rtl`,swapButton:`${$}__swap-button`,printButton:`${$}__export-button`,templateSelectContainer:`${$}__template-select-container`,templateSelectBlock:`${$}__template-select-block`,templateSelectIcon:`${$}__template-select-icon`,formSectionContainer:`${$}__form-section-container`,formCheckboxLabel:`${$}__form-checkbox-label`,advancedOptionsSection:`${$}__advanced-options-section`,advancedOptionsContainer:`${$}__advanced-options-container`,browseTemplateButtonContainer:`${$}__browse-template-button-container`,exportedFilesContainer:`${$}__export-panel-container`,exportedFilesTitle:`${$}__export-title`,exportedFile:`${$}__exported-file`,exportedFileLink:`${$}__exported-file-link`,exportedFileLinkTitle:`${$}__exported-file-link-title`,exportedFilesEmpty:`${$}__exported-files-empty`,printWidgetContainer:`${$}__container`,content:`${$}__content`,panelContainer:`${$}__panel-container`,scaleInfoContainer:`${$}__scale-info-container`,scaleInputContainer:`${$}__scale-input-container`,scaleInput:`${$}__scale-input`,sizeContainer:`${$}__size-container`,panelError:`${$}__panel--error`,exportedFileError:`${$}__exported-file--error`,exportedFileLoader:`${$}__exported-file--loader`,exportSection:`${$}__export-section`,exportSectionCentered:`${$}__export-section--centered`,templateButtonContainer:`${$}__template-button-container`,templateDoneButton:`${$}__template-done-button`,templateSelectFlowItemContainer:`${$}__template-select-flow-item-container`,templateSelectFlowItemContent:`${$}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${$}__template-select-flow-item-list-heading`};function M(e,t,l,a){const i=l/t,o=a/t;return{width:Math.round(e*i),height:Math.round(e*o)}}function E(e){return!isNaN(e)&&e>0}function F(e){return e?.toUpperCase()===k}function j(e){const{state:t,extension:l}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return l?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}function P(e,t){return!!t&&e.some((e=>e.layoutItem?.id===t||e.layout===t))}const A=new l({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});let B=class extends m{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=I.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedLayout=null,this._abortController=null,this._showTemplates=!1,this.browseTemplateButtonOnClick=null,this.exportedLinks=new O,this.headingLevel=3,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new b,this._onInput=e=>{this._selectedTab===I.layout?this.templateOptions.title=e.target.value:this._selectedTab===I.mapOnly&&(this.templateOptions.fileName=e.target.value)},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const l=d(this.viewModel.effectivePrintServiceUrl),a=t.url,i=document.createElement("a");if(i.target="_blank",i.href=a,i.rel="noreferrer",i.download=t.formattedName??"",!l)return i.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",l),i.href=o.href,i.click(),i.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([i((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format.defaultValue]),(([e,t])=>{if(t&&!e)return void(this.templateOptions.format=t);if(!e||!t||!this.viewModel.templatesInfo)return;if(this.viewModel.templatesInfo.format.choiceList.includes(e))return;const l=this.viewModel.templatesInfo.format.choiceList.find((t=>t.toUpperCase().includes(`(${e.toUpperCase()})`)));this.templateOptions.format=l??t})),i((()=>[this.templateOptions.layout,this.viewModel.templatesInfo?.layout.defaultValue]),(async([e,t])=>{if(this._selectedTab=F(e)?I.mapOnly:I.layout,this._selectedTab!==I.layout)return;const{includeDefaultTemplates:l,viewModel:i,_selectedLayout:o}=this,{portalTemplateIds:n,browseTemplates:s,templatesInfo:r}=i,c=i.defaultTemplates.filter((({layoutItem:e})=>n.includes(e?.id))),p=i.defaultTemplates.filter((({layoutItem:e})=>!n.includes(e?.id))),d=l&&p.length;if(e){(d?P(p,e):r?.layout.choiceList.includes(e))||P(c,e)||P(s,e)||(this.templateOptions.layout=null,this.templateOptions.layoutItem=null)}else{o&&((d?P(p,o):r?.layout.choiceList.includes(o))||P(c,o)||P(s,o))?await this._applyTemplate(o):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null),this.templateOptions.layout||d||!t||await this._applyTemplate(t)}this._selectedLayout=this.templateOptions.layout;const u=!!this.templateOptions.layout&&this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=u?a(u):null})),i((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),i((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const l=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(l),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:l,view:a}=this,{attributionEnabled:i,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,legendEnabled:d,northArrowEnabled:m,scaleEnabled:h,scale:b,width:y}=t,w="ready"!==l.state||this._awaitingServerResponse||!p,T=this._renderTitleOrFileNameSection(),C=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.fileFormatTitle,x("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({target:e})=>{this.templateOptions.format=e.selectedItems[0].value}},l.templatesInfo?.format?.choiceList.sort().map(((e,t)=>x("calcite-combobox-item",{key:`file-format-${t}`,selected:e===this.templateOptions.format,textLabel:u(e),value:e})))))),O=x("calcite-label",{layout:"inline"},x("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.target.checked}}),e.printPreview),k=x("div",null,x("div",{class:S.formSectionContainer},x("calcite-label",null,e.template,x("div",{class:S.templateSelectContainer,onclick:()=>{this._showTemplates=!0}},x("calcite-block",{class:S.templateSelectBlock,description:this._getPageSizeLabel(p),heading:this._getTemplateLabel()}),x("calcite-icon",{class:S.templateSelectIcon,icon:v()?"chevron-left":"chevron-right",scale:"s"})))),O),$=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.dpi,x("calcite-input",{bind:this,"data-input-name":"dpi",min:1,onchange:this._handleDPIChange,tabIndex:0,type:"number",value:`${s}`}))),L=x("div",{class:this.classes(S.scaleInfoContainer,S.formSectionContainer)},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:h,"data-option-name":"scaleEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),x("div",{class:S.scaleInputContainer},x("calcite-input",{"aria-label":e.scaleLabel,"aria-valuenow":`${b}`,bind:this,class:S.scaleInput,"data-input-name":"scale",disabled:!h,onchange:this._updateInputValue,tabIndex:0,type:"number",value:`${b}`}),x("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!h,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale,tabIndex:0}))),M=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:S.advancedOptionsContainer,key:"advanced-section-for-layout"},L,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?x("div",{class:S.formSectionContainer,key:"author-info"},x("calcite-label",null,e.author,x("calcite-input",{bind:this,"data-input-name":"author",onchange:this._updateInputValue,tabIndex:0,value:o??""}))):null,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?x("div",{class:S.formSectionContainer,key:"copyright-text"},x("calcite-label",null,e.copyright,x("calcite-input",{bind:this,"data-input-name":"copyright",onchange:this._updateInputValue,tabIndex:0,value:n??""}))):null,$,this._renderCustomTextElementSection(),this.viewModel.layoutTemplateInfo?.layoutOptions?.hasLegend??1?x("div",{class:S.formSectionContainer,key:"legend-info"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:d,"data-option-name":"legendEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this.viewModel.layoutTemplateNorthArrowInfo??1?x("div",{class:S.formSectionContainer,key:"north-arrow"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:m,"data-option-name":"northArrowEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null),E=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:S.advancedOptionsContainer},L,$,x("div",{class:S.formSectionContainer},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:i,"data-option-name":"attributionEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),F=this.exportedLinks.toArray(),j=this._renderExportedLink(F),P={[S.exportSectionCentered]:!F.length},A=this._selectedTab===I.layout?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:S.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:S.panelContainer},this.viewModel.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?T:null,k,this._selectedTab===I.layout?C:null,x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,disabled:!p,heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},M))):this._selectedTab===I.mapOnly?x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:S.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:S.panelContainer},T,C,x("div",null,x("div",{class:this.classes(S.sizeContainer,S.formSectionContainer)},x("calcite-label",null,e.width,x("calcite-input",{bind:this,"data-input-name":"width",onchange:this._updateInputValue,tabIndex:0,type:"number",value:`${y}`})),x("calcite-label",null,e.height,x("calcite-input",{bind:this,"data-input-name":"height",onchange:this._updateInputValue,tabIndex:0,type:"number",value:`${c}`})),x("button",{"aria-label":e.swap,bind:this,class:this.classes(_.widgetButton,S.swapButton,g.swap),onclick:this._switchInput,tabIndex:0,type:"button"})),O),x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},E))):x("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(S.exportSection,P),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},x("div",{class:S.panelContainer},x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:S.exportedFilesContainer},0===F.length?x("div",{class:S.exportedFilesEmpty},x("calcite-icon",{icon:"file",scale:"l"}),x("div",null,x(f,{class:S.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),x("div",null,e.exportHint))):j))),B={[_.buttonDisabled]:w||!p&&!r},D=!a||"2d"!==a.type,U=x("div",{class:S.panelError},D?e.sceneViewError:e.serviceError),N=F.some((({state:e})=>"pending"===e)),V=x("div",{class:S.content,key:"panel"},x("div",null,x("ul",{bind:this,class:S.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===I.layout}`,class:S.layoutTab,"data-tab-id":I.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===I.mapOnly}`,class:S.layoutTab,"data-tab-id":I.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===I.export}`,class:S.layoutTab,"data-tab-id":I.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},N?x("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),A),this._selectedTab!==I.export?x("button",{"aria-label":e.exportDescription,bind:this,class:this.classes(S.printButton,_.button,B),disabled:w,onclick:this._handlePrintMap,tabIndex:0,type:"button"},e.export):null),R=x("calcite-flow",{key:"root-flow"},x("calcite-flow-item",{bind:this,key:"root-flow-item"},x("div",{class:S.printWidgetContainer},x("header",{class:S.headerTitle},e.export),this.error||D||!a?U:V)),this._renderChooseTemplateFlowItem()),z="initializing"===l.state,H=z?this._renderLoader():R,W={[S.panelItemsCentered]:z};return x("div",{bind:this,class:this.classes(S.base,_.widget,_.panel,W)},H)}_getPageSizeLabel(e){if(!e)return;const t=this.viewModel.getLayoutTemplateInfo(e);if(!t)return;const l=A.fromJSON(t.pageUnits.toLowerCase());return`${C(t.pageSize[0])} x ${C(t.pageSize[1])} ${o(this.messagesUnits,l,"abbr")}`}_getTemplateLabel(){const{messages:e,includeDefaultTemplates:t,templateOptions:l,viewModel:a}=this,{layout:i}=l,o=i?(t?a.defaultTemplates.find((({layoutItem:e,layout:t})=>i===e?.id||i===t)):null)??a.browseTemplates.find((({layoutItem:e})=>i===e?.id)):null;return o?.label?.replaceAll("_"," ")??e[i]??i?.replaceAll("_"," ")??e.selectTemplate}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{includeDefaultTemplates:e,messages:t,viewModel:l}=this,{defaultTemplates:a,templatesInfo:i,browseTemplates:o,portalTemplateIds:n}=l,s=p.test(this.portal?.url),r=o.length?o.toArray().sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,a)=>{const i=e.layoutItem?.id??e.layout,o=this._getPageSizeLabel(i),n=i===this.templateOptions.layout;return x("calcite-list-item",{description:o,key:`browse-template-${a}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:n,title:e.description??"",value:i},!o&&n&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`browse-template-loader-${a}`,label:"loading",scale:"s",slot:"content-end"}):null,x("calcite-action",{icon:"trash",onclick:()=>l.removePortalTemplate(e),slot:"actions-end",text:"delete"}))})):null,c=a.length&&e?a.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&n.includes(t?.id))).map(((e,l)=>{const a=e.layoutItem?.id??e.layout,i=this._getPageSizeLabel(a),o=a===this.templateOptions.layout;return x("calcite-list-item",{description:i,key:`portal-template-${a}-${o}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:a},!i&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`portal-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,d=a.length&&e?a.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&!n.includes(t?.id))).sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,l)=>{const a=e.layoutItem?.id??e.layout,i=this._getPageSizeLabel(a),o=a===this.templateOptions.layout;return x("calcite-list-item",{description:i,key:`default-template-${l}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:a},!i&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`default-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,u=!i?.layout?.choiceList.length||e&&d?.length?null:i.layout.choiceList.map((e=>({label:t[e]??e.replaceAll("_"," "),value:e}))).sort(((e,t)=>e.label>t.label?1:0)).map((({label:e,value:t},l)=>x("calcite-list-item",{description:this._getPageSizeLabel(t),key:`service-template-${l}`,label:e,selected:t===this.templateOptions.layout,value:t}))),m=(r?.length??0)+(c?.length??0)+(d?.length??0)+(u?.length??0)>15;return x("calcite-flow-item",{bind:this,closable:!1,heading:t.chooseTemplate,key:"template-flow-item",onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},x("div",{class:S.templateSelectFlowItemContainer},x("div",{class:S.templateSelectFlowItemContent},this.browseTemplateButtonOnClick?x("calcite-button",{appearance:"outline",class:S.browseTemplateButtonContainer,key:"browse-template-button",onclick:this.browseTemplateButtonOnClick},"Browse Templates"):null,x("calcite-list",{filterEnabled:m,key:"template-list",selectionMode:"single-persist",onCalciteListChange:({target:e})=>this._applyTemplate(e.selectedItems[0].value)},r?.length?x("div",{key:"my-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.myTemplates,x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta)),r):null,c?.length?x("div",{key:"org-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.organizationTemplates,s?x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta):null),c):null,r?.length||c?.length?d?.length?x("div",{key:"default-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),d):null:d,r?.length||c?.length?u?.length?x("div",{key:"service-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),u):null:u)),x("div",{class:S.templateButtonContainer},x("calcite-button",{class:S.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?x("div",{class:S.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,l]=Object.entries(e)[0];return"date"===t?null:x("calcite-label",null,t,x("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":t,value:l??"",onCalciteInputInput:this._updateInputValue}))}))):null}async _applyTemplate(e){if(this._abortController&&(this._abortController.abort(),this._abortController=null),!e)return;const t=this.viewModel.defaultTemplates.find((({layoutItem:t})=>e===t?.id))??this.viewModel.browseTemplates.find((({layoutItem:t})=>e===t?.id));if(!t)return this.templateOptions.layout=e,void(this.templateOptions.layoutItem=null);const{format:l,layoutItem:i}=t,o=i?.id??t.layout??this.templateOptions.layout;if(this.templateOptions.layout=o,!t.layoutOptions)try{this._abortController=new AbortController,await this.viewModel.fetchLayoutTemplateInfo(t,{signal:this._abortController.signal})}catch(p){return}finally{this._abortController=null}const n=t.layoutOptions?.legend??this.templateOptions.legendEnabled,s=t.layoutOptions?.northArrow??this.templateOptions.northArrowEnabled,r=o?this.viewModel.effectiveTemplateCustomTextElements[o]:null,c=r?a(r):null;this.templateOptions.set({customTextElements:c,format:l,layout:o,layoutItem:i,legendEnabled:n,northArrowEnabled:s})}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:l,fileNamePlaceHolder:a}=this.messages,i=this._selectedTab===I.layout?e:t,o=this._selectedTab===I.layout?l:a,n=this._selectedTab===I.layout?this.templateOptions.title:this.templateOptions.fileName;return x("div",{class:S.formSectionContainer,key:i},x("calcite-label",null,i,x("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===I.layout||"mapOnlyTab"===t&&this._selectedTab===I.mapOnly||"exportTab"===t&&this._selectedTab===I.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[S.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const l=t||this.messages.untitled,a=e.format.toLowerCase(),i=a.includes("png")?"png":a,o=l+i;return void 0!==this._exportedFileNameMap[o]?this._exportedFileNameMap[o]++:this._exportedFileNameMap[o]=0,new h({name:l,extension:i,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,l){e.find((e=>{const[l]=Object.entries(e)[0];return l===t}))[t]=l}_updateInputValue(e){const t=e.target,l=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:i}=this;if(a)return void this._updateCustomTextElementValue(i.customTextElements,l,t.value);let o;if("number"===t.type){if(!E(t.valueAsNumber)){const e=i[l];return void(t.value=`${e}`)}o=t.valueAsNumber}else o=t.value;i[l]=o}_handleDPIChange(e){const{templateOptions:t}=this,l=t.dpi;this._updateInputValue(e);const a=e.currentTarget.valueAsNumber,{height:i,width:o}=M(a,l,t.width,t.height);t.height=i,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),l=this._selectedTab===I.layout?t.layoutOptions?.titleText:e.fileName,a=this._createFileLink(t,l);this.exportedLinks.add(a),this.emit("submit",{link:a}),this._selectedTab=I.export,this.viewModel.print(t).then((e=>{a.set({url:e&&e.url,state:"ready"})})).catch((e=>{a.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:a}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:l}=e,a=l-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,l=t.getAttribute("data-option-name");this.templateOptions[l]=t.checked,"scaleEnabled"===l&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,l=e.map((e=>{const{error:l,url:a,state:i}=e,o=e.formattedName??"",r="error"===i,c="pending"===i,p="ready"===i;let d=a||null;d&&(d=n(d));const u=s(a,location.href);let m;m=c?t.pending:p?t.ready:t.errorMessage;const h=r?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("calcite-list-item",{"aria-label":m,class:S.exportedFile,"data-item":e,description:c?t.generatingExport:h||(u?t.ready:t.linkReady),key:o,label:o,title:h,onCalciteListItemSelect:this._handleLinkClick},c?x("calcite-loader",{class:S.exportedFileLoader,inline:!0,key:`${o}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):x("calcite-icon",{icon:j(e),key:`${o}-start-icon`,scale:"s",slot:"content-start"}),p?x("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null,c?null:x("calcite-action",{"aria-label":`${h}`,"data-item":e,icon:"x",key:`${o}-action`,onclick:this._removeLink,slot:"actions-end",text:`${h}`}))}));return x("calcite-list",{filterEnabled:e?.length>10},l)}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===I.mapOnly)this.templateOptions.layout=k,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null;else if(this._selectedTab===I.layout){const e=this._selectedLayout??(this.includeDefaultTemplates&&this.viewModel.defaultTemplates.length?null:this.viewModel.templatesInfo?.layout?.defaultValue);e?this._applyTemplate(e):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,l=e.target.getAttribute("data-tab-id");if(w(t))return this._toggleTab(l),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(l){case I.layout:this._toggleTab("ArrowLeft"===t?I.export:I.mapOnly);break;case I.mapOnly:this._toggleTab("ArrowLeft"===t?I.layout:I.export);break;case I.export:this._toggleTab("ArrowLeft"===t?I.mapOnly:I.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],B.prototype,"_showTemplates",void 0),e([r()],B.prototype,"allowedFormats",null),e([r()],B.prototype,"allowedLayouts",null),e([r()],B.prototype,"browseTemplateButtonOnClick",void 0),e([r()],B.prototype,"error",null),e([r({type:O})],B.prototype,"exportedLinks",void 0),e([r()],B.prototype,"extraParameters",null),e([r()],B.prototype,"headingLevel",void 0),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"includeDefaultTemplates",null),e([r()],B.prototype,"label",null),e([r(),T("esri/widgets/Print/t9n/Print")],B.prototype,"messages",void 0),e([r(),T("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([r(),T("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),e([r()],B.prototype,"portal",null),e([r()],B.prototype,"showPrintAreaEnabled",null),e([r()],B.prototype,"printServiceUrl",null),e([r()],B.prototype,"templateCustomTextElements",null),e([r()],B.prototype,"templateOptions",null),e([r()],B.prototype,"view",null),e([r({type:b})],B.prototype,"viewModel",void 0),B=e([c("esri.widgets.Print")],B);const D=B;export{D as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as i}from"../core/lang.js";import{watch as a}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{reArcGISOnlineDomain as p}from"../portal/support/urlUtils.js";import{getToken as d}from"../rest/utils.js";import{toJSON as u}from"../rest/support/fileFormat.js";import m from"./Widget.js";import h from"./Print/FileLink.js";import b from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{isRTL as v,isActivationKey as w}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";import{formatNumber as C}from"../intl/number.js";const O=t.ofType(h),I="MAP_ONLY";var k;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(k||(k={}));const $="esri-print",L=`${$}__advanced-options-button`,S={base:$,headerTitle:`${$}__header-title`,layoutTabList:`${$}__layout-tab-list`,layoutTab:`${$}__layout-tab`,layoutSection:`${$}__layout-section`,mapOnlySection:`${$}__map-only-section`,panelItemsCentered:`${$}__panel-items--centered`,loader:`${$}__loader`,advancedOptionsButton:L,advancedOptionsButtonContainer:`${L}-container`,advancedOptionsButtonTitle:`${L}-title`,advancedOptionsButtonIconOpened:`${L}-icon--opened`,advancedOptionsButtonIconClosed:`${L}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${L}-icon--closed-rtl`,swapButton:`${$}__swap-button`,printButton:`${$}__export-button`,templateSelectContainer:`${$}__template-select-container`,templateSelectBlock:`${$}__template-select-block`,templateSelectIcon:`${$}__template-select-icon`,formSectionContainer:`${$}__form-section-container`,formCheckboxLabel:`${$}__form-checkbox-label`,advancedOptionsSection:`${$}__advanced-options-section`,advancedOptionsContainer:`${$}__advanced-options-container`,browseTemplateButtonContainer:`${$}__browse-template-button-container`,exportedFilesContainer:`${$}__export-panel-container`,exportedFilesTitle:`${$}__export-title`,exportedFile:`${$}__exported-file`,exportedFileLink:`${$}__exported-file-link`,exportedFileLinkTitle:`${$}__exported-file-link-title`,exportedFilesEmpty:`${$}__exported-files-empty`,printWidgetContainer:`${$}__container`,content:`${$}__content`,panelContainer:`${$}__panel-container`,scaleInfoContainer:`${$}__scale-info-container`,scaleInputContainer:`${$}__scale-input-container`,scaleInput:`${$}__scale-input`,sizeContainer:`${$}__size-container`,panelError:`${$}__panel--error`,exportedFileError:`${$}__exported-file--error`,exportedFileLoader:`${$}__exported-file--loader`,exportSection:`${$}__export-section`,exportSectionCentered:`${$}__export-section--centered`,templateButtonContainer:`${$}__template-button-container`,templateDoneButton:`${$}__template-done-button`,templateSelectFlowItemContainer:`${$}__template-select-flow-item-container`,templateSelectFlowItemContent:`${$}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${$}__template-select-flow-item-list-heading`};function M(e,t,l,i){const a=l/t,o=i/t;return{width:Math.round(e*a),height:Math.round(e*o)}}function E(e){return!isNaN(e)&&e>0}function F(e){return e?.toUpperCase()===I}function j(e){const{state:t,extension:l}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return l?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}function P(e,t){return!!t&&e.some((e=>e.layoutItem?.id===t||e.layout===t))}const A=new l({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});let B=class extends m{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=k.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedLayout=null,this._abortController=null,this._showTemplates=!1,this.browseTemplateButtonOnClick=null,this.exportedLinks=new O,this.headingLevel=3,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new b,this._onInput=e=>{this._selectedTab===k.layout?this.templateOptions.title=e.target.value:this._selectedTab===k.mapOnly&&(this.templateOptions.fileName=e.target.value)},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const l=d(this.viewModel.effectivePrintServiceUrl),i=t.url,a=document.createElement("a");if(a.target="_blank",a.href=i,a.rel="noreferrer",a.download=t.formattedName??"",!l)return a.click(),void e.stopPropagation();e.preventDefault();const o=new URL(i);o.searchParams.set("token",l),a.href=o.href,a.click(),a.href=i},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format.defaultValue]),(([e,t])=>{if(t&&!e)return void(this.templateOptions.format=t);if(!e||!t||!this.viewModel.templatesInfo)return;if(this.viewModel.templatesInfo.format.choiceList.includes(e))return;const l=this.viewModel.templatesInfo.format.choiceList.find((t=>t.toUpperCase().includes(`(${e.toUpperCase()})`)));this.templateOptions.format=l??t})),a((()=>[this.templateOptions.layout,this.viewModel.templatesInfo?.layout.defaultValue]),(async([e,t])=>{if(this._selectedTab=F(e)?k.mapOnly:k.layout,this._selectedTab!==k.layout)return;const{includeDefaultTemplates:l,viewModel:a,_selectedLayout:o}=this,{portalTemplateIds:n,browseTemplates:s,templatesInfo:r}=a,c=a.defaultTemplates.filter((({layoutItem:e})=>n.includes(e?.id))),p=a.defaultTemplates.filter((({layoutItem:e})=>!n.includes(e?.id))),d=l&&p.length;if(e){(d?P(p,e):r?.layout.choiceList.includes(e))||P(c,e)||P(s,e)||(this.templateOptions.layout=null,this.templateOptions.layoutItem=null)}else{o&&((d?P(p,o):r?.layout.choiceList.includes(o))||P(c,o)||P(s,o))?await this._applyTemplate(o):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null),this.templateOptions.layout||d||!t||await this._applyTemplate(t)}this._selectedLayout=this.templateOptions.layout;const u=!!this.templateOptions.layout&&this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=u?i(u):null})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const l=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(l),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:l,view:i}=this,{attributionEnabled:a,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,legendEnabled:d,northArrowEnabled:m,scaleEnabled:h,scale:b,width:y}=t,w="ready"!==l.state||this._awaitingServerResponse||!p,T=this._renderTitleOrFileNameSection(),C=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.fileFormatTitle,x("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({target:e})=>{this.templateOptions.format=e.selectedItems[0].value}},l.templatesInfo?.format?.choiceList.sort().map(((e,t)=>x("calcite-combobox-item",{key:`file-format-${t}`,selected:e===this.templateOptions.format,textLabel:u(e),value:e})))))),O=x("calcite-label",{layout:"inline"},x("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.target.checked}}),e.printPreview),I=x("div",null,x("div",{class:S.formSectionContainer},x("calcite-label",null,e.template,x("div",{class:S.templateSelectContainer,onclick:()=>{this._showTemplates=!0}},x("calcite-block",{class:S.templateSelectBlock,description:this._getPageSizeLabel(p),heading:this._getTemplateLabel()}),x("calcite-icon",{class:S.templateSelectIcon,icon:v()?"chevron-left":"chevron-right",scale:"s"})))),O),$=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.dpi,x("calcite-input",{bind:this,"data-input-name":"dpi",min:1,tabIndex:0,type:"number",value:`${s}`,onCalciteInputInput:this._handleDPIChange}))),L=x("div",{class:this.classes(S.scaleInfoContainer,S.formSectionContainer)},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:h,"data-option-name":"scaleEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),x("div",{class:S.scaleInputContainer},x("calcite-input",{"aria-label":e.scaleLabel,"aria-valuenow":`${b}`,bind:this,class:S.scaleInput,"data-input-name":"scale",disabled:!h,tabIndex:0,type:"number",value:`${b}`,onCalciteInputInput:this._updateInputValue}),x("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!h,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale,tabIndex:0}))),M=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:S.advancedOptionsContainer,key:"advanced-section-for-layout"},L,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?x("div",{class:S.formSectionContainer,key:"author-info"},x("calcite-label",null,e.author,x("calcite-input",{bind:this,"data-input-name":"author",tabIndex:0,value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?x("div",{class:S.formSectionContainer,key:"copyright-text"},x("calcite-label",null,e.copyright,x("calcite-input",{bind:this,"data-input-name":"copyright",tabIndex:0,value:n??"",onCalciteInputInput:this._updateInputValue}))):null,$,this._renderCustomTextElementSection(),this.viewModel.layoutTemplateInfo?.layoutOptions?.hasLegend??1?x("div",{class:S.formSectionContainer,key:"legend-info"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:d,"data-option-name":"legendEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this.viewModel.layoutTemplateNorthArrowInfo??1?x("div",{class:S.formSectionContainer,key:"north-arrow"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:m,"data-option-name":"northArrowEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null),E=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:S.advancedOptionsContainer},L,$,x("div",{class:S.formSectionContainer},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:a,"data-option-name":"attributionEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),F=this.exportedLinks.toArray(),j=this._renderExportedLink(F),P={[S.exportSectionCentered]:!F.length},A=this._selectedTab===k.layout?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:S.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:S.panelContainer},this.viewModel.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?T:null,I,this._selectedTab===k.layout?C:null,x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,disabled:!p,heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},M))):this._selectedTab===k.mapOnly?x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:S.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:S.panelContainer},T,C,x("div",null,x("div",{class:this.classes(S.sizeContainer,S.formSectionContainer)},x("calcite-label",null,e.width,x("calcite-input",{bind:this,"data-input-name":"width",tabIndex:0,type:"number",value:`${y}`,onCalciteInputInput:this._updateInputValue})),x("calcite-label",null,e.height,x("calcite-input",{bind:this,"data-input-name":"height",tabIndex:0,type:"number",value:`${c}`,onCalciteInputInput:this._updateInputValue})),x("button",{"aria-label":e.swap,bind:this,class:this.classes(_.widgetButton,S.swapButton,g.swap),onclick:this._switchInput,tabIndex:0,type:"button"})),O),x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},E))):x("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(S.exportSection,P),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},x("div",{class:S.panelContainer},x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:S.exportedFilesContainer},0===F.length?x("div",{class:S.exportedFilesEmpty},x("calcite-icon",{icon:"file",scale:"l"}),x("div",null,x(f,{class:S.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),x("div",null,e.exportHint))):j))),B={[_.buttonDisabled]:w||!p&&!r},D=!i||"2d"!==i.type,U=x("div",{class:S.panelError},D?e.sceneViewError:e.serviceError),N=F.some((({state:e})=>"pending"===e)),V=x("div",{class:S.content,key:"panel"},x("div",null,x("ul",{bind:this,class:S.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.layout}`,class:S.layoutTab,"data-tab-id":k.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.mapOnly}`,class:S.layoutTab,"data-tab-id":k.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.export}`,class:S.layoutTab,"data-tab-id":k.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},N?x("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),A),this._selectedTab!==k.export?x("button",{"aria-label":e.exportDescription,bind:this,class:this.classes(S.printButton,_.button,B),disabled:w,onclick:this._handlePrintMap,tabIndex:0,type:"button"},e.export):null),R=x("calcite-flow",{key:"root-flow"},x("calcite-flow-item",{bind:this,key:"root-flow-item"},x("div",{class:S.printWidgetContainer},x("header",{class:S.headerTitle},e.export),this.error||D||!i?U:V)),this._renderChooseTemplateFlowItem()),z="initializing"===l.state,H=z?this._renderLoader():R,W={[S.panelItemsCentered]:z};return x("div",{bind:this,class:this.classes(S.base,_.widget,_.panel,W)},H)}_getPageSizeLabel(e){if(!e)return;const t=this.viewModel.getLayoutTemplateInfo(e);if(!t)return;const l=A.fromJSON(t.pageUnits.toLowerCase());return`${C(t.pageSize[0])} x ${C(t.pageSize[1])} ${o(this.messagesUnits,l,"abbr")}`}_getTemplateLabel(){const{messages:e,includeDefaultTemplates:t,templateOptions:l,viewModel:i}=this,{layout:a}=l,o=a?(t?i.defaultTemplates.find((({layoutItem:e,layout:t})=>a===e?.id||a===t)):null)??i.browseTemplates.find((({layoutItem:e})=>a===e?.id)):null;return o?.label?.replaceAll("_"," ")??e[a]??a?.replaceAll("_"," ")??e.selectTemplate}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{includeDefaultTemplates:e,messages:t,viewModel:l}=this,{defaultTemplates:i,templatesInfo:a,browseTemplates:o,portalTemplateIds:n}=l,s=p.test(this.portal?.url),r=o.length?o.toArray().sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,i)=>{const a=e.layoutItem?.id??e.layout,o=this._getPageSizeLabel(a),n=a===this.templateOptions.layout;return x("calcite-list-item",{description:o,key:`browse-template-${i}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:n,title:e.description??"",value:a},!o&&n&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`browse-template-loader-${i}`,label:"loading",scale:"s",slot:"content-end"}):null,x("calcite-action",{icon:"trash",onclick:()=>l.removePortalTemplate(e),slot:"actions-end",text:"delete"}))})):null,c=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&n.includes(t?.id))).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`portal-template-${i}-${o}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`portal-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,d=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&!n.includes(t?.id))).sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`default-template-${l}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`default-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,u=!a?.layout?.choiceList.length||e&&d?.length?null:a.layout.choiceList.map((e=>({label:t[e]??e.replaceAll("_"," "),value:e}))).sort(((e,t)=>e.label>t.label?1:0)).map((({label:e,value:t},l)=>x("calcite-list-item",{description:this._getPageSizeLabel(t),key:`service-template-${l}`,label:e,selected:t===this.templateOptions.layout,value:t}))),m=(r?.length??0)+(c?.length??0)+(d?.length??0)+(u?.length??0)>15;return x("calcite-flow-item",{bind:this,closable:!1,heading:t.chooseTemplate,key:"template-flow-item",onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},x("div",{class:S.templateSelectFlowItemContainer},x("div",{class:S.templateSelectFlowItemContent},this.browseTemplateButtonOnClick?x("calcite-button",{appearance:"outline",class:S.browseTemplateButtonContainer,key:"browse-template-button",onclick:this.browseTemplateButtonOnClick},"Browse Templates"):null,x("calcite-list",{filterEnabled:m,key:"template-list",selectionMode:"single-persist",onCalciteListChange:({target:e})=>this._applyTemplate(e.selectedItems[0].value)},r?.length?x("div",{key:"my-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.myTemplates,x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta)),r):null,c?.length?x("div",{key:"org-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.organizationTemplates,s?x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta):null),c):null,r?.length||c?.length?d?.length?x("div",{key:"default-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),d):null:d,r?.length||c?.length?u?.length?x("div",{key:"service-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),u):null:u)),x("div",{class:S.templateButtonContainer},x("calcite-button",{class:S.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?x("div",{class:S.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[l,i]=Object.entries(e)[0];return"date"===l?null:x("calcite-label",{key:`custom-text-elements-${l}-${t}`},l,x("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":l,value:i??"",onCalciteInputInput:this._updateInputValue}))}))):null}async _applyTemplate(e){if(this._abortController&&(this._abortController.abort(),this._abortController=null),!e)return;const t=this.viewModel.defaultTemplates.find((({layoutItem:t})=>e===t?.id))??this.viewModel.browseTemplates.find((({layoutItem:t})=>e===t?.id));if(!t)return this.templateOptions.layout=e,void(this.templateOptions.layoutItem=null);const{format:l,layoutItem:a}=t,o=a?.id??t.layout??this.templateOptions.layout;if(this.templateOptions.layout=o,!t.layoutOptions)try{this._abortController=new AbortController,await this.viewModel.fetchLayoutTemplateInfo(t,{signal:this._abortController.signal})}catch(p){return}finally{this._abortController=null}const n=t.layoutOptions?.legend??this.templateOptions.legendEnabled,s=t.layoutOptions?.northArrow??this.templateOptions.northArrowEnabled,r=o?this.viewModel.effectiveTemplateCustomTextElements[o]:null,c=r?i(r):null;this.templateOptions.set({customTextElements:c,format:l,layout:o,layoutItem:a,legendEnabled:n,northArrowEnabled:s})}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:l,fileNamePlaceHolder:i}=this.messages,a=this._selectedTab===k.layout?e:t,o=this._selectedTab===k.layout?l:i,n=this._selectedTab===k.layout?this.templateOptions.title:this.templateOptions.fileName;return x("div",{class:S.formSectionContainer,key:a},x("calcite-label",null,a,x("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===k.layout||"mapOnlyTab"===t&&this._selectedTab===k.mapOnly||"exportTab"===t&&this._selectedTab===k.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[S.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const l=t||this.messages.untitled,i=e.format.toLowerCase(),a=i.includes("png")?"png":i,o=l+a;return void 0!==this._exportedFileNameMap[o]?this._exportedFileNameMap[o]++:this._exportedFileNameMap[o]=0,new h({name:l,extension:a,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,l){e.find((e=>{const[l]=Object.entries(e)[0];return l===t}))[t]=l}_updateInputValue(e){const t=e.target,l=t.getAttribute("data-input-name"),i=!!t["data-input-custom"],{templateOptions:a}=this;if(i)return void this._updateCustomTextElementValue(a.customTextElements,l,t.value);let o;if("number"===t.type){const e=Number(t.value);if(!E(e)){const e=a[l];return void(t.value=`${e}`)}o=e}else o=t.value;a[l]=o}_handleDPIChange(e){const{templateOptions:t}=this,l=t.dpi;this._updateInputValue(e);const i=t.dpi,{height:a,width:o}=M(i,l,t.width,t.height);t.height=a,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),l=this._selectedTab===k.layout?t.layoutOptions?.titleText:e.fileName,i=this._createFileLink(t,l);this.exportedLinks.add(i),this.emit("submit",{link:i}),this._selectedTab=k.export,this.viewModel.print(t).then((e=>{i.set({url:e&&e.url,state:"ready"})})).catch((e=>{i.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:i}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:l}=e,i=l-t;i>0&&(e.scrollTop=i)}_toggleInputValue(e){const t=e.target,l=t.getAttribute("data-option-name");this.templateOptions[l]=t.checked,"scaleEnabled"===l&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,l=e.map((e=>{const{error:l,url:i,state:a}=e,o=e.formattedName??"",r="error"===a,c="pending"===a,p="ready"===a;let d=i||null;d&&(d=n(d));const u=s(i,location.href);let m;m=c?t.pending:p?t.ready:t.errorMessage;const h=r?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("calcite-list-item",{"aria-label":m,class:S.exportedFile,"data-item":e,description:c?t.generatingExport:h||(u?t.ready:t.linkReady),key:o,label:o,title:h,onCalciteListItemSelect:this._handleLinkClick},c?x("calcite-loader",{class:S.exportedFileLoader,inline:!0,key:`${o}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):x("calcite-icon",{icon:j(e),key:`${o}-start-icon`,scale:"s",slot:"content-start"}),p?x("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null,c?null:x("calcite-action",{"aria-label":`${h}`,"data-item":e,icon:"x",key:`${o}-action`,onclick:this._removeLink,slot:"actions-end",text:`${h}`}))}));return x("calcite-list",{filterEnabled:e?.length>10},l)}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===k.mapOnly)this.templateOptions.layout=I,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null;else if(this._selectedTab===k.layout){const e=this._selectedLayout??(this.includeDefaultTemplates&&this.viewModel.defaultTemplates.length?null:this.viewModel.templatesInfo?.layout?.defaultValue);e?this._applyTemplate(e):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,l=e.target.getAttribute("data-tab-id");if(w(t))return this._toggleTab(l),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(l){case k.layout:this._toggleTab("ArrowLeft"===t?k.export:k.mapOnly);break;case k.mapOnly:this._toggleTab("ArrowLeft"===t?k.layout:k.export);break;case k.export:this._toggleTab("ArrowLeft"===t?k.mapOnly:k.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],B.prototype,"_showTemplates",void 0),e([r()],B.prototype,"allowedFormats",null),e([r()],B.prototype,"allowedLayouts",null),e([r()],B.prototype,"browseTemplateButtonOnClick",void 0),e([r()],B.prototype,"error",null),e([r({type:O})],B.prototype,"exportedLinks",void 0),e([r()],B.prototype,"extraParameters",null),e([r()],B.prototype,"headingLevel",void 0),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"includeDefaultTemplates",null),e([r()],B.prototype,"label",null),e([r(),T("esri/widgets/Print/t9n/Print")],B.prototype,"messages",void 0),e([r(),T("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([r(),T("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),e([r()],B.prototype,"portal",null),e([r()],B.prototype,"showPrintAreaEnabled",null),e([r()],B.prototype,"printServiceUrl",null),e([r()],B.prototype,"templateCustomTextElements",null),e([r()],B.prototype,"templateOptions",null),e([r()],B.prototype,"view",null),e([r({type:b})],B.prototype,"viewModel",void 0),B=e([c("esri.widgets.Print")],B);const D=B;export{D as default};
|