System.register(["jimu-core","jimu-arcgis","jimu-ui","esri/geometry/Point","esri/rest/print","esri/rest/support/PrintParameters","esri/rest/support/PrintTemplate"],(function(e,t){var r={},a={},n={},o={},c={},l={},s={};return{setters:[function(e){r.React=e.React,r.ReactDOM=e.ReactDOM},function(e){a.JimuMapViewComponent=e.JimuMapViewComponent},function(e){n.Button=e.Button,n.Card=e.Card,n.CardBody=e.CardBody,n.CardFooter=e.CardFooter,n.CardHeader=e.CardHeader,n.Label=e.Label,n.Loading=e.Loading,n.Option=e.Option,n.Select=e.Select,n.TextInput=e.TextInput,n.WidgetPlaceholder=e.WidgetPlaceholder},function(e){o.default=e.default},function(e){c.default=e.default},function(e){l.default=e.default},function(e){s.default=e.default}],execute:function(){e((()=>{var e={72:e=>{e.exports=''},294:e=>{"use strict";e.exports=o},191:e=>{"use strict";e.exports=c},641:e=>{"use strict";e.exports=l},347:e=>{"use strict";e.exports=s},826:e=>{"use strict";e.exports=a},891:e=>{"use strict";e.exports=r},726:e=>{"use strict";e.exports=n}},t={};function i(r){var a=t[r];if(void 0!==a)return a.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="";var u={};return i.p=window.jimuConfig.baseUrl,(()=>{"use strict";i.r(u),i.d(u,{__set_webpack_public_path__:()=>R,default:()=>x});var e=i(891),t=i(826),r=i(726),a=i(294),n=i(191),o=i(641),c=i(347);const l={_widgetLabel:"Print",heading:"PDF drucken",titleLabel:"Titel",scaleLabel:"Maßstab",formatLabel:"Format","A4 Hochformat":"A4 Hochformat","A4 Hochformat mit Legende":"A4 Hochformat mit Legende","A4 Querformat":"A4 Querformat","A4 Querformat mit Legende":"A4 Querformat mit Legende","A3 Hochformat":"A3 Hochformat","A3 Hochformat mit Legende":"A3 Hochformat mit Legende","A3 Querformat":"A3 Querformat","A3 Querformat mit Legende":"A3 Querformat mit Legende",buttonPrint:"Drucken",buttonCancel:"Abbrechen"},{useState:s,useRef:d,useEffect:m}=e.React,f=[1e4,25e3,5e4,1e5,2e5,5e5,1e6,35e5],p={"A4 Hochformat":[190,265],"A4 Hochformat mit Legende":[190,225],"A4 Querformat":[277,178],"A4 Querformat mit Legende":[277,140],"A3 Hochformat":[277,385],"A3 Hochformat mit Legende":[277,335],"A3 Querformat":[400,264],"A3 Querformat mit Legende":[400,215]};function g({view:t,intl:a,updatePreview:i}){const[u,g]=s("GeoSphere Austria"),[h,b]=s(Object.keys(p)[0]),[v,y]=s(1e4),[M,w]=s(!1),x=d(),R=d();x.current=v,R.current=h;const L=d(null);function C(e){fetch(e.url).then((e=>e.blob())).then((e=>{const t=document.createElement("a");t.setAttribute("href",URL.createObjectURL(e)),t.setAttribute("download","GeoSphere_Maps_Print.pdf"),document.body.appendChild(t),t.click(),document.body.removeChild(t),w(!1)}))}function A(e){"AbortError"===e.name||console.error("Error: ",e)}return m((()=>{const e=t.watch("extent",(()=>{x.current&&R.current&&i(x.current,R.current)}));return()=>{e.remove()}}),[]),e.React.createElement(e.React.Fragment,null,e.React.createElement(r.Card,{className:"border-right-0 border-left-0 border-bottom-0"},e.React.createElement(r.CardHeader,null,a.formatMessage({id:"heading",defaultMessage:l.heading})),e.React.createElement(r.CardBody,null,e.React.createElement("div",null,M&&e.React.createElement(r.Loading,{type:"BAR"})),e.React.createElement(r.Label,{className:"w-100"},a.formatMessage({id:"titleLabel",defaultMessage:l.titleLabel}),e.React.createElement(r.TextInput,{type:"text",onChange:e=>{g(e.target.value)},placeholder:a.formatMessage({id:"titleLabel",defaultMessage:l.titleLabel})})),e.React.createElement(r.Label,{className:"w-100"},a.formatMessage({id:"formatLabel",defaultMessage:l.formatLabel}),e.React.createElement(r.Select,{onChange:e=>{const t=e.target.value;b(t),i(v,t)},value:h},Object.keys(p).map((t=>e.React.createElement(r.Option,{key:`${t}`,value:`${t}`},a.formatMessage({id:t,defaultMessage:l[t]})))))),e.React.createElement(r.Label,{className:"w-100"},a.formatMessage({id:"scaleLabel",defaultMessage:l.scaleLabel}),e.React.createElement(r.Select,{onChange:e=>{const t=parseInt(e.target.value);y(t),i(t,h)},value:v},f.map((t=>{var a;return e.React.createElement(r.Option,{value:`${t}`,key:t},`1:${null===(a=t.toString().match(/(\d+?)(?=(\d{3})+(?!\d)|$)/g))||void 0===a?void 0:a.join(".")}`)})))))),e.React.createElement(r.Card,{className:"border-right-0 border-left-0 border-top-0"},e.React.createElement(r.CardFooter,{className:"d-flex justify-content-center"},M?e.React.createElement(r.Button,{type:"primary",onClick:()=>{L.current&&(L.current.abort(),w(!1))}},a.formatMessage({id:"CalciteCancel",defaultMessage:l.buttonCancel})):e.React.createElement(r.Button,{type:"primary",onClick:()=>{w(!0);const e=new c.default({layout:h,format:"pdf",layoutOptions:{titleText:u,scalebarUnit:"Kilometers",customTextElements:[]},exportOptions:{dpi:98},scalePreserved:!0,outScale:v}),r=new o.default({view:t,template:e});L.current=new AbortController,n.default.execute("https://gis.geosphere.at/maps/rest/services/tools/printing/GPServer/Export%20Web%20Map",r,{signal:L.current.signal}).then(C).catch(A)}},a.formatMessage({id:"buttonPrint",defaultMessage:l.buttonPrint})))))}var h=i(72),b=i.n(h);const{useState:v,useRef:y,useEffect:M}=e.React;function w(e,t,r){return er?r:e}const x=n=>{const[o,c]=v(null),[l,s]=v(!1),i=y(null),u=y(null);M((()=>{s(!0);const e=i.current.closest(".panel-container"),t=new MutationObserver((e=>{for(const t of e)"attributes"===t.type&&(s(!t.target.classList.contains("d-none")),t.target.classList.contains("d-none")?u.current.style.display="none":u.current.style.display="block")}));e&&t.observe(e,{attributeFilter:["class"]})}),[]),M((()=>{if(o){const t=document.querySelector(".esri-view-root"),r=document.createElement("div");t.append(r);const[a,n]=d(1e4,"A4 Hochformat"),[o,c,l,s]=m(a,n),i={position:"absolute",top:c+"px",left:o+"px",width:l+"px",height:s+"px",backgroundColor:"#fca5a5",opacity:"50%",border:"2px solid #db2525",pointerEvents:"none"},f=()=>e.React.createElement("div",{ref:u,style:i});return e.ReactDOM.render(e.React.createElement(f,null),r),()=>{for(;r.firstChild;)r.removeChild(r.firstChild)}}}),[o]);const d=(e,t)=>[p[t][0]*e/1e3,p[t][1]*e/1e3],m=(e,t)=>{const r=o.center,n=r.x-e/2,c=r.x+e/2,l=r.y-t/2,s=r.y+t/2,i=o.toScreen(new a.default({x:n,y:s,spatialReference:{wkid:o.spatialReference.wkid}})),u=o.toScreen(new a.default({x:c,y:l,spatialReference:{wkid:o.spatialReference.wkid}}));return[w(Math.round(i.x),0,o.width),w(Math.round(i.y),0,o.height),w(Math.round(u.x-i.x),0,o.width),w(Math.round(u.y-i.y),0,o.height)]};return e.React.createElement("div",{className:"widget-print",ref:i},n.useMapWidgetIds&&0===n.useMapWidgetIds.length&&e.React.createElement(r.WidgetPlaceholder,{icon:b(),widgetId:n.id,message:"Please select a map widget!"}),n.useMapWidgetIds&&1===n.useMapWidgetIds.length&&e.React.createElement(t.JimuMapViewComponent,{useMapWidgetId:n.useMapWidgetIds[0],onActiveViewChange:e=>{c(e.view)}}),o&&n.intl&&e.React.createElement(g,{view:o,intl:n.intl,updatePreview:(e,t)=>{if(l){const[r,a]=d(e,t);((e,t)=>{const[r,a,n,o]=m(e,t);u&&u.current&&(u.current.style.display="block",u.current.style.left=r+"px",u.current.style.top=a+"px",u.current.style.width=n+"px",u.current.style.height=o+"px")})(r,a)}}}))};function R(e){i.p=e}})(),u})())}}}));