var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function u(t){try{f(n["throw"](t))}catch(t){o(t)}}function f(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(a,u)}f((n=n.apply(t,e||[])).next())})};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(t){return function(e){return f([t,e])}}function f(a){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:r.label++;return{value:a[1],done:false};case 5:r.label++;i=a[1];a=[0];continue;case 7:a=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1];o=a;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(a);break}if(o[2])r.ops.pop();r.trys.pop();continue}a=e.call(t,r)}catch(t){a=[6,t];i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-b236363f.system.js"],function(t){"use strict";var e;return{setters:[function(t){e=t.r}],execute:function(){var r=function(){function t(t,e){if(e===void 0){e={}}this.feature=t;if(!e.keyPrefix)e.keyPrefix="webmapgl.like";if(!e.clientId){e.clientId=localStorage.getItem(e.keyPrefix+".clientId");if(!e.clientId){e.clientId=this.makeId(64);localStorage.setItem(e.keyPrefix+".clientId",e.clientId)}}this.options=e}t.prototype.getClientId=function(){return this.options.clientId};t.prototype.isLiked=function(){var t=this.getArray(this.feature.layer);return t.indexOf(this.feature.id)!==-1};t.prototype.like=function(){var t=this.getArray(this.feature.layer);if(t.indexOf(this.feature.id)===-1)t.push(this.feature.id);this.setArray(this.feature.layer,t)};t.prototype.unlike=function(){var t=this.getArray(this.feature.layer);var e=t.indexOf(this.feature.id);if(e!==-1)t.splice(e,1);this.setArray(this.feature.layer,t)};t.prototype.makeId=function(t){var e="";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"+"0123456789";for(var n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*r.length));return e};t.prototype.getLayerKey=function(t){return this.options.keyPrefix+"|"+document.location.pathname+"|"+(t||"default")};t.prototype.getArray=function(t){var e=localStorage.getItem(this.getLayerKey(t));if(!e)return[];return e.split(",").map(function(t){return parseInt(t)}).filter(function(t){return!isNaN(t)})};t.prototype.setArray=function(t,e){var r=e.filter(function(t){return!isNaN(t)}).map(function(t){return t.toString()}).join(",");localStorage.setItem(this.getLayerKey(t),r)};return t}();var n=function(){function t(t){e(this,t)}t.prototype.create=function(t,e){if(e===void 0){e={}}return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return[2,new r(t,e)]})})};return t}();t("gl_like_controller",n);var i=function(){function t(t){e(this,t)}t.prototype.create=function(t,e){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(n){switch(n.label){case 0:r={};r["Content-Type"]="application/json";if(e.token)r["Authorization"]="Bearer "+e.token;return[4,fetch(e.url,{body:JSON.stringify(t),headers:r,method:e.method||"POST",mode:e.mode||"cors"})];case 1:return[2,n.sent()]}})})};return t}();t("gl_rest_controller",i)}}});