ol-wfst 4.1.0 → 4.2.0
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/README.md +801 -794
- package/dist/css/ol-wfst.bootstrap5.css +212 -23
- package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
- package/dist/ol-wfst.js +3468 -2595
- package/dist/ol-wfst.js.map +1 -1
- package/dist/ol-wfst.min.js +6 -1
- package/dist/ol-wfst.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/lib/@enums.d.ts +16 -16
- package/lib/@types.d.ts +200 -200
- package/lib/Geoserver.d.ts +274 -267
- package/lib/Geoserver.d.ts.map +1 -1
- package/lib/WfsLayer.d.ts +52 -52
- package/lib/WfsLayer.d.ts.map +1 -1
- package/lib/WmsLayer.d.ts +68 -61
- package/lib/WmsLayer.d.ts.map +1 -1
- package/lib/defaults.d.ts +3 -3
- package/lib/index-umd.d.ts +3 -0
- package/lib/index-umd.d.ts.map +1 -0
- package/lib/modules/EditControlChanges.d.ts +17 -17
- package/lib/modules/EditFieldsModal.d.ts +18 -18
- package/lib/modules/EditOverlay.d.ts +7 -7
- package/lib/modules/LayersControl.d.ts +33 -33
- package/lib/modules/Uploads.d.ts +49 -49
- package/lib/modules/base/BaseLayer.d.ts +61 -61
- package/lib/modules/base/WfsSource.d.ts +47 -47
- package/lib/modules/base/WmsSource.d.ts +46 -46
- package/lib/modules/editLayer.d.ts +3 -3
- package/lib/modules/errors.d.ts +11 -11
- package/lib/modules/helpers.d.ts +6 -6
- package/lib/modules/i18n/en.d.ts +2 -2
- package/lib/modules/i18n/es.d.ts +2 -2
- package/lib/modules/i18n/index.d.ts +14 -14
- package/lib/modules/i18n/zh.d.ts +2 -2
- package/lib/modules/loading.d.ts +2 -2
- package/lib/modules/state.d.ts +21 -21
- package/lib/modules/styleFunction.d.ts +12 -12
- package/lib/myPragma.d.ts +1 -1
- package/lib/ol-wfst.d.ts +336 -336
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/ol-wfst.js +2642 -2560
- package/lib/ol-wfst.js.map +1 -1
- package/lib/style/css/ol-wfst.bootstrap5.css +212 -23
- package/lib/style/scss/-ol-wfst.bootstrap5.scss +3 -0
- package/lib/style/scss/ol-wfst.scss +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +13 -12
- package/dist/@enums.d.ts +0 -17
- package/dist/@enums.d.ts.map +0 -1
- package/dist/@types.d.ts +0 -201
- package/dist/@types.d.ts.map +0 -1
- package/dist/Geoserver.d.ts +0 -268
- package/dist/Geoserver.d.ts.map +0 -1
- package/dist/WfsLayer.d.ts +0 -53
- package/dist/WfsLayer.d.ts.map +0 -1
- package/dist/WmsLayer.d.ts +0 -62
- package/dist/WmsLayer.d.ts.map +0 -1
- package/dist/defaults.d.ts +0 -4
- package/dist/defaults.d.ts.map +0 -1
- package/dist/modules/EditControlChanges.d.ts +0 -18
- package/dist/modules/EditControlChanges.d.ts.map +0 -1
- package/dist/modules/EditFieldsModal.d.ts +0 -19
- package/dist/modules/EditFieldsModal.d.ts.map +0 -1
- package/dist/modules/EditOverlay.d.ts +0 -8
- package/dist/modules/EditOverlay.d.ts.map +0 -1
- package/dist/modules/LayersControl.d.ts +0 -34
- package/dist/modules/LayersControl.d.ts.map +0 -1
- package/dist/modules/Uploads.d.ts +0 -50
- package/dist/modules/Uploads.d.ts.map +0 -1
- package/dist/modules/base/BaseLayer.d.ts +0 -62
- package/dist/modules/base/BaseLayer.d.ts.map +0 -1
- package/dist/modules/base/WfsSource.d.ts +0 -48
- package/dist/modules/base/WfsSource.d.ts.map +0 -1
- package/dist/modules/base/WmsSource.d.ts +0 -47
- package/dist/modules/base/WmsSource.d.ts.map +0 -1
- package/dist/modules/editLayer.d.ts +0 -4
- package/dist/modules/editLayer.d.ts.map +0 -1
- package/dist/modules/errors.d.ts +0 -12
- package/dist/modules/errors.d.ts.map +0 -1
- package/dist/modules/helpers.d.ts +0 -7
- package/dist/modules/helpers.d.ts.map +0 -1
- package/dist/modules/i18n/en.d.ts +0 -3
- package/dist/modules/i18n/en.d.ts.map +0 -1
- package/dist/modules/i18n/es.d.ts +0 -3
- package/dist/modules/i18n/es.d.ts.map +0 -1
- package/dist/modules/i18n/index.d.ts +0 -15
- package/dist/modules/i18n/index.d.ts.map +0 -1
- package/dist/modules/i18n/zh.d.ts +0 -3
- package/dist/modules/i18n/zh.d.ts.map +0 -1
- package/dist/modules/loading.d.ts +0 -3
- package/dist/modules/loading.d.ts.map +0 -1
- package/dist/modules/state.d.ts +0 -22
- package/dist/modules/state.d.ts.map +0 -1
- package/dist/modules/styleFunction.d.ts +0 -13
- package/dist/modules/styleFunction.d.ts.map +0 -1
- package/dist/myPragma.d.ts +0 -2
- package/dist/myPragma.d.ts.map +0 -1
- package/dist/ol-wfst.d.ts +0 -337
- package/dist/ol-wfst.d.ts.map +0 -1
package/dist/ol-wfst.min.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/style/Circle.js"),require("ol/style/Fill.js"),require("ol/style/Stroke.js"),require("ol/style/Style.js"),require("ol/control/Control.js"),require("ol/interaction/Draw.js"),require("ol/interaction/Modify.js"),require("ol/interaction/Select.js"),require("ol/interaction/Snap.js"),require("ol/Collection.js"),require("ol/events/Event.js"),require("ol/events/condition.js"),require("ol/Observable.js"),require("ol/layer/Vector.js"),require("ol/layer/Base.js"),require("ol/format/GeoJSON.js"),require("ol/source/Vector.js"),require("ol/proj.js"),require("ol/loadingstrategy.js"),require("ol/layer/Tile.js"),require("ol/source/TileWMS.js"),require("ol/geom.js"),require("ol/format/KML.js"),require("ol/format/WFS.js"),require("ol/style.js"),require("ol/Object.js"),require("ol/geom/Circle.js"),require("ol/geom/GeometryCollection.js"),require("ol/Feature.js"),require("ol/geom/Polygon.js"),require("ol/extent.js"),require("ol/Overlay.js")):"function"==typeof define&&define.amd?define(["ol/style/Circle.js","ol/style/Fill.js","ol/style/Stroke.js","ol/style/Style.js","ol/control/Control.js","ol/interaction/Draw.js","ol/interaction/Modify.js","ol/interaction/Select.js","ol/interaction/Snap.js","ol/Collection.js","ol/events/Event.js","ol/events/condition.js","ol/Observable.js","ol/layer/Vector.js","ol/layer/Base.js","ol/format/GeoJSON.js","ol/source/Vector.js","ol/proj.js","ol/loadingstrategy.js","ol/layer/Tile.js","ol/source/TileWMS.js","ol/geom.js","ol/format/KML.js","ol/format/WFS.js","ol/style.js","ol/Object.js","ol/geom/Circle.js","ol/geom/GeometryCollection.js","ol/Feature.js","ol/geom/Polygon.js","ol/extent.js","ol/Overlay.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.style.Circle,e.ol.style.Fill,e.ol.style.Stroke,e.ol.style.Style,e.ol.control.Control,e.ol.interaction.Draw,e.ol.interaction.Modify,e.ol.interaction.Select,e.ol.interaction.Snap,e.ol.Collection,e.ol.events.Event,e.ol.events.condition,e.ol.Observable,e.ol.layer.Vector,e.ol.layer.Base,e.ol.format.GeoJSON,e.ol.source.Vector,e.ol.proj,e.ol.loadingstrategy,e.ol.layer.Tile,e.ol.source.TileWMS,e.ol.geom,e.ol.format.KML,e.ol.format.WFS,e.ol.style,e.ol.Object,e.ol.geom.Circle,e.ol.geom.GeometryCollection,e.ol.Feature,e.ol.geom.Polygon,e.ol.extent,e.ol.Overlay)}(this,(function(e,t,o,s,i,r,n,a,l,c,d,h,u,p,m,g,f,v,y,_,b,w,E,S,C,F,L,T,M,k,j,A){"use strict";function O(){}function N(){N.init.call(this)}function x(e){return void 0===e._maxListeners?N.defaultMaxListeners:e._maxListeners}function I(e,t,o,s){var i,r,n,a;if("function"!=typeof o)throw new TypeError('"listener" argument must be a function');if((r=e._events)?(r.newListener&&(e.emit("newListener",t,o.listener?o.listener:o),r=e._events),n=r[t]):(r=e._events=new O,e._eventsCount=0),n){if("function"==typeof n?n=r[t]=s?[o,n]:[n,o]:s?n.unshift(o):n.push(o),!n.warned&&(i=x(e))&&i>0&&n.length>i){n.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=n.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else n=r[t]=o,++e._eventsCount;return e}function G(e,t,o){var s=!1;function i(){e.removeListener(t,i),s||(s=!0,o.apply(e,arguments))}return i.listener=o,i}function P(e){var t=this._events;if(t){var o=t[e];if("function"==typeof o)return 1;if(o)return o.length}return 0}function D(e,t){for(var o=new Array(t);t--;)o[t]=e[t];return o}O.prototype=Object.create(null),N.EventEmitter=N,N.usingDomains=!1,N.prototype.domain=void 0,N.prototype._events=void 0,N.prototype._maxListeners=void 0,N.defaultMaxListeners=10,N.init=function(){this.domain=null,N.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new O,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},N.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},N.prototype.getMaxListeners=function(){return x(this)},N.prototype.emit=function(e){var t,o,s,i,r,n,a,l="error"===e;if(n=this._events)l=l&&null==n.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(o=n[e]))return!1;var d="function"==typeof o;switch(s=arguments.length){case 1:!function(e,t,o){if(t)e.call(o);else for(var s=e.length,i=D(e,s),r=0;r<s;++r)i[r].call(o)}(o,d,this);break;case 2:!function(e,t,o,s){if(t)e.call(o,s);else for(var i=e.length,r=D(e,i),n=0;n<i;++n)r[n].call(o,s)}(o,d,this,arguments[1]);break;case 3:!function(e,t,o,s,i){if(t)e.call(o,s,i);else for(var r=e.length,n=D(e,r),a=0;a<r;++a)n[a].call(o,s,i)}(o,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,o,s,i,r){if(t)e.call(o,s,i,r);else for(var n=e.length,a=D(e,n),l=0;l<n;++l)a[l].call(o,s,i,r)}(o,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(s-1),r=1;r<s;r++)i[r-1]=arguments[r];!function(e,t,o,s){if(t)e.apply(o,s);else for(var i=e.length,r=D(e,i),n=0;n<i;++n)r[n].apply(o,s)}(o,d,this,i)}return!0},N.prototype.addListener=function(e,t){return I(this,e,t,!1)},N.prototype.on=N.prototype.addListener,N.prototype.prependListener=function(e,t){return I(this,e,t,!0)},N.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,G(this,e,t)),this},N.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,G(this,e,t)),this},N.prototype.removeListener=function(e,t){var o,s,i,r,n;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(s=this._events))return this;if(!(o=s[e]))return this;if(o===t||o.listener&&o.listener===t)0==--this._eventsCount?this._events=new O:(delete s[e],s.removeListener&&this.emit("removeListener",e,o.listener||t));else if("function"!=typeof o){for(i=-1,r=o.length;r-- >0;)if(o[r]===t||o[r].listener&&o[r].listener===t){n=o[r].listener,i=r;break}if(i<0)return this;if(1===o.length){if(o[0]=void 0,0==--this._eventsCount)return this._events=new O,this;delete s[e]}else!function(e,t){for(var o=t,s=o+1,i=e.length;s<i;o+=1,s+=1)e[o]=e[s];e.pop()}(o,i);s.removeListener&&this.emit("removeListener",e,n||t)}return this},N.prototype.off=function(e,t){return this.removeListener(e,t)},N.prototype.removeAllListeners=function(e){var t,o;if(!(o=this._events))return this;if(!o.removeListener)return 0===arguments.length?(this._events=new O,this._eventsCount=0):o[e]&&(0==--this._eventsCount?this._events=new O:delete o[e]),this;if(0===arguments.length){for(var s,i=Object.keys(o),r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=new O,this._eventsCount=0,this}if("function"==typeof(t=o[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},N.prototype.listeners=function(e){var t,o=this._events;return o&&(t=o[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),o=0;o<t.length;++o)t[o]=e[o].listener||e[o];return t}(t):[]},N.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):P.call(e,t)},N.prototype.listenerCount=P,N.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};let V=null;const q=Object.freeze({el:null,animate:!0,animateClass:"fade",animateInClass:"show",appendTo:"body",backdrop:!0,keyboard:!0,title:!1,header:!0,content:!1,footer:!0,buttons:null,headerClose:!0,construct:!1,transition:300,backdropTransition:150}),R=function e(t){for(let o in t)Array.isArray(t[o])?t[o].forEach((t=>{e(t)})):null!==t[o]&&"object"==typeof t[o]&&Object.freeze(t[o]);return Object.freeze(t)}({dialog:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}],alert:[{text:"OK",attr:{class:"btn btn-primary","data-dismiss":"modal"}}],confirm:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}]}),U={container:'<div class="modal"></div>',dialog:'<div class="modal-dialog"></div>',content:'<div class="modal-content"></div>',header:'<div class="modal-header"></div>',headerClose:'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',body:'<div class="modal-body"></div>',footer:'<div class="modal-footer"></div>',backdrop:'<div class="modal-backdrop"></div>'};function H(e,t,o){let s="data",i=e[s]||{};if(void 0===o){if(e[s]&&e[s][t])return e[s][t];var r=e.getAttribute(`${s}-${t}`);return void 0!==r?r:null}return i[t]=o,e[s]=i,e}function z(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),V||(V=document.createElement("div")),V.innerHTML="",V.innerHTML=e,!0===t?V.childNodes:V.childNodes[0])}function $(e){let t=[e];for(;e.parentNode;)e=e.parentNode,t.push(e);return t}class B extends N{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},U,B._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},R,B._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},q,B._baseOptions||{})}static get version(){return"0.12.0"}static alert(e,t={}){let o=Object.assign({},q,{title:e,content:!1,construct:!0,headerClose:!1,buttons:B.buttons.alert},t);return new B(o)}static confirm(e,t={}){let o=Object.assign({},q,{title:e,content:!1,construct:!0,headerClose:!1,buttons:B.buttons.confirm},t);return new B(o)}constructor(e={}){if(super(),this.id=(65536*(1+Math.random())|0).toString(16)+(65536*(1+Math.random())|0).toString(16),this.el=null,this._html={},this._events={},this._visible=!1,this._pointerInContent=!1,this._options=Object.assign({},B.options,e),this._templates=Object.assign({},B.templates,e.templates||{}),this._html.appendTo=document.querySelector(this._options.appendTo),this._scrollbarWidth=function(){let e,t,o,s=document.createElement("div");return Object.assign(s.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(s),o=s.offsetWidth,s.style.overflow="scroll",e=document.createElement("div"),e.style.width="100%",s.appendChild(e),t=o-e.offsetWidth,document.body.removeChild(s),t}(),null===this._options.buttons&&(this._options.buttons=B.buttons.dialog),this._options.el){let e=this._options.el;if("string"==typeof this._options.el&&(e=document.querySelector(this._options.el),!e))throw new Error(`Selector: DOM Element ${this._options.el} not found.`);H(e,"modal",this),this.el=e}else this._options.construct=!0;this._options.construct?this._render():this._mapDom()}_render(){let e=this._html,t=this._options,o=this._templates,s=!!t.animate&&t.animateClass;return e.container=z(o.container),e.dialog=z(o.dialog),e.content=z(o.content),e.header=z(o.header),e.headerClose=z(o.headerClose),e.body=z(o.body),e.footer=z(o.footer),s&&e.container.classList.add(s),this._setHeader(),this._setContent(),this._setFooter(),this.el=e.container,e.dialog.appendChild(e.content),e.container.appendChild(e.dialog),this}_mapDom(){let e=this._html,t=this._options;return this.el.classList.contains(t.animateClass)&&(t.animate=!0),e.container=this.el,e.dialog=this.el.querySelector(".modal-dialog"),e.content=this.el.querySelector(".modal-content"),e.header=this.el.querySelector(".modal-header"),e.headerClose=this.el.querySelector(".modal-header .close"),e.body=this.el.querySelector(".modal-body"),e.footer=this.el.querySelector(".modal-footer"),this._setHeader(),this._setContent(),this._setFooter(),this}_setHeader(){let e=this._html,t=this._options;t.header&&e.header&&(t.title.nodeName?e.header.innerHTML=t.title.outerHTML:"string"==typeof t.title&&(e.header.innerHTML=`<h4 class="modal-title">${t.title}</h4>`),null===this.el&&e.headerClose&&t.headerClose&&e.header.appendChild(e.headerClose),t.construct&&e.content.appendChild(e.header))}_setContent(){let e=this._html,t=this._options;t.content&&e.body&&("string"==typeof t.content?e.body.innerHTML=t.content:e.body.innerHTML=t.content.outerHTML,t.construct&&e.content.appendChild(e.body))}_setFooter(){let e=this._html,t=this._options;t.footer&&e.footer&&(t.footer.nodeName?e.footer.ineerHTML=t.footer.outerHTML:"string"==typeof t.footer?e.footer.innerHTML=t.footer:e.footer.children.length||t.buttons.forEach((t=>{let o=document.createElement("button");H(o,"button",t),o.innerHTML=t.text,o.setAttribute("type","button");for(let e in t.attr)o.setAttribute(e,t.attr[e]);e.footer.appendChild(o)})),t.construct&&e.content.appendChild(e.footer))}_setEvents(){this._options;let e=this._html;this._events.keydownHandler=this._handleKeydownEvent.bind(this),document.body.addEventListener("keydown",this._events.keydownHandler),this._events.mousedownHandler=this._handleMousedownEvent.bind(this),e.container.addEventListener("mousedown",this._events.mousedownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}_handleMousedownEvent(e){this._pointerInContent=!1,$(e.target).every((e=>!e.classList||!e.classList.contains("modal-content")||(this._pointerInContent=!0,!1)))}_handleClickEvent(e){$(e.target).every((t=>"HTML"!==t.tagName&&((!0===this._options.backdrop||!t.classList.contains("modal"))&&(!t.classList.contains("modal-content")&&("modal"===t.getAttribute("data-dismiss")?(this.emit("dismiss",this,e,H(e.target,"button")),this.hide(),!1):!(!this._pointerInContent&&t.classList.contains("modal"))||(this.emit("dismiss",this,e,null),this.hide(),!1)))))),this._pointerInContent=!1}_handleKeydownEvent(e){27===e.which&&this._options.keyboard&&(this.emit("dismiss",this,e,null),this.hide())}_handleResizeEvent(e){this._resize()}show(){let e=this._options,t=this._html;return this.emit("show",this),this._checkScrollbar(),this._setScrollbar(),document.body.classList.add("modal-open"),e.construct&&t.appendTo.appendChild(t.container),t.container.style.display="block",t.container.scrollTop=0,!1!==e.backdrop?(this.once("showBackdrop",(()=>{this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)})),this._backdrop()):(this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)),this._resize(),this}toggle(){this._visible?this.hide():this.show()}_resize(){var e=this._html.container.scrollHeight>document.documentElement.clientHeight;this._html.container.style.paddingLeft=!this.bodyIsOverflowing&&e?this._scrollbarWidth+"px":"",this._html.container.style.paddingRight=this.bodyIsOverflowing&&!e?this._scrollbarWidth+"px":""}_backdrop(){let e=this._html,t=this._templates,o=this._options,s=!!o.animate&&o.animateClass;e.backdrop=z(t.backdrop),s&&e.backdrop.classList.add(s),e.appendTo.appendChild(e.backdrop),s&&e.backdrop.offsetWidth,e.backdrop.classList.add(o.animateInClass),setTimeout((()=>{this.emit("showBackdrop",this)}),this._options.backdropTransition)}hide(){let e=this._html,t=this._options,o=e.container.classList;if(this.emit("hide",this),o.remove(t.animateInClass),t.backdrop){e.backdrop.classList.remove(t.animateInClass)}return this._removeEvents(),setTimeout((()=>{document.body.classList.remove("modal-open"),document.body.style.paddingRight=this.originalBodyPad}),t.backdropTransition),setTimeout((()=>{t.backdrop&&e.backdrop.parentNode.removeChild(e.backdrop),e.container.style.display="none",t.construct&&e.container.parentNode.removeChild(e.container),this._visible=!1,this.emit("hidden",this)}),t.transition),this}_removeEvents(){this._events.keydownHandler&&document.body.removeEventListener("keydown",this._events.keydownHandler),this._html.container.removeEventListener("mousedown",this._events.mousedownHandler),this._html.container.removeEventListener("click",this._events.clickHandler),window.removeEventListener("resize",this._events.resizeHandler)}_checkScrollbar(){this.bodyIsOverflowing=document.body.clientWidth<window.innerWidth}_setScrollbar(){if(this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing){let e=parseInt(this.originalBodyPad||0,10);document.body.style.paddingRight=e+this._scrollbarWidth+"px"}}}let W={};const Z=new Set,K=e=>"exceptions"in e?e.exceptions.map((e=>e.text)).join(","):"",J=(e,t=null,o="")=>{if(Z.has(o))return;Z.add(o);let s=`<b>Error: ${e}</b>`;t&&t.message!==e&&(s+=`. ${t.message}`);const i=B.alert(s,W);i.show(),i.on("hidden",(()=>{Z.delete(o)}))},Y={labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Failed to get data from GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer",transaction:"Error when doing Transaction with GeoServer",getFeatures:"Error getting elements from GeoServer"}},X={es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"Capa no encontrada",layerNotVisible:"La capa no está visible",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer",transaction:"Error al hacer transacción con el GeoServer",getFeatures:"Error al obtener elemento desde el GeoServer"}},en:Y,zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素.",transaction:"GeoServer处理事务出错.",getFeatures:"从GeoServer获取元素出错."}}};let Q=Y;let ee;const te=(e=!0)=>{e?ee.classList.add("ol-wfst--tools-control--loading-show"):ee.classList.remove("ol-wfst--tools-control--loading-show")},oe=(e,t,o=[])=>{const s=Object.getOwnPropertyDescriptors(t);for(let e of o)delete s[e];Object.defineProperties(e,s)},se=(e,t=[e])=>{const o=Object.getPrototypeOf(e);return null===o?t:se(o,[...t,o])},ie=(e,t,o=[])=>{var s;const i=null!==(s=((...e)=>{if(0===e.length)return;let t;const o=e.map((e=>se(e)));for(;o.every((e=>e.length>0));){const e=o.map((e=>e.pop())),s=e[0];if(!e.every((e=>e===s)))break;t=s}return t})(...e))&&void 0!==s?s:Object.prototype,r=Object.create(i),n=se(i);for(let t of e){let e=se(t);for(let t=e.length-1;t>=0;t--){let s=e[t];-1===n.indexOf(s)&&(oe(r,s,["constructor",...o]),n.push(s))}}return r.constructor=t,r},re=e=>e.filter(((t,o)=>e.indexOf(t)==o)),ne=new Map,ae=e=>ne.get(e),le=(e,t)=>{var o,s;const i=re([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),r={};for(let n of i)r[n]=re([...null!==(o=null==e?void 0:e[n])&&void 0!==o?o:[],...null!==(s=null==t?void 0:t[n])&&void 0!==s?s:[]]);return r},ce=(e,t)=>{var o,s,i,r;return{property:le(null!==(o=null==e?void 0:e.property)&&void 0!==o?o:{},null!==(s=null==t?void 0:t.property)&&void 0!==s?s:{}),method:le(null!==(i=null==e?void 0:e.method)&&void 0!==i?i:{},null!==(r=null==t?void 0:t.method)&&void 0!==r?r:{})}},de=new Map,he=(...e)=>{const t=((...e)=>{var t;const o=new Set,s=new Set([...e]);for(;s.size>0;)for(let e of s){const i=[...se(e.prototype).map((e=>e.constructor)),...null!==(t=ae(e))&&void 0!==t?t:[]].filter((e=>!o.has(e)));for(let e of i)s.add(e);o.add(e),s.delete(e)}return[...o]})(...e).map((e=>de.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var o,s,i,r,n,a;return{class:re([...null!==(o=null==e?void 0:e.class)&&void 0!==o?o:[],...null!==(s=null==t?void 0:t.class)&&void 0!==s?s:[]]),static:ce(null!==(i=null==e?void 0:e.static)&&void 0!==i?i:{},null!==(r=null==t?void 0:t.static)&&void 0!==r?r:{}),instance:ce(null!==(n=null==e?void 0:e.instance)&&void 0!==n?n:{},null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{})}})(e,t)))};function ue(...e){var t,o,s;const i=e.map((e=>e.prototype));function r(...t){for(const o of e)oe(this,new o(...t))}r.prototype=ie(i,r),Object.setPrototypeOf(r,ie(e,null,["prototype"]));let n=r;{const i=he(...e);for(let e of null!==(t=null==i?void 0:i.class)&&void 0!==t?t:[]){const t=e(n);t&&(n=t)}pe(null!==(o=null==i?void 0:i.static)&&void 0!==o?o:{},n),pe(null!==(s=null==i?void 0:i.instance)&&void 0!==s?s:{},n.prototype)}var a,l;return a=n,l=e,ne.set(a,l),n}const pe=(e,t)=>{const o=e.property,s=e.method;if(o)for(let e in o)for(let s of o[e])s(t,e);if(s)for(let e in s)for(let o of s[e])o(t,e,Object.getOwnPropertyDescriptor(t,e))};var me,ge;let fe;!function(e){e.Point="Point",e.LineString="LineString",e.LinearRing="LinearRing",e.Polygon="Polygon",e.MultiPoint="MultiPoint",e.MultiLineString="MultiLineString",e.MultiPolygon="MultiPolygon",e.GeometryCollection="GeometryCollection",e.Circle="Circle"}(me||(me={})),function(e){e.Insert="insert",e.Delete="delete",e.Update="update"}(ge||(ge={}));let ve=null,ye=null;var _e;function be(e=null){ye=e}function we(){return ye}!function(e){e.Edit="EDIT",e.Draw="DRAW"}(_e||(_e={}));const Ee=new Set,Se={};function Ce(){return fe}function Fe(e){ve=e}function Le(){return ve}function Te(){return Se}function Me(e){return Te()[e]}function ke(e){Ee.add(String(e.getId()))}function je(e){Ee.delete(String(e.getId()))}function Ae(e){return Ee.has(String(e.getId()))}class Oe extends m{_init(){const e=this.getGeoserver();e.isLoaded()?this.getAndUpdateDescribeFeatureType():e.on("change:capabilities",(async()=>{this.getAndUpdateDescribeFeatureType()}))}async getAndUpdateDescribeFeatureType(){const e=this.get(Ne.NAME),t=this.get(Ne.LABEL);try{const t=this.getGeoserver(),o=new URLSearchParams({service:"wfs",version:t.getAdvanced().describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),s=t.getUrl()+"?"+o.toString(),i=await fetch(s,{headers:t.getHeaders(),credentials:t.getCredentials()});if(!i.ok)throw new Error("");const r=await i.json();if(!r)throw new Error("");if(r.exceptions)throw new Error(K(r));const n=r.targetNamespace,a=r.featureTypes[0].properties,l=a.find((e=>e.type.indexOf("gml:")>=0));r._parsed={namespace:n,properties:a,geomType:l.localType,geomField:l.name},this.set(Ne.DESCRIBEFEATURETYPE,r)}catch(o){console.error(o),J(`${Q.errors.layer} "${t}"`,o,e)}}isVisibleByZoom(){return Ce().getView().getZoom()>this.getMinZoom()}async transactFeatures(e,t){return this.getGeoserver().transact(e,t,this.get(Ne.NAME))}async insertFeatures(e){return this.transactFeatures(ge.Insert,e)}async maybeLockFeature(e){const t=this.getGeoserver();return t.getUseLockFeature()&&t.hasLockFeature()?await t.lockFeature(e,this.get(Ne.NAME)):null}getGeoserver(){return this.get(Ne.GEOSERVER)}getDescribeFeatureType(){return this.get(Ne.DESCRIBEFEATURETYPE)}}var Ne;!function(e){e.NAME="name",e.LABEL="label",e.DESCRIBEFEATURETYPE="describeFeatureType",e.ISVISIBLE="isVisible",e.GEOSERVER="geoserver"}(Ne||(Ne={}));class xe extends f{constructor(e){super(Object.assign(Object.assign({},e),{format:new g,loader:async(t,o,s,i,r)=>{try{if(e.strategy==y.bbox){const o=v.transformExtent(t,s.getCode(),e.geoServerAdvanced.projection);this.urlParams.set("bbox",o.toString()+`,${e.geoServerAdvanced.projection}`)}const o=e.geoserverUrl+"?"+this.urlParams.toString(),r=await fetch(o,{headers:e.headers,credentials:e.credentials});if(!r.ok)throw new Error("");const n=await r.json();if(n.exceptions)throw new Error(K(n));const a=this.getFormat().readFeatures(n,{featureProjection:s.getCode(),dataProjection:e.geoServerAdvanced.projection});a.forEach((t=>{t.set("_layerName_",e.name,!0)})),this.addFeatures(a),i(a)}catch(o){this.removeLoadedExtent(t),J(Q.errors.geoserver,o,e.name),r()}}})),this.urlParams=new URLSearchParams({SERVICE:"wfs",REQUEST:"GetFeature",OUTPUTFORMAT:"application/json",EXCEPTIONS:"application/json"}),this.urlParams.set("version",e.geoServerAdvanced.getFeatureVersion),this.urlParams.set("typename",e.name),this.urlParams.set("srsName",e.geoServerAdvanced.projection.toString())}}class Ie extends(ue(Oe,p)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature);const t=e.geoserver,o=new xe(Object.assign(Object.assign({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced()},e.strategy&&{strategy:e.strategy}),{geoserverVendor:e.geoserverVendor}));this._loadingCount=0,this._loadedCount=0,o.on("featuresloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&te()})),o.on(["featuresloadend","featuresloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(o);const s=e.geoserverVendor;Object.keys(s).forEach((e=>{o.urlParams.set(e,s[e])}))}refresh(){this.getSource().refresh()}setCustomParam(e,t=null,o=!0){const s=this.getSource();return null==t?s.urlParams.delete(e):s.urlParams.set(e,t),o&&this.refresh(),s.urlParams}}var Ge=2,Pe=3;class De extends b{constructor(e){super(Object.assign({url:e.geoserverUrl,serverType:"geoserver",params:Object.assign({SERVICE:"wms",TILED:!0,LAYERS:e.name,EXCEPTIONS:"application/json"},e.geoserverVendor&&e.geoserverVendor),tileLoadFunction:async(t,o)=>{try{const i=await fetch(o,{headers:e.headers,credentials:e.credentials});if(!i.ok)throw new Error("");let r=await i.blob();if("application/json"==r.type){const e=await(s=r,new Promise((e=>{const t=new FileReader;t.onloadend=()=>e(JSON.parse(t.result)),t.readAsText(s)})));throw new Error(K(e))}t.getImage().src=URL.createObjectURL(r),t.setState(Ge)}catch(o){J(Q.errors.geoserver,o,e.name),t.setState(Pe)}var s}},e))}}class Ve extends(ue(Oe,_)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature),this._formatGeoJSON=new g;const t=e.geoserver,o=new De({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,o.on("tileloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&te()})),o.on(["tileloadend","tileloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(o)}async _getFeaturesByClickEvent(e){const t=e.coordinate,o=Ce().getView(),s=o.getZoom()>10?10:5,i=this.getSource(),r=i["getFeatureInfoUrl"in i?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](t,o.getResolution(),o.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:s,FEATURE_COUNT:1,EXCEPTIONS:"application/json"}),n=this.getGeoserver();try{const e=await fetch(r,{headers:n.getHeaders(),credentials:n.getCredentials()});if(!e.ok)throw new Error(`${Q.errors.getFeatures} ${e.status}`);const t=await e.json();return this._formatGeoJSON.readFeatures(t)}catch(e){J(e.message,e)}}refresh(){const e=this.getSource();e.refresh();const t=e.getParams();t.t=(new Date).getMilliseconds(),e.updateParams(t)}setCustomParam(e,t=null,o=!0){const s=this.getSource();return s.updateParams({[e]:t}),o&&this.refresh(),s.getParams()}}function qe(e,t={},...o){if("function"==typeof e)return e(t,o);const s=null===e?new DocumentFragment:document.createElement(e);Object.entries(t||{}).forEach((([e,t])=>{void 0!==typeof t&&null!=t&&(e.startsWith("on")&&e.toLowerCase()in window?s.addEventListener(e.toLowerCase().substr(2),t):"className"===e?s.setAttribute("class",t.toString()):"htmlFor"===e?s.setAttribute("for",t.toString()):s.setAttribute(e,t.toString()))}));for(const e of o)e&&(Array.isArray(e)?s.append(...e):void 0===e.nodeType?s.innerHTML+=e:s.appendChild(e));return s}const Re=()=>{const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")};class Ue extends u{constructor(e,t){super(),this._uploads=e,this._uploadFormats=t}addLayerEl(e){const t=document.querySelector(".wfst--tools-control--select-layers"),o=e.get(Ne.NAME),s=e===Le()?{checked:!0}:{},i=qe("input",Object.assign({value:o,id:`wfst--${o}`,type:"radio",className:"ol-wfst--tools-control-input",name:"wfst--select-layer"},s,{onChange:t=>this._layerChangeHandler(t,e)})),r=qe("div",{className:`wfst--layer-control \n ${e.getVisible()?"ol-wfst--visible-on":""}\n ${e===Le()?"ol-wfst--selected-on":""}`,"data-layer":o},qe("div",{className:"ol-wfst--tools-control-visible"},qe("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on",title:Q.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e"})),qe("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off",title:Q.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e"}))),qe("label",{htmlFor:`wfst--${o}`},i,qe("span",{title:e.getDescribeFeatureType()._parsed.geomType},e.get(Ne.LABEL))));return t.appendChild(r),e===Le()&&i.dispatchEvent(new Event("change")),r}_changeStateSelect(e,t=null){const o=(e,t)=>{Array.from(s.options).forEach((o=>{o.selected=o.value===e,o.disabled="all"!==t&&!t.includes(o.value),o.title=o.disabled?Q.labels.geomTypeNotSupported:""}))},s=document.querySelector(".wfst--tools-control--select-draw");let i;if(s){const r=e.getDescribeFeatureType()._parsed.geomType;t?i=s.value:r===me.GeometryCollection?(i=me.LineString,o(i,"all")):r===me.LinearRing?(i=me.LineString,o(i,[me.Circle,me.LinearRing,me.Polygon]),s.value=i):(i=r,o(i,[r]))}return i}_visibilityClickHandler(e){const t=e.currentTarget.closest(".wfst--layer-control"),o=t.dataset.layer;t.classList.toggle("ol-wfst--visible-on");const s=Te()[o];t.classList.contains("ol-wfst--visible-on")?s.setVisible(!0):s.setVisible(!1)}_layerChangeHandler(e,t){const o=e.currentTarget.closest(".wfst--layer-control"),s=document.querySelector(".ol-wfst--selected-on");s&&s.classList.remove("ol-wfst--selected-on"),o.classList.add("ol-wfst--selected-on"),Fe(t),this._changeStateSelect(t)}render(){return qe(null,null,qe("div",{className:"wfst--tools-control--head"},this._uploads&&qe("div",null,qe("input",{id:"ol-wfst--upload",type:"file",accept:this._uploadFormats,onChange:e=>this._uploads.process(e)}),qe("label",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",htmlFor:"ol-wfst--upload",title:Q.labels.uploadToLayer},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e"}))),qe("div",{className:"ol-wfst--tools-control-draw-cnt"},qe("button",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",type:"button",title:Q.labels.addElement,onClick:()=>{this.dispatchEvent("drawMode")}},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e"})),qe("select",{title:Q.labels.selectDrawType,className:"wfst--tools-control--select-draw",onChange:e=>{const t=e.target.value;this._changeStateSelect(Le(),t),this.dispatchEvent("changeGeom")}},[me.Point,me.MultiPoint,me.LineString,me.MultiLineString,me.Polygon,me.MultiPolygon,me.Circle].map((e=>qe("option",{value:e},e)))))),qe("div",{className:"wfst--tools-control--select-layers"}))}}let He=new p({source:new f,zIndex:100});const ze=()=>He;class $e extends u{constructor(e){super(),this._options=e,this._processUpload=e.processUpload,this._formatWFS=new S,this._formatGeoJSON=new g,this._formatKml=new E({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer}async process(e){const t=Ce().getView(),o=e.target.files[0];let s;if(!o)return;const i=o.name.split(".").pop().toLowerCase();try{if(this._processUpload&&(s=this._processUpload(o)),!s){const e=await this._fileReader(o);"geojson"===i||"json"===i?s=this._formatGeoJSON.readFeatures(e,{featureProjection:t.getProjection().getCode()}):"kml"===i?s=this._formatKml.readFeatures(e,{featureProjection:t.getProjection().getCode()}):J(Q.errors.badFormat)}let r=0,n=0;const a=[];for(let e of s)this._checkGeometry(e)||(e=this._fixGeometry(e)),e?(a.push(e),n++):r++;if(n){Re(),this.dispatchEvent(new f.VectorSourceEvent("loadedFeatures",null,a));const e=`\n ${Q.labels.validFeatures}: ${n}<br>\n ${r?`${Q.labels.invalidFeatures}: ${r}`:""}`;this._initModal(e,a)}else J(Q.errors.noValidGeometry);e.target.value=null}catch(e){J(Q.errors.badFile,e)}}async _fileReader(e){return new Promise(((t,o)=>{const s=new FileReader;s.addEventListener("load",(async e=>{const o=e.target.result;t(o)})),s.addEventListener("error",(e=>{console.error("Error"+e),o()})),s.readAsText(e)}))}_fixGeometry(e){const t=Le().getDescribeFeatureType()._parsed.geomType;let o;switch(e.getGeometry().getType()){case me.Point:if(t===me.MultiPoint){const t=e.getGeometry().getCoordinates();o=new w.MultiPoint([t])}break;case me.LineString:if(t===me.MultiLineString){const t=e.getGeometry().getCoordinates();o=new w.MultiLineString([t])}break;case me.Polygon:if(t===me.MultiPolygon){const t=e.getGeometry().getCoordinates();o=new w.MultiPolygon([t])}break;default:o=null}return o?(e.setGeometry(o),e):null}_checkGeometry(e){const t=Le().getDescribeFeatureType()._parsed.geomType,o=e.getGeometry().getType();return t===me.GeometryCollection||o===t}_initModal(e,t){const o=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Q.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Q.labels.upload}\n </button>\n `;new B(Object.assign(Object.assign({},this._options.modal),{header:!0,headerClose:!1,title:Q.labels.uploadFeatures+" "+Le().get(Ne.NAME),content:e,backdrop:"static",footer:o})).show().on("dismiss",((e,o)=>{"save"===o.target.dataset.action?this.dispatchEvent(new f.VectorSourceEvent("addedFeatures",null,t)):ze().getSource().clear()}))}}const Be=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((o=>{const s=t[o],i=e[o];e[o]=i&&s&&"object"==typeof i&&"object"==typeof s&&!Array.isArray(i)?Be(i,s):s}))})),e);class We extends i{constructor(e){super({element:qe("div",{className:"ol-wfst--changes-control"},qe("div",{className:"ol-wfst--changes-control-el"},qe("div",{className:"ol-wfst--changes-control-id"},qe("b",null,Q.labels.editMode)," -"," ",qe("i",null,String(e.getId()))),qe("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("cancel",e))}},Q.labels.cancel),qe("button",{type:"button",className:"btn btn-sm btn-primary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("apply",e))}},Q.labels.apply),qe("button",{type:"button",className:"btn btn-sm btn-danger-outline",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("delete",e))}},Q.labels.delete)))})}}function Ze(e){const t=e=>{let t=e.getGeometry();t instanceof w.GeometryCollection&&(t=t.getGeometries()[0]);const o=t.getCoordinates();let s=null;if(s=t instanceof w.Polygon||t instanceof w.MultiLineString?o.flat(1):t instanceof w.MultiPolygon?o.flat(2):o,s&&s.length)return new w.MultiPoint(s)};let o=e.getGeometry(),s=o.getType();switch(o instanceof w.GeometryCollection&&(o=o.getGeometries()[0],s=o.getType()),s){case me.Point:case me.MultiPoint:return we()===_e.Edit?[new C.Style({image:new C.Circle({radius:6,fill:new C.Fill({color:"#000000"})})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"})})})]:[new C.Style({image:new C.Circle({radius:5,fill:new C.Fill({color:"#ff0000"})})}),new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})})})];default:return we()==_e.Draw||we()==_e.Edit?[new C.Style({stroke:new C.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"}),stroke:new C.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"#ff0000",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}class Ke extends u{constructor(e){super(),this._options=e;const t=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${Q.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Q.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Q.labels.save}\n </button>\n `;this._modal=new B(Object.assign(Object.assign({},this._options),{header:!0,headerClose:!0,title:"",content:"<div></div>",footer:t})),this._modal.on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,o=e.name;this._feature.set(o,t,!0)})),this._feature.changed(),ke(this._feature),this.dispatchEvent(new f.VectorSourceEvent("save",this._feature))}else"delete"===t.target.dataset.action&&this.dispatchEvent(new f.VectorSourceEvent("delete",this._feature))}))}show(e){this._feature=e;const t=`${Q.labels.editElement} ${e.getId()} `,o=e.getProperties(),s=Me(e.get("_layerName_")).getDescribeFeatureType()._parsed.properties;let i='<form autocomplete="false">';Object.keys(o).forEach((e=>{const t=s.find((t=>t.name===e));if(t){let s;switch(t.type){case"xsd:string":default:s="text";break;case"xsd:number":case"xsd:int":s="number";break;case"xsd:date-time":s="datetime"}s&&(i+=`\n <div class="ol-wfst--input-field-container">\n <label class="ol-wfst--input-field-label" for="${e}">${e}</label>\n <input placeholder="NULL" class="ol-wfst--input-field-input" type="${s}" name="${e}" value="${o[e]||""}">\n </div>`)}})),i+="</form>",this._modal._html.body.innerHTML=i,this._modal._html.header.innerHTML=t,this._modal.show()}}var Je;!function(e){e.CAPABILITIES="capabilities",e.URL="url",e.HEADERS="headers",e.CREDENTIALS="credentials",e.ADVANCED="advanced",e.HASTRASNACTION="hasTransaction",e.HASLOCKFEATURE="hasLockFeature",e.HASDESCRIBEFEATURETYPE="hasDescribeFeatureType",e.USELOCKFEATURE="useLockFeature",e.ISLOADED="isLoaded"}(Je||(Je={}));class Ye extends A{constructor(e,t=null){super({id:e.getId(),position:t||j.getCenter(e.getGeometry().getExtent()),positioning:"center-center",offset:[0,-40],stopEvent:!0,element:qe("div",null,qe("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editFields")}},qe("button",{className:"ol-wfst--edit-button",type:"button",title:Q.labels.editFields},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e",alt:Q.labels.editFields}))),qe("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editGeom")}},qe("button",{class:"ol-wfst--edit-button",type:"button",title:Q.labels.editGeom},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e",alt:Q.labels.editGeom}))))})}}const Xe=document.createElement("div");class Qe extends i{constructor(e){super({target:null,element:Xe,render:()=>{this._map||this._init()}}),this._initialized=!1,((e="en",t=null)=>{e in X&&(Q=X[e]),t&&(Q=Object.assign(Object.assign({},Q),t))})(e.language,e.i18n);const t={layers:null,evtType:"singleclick",active:!0,showControl:!0,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${Q.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=Be(t,e),Fe(this._options.layers[0]),this._controlWidgetToolsDiv=Xe,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._uploads=new $e(this._options),this._editFields=new Ke(this._options.modal)}getLayers(){return Object.values(Te())}getLayerByName(e=""){const t=Te();return e&&e in t?t[e]:null}async _initMapAndLayers(){try{const e=this._options.layers;if(e.length){let t=0,o=0;e.forEach((e=>{e.getVisible()&&o++,e.on("layerRendered",(()=>{t++,t>=o&&(this._initialized||(this.dispatchEvent("load"),this._initialized=!0),te(!1))})),e.on("change:describeFeatureType",(()=>{const t=this._layersControl.addLayerEl(e);e.on("change:isVisible",(()=>{const o="ol-wfst--layer-not-visible";e.isVisibleByZoom()?t.classList.remove(o):t.classList.add(o)})),e.set(Ne.ISVISIBLE,this._currentZoom>e.getMinZoom()),this.dispatchEvent(new et({type:"describeFeatureType",layer:e,data:e.getDescribeFeatureType()}))})),e._init(),this._map.addLayer(e),function(e){Object.assign(Se,e)}({[e.get(Ne.NAME)]:e})})),this._createMapElements(this._options.showControl,this._options.active)}}catch(e){te(!1),J(e.message,e)}}_init(){var e,t;this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),e=this._map,fe=e,this._uploads.on("addedFeatures",(({features:e})=>{Le().insertFeatures(e)})),this._uploads.on("loadedFeatures",(({features:e})=>{this.activateEditMode();const t=ze().getSource();t.addFeatures(e),this._view.fit(t.getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})})),this._editFields.on("save",(({feature:e})=>{this._collectionModify.remove(e)})),this._editFields.dispose("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._addMapEvents(),t=this._options.modal,W=t,this._controlWidgetToolsDiv.append((ee=document.createElement("div"),ee.className="ol-wfst--tools-control--loading",ee.innerHTML=Q.labels.loading,ee)),this._initMapAndLayers()}async _createMapElements(e,t){this._prepareEditLayer(),this._addInteractions(),this._addInteractionHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}_addInteractions(){const i=()=>{this._collectionModify=new c,this._interactionWfsSelect=new a({hitTolerance:10,style:e=>Ze(e),toggleCondition:h.never,filter:(e,t)=>we()!==_e.Edit&&t&&t instanceof Ie&&t===Le()}),this._map.addInteraction(this._interactionWfsSelect),this._interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:o})=>{const s=o.coordinate;e.length&&e.forEach((e=>{if(!Ae(e)){const t=this._interactionWfsSelect.getLayer(e);t.getSource().removeFeature(e),this._addFeatureToEditMode(e,s,t.get(Ne.NAME))}})),t.length&&we()!==_e.Edit&&t.forEach((e=>{this._collectionModify.remove(e)}))}))},r=()=>{this._interactionSelectModify=new a({style:e=>Ze(e),layers:[ze()],toggleCondition:h.never,removeCondition:()=>we()===_e.Edit}),this._map.addInteraction(this._interactionSelectModify),this._collectionModify=this._interactionSelectModify.getFeatures(),this._keyClickWms=this._map.on(this._options.evtType,(async e=>{if(!this._map.hasFeatureAtPixel(e.pixel)&&we()!==_e.Edit){const t=Le();if(!t.getVisible()||!t.isVisibleByZoom()||t instanceof Ie)return;const o=await t._getFeaturesByClickEvent(e);if(!o.length)return;this._addFeatureToEditMode(o[0],e.coordinate,t.get(Ne.NAME))}}))};this._options.layers.find((e=>e instanceof Ie))&&i(),this._options.layers.find((e=>e instanceof Ve))&&r(),this._interactionModify=new n({style:()=>we()===_e.Edit?new s({image:new e({radius:6,fill:new t({color:"#ff0000"}),stroke:new o({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>h.primaryAction(e)&&we()===_e.Edit}),this._map.addInteraction(this._interactionModify),this._interactionSnap=new l({source:ze().getSource()}),this._map.addInteraction(this._interactionSnap)}_prepareEditLayer(){this._map.addLayer(ze())}_addMapEvents(){(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})(),this._map.on("moveend",(()=>{if(this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom){const e=Te();Object.keys(e).forEach((t=>{const o=e[t];this._currentZoom>o.getMinZoom()?o.get(Ne.ISVISIBLE)||o.set(Ne.ISVISIBLE,!0):o.get(Ne.ISVISIBLE)&&o.set(Ne.ISVISIBLE,!1)})),this._lastZoom=this._currentZoom}}))}_addInteractionHandlers(){this._interactionModify.on("modifyend",(e=>{ke(e.features.item(0)),super.dispatchEvent(e)})),this._interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent()}_addMapControl(){this._layersControl=new Ue(this._options.showUpload?this._uploads:null,this._options.uploadFormats),this._layersControl.on("drawMode",(()=>{if(we()===_e.Draw)Re(),this.activateEditMode();else{Le().isVisibleByZoom()?this.activateDrawMode(Le()):J(Q.errors.layerNotVisible)}})),this._layersControl.on("changeGeom",(()=>{we()===_e.Draw&&this.activateDrawMode(Le())}));const e=this._layersControl.render();this._selectDraw=e.querySelector(".wfst--tools-control--select-draw"),this._controlWidgetToolsDiv.append(e)}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");Te()[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){ze().getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),o=this._options.layers.find((e=>e.get(Ne.NAME)===t));o instanceof Ie&&this._interactionWfsSelect.getFeatures().remove(e),Ae(e)?o.transactFeatures(ge.Update,e):(o instanceof Ie&&this._restoreFeatureToLayer(e,t),this._removeFeatureFromTmpLayer(e))};this._keySelect=this._collectionModify.on("remove",(t=>{const o=t.element;this._deselectEditFeature(o),e(o),this._editModeOff()}))}_onRemoveFeatureEvent(){this._keyRemove=ze().getSource().on("removefeature",(e=>{const t=e.feature;if(!t.get("_delete_"))return;this._keySelect&&u.unByKey(this._keySelect);const o=t.get("_layerName_");this.getLayerByName(o).transactFeatures(ge.Delete,t),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_editModeOn(e){this._editFeatureOriginal=e.clone(),be(_e.Edit),ze().getSource().changed(),this._removeOverlayHelper(e),this._controlApplyDiscardChanges=new We(e),this._controlApplyDiscardChanges.on("cancel",(({feature:e})=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),je(e),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("apply",(({feature:e})=>{te(),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){be(null),this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const o=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),ze().getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_");this._options.layers.find((e=>e.get(Ne.NAME)===t))instanceof Ie&&this._interactionWfsSelect.getFeatures().remove(e)};if(t){B.confirm(Q.labels.confirmDelete,Object.assign({},this._options.modal)).show().once("dismiss",(function(e,t,s){s&&s.value&&o()}))}else o()}_addFeatureToEditMode(e,t=null,o=null){if(this._collectionModify.getLength())return;o&&e.set("_layerName_",o);if((e?e.getProperties():"")&&e.getGeometry()){ze().getSource().addFeature(e),this._collectionModify.push(e);const s=new Ye(e,t);s.on("editFields",(()=>{this._editFields.show(e)})),s.on("editGeom",(()=>{this._editModeOn(e)})),this._map.addOverlay(s);const i=Me(o);i&&i.maybeLockFeature(e.getId())}}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this._interactionDraw&&this._map.removeInteraction(this._interactionDraw);const t=this._selectDraw.value;this._interactionDraw=new r({source:ze().getSource(),type:t,style:e=>Ze(e),stopClick:!0}),this._map.addInteraction(this._interactionDraw),this._interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this._interactionDraw.on("drawend",(t=>{const o=t.feature;e.transactFeatures(ge.Insert,o),super.dispatchEvent(t)}))};if(this._interactionDraw||e){if(e){if(!e.getVisible())return;(()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-draw");e&&e.classList.add("wfst--active")})(),this._viewport.classList.add("draw-mode"),t(e)}else this._map.removeInteraction(this._interactionDraw),this._viewport.classList.remove("draw-mode");be(e?_e.Draw:null)}}activateEditMode(e=!0){e?((()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active")})(),this.activateDrawMode(!1)):this._collectionModify.clear(),this._interactionSelectModify&&this._interactionSelectModify.setActive(e),this._interactionModify.setActive(e),this._interactionWfsSelect&&this._interactionWfsSelect.setActive(e)}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const o=this._map.getOverlayById(t);o&&this._map.removeOverlay(o)}}class et extends d{constructor(e){super(e.type),this.layer=e.layer,this.data=e.data}}const tt={WfsLayer:Ie,WmsLayer:Ve,Geoserver:class extends F{constructor(e){super();const t={url:null,advanced:{getCapabilitiesVersion:"1.3.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857",lockFeatureParams:{expiry:5,lockId:"GeoServer",releaseAction:"SOME"}},headers:{},credentials:"same-origin",useLockFeature:!0};this._options=Be(t,e),this.setAdvanced(this._options.advanced),this.setHeaders(this._options.headers),this.setCredentials(this._options.credentials),this.setUrl(this._options.url),this.setUseLockFeature(this._options.useLockFeature),this._countRequests=0,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new S,this._formatGeoJSON=new g,this._formatKml=new E({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this.getAndUpdateCapabilities(),this.on("change:capabilities",(()=>{this._checkGeoserverCapabilities()}))}getCapabilities(){return this.get(Je.CAPABILITIES)}setUrl(e,t=!1){this.set(Je.URL,e,t)}getUrl(){return this.get(Je.URL)}setHeaders(e={},t=!1){return this.set(Je.HEADERS,e,t)}getHeaders(){return this.get(Je.HEADERS)}setCredentials(e=null,t=!1){this.set(Je.CREDENTIALS,e,t)}getCredentials(){return this.get(Je.CREDENTIALS)}setAdvanced(e={},t=!1){this.set(Je.ADVANCED,e,t)}getAdvanced(){return this.get(Je.ADVANCED)}hasTransaction(){return this.get(Je.HASTRASNACTION)}hasLockFeature(){return this.get(Je.HASLOCKFEATURE)}getUseLockFeature(){return this.get(Je.USELOCKFEATURE)}setUseLockFeature(e,t=!1){this.set(Je.USELOCKFEATURE,e,t)}isLoaded(){return this.get(Je.ISLOADED)}getState(){return this.state_}async getAndUpdateCapabilities(){try{const e=new URLSearchParams({service:"wfs",version:this.getAdvanced().getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this.getUrl()+"?"+e.toString(),o=await fetch(t,{headers:this.getHeaders(),credentials:this.getCredentials()});if(!o.ok)throw new Error("");const s=await o.text(),i=(new window.DOMParser).parseFromString(s,"text/xml");return this.set(Je.CAPABILITIES,i),this.state_=i?"ready":"error",i}catch(e){console.error(e);const t="string"==typeof e?e:Q.errors.capabilities;J(t,e)}}_checkGeoserverCapabilities(){const e=this.getCapabilities().getElementsByTagName("ows:Operation");if(Array.from(e).forEach((e=>{"Transaction"===e.getAttribute("name")?this.set(Je.HASTRASNACTION,!0):"LockFeature"===e.getAttribute("name")?this.set(Je.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.getAttribute("name")&&this.set(Je.HASDESCRIBEFEATURETYPE,!0)})),!this.hasTransaction())throw Q.errors.wfst}async transact(e,t,o){t=Array.isArray(t)?t:[t];const s=[],i=Me(o);for(const o of t){let t=this._cloneFeature(o);const r=t.getGeometry();r instanceof T?this._transformGeoemtryCollectionToGeometries(t,r):r instanceof L&&this._transformCircleToPolygon(t,r),"beforeTransactFeature"in i&&"function"==typeof i.beforeTransactFeature&&(t=i.beforeTransactFeature(t,e)),t&&s.push(t)}if(!s.length)return J(Q.errors.noValidGeometry),!1;switch(e){case ge.Insert:this._insertFeatures=[...this._insertFeatures,...s];break;case ge.Update:this._updateFeatures=[...this._updateFeatures,...s];break;case ge.Delete:this._deleteFeatures=[...this._deleteFeatures,...s]}this._countRequests++;const r=this._countRequests;return new Promise(((s,n)=>{setTimeout((async()=>{try{if(r!==this._countRequests)return;let n=Ce().getView().getProjection().getCode();if(n="EPSG:4326"===n?"urn:x-ogc:def:crs:EPSG:4326":n,!i||!i.getDescribeFeatureType())throw new Error(`${Q.errors.layerNotFound}: "${o}"`);const a=i.getDescribeFeatureType()._parsed,l={featureNS:a.namespace,featureType:o,srsName:n,featurePrefix:null,nativeElements:null,version:this.getAdvanced().wfsTransactionVersion},c=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,l);let d=this._xs.serializeToString(c);const h=a.geomType,u=a.geomField;if(h===me.GeometryCollection)if(e===ge.Insert)d=d.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`),d=d.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if(e===ge.Update){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`,t="</geometryMember></MultiGeometry>";d=d.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}d=e===ge.Insert?d.replace(/<(\/?)\bgeometry\b>/g,`<$1${u}>`):d.replace(/<Name>geometry<\/Name>/g,`<Name>${u}</Name>`),this.hasLockFeature&&this.getUseLockFeature()&&e!==ge.Insert&&(d=d.replace("</Transaction>",`<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`));const p=Object.assign({"Content-Type":"text/xml"},this.getHeaders()),m=await fetch(this.getUrl(),{method:"POST",body:d,headers:p,credentials:this._options.credentials});if(!m.ok)throw new Error(Q.errors.transaction+" "+m.status);const g=await m.text(),f=this._formatWFS.readTransactionResponse(g),v=Me(o);if(!Object.keys(f).length){const e=String(g).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(e)throw v instanceof Ve&&this._removeFeatures(t),new Error(e[1])}e!==ge.Delete&&this._removeFeatures(t),v.refresh(),te(!1),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,s(f)}catch(e){J(e.message,e),te(!1),this._countRequests=0,n()}}),0)}))}_removeFeatures(e){for(const t of e)ze().getSource().removeFeature(t)}_transformCircleToPolygon(e,t){const o=k.fromCircle(t);e.setGeometry(o)}_transformGeoemtryCollectionToGeometries(e,t){let o=t.getGeometries()[0];o instanceof L&&(o=k.fromCircle(o)),e.setGeometry(o)}_cloneFeature(e){je(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const o=new M(t);return o.setId(e.getId()),o}async lockFeature(e,t,o=0){const s=new URLSearchParams({service:"wfs",version:this.getAdvanced().lockFeatureVersion,request:"LockFeature",typeName:t,expiry:String(this._options.advanced.lockFeatureParams.expiry),LockId:this._options.advanced.lockFeatureParams.lockId,releaseAction:this._options.advanced.lockFeatureParams.releaseAction,exceptions:"application/json",featureid:`${e}`}),i=this.getUrl()+"?"+s.toString();try{const s=await fetch(i,{headers:this._options.headers,credentials:this._options.credentials});if(!s.ok)throw new Error(Q.errors.lockFeature);const r=await s.text();try{const s=JSON.parse(r);if("exceptions"in s){const i=new Error(K(s));if("CannotLockAllFeatures"!==s.exceptions[0].code)throw i;if(o)throw i;this.lockFeature(e,t,1)}}catch(e){}return r}catch(e){J(e.message,e)}}}};return Object.assign(Qe,tt),Qe}));
|
|
1
|
+
/*!
|
|
2
|
+
* ol-wfst - v4.2.0
|
|
3
|
+
* https://github.com/GastonZalba/ol-wfst#readme
|
|
4
|
+
* Built: Sat Sep 30 2023 12:32:13 GMT-0300 (Argentina Standard Time)
|
|
5
|
+
*/
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/style/Circle.js"),require("ol/style/Fill.js"),require("ol/style/Stroke.js"),require("ol/style/Style.js"),require("ol/control/Control.js"),require("ol/interaction/Draw.js"),require("ol/interaction/Modify.js"),require("ol/interaction/Select.js"),require("ol/interaction/Snap.js"),require("ol/Collection.js"),require("ol/events/Event.js"),require("ol/events/condition.js"),require("ol/Observable.js"),require("ol/layer/Vector.js"),require("ol/layer/Base.js"),require("ol/format/GeoJSON.js"),require("ol/source/Vector.js"),require("ol/proj.js"),require("ol/loadingstrategy.js"),require("ol/layer/Tile.js"),require("ol/source/TileWMS.js"),require("ol/geom.js"),require("ol/format/KML.js"),require("ol/format/WFS.js"),require("ol/style.js"),require("ol/Object.js"),require("ol/geom/Circle.js"),require("ol/geom/GeometryCollection.js"),require("ol/Feature.js"),require("ol/geom/Polygon.js"),require("ol/format/XML.js"),require("ol/xml.js"),require("ol/format/xlink.js"),require("ol/format/xsd.js"),require("ol/extent.js"),require("ol/Overlay.js")):"function"==typeof define&&define.amd?define(["ol/style/Circle.js","ol/style/Fill.js","ol/style/Stroke.js","ol/style/Style.js","ol/control/Control.js","ol/interaction/Draw.js","ol/interaction/Modify.js","ol/interaction/Select.js","ol/interaction/Snap.js","ol/Collection.js","ol/events/Event.js","ol/events/condition.js","ol/Observable.js","ol/layer/Vector.js","ol/layer/Base.js","ol/format/GeoJSON.js","ol/source/Vector.js","ol/proj.js","ol/loadingstrategy.js","ol/layer/Tile.js","ol/source/TileWMS.js","ol/geom.js","ol/format/KML.js","ol/format/WFS.js","ol/style.js","ol/Object.js","ol/geom/Circle.js","ol/geom/GeometryCollection.js","ol/Feature.js","ol/geom/Polygon.js","ol/format/XML.js","ol/xml.js","ol/format/xlink.js","ol/format/xsd.js","ol/extent.js","ol/Overlay.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.style.Circle,e.ol.style.Fill,e.ol.style.Stroke,e.ol.style.Style,e.ol.control.Control,e.ol.interaction.Draw,e.ol.interaction.Modify,e.ol.interaction.Select,e.ol.interaction.Snap,e.ol.Collection,e.ol.events.Event,e.ol.events.condition,e.ol.Observable,e.ol.layer.Vector,e.ol.layer.Base,e.ol.format.GeoJSON,e.ol.source.Vector,e.ol.proj,e.ol.loadingstrategy,e.ol.layer.Tile,e.ol.source.TileWMS,e.ol.geom,e.ol.format.KML,e.ol.format.WFS,e.ol.style,e.ol.Object,e.ol.geom.Circle,e.ol.geom.GeometryCollection,e.ol.Feature,e.ol.geom.Polygon,e.ol.format.XML,e.ol.xml,e.ol.format.xlink,e.ol.format.xsd,e.ol.extent,e.ol.Overlay)}(this,(function(e,t,r,o,s,n,i,a,l,c,d,u,h,p,m,g,f,y,v,b,_,S,w,E,C,k,P,F,j,T,A,L,O,M,N,I){"use strict";function x(){}function G(){G.init.call(this)}function D(e){return void 0===e._maxListeners?G.defaultMaxListeners:e._maxListeners}function R(e,t,r,o){var s,n,i,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((n=e._events)?(n.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),n=e._events),i=n[t]):(n=e._events=new x,e._eventsCount=0),i){if("function"==typeof i?i=n[t]=o?[r,i]:[i,r]:o?i.unshift(r):i.push(r),!i.warned&&(s=D(e))&&s>0&&i.length>s){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else i=n[t]=r,++e._eventsCount;return e}function V(e,t,r){var o=!1;function s(){e.removeListener(t,s),o||(o=!0,r.apply(e,arguments))}return s.listener=r,s}function U(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function q(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}x.prototype=Object.create(null),G.EventEmitter=G,G.usingDomains=!1,G.prototype.domain=void 0,G.prototype._events=void 0,G.prototype._maxListeners=void 0,G.defaultMaxListeners=10,G.init=function(){this.domain=null,G.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new x,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},G.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},G.prototype.getMaxListeners=function(){return D(this)},G.prototype.emit=function(e){var t,r,o,s,n,i,a,l="error"===e;if(i=this._events)l=l&&null==i.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=i[e]))return!1;var d="function"==typeof r;switch(o=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var o=e.length,s=q(e,o),n=0;n<o;++n)s[n].call(r)}(r,d,this);break;case 2:!function(e,t,r,o){if(t)e.call(r,o);else for(var s=e.length,n=q(e,s),i=0;i<s;++i)n[i].call(r,o)}(r,d,this,arguments[1]);break;case 3:!function(e,t,r,o,s){if(t)e.call(r,o,s);else for(var n=e.length,i=q(e,n),a=0;a<n;++a)i[a].call(r,o,s)}(r,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,o,s,n){if(t)e.call(r,o,s,n);else for(var i=e.length,a=q(e,i),l=0;l<i;++l)a[l].call(r,o,s,n)}(r,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(o-1),n=1;n<o;n++)s[n-1]=arguments[n];!function(e,t,r,o){if(t)e.apply(r,o);else for(var s=e.length,n=q(e,s),i=0;i<s;++i)n[i].apply(r,o)}(r,d,this,s)}return!0},G.prototype.addListener=function(e,t){return R(this,e,t,!1)},G.prototype.on=G.prototype.addListener,G.prototype.prependListener=function(e,t){return R(this,e,t,!0)},G.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,V(this,e,t)),this},G.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,V(this,e,t)),this},G.prototype.removeListener=function(e,t){var r,o,s,n,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(r=o[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new x:(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,n=r.length;n-- >0;)if(r[n]===t||r[n].listener&&r[n].listener===t){i=r[n].listener,s=n;break}if(s<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new x,this;delete o[e]}else!function(e,t){for(var r=t,o=r+1,s=e.length;o<s;r+=1,o+=1)e[r]=e[o];e.pop()}(r,s);o.removeListener&&this.emit("removeListener",e,i||t)}return this},G.prototype.off=function(e,t){return this.removeListener(e,t)},G.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new x,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new x:delete r[e]),this;if(0===arguments.length){for(var o,s=Object.keys(r),n=0;n<s.length;++n)"removeListener"!==(o=s[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=new x,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},G.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},G.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):U.call(e,t)},G.prototype.listenerCount=U,G.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};let H=null;const B=Object.freeze({el:null,animate:!0,animateClass:"fade",animateInClass:"show",appendTo:"body",backdrop:!0,keyboard:!0,title:!1,header:!0,content:!1,footer:!0,buttons:null,headerClose:!0,construct:!1,transition:300,backdropTransition:150}),z=function e(t){for(let r in t)Array.isArray(t[r])?t[r].forEach((t=>{e(t)})):null!==t[r]&&"object"==typeof t[r]&&Object.freeze(t[r]);return Object.freeze(t)}({dialog:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}],alert:[{text:"OK",attr:{class:"btn btn-primary","data-dismiss":"modal"}}],confirm:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}]}),$={container:'<div class="modal"></div>',dialog:'<div class="modal-dialog"></div>',content:'<div class="modal-content"></div>',header:'<div class="modal-header"></div>',headerClose:'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',body:'<div class="modal-body"></div>',footer:'<div class="modal-footer"></div>',backdrop:'<div class="modal-backdrop"></div>'};function W(e,t,r){let o="data",s=e[o]||{};if(void 0===r){if(e[o]&&e[o][t])return e[o][t];var n=e.getAttribute(`${o}-${t}`);return void 0!==n?n:null}return s[t]=r,e[o]=s,e}function Z(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),H||(H=document.createElement("div")),H.innerHTML="",H.innerHTML=e,!0===t?H.childNodes:H.childNodes[0])}function K(e){let t=[e];for(;e.parentNode;)e=e.parentNode,t.push(e);return t}class J extends G{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},$,J._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},z,J._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},B,J._baseOptions||{})}static get version(){return"0.12.0"}static alert(e,t={}){let r=Object.assign({},B,{title:e,content:!1,construct:!0,headerClose:!1,buttons:J.buttons.alert},t);return new J(r)}static confirm(e,t={}){let r=Object.assign({},B,{title:e,content:!1,construct:!0,headerClose:!1,buttons:J.buttons.confirm},t);return new J(r)}constructor(e={}){if(super(),this.id=(65536*(1+Math.random())|0).toString(16)+(65536*(1+Math.random())|0).toString(16),this.el=null,this._html={},this._events={},this._visible=!1,this._pointerInContent=!1,this._options=Object.assign({},J.options,e),this._templates=Object.assign({},J.templates,e.templates||{}),this._html.appendTo=document.querySelector(this._options.appendTo),this._scrollbarWidth=function(){let e,t,r,o=document.createElement("div");return Object.assign(o.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(o),r=o.offsetWidth,o.style.overflow="scroll",e=document.createElement("div"),e.style.width="100%",o.appendChild(e),t=r-e.offsetWidth,document.body.removeChild(o),t}(),null===this._options.buttons&&(this._options.buttons=J.buttons.dialog),this._options.el){let e=this._options.el;if("string"==typeof this._options.el&&(e=document.querySelector(this._options.el),!e))throw new Error(`Selector: DOM Element ${this._options.el} not found.`);W(e,"modal",this),this.el=e}else this._options.construct=!0;this._options.construct?this._render():this._mapDom()}_render(){let e=this._html,t=this._options,r=this._templates,o=!!t.animate&&t.animateClass;return e.container=Z(r.container),e.dialog=Z(r.dialog),e.content=Z(r.content),e.header=Z(r.header),e.headerClose=Z(r.headerClose),e.body=Z(r.body),e.footer=Z(r.footer),o&&e.container.classList.add(o),this._setHeader(),this._setContent(),this._setFooter(),this.el=e.container,e.dialog.appendChild(e.content),e.container.appendChild(e.dialog),this}_mapDom(){let e=this._html,t=this._options;return this.el.classList.contains(t.animateClass)&&(t.animate=!0),e.container=this.el,e.dialog=this.el.querySelector(".modal-dialog"),e.content=this.el.querySelector(".modal-content"),e.header=this.el.querySelector(".modal-header"),e.headerClose=this.el.querySelector(".modal-header .close"),e.body=this.el.querySelector(".modal-body"),e.footer=this.el.querySelector(".modal-footer"),this._setHeader(),this._setContent(),this._setFooter(),this}_setHeader(){let e=this._html,t=this._options;t.header&&e.header&&(t.title.nodeName?e.header.innerHTML=t.title.outerHTML:"string"==typeof t.title&&(e.header.innerHTML=`<h4 class="modal-title">${t.title}</h4>`),null===this.el&&e.headerClose&&t.headerClose&&e.header.appendChild(e.headerClose),t.construct&&e.content.appendChild(e.header))}_setContent(){let e=this._html,t=this._options;t.content&&e.body&&("string"==typeof t.content?e.body.innerHTML=t.content:e.body.innerHTML=t.content.outerHTML,t.construct&&e.content.appendChild(e.body))}_setFooter(){let e=this._html,t=this._options;t.footer&&e.footer&&(t.footer.nodeName?e.footer.ineerHTML=t.footer.outerHTML:"string"==typeof t.footer?e.footer.innerHTML=t.footer:e.footer.children.length||t.buttons.forEach((t=>{let r=document.createElement("button");W(r,"button",t),r.innerHTML=t.text,r.setAttribute("type","button");for(let e in t.attr)r.setAttribute(e,t.attr[e]);e.footer.appendChild(r)})),t.construct&&e.content.appendChild(e.footer))}_setEvents(){this._options;let e=this._html;this._events.keydownHandler=this._handleKeydownEvent.bind(this),document.body.addEventListener("keydown",this._events.keydownHandler),this._events.mousedownHandler=this._handleMousedownEvent.bind(this),e.container.addEventListener("mousedown",this._events.mousedownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}_handleMousedownEvent(e){this._pointerInContent=!1,K(e.target).every((e=>!e.classList||!e.classList.contains("modal-content")||(this._pointerInContent=!0,!1)))}_handleClickEvent(e){K(e.target).every((t=>"HTML"!==t.tagName&&((!0===this._options.backdrop||!t.classList.contains("modal"))&&(!t.classList.contains("modal-content")&&("modal"===t.getAttribute("data-dismiss")?(this.emit("dismiss",this,e,W(e.target,"button")),this.hide(),!1):!(!this._pointerInContent&&t.classList.contains("modal"))||(this.emit("dismiss",this,e,null),this.hide(),!1)))))),this._pointerInContent=!1}_handleKeydownEvent(e){27===e.which&&this._options.keyboard&&(this.emit("dismiss",this,e,null),this.hide())}_handleResizeEvent(e){this._resize()}show(){let e=this._options,t=this._html;return this.emit("show",this),this._checkScrollbar(),this._setScrollbar(),document.body.classList.add("modal-open"),e.construct&&t.appendTo.appendChild(t.container),t.container.style.display="block",t.container.scrollTop=0,!1!==e.backdrop?(this.once("showBackdrop",(()=>{this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)})),this._backdrop()):(this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)),this._resize(),this}toggle(){this._visible?this.hide():this.show()}_resize(){var e=this._html.container.scrollHeight>document.documentElement.clientHeight;this._html.container.style.paddingLeft=!this.bodyIsOverflowing&&e?this._scrollbarWidth+"px":"",this._html.container.style.paddingRight=this.bodyIsOverflowing&&!e?this._scrollbarWidth+"px":""}_backdrop(){let e=this._html,t=this._templates,r=this._options,o=!!r.animate&&r.animateClass;e.backdrop=Z(t.backdrop),o&&e.backdrop.classList.add(o),e.appendTo.appendChild(e.backdrop),o&&e.backdrop.offsetWidth,e.backdrop.classList.add(r.animateInClass),setTimeout((()=>{this.emit("showBackdrop",this)}),this._options.backdropTransition)}hide(){let e=this._html,t=this._options,r=e.container.classList;if(this.emit("hide",this),r.remove(t.animateInClass),t.backdrop){e.backdrop.classList.remove(t.animateInClass)}return this._removeEvents(),setTimeout((()=>{document.body.classList.remove("modal-open"),document.body.style.paddingRight=this.originalBodyPad}),t.backdropTransition),setTimeout((()=>{t.backdrop&&e.backdrop.parentNode.removeChild(e.backdrop),e.container.style.display="none",t.construct&&e.container.parentNode.removeChild(e.container),this._visible=!1,this.emit("hidden",this)}),t.transition),this}_removeEvents(){this._events.keydownHandler&&document.body.removeEventListener("keydown",this._events.keydownHandler),this._html.container.removeEventListener("mousedown",this._events.mousedownHandler),this._html.container.removeEventListener("click",this._events.clickHandler),window.removeEventListener("resize",this._events.resizeHandler)}_checkScrollbar(){this.bodyIsOverflowing=document.body.clientWidth<window.innerWidth}_setScrollbar(){if(this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing){let e=parseInt(this.originalBodyPad||0,10);document.body.style.paddingRight=e+this._scrollbarWidth+"px"}}}let X={};const Y=new Set,Q=e=>"exceptions"in e?e.exceptions.map((e=>e.text)).join(","):"",ee=(e,t=null,r="")=>{if(Y.has(r))return;Y.add(r);let o=`<b>Error: ${e}</b>`;t&&t.message!==e&&(o+=`. ${t.message}`);const s=J.alert(o,X);s.show(),s.on("hidden",(()=>{Y.delete(r)}))},te={labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Failed to get data from GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer",transaction:"Error when doing Transaction with GeoServer",getFeatures:"Error getting elements from GeoServer"}},re={es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"Capa no encontrada",layerNotVisible:"La capa no está visible",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer",transaction:"Error al hacer transacción con el GeoServer",getFeatures:"Error al obtener elemento desde el GeoServer"}},en:te,zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素.",transaction:"GeoServer处理事务出错.",getFeatures:"从GeoServer获取元素出错."}}};let oe=te;let se;const ne=(e=!0)=>{e?se.classList.add("ol-wfst--tools-control--loading-show"):se.classList.remove("ol-wfst--tools-control--loading-show")},ie=(e,t,r=[])=>{const o=Object.getOwnPropertyDescriptors(t);for(let e of r)delete o[e];Object.defineProperties(e,o)},ae=(e,t=[e])=>{const r=Object.getPrototypeOf(e);return null===r?t:ae(r,[...t,r])},le=(e,t,r=[])=>{var o;const s=null!==(o=((...e)=>{if(0===e.length)return;let t;const r=e.map((e=>ae(e)));for(;r.every((e=>e.length>0));){const e=r.map((e=>e.pop())),o=e[0];if(!e.every((e=>e===o)))break;t=o}return t})(...e))&&void 0!==o?o:Object.prototype,n=Object.create(s),i=ae(s);for(let t of e){let e=ae(t);for(let t=e.length-1;t>=0;t--){let o=e[t];-1===i.indexOf(o)&&(ie(n,o,["constructor",...r]),i.push(o))}}return n.constructor=t,n},ce=e=>e.filter(((t,r)=>e.indexOf(t)==r)),de=new Map,ue=e=>de.get(e),he=(e,t)=>{var r,o;const s=ce([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),n={};for(let i of s)n[i]=ce([...null!==(r=null==e?void 0:e[i])&&void 0!==r?r:[],...null!==(o=null==t?void 0:t[i])&&void 0!==o?o:[]]);return n},pe=(e,t)=>{var r,o,s,n;return{property:he(null!==(r=null==e?void 0:e.property)&&void 0!==r?r:{},null!==(o=null==t?void 0:t.property)&&void 0!==o?o:{}),method:he(null!==(s=null==e?void 0:e.method)&&void 0!==s?s:{},null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{})}},me=new Map,ge=(...e)=>{const t=((...e)=>{var t;const r=new Set,o=new Set([...e]);for(;o.size>0;)for(let e of o){const s=[...ae(e.prototype).map((e=>e.constructor)),...null!==(t=ue(e))&&void 0!==t?t:[]].filter((e=>!r.has(e)));for(let e of s)o.add(e);r.add(e),o.delete(e)}return[...r]})(...e).map((e=>me.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var r,o,s,n,i,a;return{class:ce([...null!==(r=null==e?void 0:e.class)&&void 0!==r?r:[],...null!==(o=null==t?void 0:t.class)&&void 0!==o?o:[]]),static:pe(null!==(s=null==e?void 0:e.static)&&void 0!==s?s:{},null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{}),instance:pe(null!==(i=null==e?void 0:e.instance)&&void 0!==i?i:{},null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{})}})(e,t)))};function fe(...e){var t,r,o;const s=e.map((e=>e.prototype));function n(...t){for(const r of e)ie(this,new r(...t))}n.prototype=le(s,n),Object.setPrototypeOf(n,le(e,null,["prototype"]));let i=n;{const s=ge(...e);for(let e of null!==(t=null==s?void 0:s.class)&&void 0!==t?t:[]){const t=e(i);t&&(i=t)}ye(null!==(r=null==s?void 0:s.static)&&void 0!==r?r:{},i),ye(null!==(o=null==s?void 0:s.instance)&&void 0!==o?o:{},i.prototype)}var a,l;return a=i,l=e,de.set(a,l),i}const ye=(e,t)=>{const r=e.property,o=e.method;if(r)for(let e in r)for(let o of r[e])o(t,e);if(o)for(let e in o)for(let r of o[e])r(t,e,Object.getOwnPropertyDescriptor(t,e))};var ve,be;let _e;!function(e){e.Point="Point",e.LineString="LineString",e.LinearRing="LinearRing",e.Polygon="Polygon",e.MultiPoint="MultiPoint",e.MultiLineString="MultiLineString",e.MultiPolygon="MultiPolygon",e.GeometryCollection="GeometryCollection",e.Circle="Circle"}(ve||(ve={})),function(e){e.Insert="insert",e.Delete="delete",e.Update="update"}(be||(be={}));let Se=null,we=null;var Ee;function Ce(e=null){we=e}function ke(){return we}!function(e){e.Edit="EDIT",e.Draw="DRAW"}(Ee||(Ee={}));const Pe=new Set,Fe={};function je(){return _e}function Te(e){Se=e}function Ae(){return Se}function Le(){return Fe}function Oe(e){return Le()[e]}function Me(e){Pe.add(String(e.getId()))}function Ne(e){Pe.delete(String(e.getId()))}function Ie(e){return Pe.has(String(e.getId()))}class xe extends m{_init(){const e=this.getGeoserver();e.isLoaded()?this.getAndUpdateDescribeFeatureType():e.on("change:capabilities",(async()=>{this.getAndUpdateDescribeFeatureType()}))}async getAndUpdateDescribeFeatureType(){const e=this.get(Ge.NAME),t=this.get(Ge.LABEL);try{const t=this.getGeoserver(),r=new URLSearchParams({service:"wfs",version:t.getAdvanced().describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),o=t.getUrl()+"?"+r.toString(),s=await fetch(o,{headers:t.getHeaders(),credentials:t.getCredentials()});if(!s.ok)throw new Error("");const n=await s.json();if(!n)throw new Error("");if(n.exceptions)throw new Error(Q(n));const i=n.targetNamespace,a=n.featureTypes[0].properties,l=a.find((e=>e.type.indexOf("gml:")>=0));n._parsed={namespace:i,properties:a,geomType:l.localType,geomField:l.name},this.set(Ge.DESCRIBEFEATURETYPE,n)}catch(r){console.error(r),ee(`${oe.errors.layer} "${t}"`,r,e)}}isVisibleByZoom(){return je().getView().getZoom()>this.getMinZoom()}async transactFeatures(e,t){return this.getGeoserver().transact(e,t,this.get(Ge.NAME))}async insertFeatures(e){return this.transactFeatures(be.Insert,e)}async maybeLockFeature(e){const t=this.getGeoserver();return t.getUseLockFeature()&&t.hasLockFeature()?await t.lockFeature(e,this.get(Ge.NAME)):null}getGeoserver(){return this.get(Ge.GEOSERVER)}getDescribeFeatureType(){return this.get(Ge.DESCRIBEFEATURETYPE)}}var Ge;!function(e){e.NAME="name",e.LABEL="label",e.DESCRIBEFEATURETYPE="describeFeatureType",e.ISVISIBLE="isVisible",e.GEOSERVER="geoserver"}(Ge||(Ge={}));class De extends f{constructor(e){super(Object.assign(Object.assign({},e),{format:new g,loader:async(t,r,o,s,n)=>{try{if(e.strategy==v.bbox){const r=y.transformExtent(t,o.getCode(),e.geoServerAdvanced.projection);this.urlParams.set("bbox",r.toString()+`,${e.geoServerAdvanced.projection}`)}const r=e.geoserverUrl+"?"+this.urlParams.toString(),n=await fetch(r,{headers:e.headers,credentials:e.credentials});if(!n.ok)throw new Error("");const i=await n.json();if(i.exceptions)throw new Error(Q(i));const a=this.getFormat().readFeatures(i,{featureProjection:o.getCode(),dataProjection:e.geoServerAdvanced.projection});a.forEach((t=>{t.set("_layerName_",e.name,!0)})),this.addFeatures(a),s(a)}catch(r){this.removeLoadedExtent(t),ee(oe.errors.geoserver,r,e.name),n()}}})),this.urlParams=new URLSearchParams({SERVICE:"wfs",REQUEST:"GetFeature",OUTPUTFORMAT:"application/json",EXCEPTIONS:"application/json"}),this.urlParams.set("version",e.geoServerAdvanced.getFeatureVersion),this.urlParams.set("typename",e.name),this.urlParams.set("srsName",e.geoServerAdvanced.projection.toString())}}class Re extends(fe(xe,p)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature);const t=e.geoserver,r=new De(Object.assign(Object.assign({name:e.name,headers:t.getHeaders(),credentials:t.getCredentials(),geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced()},e.strategy&&{strategy:e.strategy}),{geoserverVendor:e.geoserverVendor}));this._loadingCount=0,this._loadedCount=0,r.on("featuresloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&ne()})),r.on(["featuresloadend","featuresloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(r);const o=e.geoserverVendor;Object.keys(o).forEach((e=>{r.urlParams.set(e,o[e])}))}refresh(){this.getSource().refresh()}setCustomParam(e,t=null,r=!0){const o=this.getSource();return null==t?o.urlParams.delete(e):o.urlParams.set(e,t),r&&this.refresh(),o.urlParams}}var Ve=2,Ue=3;class qe extends _{constructor(e){super(Object.assign({url:e.geoserverUrl,serverType:"geoserver",params:Object.assign({SERVICE:"wms",TILED:!0,LAYERS:e.name,EXCEPTIONS:"application/json"},e.geoserverVendor&&e.geoserverVendor),tileLoadFunction:async(t,r)=>{try{const s=await fetch(r,{headers:e.headers,credentials:e.credentials});if(!s.ok)throw new Error("");let n=await s.blob();if("application/json"==n.type){const e=await(o=n,new Promise((e=>{const t=new FileReader;t.onloadend=()=>e(JSON.parse(t.result)),t.readAsText(o)})));throw new Error(Q(e))}t.getImage().src=URL.createObjectURL(n),t.setState(Ve)}catch(r){ee(oe.errors.geoserver,r,e.name),t.setState(Ue)}var o}},e))}}class He extends(fe(xe,b)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,this._getFullResGeometryById=async e=>{const t=new URLSearchParams({SERVICE:"wfs",VERSION:"2.0.0",INFO_FORMAT:"application/json",REQUEST:"GetFeature",TYPENAME:this.get("name"),MAXFEATURES:"1",OUTPUTFORMAT:"application/json",SRSNAME:je().getView().getProjection().getCode(),FEATUREID:String(e)}),r=this.getSource().getUrls()[0]+"?"+t.toString();try{const e=this.getGeoserver(),t=await fetch(r,{headers:e.getHeaders(),credentials:e.getCredentials()});if(!t.ok)throw new Error(`${oe.errors.getFeatures} ${t.status}`);const o=await t.json();return this._parseFeaturesFromResponse(o)}catch(e){return console.error(e),!1}},e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature),this._formatGeoJSON=new g;const t=e.geoserver,r=new qe({name:e.name,headers:t.getHeaders(),credentials:t.getCredentials(),geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,r.on("tileloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&ne()})),r.on(["tileloadend","tileloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(r)}async _getFeaturesByClickEvent(e){const t=e.coordinate,r=je().getView(),o=r.getZoom()>10?10:5,s=this.getSource(),n=s["getFeatureInfoUrl"in s?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](t,r.getResolution(),r.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:o,FEATURE_COUNT:1,EXCEPTIONS:"application/json"}),i=this.getGeoserver();try{const e=await fetch(n,{headers:i.getHeaders(),credentials:i.getCredentials()});if(!e.ok)throw new Error(`${oe.errors.getFeatures} ${e.status}`);const t=await e.json();let r=this._parseFeaturesFromResponse(t);const o=r.map((e=>e.getId())),s=await this._getFullResGeometryById(o);return s&&(r=s),r}catch(e){ee(e.message,e)}}_parseFeaturesFromResponse(e){return this._formatGeoJSON.readFeatures(e)}refresh(){const e=this.getSource();e.refresh();const t=e.getParams();t.t=(new Date).getMilliseconds(),e.updateParams(t)}setCustomParam(e,t=null,r=!0){const o=this.getSource();return o.updateParams({[e]:t}),r&&this.refresh(),o.getParams()}}function Be(e,t={},...r){if("function"==typeof e)return e(t,r);const o=null===e?new DocumentFragment:document.createElement(e);Object.entries(t||{}).forEach((([e,t])=>{null!=t&&void 0!==t&&(e.startsWith("on")&&e.toLowerCase()in window?o.addEventListener(e.toLowerCase().substr(2),t):"className"===e?o.setAttribute("class",t.toString()):"htmlFor"===e?o.setAttribute("for",t.toString()):o.setAttribute(e,t.toString()))}));for(const e of r)e&&(Array.isArray(e)?o.append(...e):void 0===e.nodeType?o.innerHTML+=e:o.appendChild(e));return o}const ze=()=>{const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")};class $e extends h{constructor(e,t){super(),this._uploads=e,this._uploadFormats=t}addLayerEl(e){const t=document.querySelector(".wfst--tools-control--select-layers"),r=e.get(Ge.NAME),o=e===Ae()?{checked:!0}:{},s=Be("input",Object.assign({value:r,id:`wfst--${r}`,type:"radio",className:"ol-wfst--tools-control-input",name:"wfst--select-layer"},o,{onChange:t=>this._layerChangeHandler(t,e)})),n=Be("div",{className:`wfst--layer-control \n ${e.getVisible()?"ol-wfst--visible-on":""}\n ${e===Ae()?"ol-wfst--selected-on":""}`,"data-layer":r},Be("div",{className:"ol-wfst--tools-control-visible"},Be("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on",title:oe.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e"})),Be("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off",title:oe.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e"}))),Be("label",{htmlFor:`wfst--${r}`},s,Be("span",{title:e.getDescribeFeatureType()._parsed.geomType},e.get(Ge.LABEL))));return t.appendChild(n),e===Ae()&&s.dispatchEvent(new Event("change")),n}_changeStateSelect(e,t=null){const r=(e,t)=>{Array.from(o.options).forEach((r=>{r.selected=r.value===e,r.disabled="all"!==t&&!t.includes(r.value),r.title=r.disabled?oe.labels.geomTypeNotSupported:""}))},o=document.querySelector(".wfst--tools-control--select-draw");let s;if(o){const n=e.getDescribeFeatureType()._parsed.geomType;t?s=o.value:n===ve.GeometryCollection?(s=ve.LineString,r(s,"all")):n===ve.LinearRing?(s=ve.LineString,r(s,[ve.Circle,ve.LinearRing,ve.Polygon]),o.value=s):(s=n,r(s,[n]))}return s}_visibilityClickHandler(e){const t=e.currentTarget.closest(".wfst--layer-control"),r=t.dataset.layer;t.classList.toggle("ol-wfst--visible-on");const o=Le()[r];t.classList.contains("ol-wfst--visible-on")?o.setVisible(!0):o.setVisible(!1)}_layerChangeHandler(e,t){const r=e.currentTarget.closest(".wfst--layer-control"),o=document.querySelector(".ol-wfst--selected-on");o&&o.classList.remove("ol-wfst--selected-on"),r.classList.add("ol-wfst--selected-on"),Te(t),this._changeStateSelect(t)}render(){return Be(null,null,Be("div",{className:"wfst--tools-control--head"},this._uploads&&Be("div",null,Be("input",{id:"ol-wfst--upload",type:"file",accept:this._uploadFormats,onChange:e=>this._uploads.process(e)}),Be("label",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",htmlFor:"ol-wfst--upload",title:oe.labels.uploadToLayer},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e"}))),Be("div",{className:"ol-wfst--tools-control-draw-cnt"},Be("button",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",type:"button",title:oe.labels.addElement,onClick:()=>{this.dispatchEvent("drawMode")}},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e"})),Be("select",{title:oe.labels.selectDrawType,className:"wfst--tools-control--select-draw",onChange:e=>{const t=e.target.value;this._changeStateSelect(Ae(),t),this.dispatchEvent("changeGeom")}},[ve.Point,ve.MultiPoint,ve.LineString,ve.MultiLineString,ve.Polygon,ve.MultiPolygon,ve.Circle].map((e=>Be("option",{value:e},e)))))),Be("div",{className:"wfst--tools-control--select-layers"}))}}let We=new p({source:new f,zIndex:100});const Ze=()=>We;class Ke extends h{constructor(e){super(),this._options=e,this._processUpload=e.processUpload,this._formatWFS=new E,this._formatGeoJSON=new g,this._formatKml=new w({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer}async process(e){const t=je().getView(),r=e.target.files[0];let o;if(!r)return;const s=r.name.split(".").pop().toLowerCase();try{if(this._processUpload&&(o=this._processUpload(r)),!o){const e=await this._fileReader(r);"geojson"===s||"json"===s?o=this._formatGeoJSON.readFeatures(e,{featureProjection:t.getProjection().getCode()}):"kml"===s?o=this._formatKml.readFeatures(e,{featureProjection:t.getProjection().getCode()}):ee(oe.errors.badFormat)}let n=0,i=0;const a=[];for(let e of o)this._checkGeometry(e)||(e=this._fixGeometry(e)),e?(a.push(e),i++):n++;if(i){ze(),this.dispatchEvent(new f.VectorSourceEvent("loadedFeatures",null,a));const e=`\n ${oe.labels.validFeatures}: ${i}<br>\n ${n?`${oe.labels.invalidFeatures}: ${n}`:""}`;this._initModal(e,a)}else ee(oe.errors.noValidGeometry);e.target.value=null}catch(e){ee(oe.errors.badFile,e)}}async _fileReader(e){return new Promise(((t,r)=>{const o=new FileReader;o.addEventListener("load",(async e=>{const r=e.target.result;t(r)})),o.addEventListener("error",(e=>{console.error("Error"+e),r()})),o.readAsText(e)}))}_fixGeometry(e){const t=Ae().getDescribeFeatureType()._parsed.geomType;let r;switch(e.getGeometry().getType()){case ve.Point:if(t===ve.MultiPoint){const t=e.getGeometry().getCoordinates();r=new S.MultiPoint([t])}break;case ve.LineString:if(t===ve.MultiLineString){const t=e.getGeometry().getCoordinates();r=new S.MultiLineString([t])}break;case ve.Polygon:if(t===ve.MultiPolygon){const t=e.getGeometry().getCoordinates();r=new S.MultiPolygon([t])}break;default:r=null}return r?(e.setGeometry(r),e):null}_checkGeometry(e){const t=Ae().getDescribeFeatureType()._parsed.geomType,r=e.getGeometry().getType();return t===ve.GeometryCollection||r===t}_initModal(e,t){const r=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${oe.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${oe.labels.upload}\n </button>\n `;new J(Object.assign(Object.assign({},this._options.modal),{header:!0,headerClose:!1,title:oe.labels.uploadFeatures+" "+Ae().get(Ge.NAME),content:e,backdrop:"static",footer:r})).show().on("dismiss",((e,r)=>{"save"===r.target.dataset.action?this.dispatchEvent(new f.VectorSourceEvent("addedFeatures",null,t)):Ze().getSource().clear()}))}}const Je=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((r=>{const o=t[r],s=e[r];e[r]=s&&o&&"object"==typeof s&&"object"==typeof o&&!Array.isArray(s)?Je(s,o):o}))})),e);class Xe extends s{constructor(e){super({element:Be("div",{className:"ol-wfst--changes-control"},Be("div",{className:"ol-wfst--changes-control-el"},Be("div",{className:"ol-wfst--changes-control-id"},Be("b",null,oe.labels.editMode)," -"," ",Be("i",null,String(e.getId()))),Be("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("cancel",e))}},oe.labels.cancel),Be("button",{type:"button",className:"btn btn-sm btn-primary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("apply",e))}},oe.labels.apply),Be("button",{type:"button",className:"btn btn-sm btn-danger-outline",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("delete",e))}},oe.labels.delete)))})}}function Ye(e){const t=e=>{let t=e.getGeometry();t instanceof S.GeometryCollection&&(t=t.getGeometries()[0]);const r=t.getCoordinates();let o=null;if(o=t instanceof S.Polygon||t instanceof S.MultiLineString?r.flat(1):t instanceof S.MultiPolygon?r.flat(2):r,o&&o.length)return new S.MultiPoint(o)};let r=e.getGeometry(),o=r.getType();switch(r instanceof S.GeometryCollection&&(r=r.getGeometries()[0],o=r.getType()),o){case ve.Point:case ve.MultiPoint:return ke()===Ee.Edit?[new C.Style({image:new C.Circle({radius:6,fill:new C.Fill({color:"#000000"})})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"})})})]:[new C.Style({image:new C.Circle({radius:5,fill:new C.Fill({color:"#ff0000"})})}),new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})})})];default:return ke()==Ee.Draw||ke()==Ee.Edit?[new C.Style({stroke:new C.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"}),stroke:new C.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"#ff0000",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}class Qe extends h{constructor(e){super(),this._options=e;const t=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${oe.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${oe.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${oe.labels.save}\n </button>\n `;this._modal=new J(Object.assign(Object.assign({},this._options),{header:!0,headerClose:!0,title:"",content:"<div></div>",footer:t})),this._modal.on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,r=e.name;this._feature.set(r,t,!0)})),this._feature.changed(),Me(this._feature),this.dispatchEvent(new f.VectorSourceEvent("save",this._feature))}else"delete"===t.target.dataset.action&&this.dispatchEvent(new f.VectorSourceEvent("delete",this._feature))}))}show(e){this._feature=e;const t=`${oe.labels.editElement} ${e.getId()} `,r=e.getProperties(),o=Oe(e.get("_layerName_")).getDescribeFeatureType()._parsed.properties;let s='<form autocomplete="false">';Object.keys(r).forEach((e=>{const t=o.find((t=>t.name===e));if(t){let o;switch(t.type){case"xsd:string":default:o="text";break;case"xsd:number":case"xsd:int":o="number";break;case"xsd:date-time":o="datetime"}o&&(s+=`\n <div class="ol-wfst--input-field-container">\n <label class="ol-wfst--input-field-label" for="${e}">${e}</label>\n <input placeholder="NULL" class="ol-wfst--input-field-input" type="${o}" name="${e}" value="${r[e]||""}">\n </div>`)}})),s+="</form>",this._modal._html.body.innerHTML=s,this._modal._html.header.innerHTML=t,this._modal.show()}}const et=[null,"http://www.opengis.net/fes/2.0","http://www.opengis.net/ows/1.1","http://www.opengis.net/wfs/2.0"],tt=L.makeStructureNS(et,{ServiceIdentification:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},rt,e,t)})),ServiceProvider:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},ot,e,t)})),OperationsMetadata:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},st,e,t)})),FeatureTypeList:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],ct,e,t)})),Filter_Capabilities:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},bt,e,t)}))});const rt=L.makeStructureNS(et,{Title:L.makeObjectPropertySetter(M.readString),Abstract:L.makeObjectPropertySetter(M.readString),Keywords:L.makeObjectPropertySetter(Gt),ServiceType:L.makeObjectPropertySetter(M.readString),ServiceTypeVersion:L.makeObjectPropertySetter(M.readString),Fees:L.makeObjectPropertySetter(M.readString),AccessConstraints:L.makeObjectPropertySetter(M.readString)}),ot=L.makeStructureNS(et,{ProviderName:L.makeObjectPropertySetter(M.readString),ServiceContact:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},nt,e,t)}))}),st=L.makeStructureNS(et,{Operation:L.makeObjectPropertyPusher((function(e,t){const r=function(e,t){return L.pushParseAndPop({},ut,e,t)}(e,t);if(r)return r.name=e.getAttribute("name"),r;return})),Constraint:L.makeObjectPropertyPusher(It)}),nt=L.makeStructureNS(et,{IndividualName:L.makeObjectPropertySetter(M.readString),PositionName:L.makeObjectPropertySetter(M.readString),ContactInfo:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},it,e,t)}))}),it=L.makeStructureNS(et,{Phone:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},at,e,t)})),Address:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},lt,e,t)}))}),at=L.makeStructureNS(et,{Voice:L.makeObjectPropertySetter(M.readString),Facsimile:L.makeObjectPropertySetter(M.readString)}),lt=L.makeStructureNS(et,{DeliveryPoint:L.makeObjectPropertySetter(M.readString),City:L.makeObjectPropertySetter(M.readString),AdministrativeArea:L.makeObjectPropertySetter(M.readString),PostalCode:L.makeObjectPropertySetter(M.readString),Country:L.makeObjectPropertySetter(M.readString),ElectronicMailAddress:L.makeObjectPropertySetter(M.readString)}),ct=L.makeStructureNS(et,{FeatureType:L.makeArrayPusher((function(e,t){return L.pushParseAndPop({},dt,e,t)}))}),dt=L.makeStructureNS(et,{Name:L.makeObjectPropertySetter(M.readString),Title:L.makeObjectPropertySetter(M.readString),Abstract:L.makeObjectPropertySetter(M.readString),Keywords:L.makeObjectPropertySetter(Gt),DefaultCRS:L.makeObjectPropertySetter(M.readString),WGS84BoundingBox:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},gt,e,t)})),MetadataURL:L.makeObjectPropertySetter(O.readHref)}),ut=L.makeStructureNS(et,{DCP:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},ft,e,t)})),Parameter:L.makeObjectPropertyPusher((function(e,t){const r=function(e,t){return L.pushParseAndPop({},ht,e,t)}(e,t);if(r)return r.name=e.getAttribute("name"),r;return}))}),ht=L.makeStructureNS(et,{AllowedValues:L.makeObjectPropertySetter(Dt)}),pt=L.makeStructureNS(et,{NoValues:L.makeObjectPropertySetter(M.readString),DefaultValue:L.makeObjectPropertySetter(M.readString),AllowedValues:L.makeObjectPropertySetter(Dt)}),mt=L.makeStructureNS(et,{Get:L.makeObjectPropertySetter(O.readHref),Post:L.makeObjectPropertySetter(O.readHref)}),gt=L.makeStructureNS(et,{LowerCorner:L.makeObjectPropertySetter(Rt),UpperCorner:L.makeObjectPropertySetter(Rt)}),ft=L.makeStructureNS(et,{HTTP:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},mt,e,t)}))}),yt=L.makeStructureNS(et,{Keyword:L.makeArrayPusher(M.readString)}),vt=L.makeStructureNS(et,{Value:L.makeArrayPusher(M.readString)}),bt=L.makeStructureNS(et,{Conformance:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},_t,e,t)})),Id_Capabilities:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},St,e,t)})),Scalar_Capabilities:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},wt,e,t)})),Spatial_Capabilities:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},Et,e,t)})),Temporal_Capabilities:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop({},Ct,e,t)})),Functions:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],kt,e,t)}))}),_t=L.makeStructureNS(et,{Constraint:L.makeObjectPropertyPusher(It)}),St=L.makeStructureNS(et,{ResourceIdentifier:L.makeObjectPropertySetter((function(e){return{name:e.getAttribute("name")}}))}),wt=L.makeStructureNS(et,{LogicalOperators:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Tt,e,t)})),ComparisonOperators:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],At,e,t)}))}),Et=L.makeStructureNS(et,{GeometryOperands:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Lt,e,t)})),SpatialOperators:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Ot,e,t)}))}),Ct=L.makeStructureNS(et,{TemporalOperands:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Mt,e,t)})),TemporalOperators:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Nt,e,t)}))}),kt=L.makeStructureNS(et,{Function:L.makeArrayPusher((function(e,t){const r=function(e,t){return L.pushParseAndPop({},Pt,e,t)}(e,t);if(r)return r.name=e.getAttribute("name"),r;return}))}),Pt=L.makeStructureNS(et,{Returns:L.makeObjectPropertySetter(M.readString),Arguments:L.makeObjectPropertySetter((function(e,t){return L.pushParseAndPop([],Ft,e,t)}))}),Ft=L.makeStructureNS(et,{Argument:L.makeArrayPusher((function(e,t){const r=function(e,t){return L.pushParseAndPop({},jt,e,t)}(e,t);if(r)return r.name=e.getAttribute("name"),r;return}))}),jt=L.makeStructureNS(et,{Type:L.makeObjectPropertySetter(M.readString)}),Tt=L.makeStructureNS(et,{LogicalOperator:L.makeArrayPusher(xt)}),At=L.makeStructureNS(et,{ComparisonOperator:L.makeArrayPusher(xt)}),Lt=L.makeStructureNS(et,{GeometryOperand:L.makeArrayPusher(xt)}),Ot=L.makeStructureNS(et,{SpatialOperator:L.makeArrayPusher(xt)}),Mt=L.makeStructureNS(et,{TemporalOperand:L.makeArrayPusher(xt)}),Nt=L.makeStructureNS(et,{TemporalOperator:L.makeArrayPusher(xt)});function It(e,t){const r=function(e,t){return L.pushParseAndPop({},pt,e,t)}(e,t);if(r)return r.name=e.getAttribute("name"),r}function xt(e){return e.getAttribute("name")||void 0}function Gt(e,t){return L.pushParseAndPop([],yt,e,t)}function Dt(e,t){return L.pushParseAndPop([],vt,e,t)}function Rt(e){const t=L.getAllTextContent(e,!1).split(" ");if(t.length)return t.map((e=>Number(e)))}const Vt=new class extends A{constructor(){super(),this.version=void 0}readFromNode(e){this.version=e.getAttribute("version").trim();const t=L.pushParseAndPop({version:this.version},tt,e,[]);return t||null}};var Ut;!function(e){e.CAPABILITIES="capabilities",e.PARSED_CAPABILITIES="parsedCapabilities",e.URL="url",e.HEADERS="headers",e.CREDENTIALS="credentials",e.ADVANCED="advanced",e.HASTRASNACTION="hasTransaction",e.HASLOCKFEATURE="hasLockFeature",e.HASDESCRIBEFEATURETYPE="hasDescribeFeatureType",e.USELOCKFEATURE="useLockFeature",e.ISLOADED="isLoaded"}(Ut||(Ut={}));class qt extends I{constructor(e,t=null){super({id:e.getId(),position:t||N.getCenter(e.getGeometry().getExtent()),positioning:"center-center",offset:[0,-40],stopEvent:!0,element:Be("div",null,Be("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editFields")}},Be("button",{className:"ol-wfst--edit-button",type:"button",title:oe.labels.editFields},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e",alt:oe.labels.editFields}))),Be("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editGeom")}},Be("button",{class:"ol-wfst--edit-button",type:"button",title:oe.labels.editGeom},Be("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e",alt:oe.labels.editGeom}))))})}}const Ht=document.createElement("div");class Bt extends s{constructor(e){super({target:null,element:Ht,render:()=>{this._map||this._init()}}),this._initialized=!1,((e="en",t=null)=>{e in re&&(oe=re[e]),t&&(oe=Object.assign(Object.assign({},oe),t))})(e.language,e.i18n);const t={layers:null,evtType:"singleclick",active:!0,showControl:!0,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${oe.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=Je(t,e),Te(this._options.layers[0]),this._controlWidgetToolsDiv=Ht,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._uploads=new Ke(this._options),this._editFields=new Qe(this._options.modal)}getLayers(){return Object.values(Le())}getLayerByName(e=""){const t=Le();return e&&e in t?t[e]:null}async _initMapAndLayers(){try{const e=this._options.layers;if(e.length){let t=0,r=0;e.forEach((e=>{e.getVisible()&&r++,e.on("layerRendered",(()=>{t++,t>=r&&(this._initialized||(this.dispatchEvent("load"),this._initialized=!0),ne(!1))})),e.on("change:describeFeatureType",(()=>{const t=this._layersControl.addLayerEl(e);e.on("change:isVisible",(()=>{const r="ol-wfst--layer-not-visible";e.isVisibleByZoom()?t.classList.remove(r):t.classList.add(r)})),e.set(Ge.ISVISIBLE,this._currentZoom>e.getMinZoom()),this.dispatchEvent(new zt({type:"describeFeatureType",layer:e,data:e.getDescribeFeatureType()}))})),e._init(),this._map.addLayer(e),function(e){Object.assign(Fe,e)}({[e.get(Ge.NAME)]:e})})),this._createMapElements(this._options.showControl,this._options.active)}}catch(e){ne(!1),ee(e.message,e)}}_init(){var e,t;this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),e=this._map,_e=e,this._uploads.on("addedFeatures",(({features:e})=>{Ae().insertFeatures(e)})),this._uploads.on("loadedFeatures",(({features:e})=>{this.activateEditMode();const t=Ze().getSource();t.addFeatures(e),this._view.fit(t.getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})})),this._editFields.on("save",(({feature:e})=>{this._collectionModify.remove(e)})),this._editFields.dispose("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._addMapEvents(),t=this._options.modal,X=t,this._controlWidgetToolsDiv.append((se=document.createElement("div"),se.className="ol-wfst--tools-control--loading",se.innerHTML=oe.labels.loading,se)),this._initMapAndLayers()}async _createMapElements(e,t){this._prepareEditLayer(),this._addInteractions(),this._addInteractionHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}_addInteractions(){const s=()=>{this._collectionModify=new c,this._interactionWfsSelect=new a({hitTolerance:10,style:e=>Ye(e),toggleCondition:u.never,filter:(e,t)=>ke()!==Ee.Edit&&t&&t instanceof Re&&t===Ae()}),this._map.addInteraction(this._interactionWfsSelect),this._interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:r})=>{const o=r.coordinate;e.length&&e.forEach((e=>{if(!Ie(e)){const t=this._interactionWfsSelect.getLayer(e);t.getSource().removeFeature(e),this._addFeatureToEditMode(e,o,t.get(Ge.NAME))}})),t.length&&ke()!==Ee.Edit&&t.forEach((e=>{this._collectionModify.remove(e)}))}))},n=()=>{this._interactionSelectModify=new a({style:e=>Ye(e),layers:[Ze()],toggleCondition:u.never,removeCondition:()=>ke()===Ee.Edit}),this._map.addInteraction(this._interactionSelectModify),this._collectionModify=this._interactionSelectModify.getFeatures(),this._keyClickWms=this._map.on(this._options.evtType,(async e=>{if(!this._map.hasFeatureAtPixel(e.pixel)&&ke()!==Ee.Edit){const t=Ae();if(!t.getVisible()||!t.isVisibleByZoom()||t instanceof Re)return;const r=await t._getFeaturesByClickEvent(e);if(!(null==r?void 0:r.length))return;this._addFeatureToEditMode(r[0],e.coordinate,t.get(Ge.NAME))}}))};this._options.layers.find((e=>e instanceof Re))&&s(),this._options.layers.find((e=>e instanceof He))&&n(),this._interactionModify=new i({style:()=>ke()===Ee.Edit?new o({image:new e({radius:6,fill:new t({color:"#ff0000"}),stroke:new r({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>u.primaryAction(e)&&ke()===Ee.Edit}),this._map.addInteraction(this._interactionModify),this._interactionSnap=new l({source:Ze().getSource()}),this._map.addInteraction(this._interactionSnap)}_prepareEditLayer(){this._map.addLayer(Ze())}_addMapEvents(){(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})(),this._map.on("moveend",(()=>{if(this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom){const e=Le();Object.keys(e).forEach((t=>{const r=e[t];this._currentZoom>r.getMinZoom()?r.get(Ge.ISVISIBLE)||r.set(Ge.ISVISIBLE,!0):r.get(Ge.ISVISIBLE)&&r.set(Ge.ISVISIBLE,!1)})),this._lastZoom=this._currentZoom}}))}_addInteractionHandlers(){this._interactionModify.on("modifyend",(e=>{Me(e.features.item(0)),super.dispatchEvent(e)})),this._interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent()}_addMapControl(){this._layersControl=new $e(this._options.showUpload?this._uploads:null,this._options.uploadFormats),this._layersControl.on("drawMode",(()=>{if(ke()===Ee.Draw)ze(),this.activateEditMode();else{Ae().isVisibleByZoom()?this.activateDrawMode(Ae()):ee(oe.errors.layerNotVisible)}})),this._layersControl.on("changeGeom",(()=>{ke()===Ee.Draw&&this.activateDrawMode(Ae())}));const e=this._layersControl.render();this._selectDraw=e.querySelector(".wfst--tools-control--select-draw"),this._controlWidgetToolsDiv.append(e)}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");Le()[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){Ze().getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),r=this._options.layers.find((e=>e.get(Ge.NAME)===t));r instanceof Re&&this._interactionWfsSelect.getFeatures().remove(e),Ie(e)?r.transactFeatures(be.Update,e):(r instanceof Re&&this._restoreFeatureToLayer(e,t),this._removeFeatureFromTmpLayer(e))};this._keySelect=this._collectionModify.on("remove",(t=>{const r=t.element;this._deselectEditFeature(r),e(r),this._editModeOff()}))}_onRemoveFeatureEvent(){this._keyRemove=Ze().getSource().on("removefeature",(e=>{const t=e.feature;if(!t.get("_delete_"))return;this._keySelect&&h.unByKey(this._keySelect);const r=t.get("_layerName_");this.getLayerByName(r).transactFeatures(be.Delete,t),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_editModeOn(e){this._editFeatureOriginal=e.clone(),Ce(Ee.Edit),Ze().getSource().changed(),this._removeOverlayHelper(e),this._controlApplyDiscardChanges=new Xe(e),this._controlApplyDiscardChanges.on("cancel",(({feature:e})=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),Ne(e),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("apply",(({feature:e})=>{ne(),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){Ce(null),this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const r=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),Ze().getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_");this._options.layers.find((e=>e.get(Ge.NAME)===t))instanceof Re&&this._interactionWfsSelect.getFeatures().remove(e)};if(t){J.confirm(oe.labels.confirmDelete,Object.assign({},this._options.modal)).show().once("dismiss",(function(e,t,o){o&&o.value&&r()}))}else r()}_addFeatureToEditMode(e,t=null,r=null){if(this._collectionModify.getLength())return;r&&e.set("_layerName_",r);if((e?e.getProperties():"")&&e.getGeometry()){Ze().getSource().addFeature(e),this._collectionModify.push(e);const o=new qt(e,t);o.on("editFields",(()=>{this._editFields.show(e)})),o.on("editGeom",(()=>{this._editModeOn(e)})),this._map.addOverlay(o);const s=Oe(r);s&&s.maybeLockFeature(e.getId())}}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this._interactionDraw&&this._map.removeInteraction(this._interactionDraw);const t=this._selectDraw.value;this._interactionDraw=new n({source:Ze().getSource(),type:t,style:e=>Ye(e),stopClick:!0}),this._map.addInteraction(this._interactionDraw),this._interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this._interactionDraw.on("drawend",(t=>{const r=t.feature;e.transactFeatures(be.Insert,r),super.dispatchEvent(t)}))};if(this._interactionDraw||e){if(e){if(!e.getVisible())return;(()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-draw");e&&e.classList.add("wfst--active")})(),this._viewport.classList.add("draw-mode"),t(e)}else this._map.removeInteraction(this._interactionDraw),this._viewport.classList.remove("draw-mode");Ce(e?Ee.Draw:null)}}activateEditMode(e=!0){e?((()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active")})(),this.activateDrawMode(!1)):this._collectionModify.clear(),this._interactionSelectModify&&this._interactionSelectModify.setActive(e),this._interactionModify.setActive(e),this._interactionWfsSelect&&this._interactionWfsSelect.setActive(e)}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const r=this._map.getOverlayById(t);r&&this._map.removeOverlay(r)}}class zt extends d{constructor(e){super(e.type),this.layer=e.layer,this.data=e.data}}const $t={WfsLayer:Re,WmsLayer:He,Geoserver:class extends k{constructor(e){super();const t={url:null,advanced:{getCapabilitiesVersion:"2.0.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857",lockFeatureParams:{expiry:5,lockId:"GeoServer",releaseAction:"SOME"}},headers:{},credentials:"same-origin",useLockFeature:!0};this._options=Je(t,e),this.setAdvanced(this._options.advanced),this.setHeaders(this._options.headers),this.setCredentials(this._options.credentials),this.setUrl(this._options.url),this.setUseLockFeature(this._options.useLockFeature),this._countRequests=0,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new E,this._formatGeoJSON=new g,this._formatKml=new w({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this.getAndUpdateCapabilities(),this.on("change:parsedCapabilities",(()=>{this._checkGeoserverCapabilities()}))}getCapabilities(){return this.get(Ut.CAPABILITIES)}getParsedCapabilities(){return this.get(Ut.PARSED_CAPABILITIES)}setUrl(e,t=!1){this.set(Ut.URL,e,t)}getUrl(){return this.get(Ut.URL)}setHeaders(e={},t=!1){return this.set(Ut.HEADERS,e,t)}getHeaders(){return this.get(Ut.HEADERS)}setCredentials(e=null,t=!1){this.set(Ut.CREDENTIALS,e,t)}getCredentials(){return this.get(Ut.CREDENTIALS)}setAdvanced(e={},t=!1){this.set(Ut.ADVANCED,e,t)}getAdvanced(){return this.get(Ut.ADVANCED)}hasTransaction(){return this.get(Ut.HASTRASNACTION)}hasLockFeature(){return this.get(Ut.HASLOCKFEATURE)}getUseLockFeature(){return this.get(Ut.USELOCKFEATURE)}setUseLockFeature(e,t=!1){this.set(Ut.USELOCKFEATURE,e,t)}isLoaded(){return this.get(Ut.ISLOADED)}getState(){return this.state_}async getAndUpdateCapabilities(){try{const e=new URLSearchParams({service:"wfs",version:this.getAdvanced().getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this.getUrl()+"?"+e.toString(),r=await fetch(t,{headers:this.getHeaders(),credentials:this.getCredentials()});if(!r.ok)throw new Error("");const o=await r.text(),s=(new window.DOMParser).parseFromString(o,"text/xml");this.set(Ut.CAPABILITIES,s);const n=Vt.read(o);return this.set(Ut.PARSED_CAPABILITIES,n),this.state_=s?"ready":"error",s}catch(e){console.error(e);const t="string"==typeof e?e:oe.errors.capabilities;ee(t,e)}}_checkGeoserverCapabilities(){var e,t;if("2.0.0"===this.getAdvanced().getCapabilitiesVersion){const r=null===(t=null===(e=this.getParsedCapabilities())||void 0===e?void 0:e.OperationsMetadata)||void 0===t?void 0:t.Operation;r&&r.forEach((e=>{"Transaction"===e.name?this.set(Ut.HASTRASNACTION,!0):"LockFeature"===e.name?this.set(Ut.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.name&&this.set(Ut.HASDESCRIBEFEATURETYPE,!0)}))}else{const e=this.getCapabilities().getElementsByTagName("ows:Operation");Array.from(e).forEach((e=>{"Transaction"===e.getAttribute("name")?this.set(Ut.HASTRASNACTION,!0):"LockFeature"===e.getAttribute("name")?this.set(Ut.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.getAttribute("name")&&this.set(Ut.HASDESCRIBEFEATURETYPE,!0)}))}if(!this.hasTransaction())throw oe.errors.wfst}async transact(e,t,r){t=Array.isArray(t)?t:[t];const o=[],s=Oe(r);for(const r of t){let t=this._cloneFeature(r);const n=t.getGeometry();n instanceof F?this._transformGeoemtryCollectionToGeometries(t,n):n instanceof P&&this._transformCircleToPolygon(t,n),"beforeTransactFeature"in s&&"function"==typeof s.beforeTransactFeature&&(t=s.beforeTransactFeature(t,e)),t&&o.push(t)}if(!o.length)return ee(oe.errors.noValidGeometry),!1;switch(e){case be.Insert:this._insertFeatures=[...this._insertFeatures,...o];break;case be.Update:this._updateFeatures=[...this._updateFeatures,...o];break;case be.Delete:this._deleteFeatures=[...this._deleteFeatures,...o]}this._countRequests++;const n=this._countRequests;return new Promise(((o,i)=>{setTimeout((async()=>{try{if(n!==this._countRequests)return;let i=je().getView().getProjection().getCode();if(i="EPSG:4326"===i?"urn:x-ogc:def:crs:EPSG:4326":i,!s||!s.getDescribeFeatureType())throw new Error(`${oe.errors.layerNotFound}: "${r}"`);const a=s.getDescribeFeatureType()._parsed,l={featureNS:a.namespace,featureType:r,srsName:i,featurePrefix:null,nativeElements:null,version:this.getAdvanced().wfsTransactionVersion},c=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,l);let d=this._xs.serializeToString(c);const u=a.geomType,h=a.geomField;if(u===ve.GeometryCollection)if(e===be.Insert)d=d.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${i}"><geometryMember>`),d=d.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if(e===be.Update){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${i}"><geometryMember>`,t="</geometryMember></MultiGeometry>";d=d.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}d=e===be.Insert?d.replace(/<(\/?)\bgeometry\b>/g,`<$1${h}>`):d.replace(/<Name>geometry<\/Name>/g,`<Name>${h}</Name>`),this.hasLockFeature&&this.getUseLockFeature()&&e!==be.Insert&&(d=d.replace("</Transaction>",`<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`));const p=Object.assign({"Content-Type":"text/xml"},this.getHeaders()),m=await fetch(this.getUrl(),{method:"POST",body:d,headers:p,credentials:this._options.credentials});if(!m.ok)throw new Error(oe.errors.transaction+" "+m.status);const g=await m.text(),f=this._formatWFS.readTransactionResponse(g),y=Oe(r);if(!Object.keys(f).length){const e=String(g).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(e)throw y instanceof He&&this._removeFeatures(t),new Error(e[1])}e!==be.Delete&&this._removeFeatures(t),y.refresh(),ne(!1),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,o(f)}catch(e){ee(e.message,e),ne(!1),this._countRequests=0,i()}}),0)}))}_removeFeatures(e){for(const t of e)Ze().getSource().removeFeature(t)}_transformCircleToPolygon(e,t){const r=T.fromCircle(t);e.setGeometry(r)}_transformGeoemtryCollectionToGeometries(e,t){let r=t.getGeometries()[0];r instanceof P&&(r=T.fromCircle(r)),e.setGeometry(r)}_cloneFeature(e){Ne(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const r=new j(t);return r.setId(e.getId()),r}async lockFeature(e,t,r=0){const o=new URLSearchParams({service:"wfs",version:this.getAdvanced().lockFeatureVersion,request:"LockFeature",typeName:t,expiry:String(this._options.advanced.lockFeatureParams.expiry),LockId:this._options.advanced.lockFeatureParams.lockId,releaseAction:this._options.advanced.lockFeatureParams.releaseAction,exceptions:"application/json",featureid:`${e}`}),s=this.getUrl()+"?"+o.toString();try{const o=await fetch(s,{headers:this._options.headers,credentials:this._options.credentials});if(!o.ok)throw new Error(oe.errors.lockFeature);const n=await o.text();try{const o=JSON.parse(n);if("exceptions"in o){const s=new Error(Q(o));if("CannotLockAllFeatures"!==o.exceptions[0].code)throw s;if(r)throw s;this.lockFeature(e,t,1)}}catch(e){}return n}catch(e){ee(e.message,e)}}}};return Object.assign(Bt,$t),Bt}));
|
|
2
7
|
//# sourceMappingURL=ol-wfst.min.js.map
|