import{B as s,C as d,L as S,N as _,O as L,P as z,R as O,ba as P,ca as T,da as C,ea as G,fa as f,ga as p,na as M,u as k}from"./chunk-MNVOJIXC.js";import{Aa as c,Id as b,Qd as v,Qg as w,Yg as y,_a as g,ag as m,bb as h,dd as x,ya as u}from"./chunk-SKPDQO4E.js";var E=`<div class="d-flex flex-column rnd-1 bg-white">
    <div class="d-flex align-items-center mb-2">
        <div class="d-flex flex-column align-items-center">
            <span class="text-base">{{'MAP.GEOLOCATION'|translate}}</span>
            <span class="text-xs text-italic color-error" *ngIf="ignoreReliable==false && !location.isLocationReliable">
                <cds-icon shape="exclamation-triangle cds-icon-12" solid></cds-icon>
                {{'MAP.LOCATION_UNVERIFIED'|translate}}
            </span>
        </div>
        <div class="d-flex align-items-center ms-auto column-gap-1">
            <div (click)="toggleFullScreen(false)">
                <cds-icon shape="resize" class="cds-icon-18 cursor-pointer color-primary" nz-tooltip
                    nzTooltipTitle="{{'BUTTON.EXPAND'| translate}}"></cds-icon>
            </div>
            <div *ngIf="googleMapsUrl">
                <a href="{{googleMapsUrl}}" target="_blank">
                    <cds-icon shape="google_maps" class="cds-icon-18 cursor-pointer color-primary" nz-tooltip
                        nzTooltipTitle="{{'MAP.LOCATION_SHOW_GOOGLE_MAPS'| translate}}"></cds-icon>
                </a>
            </div>
        </div>
    </div>
    <div class="map-container" [attr.fullscreen]="fullScreen" [ngClass]="{'opacity-0': !visibleMap}"
        (click)="toggleFullScreen(true)">
        <div class="map-container-absolute" click-stop-propagation>
            <div id="{{mapId}}" class="map-dom" click-stop-propagation></div>
        </div>
        <div class="map-container-button cursor-pointer" *ngIf="fullScreen" nz-tooltip
            nzTooltipTitle="{{'BUTTON.COLLAPSE'| translate}}">
            <cds-icon shape="shrink" class="cds-icon-20"></cds-icon>
        </div>
    </div>
</div>`;var I=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}.map-container[fullscreen=true]{position:fixed;margin:auto;inset:0;background-color:#0009;padding:48px;z-index:200}.map-container[fullscreen=true] .map-container-button{position:absolute;top:30px;right:30px;padding:.5rem;background-color:#fff;color:#0a2a5a;border:1px solid #0a2a5a;border-radius:.4rem}.map-container[fullscreen=true] .map-container-button:hover{background-color:#0369a1;color:#fff}.map-container[fullscreen=true] .map-container-absolute{position:absolute;inset:48px;margin:auto;background-color:#f3f4f6;border-radius:.8rem;padding:1rem}.map-container[fullscreen=true] .map-dom{width:calc(100% - 2rem)!important;height:calc(100% - 2rem)!important;position:absolute}.map-container[fullscreen=true] .map-dom::ng-deep .ol-attribution{font-size:.2rem!important}.map-container[fullscreen=false]{position:relative;height:180px;min-width:240px}.map-container[fullscreen=false] .map-container-absolute{position:absolute;height:180px;left:0;right:0}.map-container[fullscreen=false] .map-dom{width:100%!important;height:100%;position:absolute;border:1px solid #0a2a5a}.map-container[fullscreen=false] .map-dom::ng-deep .ol-attribution{font-size:.2rem!important}
`;var U=function(l,e,o,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,o):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(l,e,o,i);else for(var r=l.length-1;r>=0;r--)(a=l[r])&&(t=(n<3?a(t):n>3?a(e,o,t):a(e,o))||t);return n>3&&t&&Object.defineProperty(e,o,t),t},j=class{location;zoom=16;ignoreReliable=!1;visibleMap=!1;googleMapsUrl;mapId;map;marker;circleGeom;fullScreen=!1;constructor(){this.mapId="map-open-layer-map-"+b()}ngAfterViewInit(){this.location.radius||(this.location.radius=20),this.createMap()}createMap(){var e=[],o=[32.853847589157375,39.92079225552399];if(this.location.type)switch(this.location.type){case m.Circle:o=[this.location.longitude,this.location.latitude];var i=s([this.location.longitude,this.location.latitude]);this.circleGeom=new f(i,this.location.radius),e=[new p(this.circleGeom)];break;case m.Polygon:let t=[];this.location.points.forEach(r=>{let N=[r.longitude,r.latitude];t.push(d(N,"EPSG:4326","EPSG:3857"))}),e=[new p(new S([t]))];let a=e[0].getGeometry().getExtent();o=d(k(a),"EPSG:3857","EPSG:4326");break}else{o=[this.location.longitude,this.location.latitude];var i=s([this.location.longitude,this.location.latitude]);this.circleGeom=new f(i,this.location.radius?this.location.radius:20),e=[new p(this.circleGeom)],this.googleMapsUrl=w.getLocationGoogleMapsUrl(this.location)}this.map=new P({target:this.mapId,layers:[new C({source:new T})],view:new _({center:s(o),zoom:this.zoom})});var n=new G({source:new M({features:e}),style:[new O({stroke:new z({color:"rgba(0, 0, 255)",width:1}),fill:new L({color:"rgba(0, 0, 255, 0.2)"})})]});this.map.addLayer(n),setTimeout(()=>{this.map.updateSize(),setTimeout(()=>{this.visibleMap=!0},300)},200)}toggleFullScreen(e){e&&!this.fullScreen||(this.fullScreen=!this.fullScreen,setTimeout(()=>{this.map.updateSize()},200))}ngOnInit(){}static ctorParameters=()=>[];static propDecorators={location:[{type:c}],zoom:[{type:c}],ignoreReliable:[{type:c}]}};j=U([u({selector:"armon-map-open-layers",template:E,standalone:!0,imports:[h,g,y,v,x],styles:[I]})],j);export{j as a};
