@mapcreator/api 3.2.0 → 3.3.1
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/dist/bundle.browser.js +1780 -1696
- package/dist/bundle.browser.min.js +1 -1
- package/dist/bundle.browser.min.js.LICENSE.txt +2 -2
- package/dist/bundle.js +1004 -920
- package/dist/bundle.min.js +1 -1
- package/dist/bundle.min.js.LICENSE.txt +1 -1
- package/dist/resources/Organisation.d.ts +2 -0
- package/dist/resources/OrganisationNote.d.ts +17 -0
- package/dist/resources/base/CrudBase.d.ts +2 -1
- package/dist/resources/base/CrudBase.d.ts.map +1 -1
- package/dist/resources/base/CrudSetItemBase.d.ts.map +1 -1
- package/dist/resources/base/DownloadedResource.d.ts +2 -2
- package/dist/resources/base/ResourceBase.d.ts +3 -1
- package/dist/resources/base/ResourceBase.d.ts.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/proxy/GeoResourceProxy.js +1 -1
- package/src/proxy/SimpleResourceProxy.js +1 -1
- package/src/resources/Organisation.js +15 -0
- package/src/resources/OrganisationNote.js +57 -0
- package/src/resources/base/CrudBase.js +3 -2
- package/src/resources/base/CrudSetItemBase.js +3 -2
- package/src/resources/base/ResourceBase.js +12 -3
- package/src/resources/index.js +1 -0
package/dist/bundle.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see bundle.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var __webpack_modules__=[(e,t,r)=>{r.r(t),r.d(t,{isParentOf:()=>i,getTypeName:()=>n,mix:()=>u,hasTrait:()=>l});var s=r(31),a=r(23);function i(e,t){if(null===e||null===t)return!1;e="function"==typeof e?e:e.constructor,t="function"==typeof t?t:t.constructor;do{if(t.name===e.name)return!0;t=Object.getPrototypeOf(t)}while(""!==t.name);return!1}function n(e){return void 0===e?"undefined":(e="function"==typeof e?e:e.constructor).name}function o(e,t){Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach((r=>{r.match(/^(?:constructor|initializer|prototype|arguments|caller|name|bind|call|apply|toString|length)$/)||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}function u(e,...t){const r=class extends(e||class{}){constructor(...e){super(...e),t.map((e=>e.prototype.initializer)).filter((e=>"function"==typeof e)).forEach((e=>e.call(this)))}};for(const e of t){if(!i(s.default,e))throw new TypeError(`Expected mixin to implement Trait for ${e.name}`);o(r.prototype,e.prototype),o(r,e)}r.__mixins=t;const n=(0,a.fnv32b)(t.map((e=>e.name)).join(","));return Object.defineProperty(r,"name",{value:`Cocktail_${n}`}),r}function l(e,t){e="function"==typeof e?e:e.constructor;do{if(Array.isArray(e.__mixins)&&e.__mixins.includes(t))return!0;e=Object.getPrototypeOf(e)}while(""!==e.name);return!1}},(e,t,r)=>{async function s(e,t=1,r){e instanceof Promise&&(e=await e);const s=e.data,a=[];t=t||e.page,r=r||e.pageCount,t===e.page&&t++;for(let s=t;s<=r;s++)a.push(e.get(s));const i=await Promise.all(a);return s.concat(...i.map((e=>e.data)))}r.r(t),r.d(t,{getPaginatedRange:()=>s,delay:()=>a,wrapKyCancelable:()=>i,makeCancelable:()=>n,serializeUTCDate:()=>o,clone:()=>u});const a=e=>new Promise((t=>setTimeout(t,e)));function i(e){return(t,r={})=>{if("object"==typeof r&&r.hasOwnProperty("signal"))return e(t,r);const s=new AbortController,a=e(t,{signal:s.signal,...r});return a.cancel=()=>s.abort(),a}}function n(e){const t=new AbortController,r=e(t.signal);return r instanceof Promise&&(r.cancel=()=>t.abort()),r}function o(e){if(!(e instanceof Date))throw new TypeError("Expected date to be of type Date");const t=e=>`00${e}`.slice(-Math.max(String(e).length,2));let r=[e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate()].map(t).join("-");return r+=` ${[e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()].map(t).join(":")}`,r}function u(e,t=!0){const r=e=>u(e,t);if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(r);const s={};for(const a of Object.keys(e))!t&&a.startsWith("_")||(s[a]=r(e[a]));return s}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(34),a=r(3),i=r(1);class n extends a.default{constructor(e,t={}){if(super(e,t),this.constructor===n)throw new s.AbstractClassError}_buildCreateData(){this._updateProperties();const e={},t=[].concat(Object.keys(this._properties),Object.keys(this._baseProperties)).filter(((e,t,r)=>r.indexOf(e)===t));for(const r of t)e[r]=this._properties[r]||this._baseProperties[r];return delete e.id,e}save(){return this.id?this._update():this._create()}_create(){return(0,i.makeCancelable)((async e=>{const t=this._prepareData(this._buildCreateData()),{data:r}=await this.api.ky.post(this.baseUrl,{json:t,signal:e}).json();return this._properties={},this._baseProperties=r,this._updateProperties(),this}))}_update(){return this._updateProperties(),(0,i.makeCancelable)((async e=>{if(0===Object.keys(this._properties).length)return this;const t=this._prepareData(this._properties);return await this.api.ky.patch(this.url,{json:t,signal:e}),Object.assign(this._baseProperties,this._properties),this._properties={},"updated_at"in this._baseProperties&&(this._baseProperties.updated_at=new Date),this}))}delete(e=!0){return(0,i.makeCancelable)((async t=>(await this.api.ky.delete(this.url,{signal:t}),e&&(this._baseProperties.deleted_at=new Date),this)))}restore(e=!0){return(0,i.makeCancelable)((async t=>{const{data:r}=await this.api.ky.put(this.url,{signal:t}).json(),s=new this.constructor(this.api,r);return e&&(this._properties={},this._baseProperties=r,this._updateProperties()),s}))}_prepareData(e){const t={};for(const[r,s]of Object.entries(e))s instanceof Date?t[r]=(0,i.serializeUTCDate)(s):t[r]=s;return t}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(8),a=r(21),i=r(15),n=r(13),o=r(61),u=r(23),l=r(0),c=r(1);function h(e){return e.filter(((t,r)=>e.findIndex((e=>e===t))===r))}class d extends((0,l.mix)(null,o.default)){constructor(e,t={}){if(super(),this.constructor===d)throw new a.AbstractClassError;this.api=e,t=(0,c.clone)(t);for(const e of Object.keys(t)){const r=(0,s.snake)(e);(0,s.camel)(r)in this?delete t[e]:(t[r]=this._guessType(r,t[e]),r!==e&&delete t[e])}this._baseProperties=t||{},this._properties={},this._api=e;const r=Object.keys(this._baseProperties);for(const e of r)this._applyProperty(e);r.includes("deleted_at")&&Object.defineProperty(this,"deleted",{enumerable:!0,configurable:!0,get:()=>Boolean(this.deletedAt)}),this._knownFields=Object.keys(this).filter((e=>"_"!==e[0]))}get api(){return this._api}set api(e){if(!(0,l.isParentOf)(i.default,e))throw new TypeError("Expected api to be of type Mapcreator or null");this._api=e}static get resourcePath(){return`/${this.resourceName}/{id}`}static get resourceName(){throw new a.AbstractError}static get resourceUrlKey(){return"id"}static get protectedFields(){return["id","created_at","updated_at","deleted_at"]}static get readonly(){return!1}_updateProperties(){let e=Object.keys(this).filter((e=>"_"!==e[0])).filter((e=>!this._knownFields.includes(e)));for(const t of e){const e=(0,s.snake)(t);this._properties[e]=this[t],delete this[t],this._applyProperty(e),this._knownFields.push(e)}e=Object.keys(this._baseProperties).filter((e=>!this._knownFields.includes((0,s.camel)(e))));for(const t of e)this._applyProperty(t),this._knownFields.push(t);this._knownFields=h(this._knownFields)}sanitize(){this._updateProperties(),Object.assign(this._baseProperties,this._properties),this._properties={}}reset(e=null){this._updateProperties(),"string"==typeof e?this.reset([e]):null===e?this._properties={}:Array.isArray(e)&&e.map(String).map(s.snake).forEach((e=>delete this._properties[e]))}clone(){this._updateProperties();const e=new this.constructor(this.api,this._baseProperties);for(const t of Object.keys(this._properties))e[t]=this._properties[t];return e}refresh(e=!0){return(0,c.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(this.url,{signal:t}).json();return e&&(this._properties={},this._baseProperties=r,this._updateProperties()),new this.constructor(this._api,r)}))}_applyProperty(e){const t={enumerable:!0,configurable:!0,get:()=>this._properties.hasOwnProperty(e)?this._properties[e]:this._baseProperties[e]};this.constructor.protectedFields.includes(e)||this.constructor.readonly||(t.set=t=>{this._properties[e]=this._guessType(e,t),delete this._url});const r=(0,s.camel)(e);Object.defineProperty(this,r,t)}_guessType(e,t){return e.endsWith("_at")||e.startsWith("date_")?"string"==typeof t?new Date(t.replace(" ","T")):t:/(_|^)id$/.test(e)&&null!==t&&Number.isFinite(Number(t))?Number(t):t}get ownable(){return!1}get url(){if(!this._url){let e=`${this._api.url}${this.constructor.resourcePath}`;e=e.replace(/{(\w+)}/g,((e,t)=>this[(0,s.camel)(t)])),this._url=e}return this._url}get baseUrl(){const e=this.constructor.resourcePath.match(/^(\/[^{]+\b)/)[1];return`${this._api.url}${e}`}get fieldNames(){return h([...Object.keys(this._baseProperties),...Object.keys(this._properties)]).map(s.camel)}toString(){return`${this.constructor.name}(${this[this.resourceUrlKey]})`}toObject(e=!1){this._updateProperties();const t={...this._baseProperties,...this._properties};if(e)for(const e of Object.keys(t)){const r=(0,s.camel)(e);e!==r&&(t[r]=t[e],delete t[e])}return t}_proxyResourceList(e,t=null,r={}){return t||(t=`${e.resourceName.replace(/s+$/,"")}s`),"string"!=typeof t||t.startsWith("/")||t.match(/https?:/)||(t=`${this.url}/${t}`),new n.default(this.api,e,t,r)}static(e,t=d,r={}){let s;if("string"==typeof e){s=`${this.url}/${e}`;const r=t.name||"AnonymousResource";e=class extends t{static get resourceName(){return Object.getPrototypeOf(this).resourceName||"anonymous"}static get resourcePath(){return s}},Object.defineProperty(e,"name",{value:`${r}_${(0,u.fnv32b)(s)}`})}if(!(0,l.isParentOf)(d,e))throw new TypeError("Expected Target to be of type String or ResourceBase constructor");return this._proxyResourceList(e,s,r)}}},(e,t,r)=>{r.r(t),r.d(t,{FormData:()=>s,encodeQueryString:()=>i,wrapKyPrefixUrl:()=>n});const s=(0,r(9).windowTest)("FormData")?window.FormData:r(59);function a(e,t=[]){return Object.keys(e).sort().map((r=>{const s=t.slice(0);if("object"==typeof e[r]&&null!==e[r])return s.push(r),a(e[r],s);s.push(r);let i="";i+=encodeURIComponent(s.shift()),i+=s.map((e=>`[${encodeURIComponent(e)}]`)).join("");const n=e[r];return null!=n&&(i+=`=${encodeURIComponent(n)}`),i})).join("&")}function i(e){return a(e).replace(/^&*|&+(?=&)|&*$/g,"")}function n(e,t){return function(r,s){return"string"!=typeof r||/^https?:\/\//.test(r)||(r.startsWith("/")||(r=`/${r}`),r=t+r),e(r,s)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(33),a=r(31);class i extends a.default{get organisations(){return new s.default(this.api,this)}get ownable(){return!0}}},(e,t,r)=>{r.r(t),r.d(t,{DeletedState:()=>a,Enum:()=>s.default,JobShareVisibility:()=>n,ResultStatus:()=>i});var s=r(11);const a=new s.default({ALL:"all",BOTH:"all",NONE:"none",ONLY:"only"}),i=new s.default(["queued","processing","completed","canceled","failed"],!0),n=new s.default(["private","organisation","public"],!0)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var s=r(8),a=r(40),i=r(6),n=r(23),o=r(0),u=r(4);class l extends a.EventEmitter{constructor(e={}){super(),l.keys().forEach((e=>this._resolve(e))),this.apply(e)}get page(){return this._resolve("page")}get perPage(){return this._resolve("perPage")}get offset(){return this._resolve("offset")}get search(){return this._resolve("search")}get sort(){return this._resolve("sort")}get deleted(){return this._resolve("deleted")}get extra(){return this._resolve("extra")}set page(e){this._update("page",e)}set perPage(e){this._update("perPage",e)}set offset(e){this._update("offset",e)}set search(e){this._update("search",e)}set sort(e){this._update("sort",e)}set deleted(e){this._update("deleted",e)}set extra(e){this._update("extra",e)}static get page(){return l._page||1}static get perPage(){return l._perPage||Number("12")||12}static get offset(){return l._offset||0}static get maxPerPage(){return l._maxPerPage||50}static get search(){return l._search||{}}static get sort(){return l._sort||[]}static get deleted(){return l._deleted||void 0}static get extra(){return l._extra||{}}static set page(e){l._page=l._validatePage(e)}static set perPage(e){l._perPage=l._validatePerPage(e)}static set offset(e){l._offset=l._validateOffset(e)}static set maxPerPage(e){l._maxPerPage=l._validateMaxPerPage(e)}static set search(e){l._search=l._validateSearch(e)}static set sort(e){l._sort=l._validateSort(e)}static set deleted(e){l._deleted=l._validateDeleted(e)}static set extra(e){l._extra=l._validateExtra(e)}static _validatePage(e){if("number"!=typeof e)throw new TypeError(`Expected page to be of type 'number' instead got '${typeof e}'`);if(e<0)throw new TypeError("Page must be a positive number");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Page must be a real number");if(Math.round(e)!==e)throw new TypeError("Page must be a natural number");return Math.round(e)}static _validatePerPage(e){if("number"!=typeof e)throw new TypeError(`Expected per page to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<=0)throw new TypeError("Per page must be greater than zero");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Per page must be a real number");if(Math.round(e)!==e)throw new TypeError("Per page must be a natural number");return e=Math.min(l.maxPerPage,e)}static _validateOffset(e){if("number"!=typeof e)throw new TypeError(`Expected offset to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<0)throw new TypeError("Offset must be a positive number");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Offset must be a real number");if(Math.round(e)!==e)throw new TypeError("Offset must be a natural number");return e}static _validateMaxPerPage(e){if("number"!=typeof e)throw new TypeError(`Expected page to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<1)throw new TypeError("Value must be greater or equal to 1");return e}static _validateSearch(e){if("object"!=typeof e||Array.isArray(e))throw new TypeError(`Expected value to be of type "Object" got "${(0,o.getTypeName)(e)}"`);const t=e=>"number"==typeof e?e.toString():e;for(let r of Object.keys(e)){if(r=t(r),e[r]=t(e[r]),"string"!=typeof r)throw new TypeError(`Expected key to be of type "String" got "${(0,o.getTypeName)(r)}"`);if(Array.isArray(e[r]))if(e[r].length>0){for(const t of e[r])if(!["string","number","boolean"].includes(typeof t)&&null!==t)throw new TypeError(`Expected query for "${r}" to be of type "String", "Boolean", "Number" or "null" got "${(0,o.getTypeName)(t)}"`)}else delete e[r];else if(null===e[r])delete e[r];else if(!["string","number","boolean"].includes(typeof e[r])&&null!==e[r])throw new TypeError(`Expected query value to be of type "String", "Boolean", "Number", "Array" or "null" got "${(0,o.getTypeName)(e[r])}"`)}return e}static _validateSort(e){if("string"==typeof e)return this._validateSort(e.split(","));if(!(e instanceof Array))throw new TypeError(`Expected sort value to be of type "Array" got "${(0,o.getTypeName)(e)}"`);return e.filter((e=>"string"!=typeof e)).forEach((e=>{throw new TypeError(`Expected sort array values to be of type "String" got "${(0,o.getTypeName)(e)}"`)})),e}static _validateDeleted(e){if(void 0===e)return e;if("string"!=typeof e)throw new TypeError(`Expected deleted to be of type "string" got "${(0,o.getTypeName)(e)}". See: DeletedState`);e=e.toLowerCase();const t=i.DeletedState.values();if(!t.includes(e))throw new TypeError(`Expected deleted to be one of ${t.join(", ")}, got ${e}`);return e}static _validateExtra(e){if("object"!=typeof e)throw new TypeError(`Expected extra to be of type 'object', got '${(0,o.getTypeName)(e)}'`);return e}_resolve(e){const t=`_${e}`;return this[t]||((this||{})[t]=l[e]),this[t]}_update(e,t,r=!1){const a=`_${e}`;return t=l[`_validate${(0,s.pascal)(e)}`](t),(this||{})[a]=t,r||(this.emit("change",[{name:e,value:t}]),this.emit(`change:${e}`,t)),t}encode(){return(0,u.encodeQueryString)(this.toParameterObject())}toObject(){return l.keys().reduce(((e,t)=>(e[(0,s.snake)(t)]=this._resolve(t),e)),{})}toParameterObject(){const e={};l.keys().forEach((t=>{"extra"!==t&&(e[(0,s.snake)(t)]=this._resolve(t))})),e.sort=e.sort.map(s.snake).map((e=>e.replace(/^_/,"-"))).join(","),0===e.offset&&delete e.offset;for(const t of Object.keys(e.search)){const r=t.split(",").map(s.snake).join(",");t!==r&&(e.search[r]=e.search[t],delete e.search[t])}for(const t of Object.keys(e.search))"boolean"==typeof e.search[t]&&(e.search[t]=Number(e.search[t])),null===e.search[t]&&(e.search[t]="");const t=this._resolve("extra");for(const r of Object.keys(t))e[r]=t[r];for(const t of Object.keys(e))void 0===e[t]&&delete e[t];return e}copy(){return new l(this.toObject())}static keys(){return["page","perPage","offset","search","sort","deleted","extra"]}token(){const e=this.toObject();return delete e.page,delete e.per_page,(0,n.hashObject)(e)}static resetDefaults(){for(const e of l.keys())delete l[`_${e}`]}apply(e){e instanceof l&&(e=e.toObject());const t=[];for(const r of Object.keys(e)){const a=(0,s.camel)(r);"_"!==r[0]&&l.keys().includes(a)&&t.push({name:a,value:this._update(a,e[r],!0)})}this.emit("change",t);for(const{name:e,value:r}of t)this.emit(`change:${e}`,r);return t}}},e=>{e.exports=require("case")},(e,t,r)=>{function s(){try{return"[object process]"===Object.prototype.toString.call("undefined"==typeof process?0:process)}catch(e){return!1}}function a(e){return"undefined"!=typeof window&&void 0!==window[e]}r.r(t),r.d(t,{isNode:()=>s,windowTest:()=>a})},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(21),a=r(2),i=r(8);class n extends a.default{constructor(e,t={}){if(super(e,t),this.constructor===a.default)throw new s.AbstractClassError}get hasParent(){const e=(0,i.camel)(this.constructor.parentKey);return this.hasOwnProperty(e)}get parentId(){if(this.hasParent){const e=(0,i.camel)(this.constructor.parentKey);return Number(this[e])}}static get parentKey(){return this.resourceName.replace(/s$/,"_set_id")}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(8),a=r(0);class i{get[Symbol.toStringTag](){return this.constructor.name}}class n extends i{constructor(e,t=!1){super();const r=Array.isArray(e);if(t&&!r)throw new TypeError(`Expected enums to be of type "Array" got "${(0,a.getTypeName)(e)}"`);if(r&&t)for(const t of e){const e=(0,s.constant)(t);Object.defineProperty(this,e,{enumerable:!0,value:t})}else if(r)for(const t of e)Object.defineProperty(this,t,{enumerable:!0,value:n._iota});else for(const t of Object.keys(e)){const r={enumerable:!0};"function"==typeof e[t]?r.get=e[t]:r.value=e[t],Object.defineProperty(this,t,r)}Object.freeze(this)}keys(){return Object.keys(this)}values(){return this.keys().map((e=>this[e])).filter(((e,t,r)=>r.indexOf(e)===t))}static get _iota(){return n.__iota||(n.__iota=0),n.__iota++}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(22),a=r(4);class i{constructor(e,t="Bearer",r=432e3,s=[]){if(this.scopes=s,this.token=e,this.type=t.toLowerCase().replace(/(\s|^)\w/g,(e=>e.toUpperCase())),"number"==typeof r){const e=1e3*r;this.expires=new Date(Date.now()+e)}else{if(!(r instanceof Date))throw new TypeError("Expires not of type Date or Number");this.expires=r}}toString(){return`${this.type} ${this.token}`}toResponseObject(){return{access_token:this.token,token_type:this.type.toLowerCase(),expires_in:this.expires-Date.now(),scope:this.scopes}}toQueryString(){return(0,a.encodeQueryString)(this.toResponseObject())}get expired(){return new Date>this.expires}static get storageName(){return"api_token"}static fromResponseObject(e){"string"==typeof e&&(e=JSON.parse(e));let t=432e3;return void 0!==e.exipires_in?t=Number(e.expires_in):"string"==typeof e.expires&&(t=new Date(e.expires)),new i(e.access_token,e.token_type,t,e.scope||[])}save(e=i.storageName){const t={token:this.token,type:this.type,expires:this.expires.toUTCString(),scopes:this.scopes};s.default.secure.set(e,JSON.stringify(t),this.expires)}static recover(e=i.storageName){const t=s.default.secure.get(e);if(!t)return null;const r=JSON.parse(t),a=new i(r.token,r.type,new Date(r.expires),r.scopes||[]);return a.expired?null:a}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(15),a=r(7),i=r(0),n=r(1);class o{constructor(e,t,r,n,o=null,u=0,l=[]){if(!(0,i.isParentOf)(s.default,e))throw new TypeError("Expected api to be of type Mapcreator");(0,i.isParentOf)(a.default,n)||(n=new a.default(n)),this._api=e,this.route=t,this._Target=r,this._parameters=n,this._pageCount=o,this._rows=u,this._data=l}get api(){return this._api}get route(){return this._route}set route(e){e.startsWith("https://")||e.startsWith("http://")||(e.startsWith("/")||(e=`/${e}`),e=`${this._api.url}${e}`),this._route=e}get Target(){return this._Target}get parameters(){return this._parameters}set parameters(e){this._parameters=e}get page(){return this.parameters.page}get perPage(){return this.parameters.perPage}get sort(){return this.parameters.sort}set sort(e){this.parameters.sort=e}get deleted(){return this.parameters.deleted}set deleted(e){this.parameters.deleted=e}get pageCount(){return this._pageCount}get data(){return this._data}get rows(){return this._rows}get query(){return this.parameters.search}set query(e){this.parameters.search=e}getPage(e=this.page,t=this.perPage){const r=this.parameters.copy();r.page=e,r.perPage=t;const s=this.route.includes("?")?"&":"?",a=this.route+s+r.encode();return(0,n.makeCancelable)((async t=>{const r=await this.api.ky.get(a,{signal:t}),{data:s}=await r.json(),i=Number(r.headers.get("x-paginate-total")||s.length),n=Number(r.headers.get("x-paginate-pages")||1),u=this.parameters.copy();return u.page=e,new o(this.api,this.route,this.Target,u,n,i,s.map((e=>new this.Target(this.api,e))))}))}get hasNext(){return this.page<this.pageCount}get hasPrevious(){return this.page>1}get cacheToken(){return this.parameters.token()}next(){return this.getPage(this.page+1)}previous(){return this.getPage(this.page-1)}}var u=r(73),l=r(3);class c{constructor(e,t,r=null,s={}){if(!(0,i.isParentOf)(l.default,t))throw new TypeError("Target is not a child of ResourceBase");if("function"!=typeof t)throw new TypeError("Target must to be a class not an instance");r&&(this.__baseUrl=r),this._api=e,this._Target=t,this._seedData=s}get baseUrl(){return this.__baseUrl||(this.__baseUrl=this.new().baseUrl),this.__baseUrl}get api(){return this._api}get Target(){return this._Target}new(e={}){return e={...this._seedData,...e},new this.Target(this._api,e)}list(e={}){const t=this._buildResolver(e);return t.getPage(t.page)}lister(e={},t=50){return new u.default(this.api,this.baseUrl,this.Target,e,t,this.Target.resourceUrlKey)}_buildResolver(e={}){const t=typeof e,r=this.baseUrl;if(!["number","object"].includes(t))throw new TypeError(`Expected params to be of type number or object. Got "${t}"`);return"number"===t?this._buildResolver({page:e}):(e instanceof a.default||(e=new a.default(e)),new o(this._api,r,this.Target,e))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(21),a=r(2),i=r(8);class n extends a.default{get items(){const e=`${this.url}/items`,t={};return t[this.constructor.foreignKeyName]=this.id,this._proxyResourceList(this._Child,e,t)}get _Child(){throw new s.AbstractError}static get foreignKeyName(){if(!this._fk){let e=this.name;e=(0,i.camel)(e),this._fk=`${e}Id`}return this._fk}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>P});var s=r(30),a=r.n(s),i=r(6),n=r(72),o=r(18),u=r(12),l=r(38),c=r(19),h=r(13),d=r(36),p=r(3),f=r(61),g=r(23);class _{constructor(e="warn"){this.logLevel=e}getLogLevels(){return["debug","info","warn","error","none"]}log(e,t="info"){"none"!==t&&this._shouldLog(t)&&console[t](e)}debug(e){this.log(e,"debug")}info(e){this.log(e,"info")}warn(e){this.log(e,"warn")}error(e){this.log(e,"error")}get logLevel(){return this._logLevel}set logLevel(e){if(e=e.toLowerCase(),!this.getLogLevels().includes(e))throw new TypeError(`Expected one of ${this.getLogLevels().join(", ")}. Got ${e}`);this._logLevel=e}_shouldLog(e){const t=this.getLogLevels();return t.findIndex((t=>t===e))>=t.findIndex((e=>e===this.logLevel))}}var y=r(0),m=r(1),w=r(74),b=r(62),x=r(4),v=r(40),k=r.n(v);class P extends((0,y.mix)(k(),f.default)){constructor(e=new n.default,t="https://api.mapcreator.io"){if(super(),"string"==typeof e){const t=e;(e=new n.default).token=new u.default(t,"Bearer",new Date("2100-01-01T01:00:00"),["*"])}this.auth=e,this.host=t,this._logger=new _("warn"),this.wrapKy(m.wrapKyCancelable),this.wrapKy(x.wrapKyPrefixUrl,`${this.host}/${this.version}`)}get version(){return"v1"}get auth(){return this._auth}get logger(){return this._logger}set auth(e){if(!(0,y.isParentOf)(o.default,e))throw new TypeError("auth must be an instance of OAuth");this._auth=e}get authenticated(){return this.auth.authenticated}get host(){return this._host}set host(e){e=e.replace(/\/+$/,""),this._host=e,this.auth.host=e}get url(){return`${this.host}/${this.version}`}saveToken(e){this.auth.token.save(e)}async authenticate(){return await this.auth.authenticate(),this}get ky(){var e;if(this._ky)return this._ky;const t={beforeRequest:[e=>{this.authenticated&&e.headers.set("Authorization",this.auth.token.toString())}],afterResponse:[async(e,t,r)=>{if(429!==r.status)return r;const s=1e3*r.headers.get("x-ratelimit-reset")||500;return await(0,m.delay)(s),this._ky(e)},async(e,t,r)=>{if(r.status<400||r.status>=600)return r;const s=await r.json(),a={data:s,request:e,options:t,response:r};if(s.error.validation_errors)throw new w.default(a);const i=new b.default(a);throw"AuthenticationException"===i.type&&this.emit("error",i),i}]};return this._ky=a().create({timeout:null!==(e="60000")?e:6e4,retry:0,headers:{Accept:"application/json","X-No-CDN-Redirect":"true"},hooks:t}),this._ky}wrapKy(e,...t){this._ky=e(this.ky,...t);const r=["get","post","put","patch","head","delete"];for(const e of r)this._ky[e]=(t,r)=>this._ky(t,{...r,method:e})}static(e,t=p.default){if("string"==typeof e){const r=e,s=t.name||"AnonymousResource";e=class extends t{static get resourceName(){return Object.getPrototypeOf(this).resourceName||"anonymous"}static get resourcePath(){return r}},Object.defineProperty(e,"name",{value:`${s}_${(0,g.fnv32b)(r)}`})}if((0,y.isParentOf)(p.default,e))return new c.default(this,e);throw new TypeError("Expected Target to be of type string and Constructor to be a ResourceBase constructor")}get choropleths(){return new l.default(this,d.Choropleth)}get vectorChoropleths(){return new l.default(this,d.VectorChoropleth)}get colors(){return this.static(d.Color)}get tags(){return this.static(d.Tag)}get tagTypes(){return this.static(d.TagType)}get contracts(){return this.static(d.Contract)}get dimensions(){return this.static(d.Dimension)}get dimensionSets(){return this.static(d.DimensionSet)}get faqs(){return this.static(d.Faq)}get features(){return this.static(d.Feature)}get featuredMaps(){return new h.default(this,d.Job,"/jobs/featured")}get fonts(){return this.static(d.Font)}get fontFamilies(){return this.static(d.FontFamily)}get highlights(){return new l.default(this,d.Highlight)}get vectorHighlights(){return new l.default(this,d.VectorHighlight)}get insetMaps(){return new l.default(this,d.InsetMap)}get jobs(){return this.static(d.Job)}get jobShares(){return this.static(d.JobShare)}get jobTypes(){return this.static(d.JobType)}get languages(){return this.static(d.Language)}get layers(){return this.static(d.Layer)}get layerFaqs(){return this.static(d.LayerFaq)}get layerGroups(){return this.static(d.LayerGroup)}get mapstyles(){return this.static(d.Mapstyle)}get mapstyleSets(){return this.static(d.MapstyleSet)}get notifications(){return this.static(d.Notification)}get messages(){return this.static(d.Message)}get organisations(){return this.static(d.Organisation)}get permissions(){return this.static(d.Permission)}get productTours(){return this.static(d.ProductTour)}get productTourSteps(){return this.static(d.ProductTourStep)}get roles(){return this.static(d.Role)}get svgs(){return this.static(d.Svg)}get svgSets(){return this.static(d.SvgSet)}get users(){return this.static(d.User)}getSvgSetTypes(){return(0,m.makeCancelable)((async e=>{const{data:t}=await this.ky.get("svgs/sets/types",{signal:e}).json();return new i.Enum(t,!0)}))}getFontStyles(){return(0,m.makeCancelable)((async e=>{const{data:t}=await this.ky.get("fonts/styles",{signal:e}).json();return new i.Enum(t,!0)}))}logout(){return this.auth.logout()}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(17),a=r.n(s);class i extends Error{constructor(e,t=""){super(t),a()(this,"error",void 0),this.error=String(e)}toString(){let e=this.error;return e.includes("_")&&(e=e.replace("_"," ").replace(/^./,(e=>e.toUpperCase()))),this.message?`${e}: ${this.message}`:e}}},e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(17),a=r.n(s),i=r(30),n=r.n(i),o=r(21),u=r(22),l=r(12),c=r(37),h=r(1);class d{constructor(e,t=["*"]){if(a()(this,"token",null),a()(this,"path","/"),a()(this,"host","https://api.mapcreator.io"),this.constructor===d)throw new o.AbstractClassError;this.clientId=String(e),this.scopes=t,this.clientId&&(this.token=l.default.recover())}get authenticated(){return null!==this.token&&!this.token.expired}authenticate(){throw new o.AbstractMethodError}forget(){c.default.clean(),u.default.secure.remove(l.default.storageName),this.token=null}logout(){if(!this.token)return(0,h.makeCancelable)((()=>{}));const e=`${this.host}/oauth/logout`;return(0,h.makeCancelable)((async t=>{await n().post(e,{headers:{Accept:"application/json",Authorization:this.token.toString()},signal:t}),this.forget()}))}importToken(e,t="Bearer",r=432e3,s=[]){this.token=new l.default(e,t,r,s)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(4),a=r(13),i=r(1);class n extends a.default{_parseSelector(e){if(""===e||null===e)return{};switch(typeof e){case"number":case"string":return{[this.Target.resourceUrlKey]:e};case"object":return e;default:return{}}}get(e,t=null){return(0,i.makeCancelable)((async r=>{const a={...this._seedData,...this._parseSelector(e)};let i=this.new(a).url;if("string"==typeof t){const e=i.includes("?")?"&":"?";i+=e+(0,s.encodeQueryString)({deleted:t})}const{data:n}=await this.api.ky.get(i,{signal:r}).json();return this.new(n)}))}select(e){const t={...this._seedData,...this._parseSelector(e)};return this.new(t)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(13),a=r(1);class i extends s.default{constructor(e,t,r){const s=r.resourceName.replace(/s+$/,"");super(e,r,`${t.url}/${s}s`)}sync(e){return this._modifyResourceLink(e,"PATCH")}attach(e){return this._modifyResourceLink(e,"POST")}detach(e){return this._modifyResourceLink(e,"DELETE")}attachAll(){return(0,a.makeCancelable)((async e=>{await this.api.ky.post(`${this.baseUrl}/all`,{signal:e})}))}detachAll(){return(0,a.makeCancelable)((async e=>{await this.api.ky.delete(`${this.baseUrl}/all`,{signal:e})}))}_modifyResourceLink(e,t){Array.isArray(e)||(e=[e]);const r=e.map((e=>i._getKeyValue(e))).map(Number).filter((e=>!Number.isNaN(e)));return(0,a.makeCancelable)((async e=>{await this.api.ky(this.baseUrl,{method:t,signal:e,json:{keys:r}})}))}static _getKeyValue(e){if(["number","string"].includes(typeof e))return e;const t=e.constructor.resourceUrlKey||"id";if(void 0!==e[t])return e[t];throw new TypeError("Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}")}}},(e,t,r)=>{r.r(t),r.d(t,{AbstractError:()=>s,AbstractClassError:()=>a,AbstractMethodError:()=>i});class s extends Error{constructor(e="Unimplemented"){super(e)}}class a extends s{constructor(){super("Can not make an instance of an abstract class")}}class i extends s{constructor(){super("Can not call an abstract method")}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(32),a=r(9),i=r(24);class n extends i.default{constructor(e="_m4n_"){super(),this.__prefix=e}get _prefix(){return this.__prefix}static get secure(){return"https:"===window.location.protocol}static get available(){return!(0,a.isNode)()}set(e,t,r=new Date("2050-01-01")){e=encodeURIComponent(this._prefix+e),t=encodeURIComponent(t),r instanceof Date&&(r=r.toUTCString());let s=`${e}=${t}; expires=${r}`;n.secure&&(s+="; secure"),document.cookie=s}get(e){return e=this._prefix+e,this._toObject()[e]}remove(e){this.set(e,"",new Date(1970))}keys(){const e=new RegExp(`^${this._prefix}`);return Object.keys(this._toObject()).map((t=>t.replace(e,"")))}_toObject(){const e={};return document.cookie.split(";").map((e=>e.trim().split("=").map(decodeURIComponent))).filter((e=>e[0].startsWith(this._prefix))).forEach((t=>{e[t[0]]=t[1]})),e}}var o=r(17),u=r.n(o);class l extends i.default{static get available(){return(0,a.isNode)()&&"test"===process.env.NODE_ENV}static get secure(){return!0}set(e,t){this.constructor._data[e]=t}get(e){return this.constructor._data[e]}remove(e){delete this.constructor._data[e]}keys(){return Object.keys(this.constructor._data)}}u()(l,"_data",{});var c=r(58);class h extends i.default{static get _prefix(){return"_m4n_"}static get available(){return!(0,a.isNode)()}set(e,t){e=h._prefix+e,window.localStorage.setItem(e,t)}get(e){return e=h._prefix+e,window.localStorage.getItem(e)}remove(e){e=h._prefix+e,window.localStorage.removeItem(e)}keys(){const e=[],t=window.localStorage,r=h._prefix;for(let s=0;s<t.length;s++){let a=t.key(s);a.startsWith(r)&&(a=a.replace(new RegExp(`^${r}`),""),e.push(a))}return e}}class d extends s.default{static get available(){return[l,h,c.default].filter((e=>e.available))}static get localStorage(){return new h}static get cookies(){return new n}static get file(){return new c.default}static get dummy(){return new l}static get best(){return new this.available[0]}static get secure(){const e=this.available.filter((e=>e.secure))[0];return void 0===e?d.best:new e}}},(e,t,r)=>{r.r(t),r.d(t,{fnv32b:()=>i,hashObject:()=>n});const s=require("json-stable-stringify");var a=r.n(s);function i(e){let t=e.split("").map((e=>e.charCodeAt(0))).reduce(((e,t)=>(e^=t)+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)),2166136261);return t^=t<<3,t+=t>>5,t^=t<<4,t+=t>>17,t^=t<<25,t+=t>>6,`0000000${(t>>>0).toString(16)}`.substr(-8)}function n(e){return i(a()(e))}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(21);class a{constructor(){if(this.constructor===a)throw new s.AbstractClassError;if(!this.constructor.available)throw new Error(`${this.constructor.name} is unavailable`)}static get available(){return!1}static get secure(){return!1}set(e,t){throw new s.AbstractMethodError}get(e){throw new s.AbstractMethodError}remove(e){throw new s.AbstractMethodError}clear(){this.keys().map((e=>this.remove(e)))}keys(){throw new s.AbstractMethodError}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(9);class a{constructor(e,t="application/octet-stream",r="Untitled"){this._data=e,this._type=t,this._fileName=r}static async fromResponse(e){const t=await e.arrayBuffer();let r;const s=e.headers.get("content-type");let i;s&&(r=s.split(";")[0].trim());const n=e.headers.get("content-disposition");if(n){const e=/filename[^;=\n]*=((['"])(.*?)\2|([^;\s]*))/i.exec(n);e&&(i=e[3]||e[4])}return new a(t,r,i)}get data(){return this._data}get type(){return this._type}get fileName(){return this._fileName}get size(){return this.data.length}createObjectUrl(){if((0,s.isNode)())throw new Error("Object urls are not supported by Node");return URL.createObjectURL(this.createBlob())}createBlob(){return new Blob([this.data],{type:this.type})}toDataUri(){return`data:${this.type};base64,${this.toBase64()}`}toBase64(){return function(e){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(e),a=s.byteLength,i=a%3,n=a-i;let o,u,l,c,h;for(let e=0;e<n;e+=3)h=65536*s[e]|256*s[e+1]|s[e+2],o=(16515072&h)>>18,u=(258048&h)>>12,l=(4032&h)>>6,c=63&h,t+=r[o]+r[u]+r[l]+r[c];return 1===i?(h=s[n],o=(252&h)>>2,u=(3&h)<<4,t+=`${r[o]+r[u]}==`):2===i&&(h=256*s[n]|s[n+1],o=(64512&h)>>10,u=(1008&h)>>4,l=(15&h)<<2,t+=`${r[o]+r[u]+r[l]}=`),t}(this.data)}toString(){return this.data.toString()}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(6),a=r(2);class i extends a.default{save(){throw new Error("Unsupported method JobShare::save")}static get visibility(){return s.JobShareVisibility}static get resourcePath(){return"/jobs/shares/{id}"}static get resourceName(){return"shares"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(50),a=r(5),i=r(0),n=r(2);class o extends((0,i.mix)(n.default,a.default,s.default)){static get resourceName(){return"layers"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(5),a=r(0),i=r(14),n=r(66),o=r(19),u=r(10);class l extends u.default{static get resourcePath(){return"/mapstyles/sets/{mapstyle_set_id}/colors/{id}"}static get resourceName(){return"mapstyle-set-colors"}get baseUrl(){return`${this._api.url}/mapstyles/sets/${this.mapstyleSetId}/colors`}}class c extends((0,a.mix)(i.default,s.default)){static get resourcePath(){return"/mapstyles/sets/{id}"}static get resourceName(){return"mapstyle-sets"}get _Child(){return n.default}get colors(){const e={mapstyleSetId:this.id};return new o.default(this.api,l,null,e)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(5),a=r(0),i=r(10);class n extends((0,a.mix)(i.default,s.default)){static get resourceName(){return"tags"}static get parentKey(){return"tag_type_id"}}},e=>{e.exports=require("ky-universal")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s{initializer(){}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(57);class a{constructor(){throw new s.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(0),a=r(13),i=r(1);class n extends a.default{constructor(e,t){super(e,r(41).default,`${t.url}/organisations`,{}),this._parent=t}get parent(){return this._parent}sync(e){return this._modifyLink(e,"PATCH",this.Target)}attach(e){return this._modifyLink(e,"POST",this.Target)}detach(e){return this._modifyLink(e,"DELETE",this.Target)}attachAll(){return(0,i.makeCancelable)((async e=>{await this.api.ky.post(`${this.baseUrl}/all`,{signal:e})}))}detachAll(){return(0,i.makeCancelable)((async e=>{await this.api.ky.delete(`${this.baseUrl}/all`,{signal:e})}))}_modifyLink(e,t,r,a=null){if(Array.isArray(e)||(e=[e]),!a){a=`${r.resourceName.replace(/s+$/,"")}s`}const n=e.map((e=>"number"==typeof e?e:e.id)).map(Number);if(!(0===n.filter((e=>!(0,s.isParentOf)(r,e)&&!Number.isFinite(e))).length))throw new TypeError(`Array must contain either Numbers (resource id) or "${r.name}".`);const o=`${this.parent.url}/${a}`;return(0,i.makeCancelable)((async e=>{await this.api.ky(o,{method:t,signal:e,json:{keys:n}})}))}}},(e,t,r)=>{r.r(t),r.d(t,{AbstractClassError:()=>s.AbstractClassError,AbstractError:()=>s.AbstractError,AbstractMethodError:()=>s.AbstractMethodError,ApiError:()=>a.default,GeoError:()=>l.default,NodeError:()=>n,OAuthError:()=>o.default,StaticClassError:()=>u.default,ValidationError:()=>i.default});var s=r(21),a=r(62),i=r(74);class n extends Error{}var o=r(16),u=r(57),l=r(39)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(2),a=r(3);class i extends a.default{}var n=r(1),o=r(8);class u extends s.default{static get resourceName(){return"messages"}toObject(e=!1){const t=super.toObject(e);return t.variants=t.variants.map((t=>{if(t instanceof i)return t.toObject(e);const r=e?o.camel:o.snake,s={},a=Object.keys(t);for(const e of a)s[r(e)]=t[e];return s})),t}_guessType(e,t){return"variants"===e?Array.from(t).map((e=>new i(this.api,e))):super._guessType(e,t)}_buildCreateData(){return this.toObject()}_update(){return(0,n.makeCancelable)((async e=>{const t=this.toObject();return await this.api.ky.patch(this.url,{json:t,signal:e}),Object.assign(this._baseProperties,this._properties),this._properties={},"updated_at"in this._baseProperties&&(this._baseProperties.updated_at=new Date),this}))}}},(e,t,r)=>{r.r(t),r.d(t,{Choropleth:()=>n,Color:()=>o.default,Contract:()=>u.default,Dimension:()=>l.default,DimensionSet:()=>c.default,Domain:()=>h.default,Faq:()=>p,Feature:()=>f.default,Font:()=>g.default,FontFamily:()=>_.default,Highlight:()=>y,InsetMap:()=>m,Job:()=>w.default,JobResult:()=>b.default,JobRevision:()=>x.default,JobShare:()=>v.default,JobType:()=>k.default,Language:()=>P.default,Layer:()=>j.default,LayerFaq:()=>O,LayerGroup:()=>N.default,Mapstyle:()=>$.default,MapstyleSet:()=>S.default,Message:()=>T.default,Notification:()=>C.default,Organisation:()=>R.default,Permission:()=>A.default,ProductTour:()=>q,ProductTourStep:()=>L,Role:()=>F.default,Svg:()=>M.default,SvgSet:()=>I.default,Tag:()=>B.default,TagType:()=>K,User:()=>Q.default,VectorChoropleth:()=>J,VectorHighlight:()=>W,base:()=>z});var s=r(25),a=r(3),i=r(1);class n extends a.default{static get resourceName(){return"choropleths"}getJson(){return(0,i.makeCancelable)((e=>this.api.ky.get(`${this.url}/json`,{signal:e}).json()))}downloadPreview(){return(0,i.makeCancelable)((async e=>{const t=await this.api.ky.get(`${this.url}/preview`,{signal:e});return s.default.fromResponse(t)}))}}var o=r(42),u=r(63),l=r(44),c=r(43),h=r(64),d=r(2);class p extends d.default{static get resourceName(){return"faqs"}}var f=r(45),g=r(47),_=r(46);class y extends a.default{static get resourceName(){return"highlights"}}class m extends a.default{static get resourceName(){return"inset-maps"}getJson(){return(0,i.makeCancelable)((e=>this.api.ky.get(`${this.url}/json`,{signal:e}).json()))}}var w=r(48),b=r(49),x=r(65),v=r(26),k=r(51),P=r(67),j=r(27),E=r(10);class O extends E.default{static get resourceName(){return"layer-faqs"}static get parentKey(){return"layer_group_id"}}var N=r(70),$=r(66),S=r(28),T=r(35),C=r(68),R=r(41),A=r(55),U=r(0),D=r(14);class L extends((0,U.mix)(E.default)){static get resourceName(){return"product-tours/steps"}static get parentKey(){return"product_tour_id"}}class q extends((0,U.mix)(D.default)){static get resourcePath(){return"/product-tours/{id}"}static get resourceName(){return"product-tours"}get _Child(){return L}}var F=r(69),M=r(53),I=r(52),B=r(29);class K extends d.default{static get resourcePath(){return"/tags/types/{id}"}static get resourceName(){return"tag-types"}get tags(){return this._proxyResourceList(B.default,`${this.url}/tags`)}}var Q=r(54);class W extends a.default{static get resourceName(){return"highlights/vector"}}class J extends a.default{static get resourceName(){return"choropleths/vector"}}const z={CrudBase:d.default,CrudSetBase:D.default,ResourceBase:a.default}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(22),a=r(32);class i extends a.default{static uuid4(){let e=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}static nil(){return"0000000-0000-0000-0000-000000000000"}}class n extends a.default{static get prefix(){return"oauth_state_"}static generate(){const e=i.uuid4(),t=n.prefix+e;return s.default.best.set(t,Date.now()),e}static validate(e,t=!0){const r=s.default.best,a=n.prefix+e,i=void 0!==r.get(a);return t&&i&&r.remove(a),i}static clean(){const e=Object.keys(this.list());for(const t of e)s.default.best.remove(n.prefix+t)}static list(){const e=s.default.best;return e.keys().filter((e=>e.startsWith(n.prefix))).map((e=>e.replace(n.prefix,""))).reduce(((t,r)=>(t[r]=e.get(r),t)),{})}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(39),a=r(7),i=r(60),n=r(19),o=r(1);class u extends n.default{constructor(e,t,r=null,s={},{hasForPoint:a=!0,hasForBoundary:i=!0}={}){super(e,t,r,s),this._hasForPoint=a,this._hasForBoundary=i}get hasForPoint(){return this._hasForPoint}get hasForBoundary(){return this._hasForBoundary}forBoundary({topLeft:e,bottomRight:t},r=a.default.perPage){if(!this.hasForBoundary)throw new s.default(`${this.Target.name} does not support the operation forBoundary`);const n=new i.GeoBoundary(e,t);if(r>a.default.maxPerPage)throw new TypeError(`Invalid resource limit ${r}, maximum allowed is ${a.default.maxPerPage}`);const u=`${this.new().baseUrl}/for-boundary?per_page=${r}`;return(0,o.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(u,{json:{boundary:n},signal:e}).json();return t.map((e=>this.new(e)))}))}forPoint({lat:e,lng:t},r=a.default.perPage){if(!this.hasForPoint)throw new s.default(`${this.Target.name} does not support the operation forPoint`);const n=new i.GeoPoint(e,t);if(r>a.default.maxPerPage)throw new TypeError(`Invalid resource limit ${r}, maximum allowed is ${a.default.maxPerPage}`);const u=`${this.new().baseUrl}/for-point`;return(0,o.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(u,{json:{limit:r,point:n},signal:e}).json();return t.map((e=>this.new(e)))}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s extends Error{}},e=>{e.exports=require("events")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>v});var s=r(20),a=r(2),i=r(42),n=r(63),o=r(43),u=r(64),l=r(45),c=r(46),h=r(48),d=r(26),p=r(51),f=r(27),g=r(28),_=r(52),y=r(29),m=r(54),w=r(1),b=r(4),x=r(70);class v extends a.default{static get resourceName(){return"organisations"}get fontFamilies(){return new s.default(this.api,this,c.default)}get dimensionSets(){return new s.default(this.api,this,o.default)}get mapstyleSets(){return new s.default(this.api,this,g.default)}get svgSets(){return new s.default(this.api,this,_.default)}get colors(){return new s.default(this.api,this,i.default)}get tags(){return new s.default(this.api,this,y.default)}get features(){return new s.default(this.api,this,l.default)}get layers(){return new s.default(this.api,this,f.default)}get layerGroups(){return new s.default(this.api,this,x.default)}get jobs(){return this._proxyResourceList(h.default)}get jobTypes(){return new s.default(this.api,this,p.default)}get jobShares(){return this._proxyResourceList(d.default)}get users(){return this._proxyResourceList(m.default)}get contracts(){return this._proxyResourceList(n.default)}get domains(){return this._proxyResourceList(u.default)}getTree(e=null){return(0,w.makeCancelable)((async t=>{let r=`${this.url}/tree`;if("string"==typeof e){const t=r.includes("?")?"&":"?";r+=t+(0,b.encodeQueryString)({deleted:e})}const{data:s}=await this.api.ky.get(r,{signal:t}).json();return s.map((e=>this._parseTree(e)))}))}_parseTree(e){const t=new this.constructor(this._api,e);return t.children=t.children.map((e=>this._parseTree(e))),t}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(5),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourceName(){return"colors"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(14),a=r(44),i=r(5),n=r(0);class o extends((0,n.mix)(s.default,i.default)){static get resourcePath(){return"/dimensions/sets/{id}"}static get resourceName(){return"dimension-sets"}get _Child(){return a.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"dimensions"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(5),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourceName(){return"features"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(5),a=r(0),i=r(14),n=r(47);class o extends((0,a.mix)(i.default,s.default)){static get resourcePath(){return"/fonts/families/{id}"}static get resourceName(){return"font-families"}get _Child(){return n.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"fonts"}static get parentKey(){return"font_family_id"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var s=r(19),a=r(25),i=r(2),n=r(49),o=r(65),u=r(7),l=r(4),c=r(6),h=r(1),d=r(26);class p extends i.default{get results(){return this._proxyResourceList(n.default,`${this.url}/results`)}get revisions(){const e={jobId:this.id};return new s.default(this.api,o.default,null,e)}static get resourceName(){return"jobs"}get previewUrl(){return`${this.url}/preview`}get lastArchiveUrl(){return`${this.url}/output`}downloadPreview(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.previewUrl}?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return a.default.fromResponse(r)}))}downloadOutput(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.lastArchiveUrl}?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return a.default.fromResponse(r)}))}getOutputUrl(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.url}/output-url?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r.url}))}share(e=d.default.visibility.PRIVATE,t=u.default.deleted||c.DeletedState.NONE){if(e=e.toLowerCase(),!d.default.visibility.values().includes(e))throw new Error(`Unknown visibility '${e}'`);const r=`${this.url}/share?${(0,l.encodeQueryString)({deleted:t})}`;return(0,h.makeCancelable)((async t=>{const{data:s}=await this.api.ky.post(r,{json:{visibility:e},signal:t}).json();return new d.default(this._api,s)}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var s=r(25),a=r(3),i=r(7),n=r(4),o=r(6),u=r(1);class l extends a.default{static get resourcePath(){return"/jobs/{job_id}/revisions/{revision}/result"}static get resourceName(){return"job-result"}get job(){return this.api.jobs.get(this.jobId)}get jobRevision(){return this.api.jobs.select(this.jobId).revisions.get(this.id)}get outputUrl(){return`${this.url}/output`}downloadOutput(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.outputUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}get outputUrlUrl(){return`${this.url}/output-url`}getOutputUrl(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.outputUrlUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r.url}))}get logUrl(){return`${this.url}/log`}downloadLog(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.logUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}get previewUrl(){return`${this.url}/preview`}downloadPreview(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.previewUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}dealWith(e=!0,t=i.default.deleted||o.DeletedState.NONE){const r=(e=Boolean(e))?"POST":"DELETE",s=`${this.url}/deal-with?${(0,n.encodeQueryString)({deleted:t})}`;return(0,u.makeCancelable)((async t=>{await this.api.ky(s,{method:r,signal:t}),this.dealtWith=e}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(31),a=r(15),i=r(25),n=r(3),o=r(0),u=r(4),l=r(1);class c{constructor(e,t){if(!(0,o.isParentOf)(a.default,e))throw new TypeError("Expected api to be of type Mapcreator");if(!(0,o.isParentOf)(n.default,t))throw new TypeError("Expected target to be of type ResourceBase");this._api=e,this._target=t}get api(){return this._api}get url(){return`${this._target.url}/image`}delete(){return(0,l.makeCancelable)((async e=>{await this.api.ky.delete(this.url,{signal:e})}))}download(){return(0,l.makeCancelable)((async e=>{const t=await this.api.ky.get(this.url,{signal:e});return i.default.fromResponse(t)}))}upload(e){const t=new u.FormData;t.append("image",e,"image");const r={};return t.getHeaders&&Object.assign(r,t.getHeaders()),(0,l.makeCancelable)((async e=>{await this.api.ky.post(this.url,{headers:r,body:t,signal:e})}))}}class h extends s.default{get imageHandler(){return new c(this.api,this)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(5),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourcePath(){return"/jobs/types/{id}"}static get resourceName(){return"job-types"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(5),a=r(14),i=r(53),n=r(0);class o extends((0,n.mix)(a.default,s.default)){static get resourcePath(){return"/svgs/sets/{id}"}static get resourceName(){return"svg-sets"}get _Child(){return i.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"svgs"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var s=r(20),a=r(19),i=r(2),n=r(42),o=r(44),u=r(43),l=r(45),c=r(47),h=r(46),d=r(48),p=r(26),f=r(51),g=r(67),_=r(27),y=r(66),m=r(28),w=r(35),b=r(68),x=r(41),v=r(55),k=r(69),P=r(53),j=r(52),E=r(1);class O extends i.default{static get resourceName(){return"users"}ips(){const e=`${this.url}/ips`;return(0,E.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(e,{signal:t}).json();return r.map((e=>e.ip_address))}))}organisation(){return new a.default(this.api,x.default).get(this.organisationId)}language(){return new a.default(this.api,g.default).get(this.languageCode)}get notifications(){return this._proxyResourceList(b.default)}messages(){const e=`${this.url}/messages`;return(0,E.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(e,{signal:t}).json();return{read:r.read.map((e=>new w.default(this.api,e))),unread:r.unread.map((e=>new w.default(this.api,e)))}}))}get mapstyleSets(){return this._proxyResourceList(m.default)}get mapstyles(){return this._proxyResourceList(y.default)}get dimensionSets(){return this._proxyResourceList(u.default)}get dimensions(){return this._proxyResourceList(o.default)}get fontFamilies(){return this._proxyResourceList(h.default)}get fonts(){return this._proxyResourceList(c.default)}get svgSets(){return this._proxyResourceList(j.default)}get svgs(){return this._proxyResourceList(P.default)}get colors(){return this._proxyResourceList(n.default)}get jobs(){return this._proxyResourceList(d.default)}get features(){return this._proxyResourceList(l.default)}get layers(){return this._proxyResourceList(_.default)}get jobTypes(){return this._proxyResourceList(f.default)}get jobShares(){return this._proxyResourceList(p.default)}get permissions(){return this._proxyResourceList(v.default)}get roles(){return new s.default(this.api,this,k.default)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(3);class a extends s.default{static get resourceName(){return"permissions"}}},,(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s extends Error{}},(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>FileDriver});var _utils_node__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9),_DataStoreContract__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(24);class FileDriver extends _DataStoreContract__WEBPACK_IMPORTED_MODULE_1__.default{constructor(e=".m4n"){super(),this._path=e}get path(){return this._path}set path(e){if("string"!=typeof e)throw new TypeError('Expected "path" value to be of type "string"');this._path=e}static get available(){return(0,_utils_node__WEBPACK_IMPORTED_MODULE_0__.isNode)()}static get secure(){return!0}set(e,t){const r=this._read();r[e]=t,this._write(r)}get(e){return this._read()[e]}remove(e){const t=this._read();delete t[e],this._write(t)}clear(){this._write({})}keys(){return Object.keys(this._read())}_read(){let e;try{e=this._fs.readFileSync(this.path).toString()}catch(t){e="{}"}return e?JSON.parse(e):{}}_write(e){const t=JSON.stringify(e),r=this._fs.openSync(this.path,"w");this._fs.writeSync(r,t),this._fs.closeSync(r)}get _fs(){return this.__fs||(this.__fs=eval('require("fs")')),this.__fs}}},e=>{e.exports=require("form-data")},(e,t,r)=>{r.r(t),r.d(t,{GeoPoint:()=>n,GeoBoundary:()=>o});var s=r(17),a=r.n(s),i=r(39);class n{constructor(e,t){this.lat=e,this.lng=t}get lat(){return this._lat}set lat(e){if(e=Number(e),!Number.isFinite(e))throw new i.default(`Invalid latitude: ${e}`);this._lat=Math.min(90,Math.max(-90,e))}get lng(){return this._lng}set lng(e){if(e=Number(e),!Number.isFinite(e))throw new i.default(`Invalid longitude: ${e}`);this._lng=e}toJSON(){return{lat:this.lat,lng:this.lng}}}class o{constructor({lat:e,lng:t},{lat:r,lng:s}){a()(this,"topLeft",void 0),a()(this,"bottomRight",void 0),this.topLeft=new n(e,t),this.bottomRight=new n(r,s)}getCenter(){const e=(this.topLeft.lat+this.bottomRight.lat)/2,t=(this.topLeft.lng+this.bottomRight.lng)/2;return new n(e,t)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(3),a=r(0),i=r(31);class n extends i.default{initializer(){const e=this.constructor._injectable||{};for(const t of Object.keys(e)){const{value:r,isProxy:s}=e[t];s?this.injectProxy(t,r):this.inject(t,r)}}static injectProxy(e,t){if(t)void 0===this._injectable&&(this._injectable={}),this._injectable[e]={value:t,isProxy:!0};else for(const t of Object.keys(e))this.inject(t,e[t])}static inject(e,t){if(t)void 0===this._injectable&&(this._injectable={}),this._injectable[e]={value:t,isProxy:!1};else for(const t of Object.keys(e))this.inject(t,e[t])}static uninject(e){void 0!==this._injectable&&delete this._injectable[e]}injectProxy(e,t){if(t)(0,a.isParentOf)(s.default,t)?this._injectProxy(e,t):this._inject(e,t);else for(const t of Object.keys(e))this.injectProxy(t,e[t])}inject(e,t){this._inject(e,t,!1)}uninject(e){const t=Object.getOwnPropertyDescriptor(this,e),r=t.value||t.get||{};if(!r.injected)throw new Error(`Property "${e}" was not injected, can't un-inject`);r.original?Object.defineProperty(this,e,r.original):Object.defineProperty(this,e,{value:void 0,enumerable:!1,writable:!0})}_injectProxy(e,t){e===t.name&&(e=`${e.replace(/^\w/,(e=>e.toLowerCase()))}s`);const i=r(5).default;if((0,a.hasTrait)(t,i)){const s=r(20).default;this._inject(e,(function(){return new s(this.api,this,t)}))}else if((0,a.isParentOf)(s.default,t)&&this._proxyResourceList)this._inject(e,(function(){return this._proxyResourceList(t)}));else{const s=r(19).default;this._inject(e,(function(){return new s(this,t)}))}}_inject(e,t,r=!0){const s=(...e)=>t.apply(this,e),a=Object.getOwnPropertyDescriptor(this,e);s.injected=!0,a&&(s.original=a),Object.defineProperty(this,e,{enumerable:!1,configurable:!0,[r?"get":"value"]:s})}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(17),a=r.n(s);class i extends Error{constructor({options:e,request:t,response:r,data:s}){const{type:n,message:o,trace:u}=s.error;super(o),a()(this,"options",void 0),a()(this,"response",void 0),a()(this,"request",void 0),a()(this,"type",void 0),a()(this,"status",void 0),a()(this,"trace",void 0),this.options=e,this.response=r,this.request=t,this.type=n,this.trace=[],"string"==typeof u&&(this._trace=i._parseTrace(u))}get hasTrace(){return this.trace.length>0}toString(){return`[${this.status}] ${this.type}: ${this.message}`}static _parseTrace(e){const t=/^#(\d+)\s(?:(.*?)\((\d+)\)|(.*?)):\s(.*?)$/gm,r=[];let s;for(;null!==(s=t.exec(e));)s.index===t.lastIndex&&t.lastIndex++,r.push({line:s[3],file:s[2]||s[4],code:s[5]});return r}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"contracts"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"domains"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(0),a=r(2),i=r(49),n=(r(26),r(27)),o=r(7),u=r(4),l=r(6),c=r(1);class h extends a.default{get baseUrl(){return`${this._api.url}/jobs/${this.jobId}/revisions`}static get resourcePath(){return"/jobs/{job_id}/revisions/{revision}"}static get resourceName(){return"job-revisions"}static get resourceUrlKey(){return"revision"}get layers(){return this._proxyResourceList(n.default)}result(e=o.default.deleted||l.DeletedState.NONE){return(0,c.makeCancelable)((async t=>{const r=`${this.url}/result?${(0,u.encodeQueryString)({deleted:e})}`,{data:s}=await this.api.ky.get(r,{signal:t}).json();return s.jobId=this.jobId,s.revision=this.revision,new i.default(this.api,s)}))}get resultProxy(){const e={jobId:this.jobId,revision:this.revision};return new i.default(this.api,e)}save(e={},t=null,r=o.default.deleted||l.DeletedState.NONE){if(t&&t.length>0)if((0,s.isParentOf)(n.default,t[0]))t=t.map((e=>e.id));else if("number"!=typeof t[0])throw new TypeError("layers property is not of type Array<Layer>, Array<Number> or null");const a={object:JSON.stringify(e),language_code:this.languageCode,mapstyle_set_id:this.mapstyleSetId,output:this.output};t&&(a.layers=t);const i=`${this.baseUrl}?${(0,u.encodeQueryString)({deleted:r})}`;return(0,c.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(i,{json:a,signal:e}).json();return new h(this.api,t)}))}object(e=o.default.deleted||l.DeletedState.NONE){const t=`${this.url}/object?${(0,u.encodeQueryString)({deleted:e})}`;return(0,c.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r}))}build(e,t=o.default.deleted||l.DeletedState.NONE){const r=`${this.url}/build?${(0,u.encodeQueryString)({deleted:t})}`;return(0,c.makeCancelable)((async t=>{await this.api.ky.post(r,{json:{callback:e},signal:t})}))}cancel(e=o.default.deleted||l.DeletedState.NONE){const t=`${this.url}/cancel?${(0,u.encodeQueryString)({deleted:e})}`;return(0,c.makeCancelable)((async e=>{await this.api.ky.post(t,{signal:e})}))}clone(e=null,t=o.default.deleted||l.DeletedState.NONE){const r=`${this.url}/clone?${(0,u.encodeQueryString)({deleted:t})}`;return(0,c.makeCancelable)((async t=>{const{data:s}=await this.api.ky.post(r,{json:{title:e},signal:t}).json();return new h(this.api,s)}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(50),a=r(0),i=r(10);class n extends((0,a.mix)(i.default,s.default)){static get resourceName(){return"mapstyles"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"languages"}static get resourcePath(){return`/${this.resourceName}/{code}`}toString(){return`${this.constructor.name}(${this.code})`}static get resourceUrlKey(){return"code"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"notifications"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(20),a=r(2),i=r(55),n=r(54);class o extends a.default{get permissions(){return new s.default(this.api,this,i.default)}get users(){return new s.default(this.api,this,n.default)}static get resourceName(){return"roles"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(5),a=r(0),i=r(27),n=r(14),o=r(71);class u extends((0,a.mix)(n.default,s.default)){static get resourceName(){return"layer-groups"}get items(){return new o.OwnedResourceProxy(this.api,this,this._Child)}get _Child(){return i.default}}},(e,t,r)=>{r.r(t),r.d(t,{GeoResourceProxy:()=>s.default,OrganisationProxy:()=>a.default,OwnedResourceProxy:()=>i.default,ResourceProxy:()=>n.default,SimpleResourceProxy:()=>o.default});var s=r(38),a=r(33),i=r(20),n=r(19),o=r(13)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(16),a=r(18);class i extends a.default{constructor(e="",t=["*"]){super(e,t)}authenticate(){return new Promise(((e,t)=>{this.authenticated?e(this.token):t(new s.default("dummy_error","Attempted authentication using a dummy authenticator"))}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(8),a=r(40),i=r(15),n=r(7),o=r(3),u=r(0),l=r(1);class c extends a.EventEmitter{constructor(e,t,r=o.default,a=null,l=50,c="id"){if(super(),!(0,u.isParentOf)(i.default,e))throw new TypeError("Expected api to be of type Mapcreator");this._api=e,this._Resource=r,this._route=t||new this.Resource(e,{}).baseUrl,this._parameters=new n.default(a||{perPage:n.default.maxPerPage}),this._key=(0,s.snake)(c),this._waiting=!1,this.autoUpdate=!0,this.maxRows=l,this._reset()}get hasMore(){return void 0===this.availableRows||this.availableRows>this.maxRows}get waiting(){return this._waiting}get parameters(){return this._parameters}set parameters(e){this.parameters.apply(e)}get Resource(){return this._Resource}get route(){return this._route}get data(){return this._data}get api(){return this._api}get rowCount(){return this.data.length}get maxRows(){return this._maxRows}set maxRows(e){if(e=Number(e),Number.isNaN(e))throw new TypeError("Expected maxRows to be numeric got "+typeof raw);this._maxRows=e,this.autoUpdate&&this.update()}get availableRows(){return this._availableRows}set autoUpdate(e){e=Boolean(e),this.autoUpdate!==e&&(this._autoUpdate=e,void 0===this._boundUpdate&&(this._boundUpdate=this.update.bind(this)),this.autoUpdate?this.parameters.on("change",this._boundUpdate):this.parameters.off("change",this._boundUpdate))}get autoUpdate(){return this._autoUpdate}_reset(){this._parameterToken=this.parameters.token(),this._realData=[],this._data=[],this._keys=[],delete this._availableRows}async update(){if(!this.waiting){this._waiting=!0;try{if(this._parameterToken!==this.parameters.token()&&this._reset(),this._realData.length<this.maxRows)try{await this._fetchMore()}catch(e){throw this.autoUpdate=!1,this.emit("error",e),e}this.data.length!==this.maxRows&&(this._data=this._realData.slice(0,this.maxRows))}finally{this._waiting=!1}this.emit("update")}}_fetchMore(){const e=this.route.includes("?")?"&":"?",t=this.parameters.copy();t.offset+=this.rowCount;const r=Math.ceil((this.maxRows-this.rowCount)/this.parameters.perPage),s=[];return(0,l.makeCancelable)((async a=>{for(;t.page<=r;t.page++){const r=this.route+e+t.encode(),i=this.api.ky.get(r,{signal:a});s.push(i)}const i=await Promise.all(s);for(const e of i){const{data:r}=await e.json();r.forEach((e=>this.push(e,!1))),this._availableRows=Number(e.headers.get("x-paginate-total"))+t.offset}}))}[Symbol.iterator](){return this.data[Symbol.iterator]()}push(e,t=!0){(0,u.isParentOf)(this.Resource,e)||(e=new this.Resource(this.api,e));const r=this._keys.findIndex((t=>t===e[this._key]));r>=0?(this._realData[r]=e,void 0!==this._data[r]&&(this._data[r]=e)):(this._realData.push(e),this._keys.push(e[this._key]),t&&(this.maxRows++,this._data.push(e)))}loadMore(e=this.parameters.perPage){this.maxRows+=e}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(17),a=r.n(s),i=r(62);class n extends i.default{constructor({options:e,request:t,response:r,data:s}){super({options:e,request:t,response:r,data:s}),a()(this,"validationErrors",void 0),a()(this,"schemaErrors",void 0);const i=s.error.schema_errors;this.validationErrors=s.error.validation_errors,this.schemaErrors=Array.isArray(i)?i:[]}get hasSchemaErrors(){return this.schemaErrors.length>0}get messages(){const e=[];for(const t of Object.keys(this.validationErrors))e.push(...this.validationErrors[t]);return e}toString(){return`There were some validation errors: ${this.messages.join(", ")}`}}}],__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AbstractClassError:()=>b.AbstractClassError,AbstractError:()=>b.AbstractError,AbstractMethodError:()=>b.AbstractMethodError,ApiError:()=>w.default,DeletedState:()=>a.DeletedState,DummyFlow:()=>m.default,Enum:()=>s.default,ImplicitFlow:()=>d,ImplicitFlowPopup:()=>p,Mapcreator:()=>e.default,OAuth:()=>i.default,OAuthToken:()=>n.default,PasswordFlow:()=>y,RequestParameters:()=>t.default,ResourceLister:()=>P.default,ResultStatus:()=>a.ResultStatus,StaticClassError:()=>v.default,StorageManager:()=>r.default,ValidationError:()=>x.default,errors:()=>E,geo:()=>j,helpers:()=>_,proxies:()=>O,resources:()=>k,version:()=>N});var e=__webpack_require__(15),t=__webpack_require__(7),r=__webpack_require__(22),s=__webpack_require__(11),a=__webpack_require__(6),i=__webpack_require__(18),n=__webpack_require__(12),o=__webpack_require__(37),u=__webpack_require__(4),l=__webpack_require__(16),c=__webpack_require__(9),h=__webpack_require__(8);class d extends i.default{constructor(e,t="",r=["*"],s=!0){if(super(e,r),(0,c.isNode)())throw new Error(`${this.constructor.name} can't be used under nodejs`);if(this.path="/oauth/authorize",this.callbackUrl=t,this.useState=s,this.callbackUrl||(this.callbackUrl=window.location.toString().split("#")[0]),this._anchorParams=["access_token","token_type","expires_in"],this.useState&&this._anchorParams.push("state"),this._anchorContainsOAuthResponse()){const e=this._getOAuthAnchorParams();if(this._cleanAnchorParams(),this.useState&&!o.default.validate(e.state))throw Error("Invalid state in url");this.token=n.default.fromResponseObject(e)}}authenticate(){return new Promise(((e,t)=>{if(this.authenticated)e(this.token);else if(this._anchorContainsError()){const e=this._getError();this._cleanAnchorParams(),t(e)}else window.location=this._buildRedirectUrl()}))}_buildRedirectUrl(){const e={client_id:this.clientId,redirect_uri:this.callbackUrl,response_type:"token",scope:this.scopes.join(" ")};return this.useState&&(e.state=o.default.generate()),`${this.host+this.path}?${(0,u.encodeQueryString)(e)}`}_getAnchorParams(e=window.location.hash){const t={};e=e.replace(/^#\/?/g,"");for(const r of e.split("&")){const e=r.split("=").map(decodeURIComponent);t[e[0]]=e[1]}return t}_getOAuthAnchorParams(e=this._getAnchorParams()){return Object.keys(e).filter((e=>this._anchorParams.includes(e))).reduce(((t,r)=>(t[r]=e[r],t)),{})}_cleanAnchorParams(){const e=this._getAnchorParams(),t=this._anchorParams;t.push("state","error");for(const r of t)delete e[r];window.location.hash=(0,u.encodeQueryString)(e)}_anchorContainsOAuthResponse(){const e=Object.keys(this._getOAuthAnchorParams());return this._anchorParams.reduce(((t,r)=>t&&e.includes(r)),!0)}_anchorContainsError(){return Boolean(this._getAnchorParams().error)}_getError(){if(!this._anchorContainsError())throw Error("No OAuthError found in anchor");const e=this._getAnchorParams();return e.message?new l.default(e.error,e.message):new l.default(e.error,(0,h.title)(e.error))}}class p extends d{constructor(e,t="",r=["*"],s=!1,a="width=800, height=600"){if(super(e,t,r,s),this.windowOptions=a,window.name===p.popupWindowName)throw new Error("We're a flow popup")}static get popupWindowName(){return"m4n_api_auth"}authenticate(){return window.name===p.popupWindowName?new Promise((()=>{})):this.authenticated?new Promise((e=>{e(this.token)})):new Promise(((e,t)=>{const r=window.open(this._buildRedirectUrl(),p.popupWindowName,this.windowOptions),s=setInterval((()=>{r.closed&&t(new l.default("window_closed","Pop-up window was closed before data could be extracted"));let a=!1;try{a=!["","about:blank"].includes(r.location.href)}catch(e){}if(a){clearInterval(s);const a=this._getAnchorParams(r.location.hash);r.close(),a.error?t(new l.default(a.error,a.message)):e(this.token=n.default.fromResponseObject(a))}}),250)}))}}var f=__webpack_require__(30),g=__webpack_require__.n(f),_=__webpack_require__(1);class y extends i.default{constructor(e,t,r,s,a=["*"]){super(e,a),this._secret=t,this._username=r,this._password=s,this._path="/oauth/token",(0,c.isNode)()||(console.warn("Using PasswordFlow in the browser is unrecommended"),"https:"!==window.location.protocol&&console.warn("Page was not loaded using https. You're most likely leaking secrets right now"))}get secret(){return this._secret}set secret(e){this._secret=e}get username(){return this._username}set username(e){this._username=e}get password(){return this._password}set password(e){this._password=e}get path(){return this._path}set path(e){this._path=e}authenticate(){const e=this.host+this.path,t={grant_type:"password",client_id:this.clientId,client_secret:this._secret,username:this.username,password:this.password,scope:this.scopes.join(" ")};return(0,_.makeCancelable)((async r=>{const s=await g().post(e,{json:t,signal:r}).json();if(s.error)throw new l.default(s.error,s.message);return this.token=n.default.fromResponseObject(s),this.token.scopes=this.scopes,this.token}))}}var m=__webpack_require__(72),w=__webpack_require__(62),b=__webpack_require__(21),x=__webpack_require__(74),v=__webpack_require__(57),k=__webpack_require__(36),P=__webpack_require__(73),j=__webpack_require__(60),E=__webpack_require__(34),O=__webpack_require__(71);const N="v3.2.0"})(),module.exports=__webpack_exports__})();
|
|
2
|
+
(()=>{"use strict";var __webpack_modules__=[(e,t,r)=>{r.r(t),r.d(t,{isParentOf:()=>i,getTypeName:()=>n,mix:()=>u,hasTrait:()=>l});var s=r(32),a=r(23);function i(e,t){if(null===e||null===t)return!1;e="function"==typeof e?e:e.constructor,t="function"==typeof t?t:t.constructor;do{if(t.name===e.name)return!0;t=Object.getPrototypeOf(t)}while(""!==t.name);return!1}function n(e){return void 0===e?"undefined":(e="function"==typeof e?e:e.constructor).name}function o(e,t){Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach((r=>{r.match(/^(?:constructor|initializer|prototype|arguments|caller|name|bind|call|apply|toString|length)$/)||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}function u(e,...t){const r=class extends(e||class{}){constructor(...e){super(...e),t.map((e=>e.prototype.initializer)).filter((e=>"function"==typeof e)).forEach((e=>e.call(this)))}};for(const e of t){if(!i(s.default,e))throw new TypeError(`Expected mixin to implement Trait for ${e.name}`);o(r.prototype,e.prototype),o(r,e)}r.__mixins=t;const n=(0,a.fnv32b)(t.map((e=>e.name)).join(","));return Object.defineProperty(r,"name",{value:`Cocktail_${n}`}),r}function l(e,t){e="function"==typeof e?e:e.constructor;do{if(Array.isArray(e.__mixins)&&e.__mixins.includes(t))return!0;e=Object.getPrototypeOf(e)}while(""!==e.name);return!1}},(e,t,r)=>{async function s(e,t=1,r){e instanceof Promise&&(e=await e);const s=e.data,a=[];t=t||e.page,r=r||e.pageCount,t===e.page&&t++;for(let s=t;s<=r;s++)a.push(e.get(s));const i=await Promise.all(a);return s.concat(...i.map((e=>e.data)))}r.r(t),r.d(t,{getPaginatedRange:()=>s,delay:()=>a,wrapKyCancelable:()=>i,makeCancelable:()=>n,serializeUTCDate:()=>o,clone:()=>u});const a=e=>new Promise((t=>setTimeout(t,e)));function i(e){return(t,r={})=>{if("object"==typeof r&&r.hasOwnProperty("signal"))return e(t,r);const s=new AbortController,a=e(t,{signal:s.signal,...r});return a.cancel=()=>s.abort(),a}}function n(e){const t=new AbortController,r=e(t.signal);return r instanceof Promise&&(r.cancel=()=>t.abort()),r}function o(e){if(!(e instanceof Date))throw new TypeError("Expected date to be of type Date");const t=e=>`00${e}`.slice(-Math.max(String(e).length,2));let r=[e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate()].map(t).join("-");return r+=` ${[e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()].map(t).join(":")}`,r}function u(e,t=!0){const r=e=>u(e,t);if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(r);const s={};for(const a of Object.keys(e))!t&&a.startsWith("_")||(s[a]=r(e[a]));return s}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(35),a=r(3),i=r(1);class n extends a.default{constructor(e,t={},r=null){if(super(e,t,r),this.constructor===n)throw new s.AbstractClassError}_buildCreateData(){this._updateProperties();const e={},t=[].concat(Object.keys(this._properties),Object.keys(this._baseProperties)).filter(((e,t,r)=>r.indexOf(e)===t));for(const r of t)e[r]=this._properties[r]||this._baseProperties[r];return delete e.id,e}save(){return this.id?this._update():this._create()}_create(){return(0,i.makeCancelable)((async e=>{const t=this._prepareData(this._buildCreateData()),{data:r}=await this.api.ky.post(this.baseUrl,{json:t,signal:e}).json();return this._properties={},this._baseProperties=r,this._updateProperties(),this}))}_update(){return this._updateProperties(),(0,i.makeCancelable)((async e=>{if(0===Object.keys(this._properties).length)return this;const t=this._prepareData(this._properties);return await this.api.ky.patch(this.url,{json:t,signal:e}),Object.assign(this._baseProperties,this._properties),this._properties={},"updated_at"in this._baseProperties&&(this._baseProperties.updated_at=new Date),this}))}delete(e=!0){return(0,i.makeCancelable)((async t=>(await this.api.ky.delete(this.url,{signal:t}),e&&(this._baseProperties.deleted_at=new Date),this)))}restore(e=!0){return(0,i.makeCancelable)((async t=>{const{data:r}=await this.api.ky.put(this.url,{signal:t}).json(),s=new this.constructor(this.api,r);return e&&(this._properties={},this._baseProperties=r,this._updateProperties()),s}))}_prepareData(e){const t={};for(const[r,s]of Object.entries(e))s instanceof Date?t[r]=(0,i.serializeUTCDate)(s):t[r]=s;return t}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(8),a=r(21),i=r(16),n=r(14),o=r(61),u=r(23),l=r(0),c=r(1);function h(e){return e.filter(((t,r)=>e.findIndex((e=>e===t))===r))}class d extends((0,l.mix)(null,o.default)){constructor(e,t={},r=null){if(super(),this.constructor===d)throw new a.AbstractClassError;r&&(this.__baseUrl=r),this.api=e,t=(0,c.clone)(t);for(const e of Object.keys(t)){const r=(0,s.snake)(e);(0,s.camel)(r)in this?delete t[e]:(t[r]=this._guessType(r,t[e]),r!==e&&delete t[e])}this._baseProperties=t||{},this._properties={},this._api=e;const i=Object.keys(this._baseProperties);for(const e of i)this._applyProperty(e);i.includes("deleted_at")&&Object.defineProperty(this,"deleted",{enumerable:!0,configurable:!0,get:()=>Boolean(this.deletedAt)}),this._knownFields=Object.keys(this).filter((e=>"_"!==e[0]))}get api(){return this._api}set api(e){if(!(0,l.isParentOf)(i.default,e))throw new TypeError("Expected api to be of type Mapcreator or null");this._api=e}static get resourcePath(){return`/${this.resourceName}/{id}`}static get resourceName(){throw new a.AbstractError}static get resourceUrlKey(){return"id"}static get protectedFields(){return["id","created_at","updated_at","deleted_at"]}static get readonly(){return!1}_updateProperties(){let e=Object.keys(this).filter((e=>"_"!==e[0])).filter((e=>!this._knownFields.includes(e)));for(const t of e){const e=(0,s.snake)(t);this._properties[e]=this[t],delete this[t],this._applyProperty(e),this._knownFields.push(e)}e=Object.keys(this._baseProperties).filter((e=>!this._knownFields.includes((0,s.camel)(e))));for(const t of e)this._applyProperty(t),this._knownFields.push(t);this._knownFields=h(this._knownFields)}sanitize(){this._updateProperties(),Object.assign(this._baseProperties,this._properties),this._properties={}}reset(e=null){this._updateProperties(),"string"==typeof e?this.reset([e]):null===e?this._properties={}:Array.isArray(e)&&e.map(String).map(s.snake).forEach((e=>delete this._properties[e]))}clone(){this._updateProperties();const e=new this.constructor(this.api,this._baseProperties);for(const t of Object.keys(this._properties))e[t]=this._properties[t];return e}refresh(e=!0){return(0,c.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(this.url,{signal:t}).json();return e&&(this._properties={},this._baseProperties=r,this._updateProperties()),new this.constructor(this._api,r)}))}_applyProperty(e){const t={enumerable:!0,configurable:!0,get:()=>this._properties.hasOwnProperty(e)?this._properties[e]:this._baseProperties[e]};this.constructor.protectedFields.includes(e)||this.constructor.readonly||(t.set=t=>{this._properties[e]=this._guessType(e,t),delete this._url});const r=(0,s.camel)(e);Object.defineProperty(this,r,t)}_guessType(e,t){return e.endsWith("_at")||e.startsWith("date_")?"string"==typeof t?new Date(t.replace(" ","T")):t:/(_|^)id$/.test(e)&&null!==t&&Number.isFinite(Number(t))?Number(t):t}get ownable(){return!1}get url(){if(!this._url){let e=`${this._api.url}${this.constructor.resourcePath}`;e=e.replace(/{(\w+)}/g,((e,t)=>this[(0,s.camel)(t)])),this._url=e}return this._url}get baseUrl(){if(!this.__baseUrl){const e=this.constructor.resourcePath.match(/^(\/[^{]+\b)/)[1];this.__baseUrl=`${this._api.url}${e}`}return this.__baseUrl}get fieldNames(){return h([...Object.keys(this._baseProperties),...Object.keys(this._properties)]).map(s.camel)}toString(){return`${this.constructor.name}(${this[this.resourceUrlKey]})`}toObject(e=!1){this._updateProperties();const t={...this._baseProperties,...this._properties};if(e)for(const e of Object.keys(t)){const r=(0,s.camel)(e);e!==r&&(t[r]=t[e],delete t[e])}return t}_proxyResourceList(e,t=null,r={}){return t||(t=`${e.resourceName.replace(/s+$/,"")}s`),"string"!=typeof t||t.startsWith("/")||t.match(/https?:/)||(t=`${this.url}/${t}`),new n.default(this.api,e,t,r)}static(e,t=d,r={}){let s;if("string"==typeof e){s=`${this.url}/${e}`;const r=t.name||"AnonymousResource";e=class extends t{static get resourceName(){return Object.getPrototypeOf(this).resourceName||"anonymous"}static get resourcePath(){return s}},Object.defineProperty(e,"name",{value:`${r}_${(0,u.fnv32b)(s)}`})}if(!(0,l.isParentOf)(d,e))throw new TypeError("Expected Target to be of type String or ResourceBase constructor");return this._proxyResourceList(e,s,r)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(34),a=r(32);class i extends a.default{get organisations(){return new s.default(this.api,this)}get ownable(){return!0}}},(e,t,r)=>{r.r(t),r.d(t,{FormData:()=>s,encodeQueryString:()=>i,wrapKyPrefixUrl:()=>n});const s=(0,r(9).windowTest)("FormData")?window.FormData:r(59);function a(e,t=[]){return Object.keys(e).sort().map((r=>{const s=t.slice(0);if("object"==typeof e[r]&&null!==e[r])return s.push(r),a(e[r],s);s.push(r);let i="";i+=encodeURIComponent(s.shift()),i+=s.map((e=>`[${encodeURIComponent(e)}]`)).join("");const n=e[r];return null!=n&&(i+=`=${encodeURIComponent(n)}`),i})).join("&")}function i(e){return a(e).replace(/^&*|&+(?=&)|&*$/g,"")}function n(e,t){return function(r,s){return"string"!=typeof r||/^https?:\/\//.test(r)||(r.startsWith("/")||(r=`/${r}`),r=t+r),e(r,s)}}},(e,t,r)=>{r.r(t),r.d(t,{DeletedState:()=>a,Enum:()=>s.default,JobShareVisibility:()=>n,ResultStatus:()=>i});var s=r(11);const a=new s.default({ALL:"all",BOTH:"all",NONE:"none",ONLY:"only"}),i=new s.default(["queued","processing","completed","canceled","failed"],!0),n=new s.default(["private","organisation","public"],!0)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var s=r(8),a=r(40),i=r(6),n=r(23),o=r(0),u=r(5);class l extends a.EventEmitter{constructor(e={}){super(),l.keys().forEach((e=>this._resolve(e))),this.apply(e)}get page(){return this._resolve("page")}get perPage(){return this._resolve("perPage")}get offset(){return this._resolve("offset")}get search(){return this._resolve("search")}get sort(){return this._resolve("sort")}get deleted(){return this._resolve("deleted")}get extra(){return this._resolve("extra")}set page(e){this._update("page",e)}set perPage(e){this._update("perPage",e)}set offset(e){this._update("offset",e)}set search(e){this._update("search",e)}set sort(e){this._update("sort",e)}set deleted(e){this._update("deleted",e)}set extra(e){this._update("extra",e)}static get page(){return l._page||1}static get perPage(){return l._perPage||Number("12")||12}static get offset(){return l._offset||0}static get maxPerPage(){return l._maxPerPage||50}static get search(){return l._search||{}}static get sort(){return l._sort||[]}static get deleted(){return l._deleted||void 0}static get extra(){return l._extra||{}}static set page(e){l._page=l._validatePage(e)}static set perPage(e){l._perPage=l._validatePerPage(e)}static set offset(e){l._offset=l._validateOffset(e)}static set maxPerPage(e){l._maxPerPage=l._validateMaxPerPage(e)}static set search(e){l._search=l._validateSearch(e)}static set sort(e){l._sort=l._validateSort(e)}static set deleted(e){l._deleted=l._validateDeleted(e)}static set extra(e){l._extra=l._validateExtra(e)}static _validatePage(e){if("number"!=typeof e)throw new TypeError(`Expected page to be of type 'number' instead got '${typeof e}'`);if(e<0)throw new TypeError("Page must be a positive number");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Page must be a real number");if(Math.round(e)!==e)throw new TypeError("Page must be a natural number");return Math.round(e)}static _validatePerPage(e){if("number"!=typeof e)throw new TypeError(`Expected per page to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<=0)throw new TypeError("Per page must be greater than zero");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Per page must be a real number");if(Math.round(e)!==e)throw new TypeError("Per page must be a natural number");return e=Math.min(l.maxPerPage,e)}static _validateOffset(e){if("number"!=typeof e)throw new TypeError(`Expected offset to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<0)throw new TypeError("Offset must be a positive number");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Offset must be a real number");if(Math.round(e)!==e)throw new TypeError("Offset must be a natural number");return e}static _validateMaxPerPage(e){if("number"!=typeof e)throw new TypeError(`Expected page to be of type 'Number' instead got '${(0,o.getTypeName)(e)}'`);if(e<1)throw new TypeError("Value must be greater or equal to 1");return e}static _validateSearch(e){if("object"!=typeof e||Array.isArray(e))throw new TypeError(`Expected value to be of type "Object" got "${(0,o.getTypeName)(e)}"`);const t=e=>"number"==typeof e?e.toString():e;for(let r of Object.keys(e)){if(r=t(r),e[r]=t(e[r]),"string"!=typeof r)throw new TypeError(`Expected key to be of type "String" got "${(0,o.getTypeName)(r)}"`);if(Array.isArray(e[r]))if(e[r].length>0){for(const t of e[r])if(!["string","number","boolean"].includes(typeof t)&&null!==t)throw new TypeError(`Expected query for "${r}" to be of type "String", "Boolean", "Number" or "null" got "${(0,o.getTypeName)(t)}"`)}else delete e[r];else if(null===e[r])delete e[r];else if(!["string","number","boolean"].includes(typeof e[r])&&null!==e[r])throw new TypeError(`Expected query value to be of type "String", "Boolean", "Number", "Array" or "null" got "${(0,o.getTypeName)(e[r])}"`)}return e}static _validateSort(e){if("string"==typeof e)return this._validateSort(e.split(","));if(!(e instanceof Array))throw new TypeError(`Expected sort value to be of type "Array" got "${(0,o.getTypeName)(e)}"`);return e.filter((e=>"string"!=typeof e)).forEach((e=>{throw new TypeError(`Expected sort array values to be of type "String" got "${(0,o.getTypeName)(e)}"`)})),e}static _validateDeleted(e){if(void 0===e)return e;if("string"!=typeof e)throw new TypeError(`Expected deleted to be of type "string" got "${(0,o.getTypeName)(e)}". See: DeletedState`);e=e.toLowerCase();const t=i.DeletedState.values();if(!t.includes(e))throw new TypeError(`Expected deleted to be one of ${t.join(", ")}, got ${e}`);return e}static _validateExtra(e){if("object"!=typeof e)throw new TypeError(`Expected extra to be of type 'object', got '${(0,o.getTypeName)(e)}'`);return e}_resolve(e){const t=`_${e}`;return this[t]||((this||{})[t]=l[e]),this[t]}_update(e,t,r=!1){const a=`_${e}`;return t=l[`_validate${(0,s.pascal)(e)}`](t),(this||{})[a]=t,r||(this.emit("change",[{name:e,value:t}]),this.emit(`change:${e}`,t)),t}encode(){return(0,u.encodeQueryString)(this.toParameterObject())}toObject(){return l.keys().reduce(((e,t)=>(e[(0,s.snake)(t)]=this._resolve(t),e)),{})}toParameterObject(){const e={};l.keys().forEach((t=>{"extra"!==t&&(e[(0,s.snake)(t)]=this._resolve(t))})),e.sort=e.sort.map(s.snake).map((e=>e.replace(/^_/,"-"))).join(","),0===e.offset&&delete e.offset;for(const t of Object.keys(e.search)){const r=t.split(",").map(s.snake).join(",");t!==r&&(e.search[r]=e.search[t],delete e.search[t])}for(const t of Object.keys(e.search))"boolean"==typeof e.search[t]&&(e.search[t]=Number(e.search[t])),null===e.search[t]&&(e.search[t]="");const t=this._resolve("extra");for(const r of Object.keys(t))e[r]=t[r];for(const t of Object.keys(e))void 0===e[t]&&delete e[t];return e}copy(){return new l(this.toObject())}static keys(){return["page","perPage","offset","search","sort","deleted","extra"]}token(){const e=this.toObject();return delete e.page,delete e.per_page,(0,n.hashObject)(e)}static resetDefaults(){for(const e of l.keys())delete l[`_${e}`]}apply(e){e instanceof l&&(e=e.toObject());const t=[];for(const r of Object.keys(e)){const a=(0,s.camel)(r);"_"!==r[0]&&l.keys().includes(a)&&t.push({name:a,value:this._update(a,e[r],!0)})}this.emit("change",t);for(const{name:e,value:r}of t)this.emit(`change:${e}`,r);return t}}},e=>{e.exports=require("case")},(e,t,r)=>{function s(){try{return"[object process]"===Object.prototype.toString.call("undefined"==typeof process?0:process)}catch(e){return!1}}function a(e){return"undefined"!=typeof window&&void 0!==window[e]}r.r(t),r.d(t,{isNode:()=>s,windowTest:()=>a})},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(21),a=r(2),i=r(8);class n extends a.default{constructor(e,t={},r=null){if(super(e,t,r),this.constructor===a.default)throw new s.AbstractClassError}get hasParent(){const e=(0,i.camel)(this.constructor.parentKey);return this.hasOwnProperty(e)}get parentId(){if(this.hasParent){const e=(0,i.camel)(this.constructor.parentKey);return Number(this[e])}}static get parentKey(){return this.resourceName.replace(/s$/,"_set_id")}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(8),a=r(0);class i{get[Symbol.toStringTag](){return this.constructor.name}}class n extends i{constructor(e,t=!1){super();const r=Array.isArray(e);if(t&&!r)throw new TypeError(`Expected enums to be of type "Array" got "${(0,a.getTypeName)(e)}"`);if(r&&t)for(const t of e){const e=(0,s.constant)(t);Object.defineProperty(this,e,{enumerable:!0,value:t})}else if(r)for(const t of e)Object.defineProperty(this,t,{enumerable:!0,value:n._iota});else for(const t of Object.keys(e)){const r={enumerable:!0};"function"==typeof e[t]?r.get=e[t]:r.value=e[t],Object.defineProperty(this,t,r)}Object.freeze(this)}keys(){return Object.keys(this)}values(){return this.keys().map((e=>this[e])).filter(((e,t,r)=>r.indexOf(e)===t))}static get _iota(){return n.__iota||(n.__iota=0),n.__iota++}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(22),a=r(5);class i{constructor(e,t="Bearer",r=432e3,s=[]){if(this.scopes=s,this.token=e,this.type=t.toLowerCase().replace(/(\s|^)\w/g,(e=>e.toUpperCase())),"number"==typeof r){const e=1e3*r;this.expires=new Date(Date.now()+e)}else{if(!(r instanceof Date))throw new TypeError("Expires not of type Date or Number");this.expires=r}}toString(){return`${this.type} ${this.token}`}toResponseObject(){return{access_token:this.token,token_type:this.type.toLowerCase(),expires_in:this.expires-Date.now(),scope:this.scopes}}toQueryString(){return(0,a.encodeQueryString)(this.toResponseObject())}get expired(){return new Date>this.expires}static get storageName(){return"api_token"}static fromResponseObject(e){"string"==typeof e&&(e=JSON.parse(e));let t=432e3;return void 0!==e.exipires_in?t=Number(e.expires_in):"string"==typeof e.expires&&(t=new Date(e.expires)),new i(e.access_token,e.token_type,t,e.scope||[])}save(e=i.storageName){const t={token:this.token,type:this.type,expires:this.expires.toUTCString(),scopes:this.scopes};s.default.secure.set(e,JSON.stringify(t),this.expires)}static recover(e=i.storageName){const t=s.default.secure.get(e);if(!t)return null;const r=JSON.parse(t),a=new i(r.token,r.type,new Date(r.expires),r.scopes||[]);return a.expired?null:a}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(5),a=r(14),i=r(1);class n extends a.default{_parseSelector(e){if(""===e||null===e)return{};switch(typeof e){case"number":case"string":return{[this.Target.resourceUrlKey]:e};case"object":return e;default:return{}}}get(e,t=null){return(0,i.makeCancelable)((async r=>{const a={...this._seedData,...this._parseSelector(e)};let i=this.new(a).url;if("string"==typeof t){const e=i.includes("?")?"&":"?";i+=e+(0,s.encodeQueryString)({deleted:t})}const{data:n}=await this.api.ky.get(i,{signal:r}).json();return this.new(n)}))}select(e){const t={...this._seedData,...this._parseSelector(e)};return this.new(t)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(16),a=r(7),i=r(0),n=r(1);class o{constructor(e,t,r,n,o=null,u=0,l=[]){if(!(0,i.isParentOf)(s.default,e))throw new TypeError("Expected api to be of type Mapcreator");(0,i.isParentOf)(a.default,n)||(n=new a.default(n)),this._api=e,this.route=t,this._Target=r,this._parameters=n,this._pageCount=o,this._rows=u,this._data=l}get api(){return this._api}get route(){return this._route}set route(e){e.startsWith("https://")||e.startsWith("http://")||(e.startsWith("/")||(e=`/${e}`),e=`${this._api.url}${e}`),this._route=e}get Target(){return this._Target}get parameters(){return this._parameters}set parameters(e){this._parameters=e}get page(){return this.parameters.page}get perPage(){return this.parameters.perPage}get sort(){return this.parameters.sort}set sort(e){this.parameters.sort=e}get deleted(){return this.parameters.deleted}set deleted(e){this.parameters.deleted=e}get pageCount(){return this._pageCount}get data(){return this._data}get rows(){return this._rows}get query(){return this.parameters.search}set query(e){this.parameters.search=e}getPage(e=this.page,t=this.perPage){const r=this.parameters.copy();r.page=e,r.perPage=t;const s=this.route.includes("?")?"&":"?",a=this.route+s+r.encode();return(0,n.makeCancelable)((async t=>{const r=await this.api.ky.get(a,{signal:t}),{data:s}=await r.json(),i=Number(r.headers.get("x-paginate-total")||s.length),n=Number(r.headers.get("x-paginate-pages")||1),u=this.parameters.copy();return u.page=e,new o(this.api,this.route,this.Target,u,n,i,s.map((e=>new this.Target(this.api,e))))}))}get hasNext(){return this.page<this.pageCount}get hasPrevious(){return this.page>1}get cacheToken(){return this.parameters.token()}next(){return this.getPage(this.page+1)}previous(){return this.getPage(this.page-1)}}var u=r(73),l=r(3);class c{constructor(e,t,r=null,s={}){if(!(0,i.isParentOf)(l.default,t))throw new TypeError("Target is not a child of ResourceBase");if("function"!=typeof t)throw new TypeError("Target must to be a class not an instance");r&&(this.__baseUrl=r),this._api=e,this._Target=t,this._seedData=s}get baseUrl(){return this.__baseUrl||(this.__baseUrl=this.new().baseUrl),this.__baseUrl}get api(){return this._api}get Target(){return this._Target}new(e={}){return e={...this._seedData,...e},new this.Target(this._api,e,this.__baseUrl)}list(e={}){const t=this._buildResolver(e);return t.getPage(t.page)}lister(e={},t=50){return new u.default(this.api,this.baseUrl,this.Target,e,t,this.Target.resourceUrlKey)}_buildResolver(e={}){const t=typeof e,r=this.baseUrl;if(!["number","object"].includes(t))throw new TypeError(`Expected params to be of type number or object. Got "${t}"`);return"number"===t?this._buildResolver({page:e}):(e instanceof a.default||(e=new a.default(e)),new o(this._api,r,this.Target,e))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(21),a=r(2),i=r(8);class n extends a.default{get items(){const e=`${this.url}/items`,t={};return t[this.constructor.foreignKeyName]=this.id,this._proxyResourceList(this._Child,e,t)}get _Child(){throw new s.AbstractError}static get foreignKeyName(){if(!this._fk){let e=this.name;e=(0,i.camel)(e),this._fk=`${e}Id`}return this._fk}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>P});var s=r(31),a=r.n(s),i=r(6),n=r(72),o=r(19),u=r(12),l=r(38),c=r(13),h=r(14),d=r(30),p=r(3),f=r(61),g=r(23);class _{constructor(e="warn"){this.logLevel=e}getLogLevels(){return["debug","info","warn","error","none"]}log(e,t="info"){"none"!==t&&this._shouldLog(t)&&console[t](e)}debug(e){this.log(e,"debug")}info(e){this.log(e,"info")}warn(e){this.log(e,"warn")}error(e){this.log(e,"error")}get logLevel(){return this._logLevel}set logLevel(e){if(e=e.toLowerCase(),!this.getLogLevels().includes(e))throw new TypeError(`Expected one of ${this.getLogLevels().join(", ")}. Got ${e}`);this._logLevel=e}_shouldLog(e){const t=this.getLogLevels();return t.findIndex((t=>t===e))>=t.findIndex((e=>e===this.logLevel))}}var y=r(0),m=r(1),w=r(74),b=r(62),x=r(5),v=r(40),k=r.n(v);class P extends((0,y.mix)(k(),f.default)){constructor(e=new n.default,t="https://api.mapcreator.io"){if(super(),"string"==typeof e){const t=e;(e=new n.default).token=new u.default(t,"Bearer",new Date("2100-01-01T01:00:00"),["*"])}this.auth=e,this.host=t,this._logger=new _("warn"),this.wrapKy(m.wrapKyCancelable),this.wrapKy(x.wrapKyPrefixUrl,`${this.host}/${this.version}`)}get version(){return"v1"}get auth(){return this._auth}get logger(){return this._logger}set auth(e){if(!(0,y.isParentOf)(o.default,e))throw new TypeError("auth must be an instance of OAuth");this._auth=e}get authenticated(){return this.auth.authenticated}get host(){return this._host}set host(e){e=e.replace(/\/+$/,""),this._host=e,this.auth.host=e}get url(){return`${this.host}/${this.version}`}saveToken(e){this.auth.token.save(e)}async authenticate(){return await this.auth.authenticate(),this}get ky(){var e;if(this._ky)return this._ky;const t={beforeRequest:[e=>{this.authenticated&&e.headers.set("Authorization",this.auth.token.toString())}],afterResponse:[async(e,t,r)=>{if(429!==r.status)return r;const s=1e3*r.headers.get("x-ratelimit-reset")||500;return await(0,m.delay)(s),this._ky(e)},async(e,t,r)=>{if(r.status<400||r.status>=600)return r;const s=await r.json(),a={data:s,request:e,options:t,response:r};if(s.error.validation_errors)throw new w.default(a);const i=new b.default(a);throw"AuthenticationException"===i.type&&this.emit("error",i),i}]};return this._ky=a().create({timeout:null!==(e="60000")?e:6e4,retry:0,headers:{Accept:"application/json","X-No-CDN-Redirect":"true"},hooks:t}),this._ky}wrapKy(e,...t){this._ky=e(this.ky,...t);const r=["get","post","put","patch","head","delete"];for(const e of r)this._ky[e]=(t,r)=>this._ky(t,{...r,method:e})}static(e,t=p.default){if("string"==typeof e){const r=e,s=t.name||"AnonymousResource";e=class extends t{static get resourceName(){return Object.getPrototypeOf(this).resourceName||"anonymous"}static get resourcePath(){return r}},Object.defineProperty(e,"name",{value:`${s}_${(0,g.fnv32b)(r)}`})}if((0,y.isParentOf)(p.default,e))return new c.default(this,e);throw new TypeError("Expected Target to be of type string and Constructor to be a ResourceBase constructor")}get choropleths(){return new l.default(this,d.Choropleth)}get vectorChoropleths(){return new l.default(this,d.VectorChoropleth)}get colors(){return this.static(d.Color)}get tags(){return this.static(d.Tag)}get tagTypes(){return this.static(d.TagType)}get contracts(){return this.static(d.Contract)}get dimensions(){return this.static(d.Dimension)}get dimensionSets(){return this.static(d.DimensionSet)}get faqs(){return this.static(d.Faq)}get features(){return this.static(d.Feature)}get featuredMaps(){return new h.default(this,d.Job,"/jobs/featured")}get fonts(){return this.static(d.Font)}get fontFamilies(){return this.static(d.FontFamily)}get highlights(){return new l.default(this,d.Highlight)}get vectorHighlights(){return new l.default(this,d.VectorHighlight)}get insetMaps(){return new l.default(this,d.InsetMap)}get jobs(){return this.static(d.Job)}get jobShares(){return this.static(d.JobShare)}get jobTypes(){return this.static(d.JobType)}get languages(){return this.static(d.Language)}get layers(){return this.static(d.Layer)}get layerFaqs(){return this.static(d.LayerFaq)}get layerGroups(){return this.static(d.LayerGroup)}get mapstyles(){return this.static(d.Mapstyle)}get mapstyleSets(){return this.static(d.MapstyleSet)}get notifications(){return this.static(d.Notification)}get messages(){return this.static(d.Message)}get organisations(){return this.static(d.Organisation)}get permissions(){return this.static(d.Permission)}get productTours(){return this.static(d.ProductTour)}get productTourSteps(){return this.static(d.ProductTourStep)}get roles(){return this.static(d.Role)}get svgs(){return this.static(d.Svg)}get svgSets(){return this.static(d.SvgSet)}get users(){return this.static(d.User)}getSvgSetTypes(){return(0,m.makeCancelable)((async e=>{const{data:t}=await this.ky.get("svgs/sets/types",{signal:e}).json();return new i.Enum(t,!0)}))}getFontStyles(){return(0,m.makeCancelable)((async e=>{const{data:t}=await this.ky.get("fonts/styles",{signal:e}).json();return new i.Enum(t,!0)}))}logout(){return this.auth.logout()}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(18),a=r.n(s);class i extends Error{constructor(e,t=""){super(t),a()(this,"error",void 0),this.error=String(e)}toString(){let e=this.error;return e.includes("_")&&(e=e.replace("_"," ").replace(/^./,(e=>e.toUpperCase()))),this.message?`${e}: ${this.message}`:e}}},e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(18),a=r.n(s),i=r(31),n=r.n(i),o=r(21),u=r(22),l=r(12),c=r(37),h=r(1);class d{constructor(e,t=["*"]){if(a()(this,"token",null),a()(this,"path","/"),a()(this,"host","https://api.mapcreator.io"),this.constructor===d)throw new o.AbstractClassError;this.clientId=String(e),this.scopes=t,this.clientId&&(this.token=l.default.recover())}get authenticated(){return null!==this.token&&!this.token.expired}authenticate(){throw new o.AbstractMethodError}forget(){c.default.clean(),u.default.secure.remove(l.default.storageName),this.token=null}logout(){if(!this.token)return(0,h.makeCancelable)((()=>{}));const e=`${this.host}/oauth/logout`;return(0,h.makeCancelable)((async t=>{await n().post(e,{headers:{Accept:"application/json",Authorization:this.token.toString()},signal:t}),this.forget()}))}importToken(e,t="Bearer",r=432e3,s=[]){this.token=new l.default(e,t,r,s)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(14),a=r(1);class i extends s.default{constructor(e,t,r){const s=r.resourceName.replace(/s+$/,"");super(e,r,`${t.url}/${s}s`)}sync(e){return this._modifyResourceLink(e,"PATCH")}attach(e){return this._modifyResourceLink(e,"POST")}detach(e){return this._modifyResourceLink(e,"DELETE")}attachAll(){return(0,a.makeCancelable)((async e=>{await this.api.ky.post(`${this.baseUrl}/all`,{signal:e})}))}detachAll(){return(0,a.makeCancelable)((async e=>{await this.api.ky.delete(`${this.baseUrl}/all`,{signal:e})}))}_modifyResourceLink(e,t){Array.isArray(e)||(e=[e]);const r=e.map((e=>i._getKeyValue(e))).map(Number).filter((e=>!Number.isNaN(e)));return(0,a.makeCancelable)((async e=>{await this.api.ky(this.baseUrl,{method:t,signal:e,json:{keys:r}})}))}static _getKeyValue(e){if(["number","string"].includes(typeof e))return e;const t=e.constructor.resourceUrlKey||"id";if(void 0!==e[t])return e[t];throw new TypeError("Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}")}}},(e,t,r)=>{r.r(t),r.d(t,{AbstractError:()=>s,AbstractClassError:()=>a,AbstractMethodError:()=>i});class s extends Error{constructor(e="Unimplemented"){super(e)}}class a extends s{constructor(){super("Can not make an instance of an abstract class")}}class i extends s{constructor(){super("Can not call an abstract method")}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(33),a=r(9),i=r(24);class n extends i.default{constructor(e="_m4n_"){super(),this.__prefix=e}get _prefix(){return this.__prefix}static get secure(){return"https:"===window.location.protocol}static get available(){return!(0,a.isNode)()}set(e,t,r=new Date("2050-01-01")){e=encodeURIComponent(this._prefix+e),t=encodeURIComponent(t),r instanceof Date&&(r=r.toUTCString());let s=`${e}=${t}; expires=${r}`;n.secure&&(s+="; secure"),document.cookie=s}get(e){return e=this._prefix+e,this._toObject()[e]}remove(e){this.set(e,"",new Date(1970))}keys(){const e=new RegExp(`^${this._prefix}`);return Object.keys(this._toObject()).map((t=>t.replace(e,"")))}_toObject(){const e={};return document.cookie.split(";").map((e=>e.trim().split("=").map(decodeURIComponent))).filter((e=>e[0].startsWith(this._prefix))).forEach((t=>{e[t[0]]=t[1]})),e}}var o=r(18),u=r.n(o);class l extends i.default{static get available(){return(0,a.isNode)()&&"test"===process.env.NODE_ENV}static get secure(){return!0}set(e,t){this.constructor._data[e]=t}get(e){return this.constructor._data[e]}remove(e){delete this.constructor._data[e]}keys(){return Object.keys(this.constructor._data)}}u()(l,"_data",{});var c=r(58);class h extends i.default{static get _prefix(){return"_m4n_"}static get available(){return!(0,a.isNode)()}set(e,t){e=h._prefix+e,window.localStorage.setItem(e,t)}get(e){return e=h._prefix+e,window.localStorage.getItem(e)}remove(e){e=h._prefix+e,window.localStorage.removeItem(e)}keys(){const e=[],t=window.localStorage,r=h._prefix;for(let s=0;s<t.length;s++){let a=t.key(s);a.startsWith(r)&&(a=a.replace(new RegExp(`^${r}`),""),e.push(a))}return e}}class d extends s.default{static get available(){return[l,h,c.default].filter((e=>e.available))}static get localStorage(){return new h}static get cookies(){return new n}static get file(){return new c.default}static get dummy(){return new l}static get best(){return new this.available[0]}static get secure(){const e=this.available.filter((e=>e.secure))[0];return void 0===e?d.best:new e}}},(e,t,r)=>{r.r(t),r.d(t,{fnv32b:()=>i,hashObject:()=>n});const s=require("json-stable-stringify");var a=r.n(s);function i(e){let t=e.split("").map((e=>e.charCodeAt(0))).reduce(((e,t)=>(e^=t)+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)),2166136261);return t^=t<<3,t+=t>>5,t^=t<<4,t+=t>>17,t^=t<<25,t+=t>>6,`0000000${(t>>>0).toString(16)}`.substr(-8)}function n(e){return i(a()(e))}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(21);class a{constructor(){if(this.constructor===a)throw new s.AbstractClassError;if(!this.constructor.available)throw new Error(`${this.constructor.name} is unavailable`)}static get available(){return!1}static get secure(){return!1}set(e,t){throw new s.AbstractMethodError}get(e){throw new s.AbstractMethodError}remove(e){throw new s.AbstractMethodError}clear(){this.keys().map((e=>this.remove(e)))}keys(){throw new s.AbstractMethodError}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(9);class a{constructor(e,t="application/octet-stream",r="Untitled"){this._data=e,this._type=t,this._fileName=r}static async fromResponse(e){const t=await e.arrayBuffer();let r;const s=e.headers.get("content-type");let i;s&&(r=s.split(";")[0].trim());const n=e.headers.get("content-disposition");if(n){const e=/filename[^;=\n]*=((['"])(.*?)\2|([^;\s]*))/i.exec(n);e&&(i=e[3]||e[4])}return new a(t,r,i)}get data(){return this._data}get type(){return this._type}get fileName(){return this._fileName}get size(){return this.data.length}createObjectUrl(){if((0,s.isNode)())throw new Error("Object urls are not supported by Node");return URL.createObjectURL(this.createBlob())}createBlob(){return new Blob([this.data],{type:this.type})}toDataUri(){return`data:${this.type};base64,${this.toBase64()}`}toBase64(){return function(e){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(e),a=s.byteLength,i=a%3,n=a-i;let o,u,l,c,h;for(let e=0;e<n;e+=3)h=65536*s[e]|256*s[e+1]|s[e+2],o=(16515072&h)>>18,u=(258048&h)>>12,l=(4032&h)>>6,c=63&h,t+=r[o]+r[u]+r[l]+r[c];return 1===i?(h=s[n],o=(252&h)>>2,u=(3&h)<<4,t+=`${r[o]+r[u]}==`):2===i&&(h=256*s[n]|s[n+1],o=(64512&h)>>10,u=(1008&h)>>4,l=(15&h)<<2,t+=`${r[o]+r[u]+r[l]}=`),t}(this.data)}toString(){return this.data.toString()}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(6),a=r(2);class i extends a.default{save(){throw new Error("Unsupported method JobShare::save")}static get visibility(){return s.JobShareVisibility}static get resourcePath(){return"/jobs/shares/{id}"}static get resourceName(){return"shares"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(50),a=r(4),i=r(0),n=r(2);class o extends((0,i.mix)(n.default,a.default,s.default)){static get resourceName(){return"layers"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(4),a=r(0),i=r(15),n=r(66),o=r(13),u=r(10);class l extends u.default{static get resourcePath(){return"/mapstyles/sets/{mapstyle_set_id}/colors/{id}"}static get resourceName(){return"mapstyle-set-colors"}get baseUrl(){return`${this._api.url}/mapstyles/sets/${this.mapstyleSetId}/colors`}}class c extends((0,a.mix)(i.default,s.default)){static get resourcePath(){return"/mapstyles/sets/{id}"}static get resourceName(){return"mapstyle-sets"}get _Child(){return n.default}get colors(){const e={mapstyleSetId:this.id};return new o.default(this.api,l,null,e)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(4),a=r(0),i=r(10);class n extends((0,a.mix)(i.default,s.default)){static get resourceName(){return"tags"}static get parentKey(){return"tag_type_id"}}},(e,t,r)=>{r.r(t),r.d(t,{Choropleth:()=>n,Color:()=>o.default,Contract:()=>u.default,Dimension:()=>l.default,DimensionSet:()=>c.default,Domain:()=>h.default,Faq:()=>p,Feature:()=>f.default,Font:()=>g.default,FontFamily:()=>_.default,Highlight:()=>y,InsetMap:()=>m,Job:()=>w.default,JobResult:()=>b.default,JobRevision:()=>x.default,JobShare:()=>v.default,JobType:()=>k.default,Language:()=>P.default,Layer:()=>j.default,LayerFaq:()=>O,LayerGroup:()=>N.default,Mapstyle:()=>$.default,MapstyleSet:()=>S.default,Message:()=>T.default,Notification:()=>C.default,Organisation:()=>R.default,OrganisationNote:()=>D,Permission:()=>L.default,ProductTour:()=>M,ProductTourStep:()=>F,Role:()=>I.default,Svg:()=>B.default,SvgSet:()=>K.default,Tag:()=>Q.default,TagType:()=>W,User:()=>J.default,VectorChoropleth:()=>V,VectorHighlight:()=>z,base:()=>G});var s=r(25),a=r(3),i=r(1);class n extends a.default{static get resourceName(){return"choropleths"}getJson(){return(0,i.makeCancelable)((e=>this.api.ky.get(`${this.url}/json`,{signal:e}).json()))}downloadPreview(){return(0,i.makeCancelable)((async e=>{const t=await this.api.ky.get(`${this.url}/preview`,{signal:e});return s.default.fromResponse(t)}))}}var o=r(42),u=r(63),l=r(44),c=r(43),h=r(64),d=r(2);class p extends d.default{static get resourceName(){return"faqs"}}var f=r(45),g=r(47),_=r(46);class y extends a.default{static get resourceName(){return"highlights"}}class m extends a.default{static get resourceName(){return"inset-maps"}getJson(){return(0,i.makeCancelable)((e=>this.api.ky.get(`${this.url}/json`,{signal:e}).json()))}}var w=r(48),b=r(49),x=r(65),v=r(26),k=r(51),P=r(67),j=r(27),E=r(10);class O extends E.default{static get resourceName(){return"layer-faqs"}static get parentKey(){return"layer_group_id"}}var N=r(70),$=r(66),S=r(28),T=r(36),C=r(68),R=r(41),A=r(4),U=r(0);class D extends((0,U.mix)(d.default,A.default)){static get resourcePath(){return"/organisations/{organisation_id}/notes/{id}"}static get resourceName(){return"notes"}}var L=r(55),q=r(15);class F extends((0,U.mix)(E.default)){static get resourceName(){return"product-tours/steps"}static get parentKey(){return"product_tour_id"}}class M extends((0,U.mix)(q.default)){static get resourcePath(){return"/product-tours/{id}"}static get resourceName(){return"product-tours"}get _Child(){return F}}var I=r(69),B=r(53),K=r(52),Q=r(29);class W extends d.default{static get resourcePath(){return"/tags/types/{id}"}static get resourceName(){return"tag-types"}get tags(){return this._proxyResourceList(Q.default,`${this.url}/tags`)}}var J=r(54);class z extends a.default{static get resourceName(){return"highlights/vector"}}class V extends a.default{static get resourceName(){return"choropleths/vector"}}const G={CrudBase:d.default,CrudSetBase:q.default,ResourceBase:a.default}},e=>{e.exports=require("ky-universal")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s{initializer(){}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(57);class a{constructor(){throw new s.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(0),a=r(14),i=r(1);class n extends a.default{constructor(e,t){super(e,r(41).default,`${t.url}/organisations`,{}),this._parent=t}get parent(){return this._parent}sync(e){return this._modifyLink(e,"PATCH",this.Target)}attach(e){return this._modifyLink(e,"POST",this.Target)}detach(e){return this._modifyLink(e,"DELETE",this.Target)}attachAll(){return(0,i.makeCancelable)((async e=>{await this.api.ky.post(`${this.baseUrl}/all`,{signal:e})}))}detachAll(){return(0,i.makeCancelable)((async e=>{await this.api.ky.delete(`${this.baseUrl}/all`,{signal:e})}))}_modifyLink(e,t,r,a=null){if(Array.isArray(e)||(e=[e]),!a){a=`${r.resourceName.replace(/s+$/,"")}s`}const n=e.map((e=>"number"==typeof e?e:e.id)).map(Number);if(!(0===n.filter((e=>!(0,s.isParentOf)(r,e)&&!Number.isFinite(e))).length))throw new TypeError(`Array must contain either Numbers (resource id) or "${r.name}".`);const o=`${this.parent.url}/${a}`;return(0,i.makeCancelable)((async e=>{await this.api.ky(o,{method:t,signal:e,json:{keys:n}})}))}}},(e,t,r)=>{r.r(t),r.d(t,{AbstractClassError:()=>s.AbstractClassError,AbstractError:()=>s.AbstractError,AbstractMethodError:()=>s.AbstractMethodError,ApiError:()=>a.default,GeoError:()=>l.default,NodeError:()=>n,OAuthError:()=>o.default,StaticClassError:()=>u.default,ValidationError:()=>i.default});var s=r(21),a=r(62),i=r(74);class n extends Error{}var o=r(17),u=r(57),l=r(39)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(2),a=r(3);class i extends a.default{}var n=r(1),o=r(8);class u extends s.default{static get resourceName(){return"messages"}toObject(e=!1){const t=super.toObject(e);return t.variants=t.variants.map((t=>{if(t instanceof i)return t.toObject(e);const r=e?o.camel:o.snake,s={},a=Object.keys(t);for(const e of a)s[r(e)]=t[e];return s})),t}_guessType(e,t){return"variants"===e?Array.from(t).map((e=>new i(this.api,e))):super._guessType(e,t)}_buildCreateData(){return this.toObject()}_update(){return(0,n.makeCancelable)((async e=>{const t=this.toObject();return await this.api.ky.patch(this.url,{json:t,signal:e}),Object.assign(this._baseProperties,this._properties),this._properties={},"updated_at"in this._baseProperties&&(this._baseProperties.updated_at=new Date),this}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(22),a=r(33);class i extends a.default{static uuid4(){let e=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}static nil(){return"0000000-0000-0000-0000-000000000000"}}class n extends a.default{static get prefix(){return"oauth_state_"}static generate(){const e=i.uuid4(),t=n.prefix+e;return s.default.best.set(t,Date.now()),e}static validate(e,t=!0){const r=s.default.best,a=n.prefix+e,i=void 0!==r.get(a);return t&&i&&r.remove(a),i}static clean(){const e=Object.keys(this.list());for(const t of e)s.default.best.remove(n.prefix+t)}static list(){const e=s.default.best;return e.keys().filter((e=>e.startsWith(n.prefix))).map((e=>e.replace(n.prefix,""))).reduce(((t,r)=>(t[r]=e.get(r),t)),{})}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(39),a=r(7),i=r(60),n=r(13),o=r(1);class u extends n.default{constructor(e,t,r=null,s={},{hasForPoint:a=!0,hasForBoundary:i=!0}={}){super(e,t,r,s),this._hasForPoint=a,this._hasForBoundary=i}get hasForPoint(){return this._hasForPoint}get hasForBoundary(){return this._hasForBoundary}forBoundary({topLeft:e,bottomRight:t},r=a.default.perPage){if(!this.hasForBoundary)throw new s.default(`${this.Target.name} does not support the operation forBoundary`);const n=new i.GeoBoundary(e,t);if(r>a.default.maxPerPage)throw new TypeError(`Invalid resource limit ${r}, maximum allowed is ${a.default.maxPerPage}`);const u=`${this.new().baseUrl}/for-boundary?per_page=${r}`;return(0,o.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(u,{json:{boundary:n},signal:e}).json();return t.map((e=>this.new(e)))}))}forPoint({lat:e,lng:t},r=a.default.perPage){if(!this.hasForPoint)throw new s.default(`${this.Target.name} does not support the operation forPoint`);const n=new i.GeoPoint(e,t);if(r>a.default.maxPerPage)throw new TypeError(`Invalid resource limit ${r}, maximum allowed is ${a.default.maxPerPage}`);const u=`${this.new().baseUrl}/for-point?per_page=${r}`;return(0,o.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(u,{json:{limit:r,point:n},signal:e}).json();return t.map((e=>this.new(e)))}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s extends Error{}},e=>{e.exports=require("events")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>P});var s=r(20),a=r(2),i=r(42),n=r(63),o=r(43),u=r(64),l=r(45),c=r(46),h=r(48),d=r(26),p=r(51),f=r(27),g=r(28),_=r(52),y=r(29),m=r(54),w=r(1),b=r(5),x=r(70),v=r(30),k=r(13);class P extends a.default{static get resourceName(){return"organisations"}get fontFamilies(){return new s.default(this.api,this,c.default)}get dimensionSets(){return new s.default(this.api,this,o.default)}get mapstyleSets(){return new s.default(this.api,this,g.default)}get notes(){const e={organisationId:this.id};return new k.default(this.api,v.OrganisationNote,`${this.api.url}/organisations/${this.id}/notes`,e)}get svgSets(){return new s.default(this.api,this,_.default)}get colors(){return new s.default(this.api,this,i.default)}get tags(){return new s.default(this.api,this,y.default)}get features(){return new s.default(this.api,this,l.default)}get layers(){return new s.default(this.api,this,f.default)}get layerGroups(){return new s.default(this.api,this,x.default)}get jobs(){return this._proxyResourceList(h.default)}get jobTypes(){return new s.default(this.api,this,p.default)}get jobShares(){return this._proxyResourceList(d.default)}get users(){return this._proxyResourceList(m.default)}get contracts(){return this._proxyResourceList(n.default)}get domains(){return this._proxyResourceList(u.default)}getTree(e=null){return(0,w.makeCancelable)((async t=>{let r=`${this.url}/tree`;if("string"==typeof e){const t=r.includes("?")?"&":"?";r+=t+(0,b.encodeQueryString)({deleted:e})}const{data:s}=await this.api.ky.get(r,{signal:t}).json();return s.map((e=>this._parseTree(e)))}))}_parseTree(e){const t=new this.constructor(this._api,e);return t.children=t.children.map((e=>this._parseTree(e))),t}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(4),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourceName(){return"colors"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(15),a=r(44),i=r(4),n=r(0);class o extends((0,n.mix)(s.default,i.default)){static get resourcePath(){return"/dimensions/sets/{id}"}static get resourceName(){return"dimension-sets"}get _Child(){return a.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"dimensions"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(4),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourceName(){return"features"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(4),a=r(0),i=r(15),n=r(47);class o extends((0,a.mix)(i.default,s.default)){static get resourcePath(){return"/fonts/families/{id}"}static get resourceName(){return"font-families"}get _Child(){return n.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"fonts"}static get parentKey(){return"font_family_id"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var s=r(13),a=r(25),i=r(2),n=r(49),o=r(65),u=r(7),l=r(5),c=r(6),h=r(1),d=r(26);class p extends i.default{get results(){return this._proxyResourceList(n.default,`${this.url}/results`)}get revisions(){const e={jobId:this.id};return new s.default(this.api,o.default,null,e)}static get resourceName(){return"jobs"}get previewUrl(){return`${this.url}/preview`}get lastArchiveUrl(){return`${this.url}/output`}downloadPreview(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.previewUrl}?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return a.default.fromResponse(r)}))}downloadOutput(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.lastArchiveUrl}?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return a.default.fromResponse(r)}))}getOutputUrl(e=u.default.deleted||c.DeletedState.NONE){const t=`${this.url}/output-url?${(0,l.encodeQueryString)({deleted:e})}`;return(0,h.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r.url}))}share(e=d.default.visibility.PRIVATE,t=u.default.deleted||c.DeletedState.NONE){if(e=e.toLowerCase(),!d.default.visibility.values().includes(e))throw new Error(`Unknown visibility '${e}'`);const r=`${this.url}/share?${(0,l.encodeQueryString)({deleted:t})}`;return(0,h.makeCancelable)((async t=>{const{data:s}=await this.api.ky.post(r,{json:{visibility:e},signal:t}).json();return new d.default(this._api,s)}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var s=r(25),a=r(3),i=r(7),n=r(5),o=r(6),u=r(1);class l extends a.default{static get resourcePath(){return"/jobs/{job_id}/revisions/{revision}/result"}static get resourceName(){return"job-result"}get job(){return this.api.jobs.get(this.jobId)}get jobRevision(){return this.api.jobs.select(this.jobId).revisions.get(this.id)}get outputUrl(){return`${this.url}/output`}downloadOutput(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.outputUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}get outputUrlUrl(){return`${this.url}/output-url`}getOutputUrl(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.outputUrlUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r.url}))}get logUrl(){return`${this.url}/log`}downloadLog(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.logUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}get previewUrl(){return`${this.url}/preview`}downloadPreview(e=i.default.deleted||o.DeletedState.NONE){const t=`${this.previewUrl}?${(0,n.encodeQueryString)({deleted:e})}`;return(0,u.makeCancelable)((async e=>{const r=await this.api.ky.get(t,{signal:e});return s.default.fromResponse(r)}))}dealWith(e=!0,t=i.default.deleted||o.DeletedState.NONE){const r=(e=Boolean(e))?"POST":"DELETE",s=`${this.url}/deal-with?${(0,n.encodeQueryString)({deleted:t})}`;return(0,u.makeCancelable)((async t=>{await this.api.ky(s,{method:r,signal:t}),this.dealtWith=e}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(32),a=r(16),i=r(25),n=r(3),o=r(0),u=r(5),l=r(1);class c{constructor(e,t){if(!(0,o.isParentOf)(a.default,e))throw new TypeError("Expected api to be of type Mapcreator");if(!(0,o.isParentOf)(n.default,t))throw new TypeError("Expected target to be of type ResourceBase");this._api=e,this._target=t}get api(){return this._api}get url(){return`${this._target.url}/image`}delete(){return(0,l.makeCancelable)((async e=>{await this.api.ky.delete(this.url,{signal:e})}))}download(){return(0,l.makeCancelable)((async e=>{const t=await this.api.ky.get(this.url,{signal:e});return i.default.fromResponse(t)}))}upload(e){const t=new u.FormData;t.append("image",e,"image");const r={};return t.getHeaders&&Object.assign(r,t.getHeaders()),(0,l.makeCancelable)((async e=>{await this.api.ky.post(this.url,{headers:r,body:t,signal:e})}))}}class h extends s.default{get imageHandler(){return new c(this.api,this)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(2),a=r(4),i=r(0);class n extends((0,i.mix)(s.default,a.default)){static get resourcePath(){return"/jobs/types/{id}"}static get resourceName(){return"job-types"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(4),a=r(15),i=r(53),n=r(0);class o extends((0,n.mix)(a.default,s.default)){static get resourcePath(){return"/svgs/sets/{id}"}static get resourceName(){return"svg-sets"}get _Child(){return i.default}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(10);class a extends s.default{static get resourceName(){return"svgs"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var s=r(20),a=r(13),i=r(2),n=r(42),o=r(44),u=r(43),l=r(45),c=r(47),h=r(46),d=r(48),p=r(26),f=r(51),g=r(67),_=r(27),y=r(66),m=r(28),w=r(36),b=r(68),x=r(41),v=r(55),k=r(69),P=r(53),j=r(52),E=r(1);class O extends i.default{static get resourceName(){return"users"}ips(){const e=`${this.url}/ips`;return(0,E.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(e,{signal:t}).json();return r.map((e=>e.ip_address))}))}organisation(){return new a.default(this.api,x.default).get(this.organisationId)}language(){return new a.default(this.api,g.default).get(this.languageCode)}get notifications(){return this._proxyResourceList(b.default)}messages(){const e=`${this.url}/messages`;return(0,E.makeCancelable)((async t=>{const{data:r}=await this.api.ky.get(e,{signal:t}).json();return{read:r.read.map((e=>new w.default(this.api,e))),unread:r.unread.map((e=>new w.default(this.api,e)))}}))}get mapstyleSets(){return this._proxyResourceList(m.default)}get mapstyles(){return this._proxyResourceList(y.default)}get dimensionSets(){return this._proxyResourceList(u.default)}get dimensions(){return this._proxyResourceList(o.default)}get fontFamilies(){return this._proxyResourceList(h.default)}get fonts(){return this._proxyResourceList(c.default)}get svgSets(){return this._proxyResourceList(j.default)}get svgs(){return this._proxyResourceList(P.default)}get colors(){return this._proxyResourceList(n.default)}get jobs(){return this._proxyResourceList(d.default)}get features(){return this._proxyResourceList(l.default)}get layers(){return this._proxyResourceList(_.default)}get jobTypes(){return this._proxyResourceList(f.default)}get jobShares(){return this._proxyResourceList(p.default)}get permissions(){return this._proxyResourceList(v.default)}get roles(){return new s.default(this.api,this,k.default)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(3);class a extends s.default{static get resourceName(){return"permissions"}}},,(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});class s extends Error{}},(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>FileDriver});var _utils_node__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9),_DataStoreContract__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(24);class FileDriver extends _DataStoreContract__WEBPACK_IMPORTED_MODULE_1__.default{constructor(e=".m4n"){super(),this._path=e}get path(){return this._path}set path(e){if("string"!=typeof e)throw new TypeError('Expected "path" value to be of type "string"');this._path=e}static get available(){return(0,_utils_node__WEBPACK_IMPORTED_MODULE_0__.isNode)()}static get secure(){return!0}set(e,t){const r=this._read();r[e]=t,this._write(r)}get(e){return this._read()[e]}remove(e){const t=this._read();delete t[e],this._write(t)}clear(){this._write({})}keys(){return Object.keys(this._read())}_read(){let e;try{e=this._fs.readFileSync(this.path).toString()}catch(t){e="{}"}return e?JSON.parse(e):{}}_write(e){const t=JSON.stringify(e),r=this._fs.openSync(this.path,"w");this._fs.writeSync(r,t),this._fs.closeSync(r)}get _fs(){return this.__fs||(this.__fs=eval('require("fs")')),this.__fs}}},e=>{e.exports=require("form-data")},(e,t,r)=>{r.r(t),r.d(t,{GeoPoint:()=>n,GeoBoundary:()=>o});var s=r(18),a=r.n(s),i=r(39);class n{constructor(e,t){this.lat=e,this.lng=t}get lat(){return this._lat}set lat(e){if(e=Number(e),!Number.isFinite(e))throw new i.default(`Invalid latitude: ${e}`);this._lat=Math.min(90,Math.max(-90,e))}get lng(){return this._lng}set lng(e){if(e=Number(e),!Number.isFinite(e))throw new i.default(`Invalid longitude: ${e}`);this._lng=e}toJSON(){return{lat:this.lat,lng:this.lng}}}class o{constructor({lat:e,lng:t},{lat:r,lng:s}){a()(this,"topLeft",void 0),a()(this,"bottomRight",void 0),this.topLeft=new n(e,t),this.bottomRight=new n(r,s)}getCenter(){const e=(this.topLeft.lat+this.bottomRight.lat)/2,t=(this.topLeft.lng+this.bottomRight.lng)/2;return new n(e,t)}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(3),a=r(0),i=r(32);class n extends i.default{initializer(){const e=this.constructor._injectable||{};for(const t of Object.keys(e)){const{value:r,isProxy:s}=e[t];s?this.injectProxy(t,r):this.inject(t,r)}}static injectProxy(e,t){if(t)void 0===this._injectable&&(this._injectable={}),this._injectable[e]={value:t,isProxy:!0};else for(const t of Object.keys(e))this.inject(t,e[t])}static inject(e,t){if(t)void 0===this._injectable&&(this._injectable={}),this._injectable[e]={value:t,isProxy:!1};else for(const t of Object.keys(e))this.inject(t,e[t])}static uninject(e){void 0!==this._injectable&&delete this._injectable[e]}injectProxy(e,t){if(t)(0,a.isParentOf)(s.default,t)?this._injectProxy(e,t):this._inject(e,t);else for(const t of Object.keys(e))this.injectProxy(t,e[t])}inject(e,t){this._inject(e,t,!1)}uninject(e){const t=Object.getOwnPropertyDescriptor(this,e),r=t.value||t.get||{};if(!r.injected)throw new Error(`Property "${e}" was not injected, can't un-inject`);r.original?Object.defineProperty(this,e,r.original):Object.defineProperty(this,e,{value:void 0,enumerable:!1,writable:!0})}_injectProxy(e,t){e===t.name&&(e=`${e.replace(/^\w/,(e=>e.toLowerCase()))}s`);const i=r(4).default;if((0,a.hasTrait)(t,i)){const s=r(20).default;this._inject(e,(function(){return new s(this.api,this,t)}))}else if((0,a.isParentOf)(s.default,t)&&this._proxyResourceList)this._inject(e,(function(){return this._proxyResourceList(t)}));else{const s=r(13).default;this._inject(e,(function(){return new s(this,t)}))}}_inject(e,t,r=!0){const s=(...e)=>t.apply(this,e),a=Object.getOwnPropertyDescriptor(this,e);s.injected=!0,a&&(s.original=a),Object.defineProperty(this,e,{enumerable:!1,configurable:!0,[r?"get":"value"]:s})}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(18),a=r.n(s);class i extends Error{constructor({options:e,request:t,response:r,data:s}){const{type:n,message:o,trace:u}=s.error;super(o),a()(this,"options",void 0),a()(this,"response",void 0),a()(this,"request",void 0),a()(this,"type",void 0),a()(this,"status",void 0),a()(this,"trace",void 0),this.options=e,this.response=r,this.request=t,this.type=n,this.trace=[],"string"==typeof u&&(this._trace=i._parseTrace(u))}get hasTrace(){return this.trace.length>0}toString(){return`[${this.status}] ${this.type}: ${this.message}`}static _parseTrace(e){const t=/^#(\d+)\s(?:(.*?)\((\d+)\)|(.*?)):\s(.*?)$/gm,r=[];let s;for(;null!==(s=t.exec(e));)s.index===t.lastIndex&&t.lastIndex++,r.push({line:s[3],file:s[2]||s[4],code:s[5]});return r}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"contracts"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"domains"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(0),a=r(2),i=r(49),n=(r(26),r(27)),o=r(7),u=r(5),l=r(6),c=r(1);class h extends a.default{get baseUrl(){return`${this._api.url}/jobs/${this.jobId}/revisions`}static get resourcePath(){return"/jobs/{job_id}/revisions/{revision}"}static get resourceName(){return"job-revisions"}static get resourceUrlKey(){return"revision"}get layers(){return this._proxyResourceList(n.default)}result(e=o.default.deleted||l.DeletedState.NONE){return(0,c.makeCancelable)((async t=>{const r=`${this.url}/result?${(0,u.encodeQueryString)({deleted:e})}`,{data:s}=await this.api.ky.get(r,{signal:t}).json();return s.jobId=this.jobId,s.revision=this.revision,new i.default(this.api,s)}))}get resultProxy(){const e={jobId:this.jobId,revision:this.revision};return new i.default(this.api,e)}save(e={},t=null,r=o.default.deleted||l.DeletedState.NONE){if(t&&t.length>0)if((0,s.isParentOf)(n.default,t[0]))t=t.map((e=>e.id));else if("number"!=typeof t[0])throw new TypeError("layers property is not of type Array<Layer>, Array<Number> or null");const a={object:JSON.stringify(e),language_code:this.languageCode,mapstyle_set_id:this.mapstyleSetId,output:this.output};t&&(a.layers=t);const i=`${this.baseUrl}?${(0,u.encodeQueryString)({deleted:r})}`;return(0,c.makeCancelable)((async e=>{const{data:t}=await this.api.ky.post(i,{json:a,signal:e}).json();return new h(this.api,t)}))}object(e=o.default.deleted||l.DeletedState.NONE){const t=`${this.url}/object?${(0,u.encodeQueryString)({deleted:e})}`;return(0,c.makeCancelable)((async e=>{const{data:r}=await this.api.ky.get(t,{signal:e}).json();return r}))}build(e,t=o.default.deleted||l.DeletedState.NONE){const r=`${this.url}/build?${(0,u.encodeQueryString)({deleted:t})}`;return(0,c.makeCancelable)((async t=>{await this.api.ky.post(r,{json:{callback:e},signal:t})}))}cancel(e=o.default.deleted||l.DeletedState.NONE){const t=`${this.url}/cancel?${(0,u.encodeQueryString)({deleted:e})}`;return(0,c.makeCancelable)((async e=>{await this.api.ky.post(t,{signal:e})}))}clone(e=null,t=o.default.deleted||l.DeletedState.NONE){const r=`${this.url}/clone?${(0,u.encodeQueryString)({deleted:t})}`;return(0,c.makeCancelable)((async t=>{const{data:s}=await this.api.ky.post(r,{json:{title:e},signal:t}).json();return new h(this.api,s)}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(50),a=r(0),i=r(10);class n extends((0,a.mix)(i.default,s.default)){static get resourceName(){return"mapstyles"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"languages"}static get resourcePath(){return`/${this.resourceName}/{code}`}toString(){return`${this.constructor.name}(${this.code})`}static get resourceUrlKey(){return"code"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var s=r(2);class a extends s.default{static get resourceName(){return"notifications"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(20),a=r(2),i=r(55),n=r(54);class o extends a.default{get permissions(){return new s.default(this.api,this,i.default)}get users(){return new s.default(this.api,this,n.default)}static get resourceName(){return"roles"}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(4),a=r(0),i=r(27),n=r(15),o=r(71);class u extends((0,a.mix)(n.default,s.default)){static get resourceName(){return"layer-groups"}get items(){return new o.OwnedResourceProxy(this.api,this,this._Child)}get _Child(){return i.default}}},(e,t,r)=>{r.r(t),r.d(t,{GeoResourceProxy:()=>s.default,OrganisationProxy:()=>a.default,OwnedResourceProxy:()=>i.default,ResourceProxy:()=>n.default,SimpleResourceProxy:()=>o.default});var s=r(38),a=r(34),i=r(20),n=r(13),o=r(14)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(17),a=r(19);class i extends a.default{constructor(e="",t=["*"]){super(e,t)}authenticate(){return new Promise(((e,t)=>{this.authenticated?e(this.token):t(new s.default("dummy_error","Attempted authentication using a dummy authenticator"))}))}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(8),a=r(40),i=r(16),n=r(7),o=r(3),u=r(0),l=r(1);class c extends a.EventEmitter{constructor(e,t,r=o.default,a=null,l=50,c="id"){if(super(),!(0,u.isParentOf)(i.default,e))throw new TypeError("Expected api to be of type Mapcreator");this._api=e,this._Resource=r,this._route=t||new this.Resource(e,{}).baseUrl,this._parameters=new n.default(a||{perPage:n.default.maxPerPage}),this._key=(0,s.snake)(c),this._waiting=!1,this.autoUpdate=!0,this.maxRows=l,this._reset()}get hasMore(){return void 0===this.availableRows||this.availableRows>this.maxRows}get waiting(){return this._waiting}get parameters(){return this._parameters}set parameters(e){this.parameters.apply(e)}get Resource(){return this._Resource}get route(){return this._route}get data(){return this._data}get api(){return this._api}get rowCount(){return this.data.length}get maxRows(){return this._maxRows}set maxRows(e){if(e=Number(e),Number.isNaN(e))throw new TypeError("Expected maxRows to be numeric got "+typeof raw);this._maxRows=e,this.autoUpdate&&this.update()}get availableRows(){return this._availableRows}set autoUpdate(e){e=Boolean(e),this.autoUpdate!==e&&(this._autoUpdate=e,void 0===this._boundUpdate&&(this._boundUpdate=this.update.bind(this)),this.autoUpdate?this.parameters.on("change",this._boundUpdate):this.parameters.off("change",this._boundUpdate))}get autoUpdate(){return this._autoUpdate}_reset(){this._parameterToken=this.parameters.token(),this._realData=[],this._data=[],this._keys=[],delete this._availableRows}async update(){if(!this.waiting){this._waiting=!0;try{if(this._parameterToken!==this.parameters.token()&&this._reset(),this._realData.length<this.maxRows)try{await this._fetchMore()}catch(e){throw this.autoUpdate=!1,this.emit("error",e),e}this.data.length!==this.maxRows&&(this._data=this._realData.slice(0,this.maxRows))}finally{this._waiting=!1}this.emit("update")}}_fetchMore(){const e=this.route.includes("?")?"&":"?",t=this.parameters.copy();t.offset+=this.rowCount;const r=Math.ceil((this.maxRows-this.rowCount)/this.parameters.perPage),s=[];return(0,l.makeCancelable)((async a=>{for(;t.page<=r;t.page++){const r=this.route+e+t.encode(),i=this.api.ky.get(r,{signal:a});s.push(i)}const i=await Promise.all(s);for(const e of i){const{data:r}=await e.json();r.forEach((e=>this.push(e,!1))),this._availableRows=Number(e.headers.get("x-paginate-total"))+t.offset}}))}[Symbol.iterator](){return this.data[Symbol.iterator]()}push(e,t=!0){(0,u.isParentOf)(this.Resource,e)||(e=new this.Resource(this.api,e));const r=this._keys.findIndex((t=>t===e[this._key]));r>=0?(this._realData[r]=e,void 0!==this._data[r]&&(this._data[r]=e)):(this._realData.push(e),this._keys.push(e[this._key]),t&&(this.maxRows++,this._data.push(e)))}loadMore(e=this.parameters.perPage){this.maxRows+=e}}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(18),a=r.n(s),i=r(62);class n extends i.default{constructor({options:e,request:t,response:r,data:s}){super({options:e,request:t,response:r,data:s}),a()(this,"validationErrors",void 0),a()(this,"schemaErrors",void 0);const i=s.error.schema_errors;this.validationErrors=s.error.validation_errors,this.schemaErrors=Array.isArray(i)?i:[]}get hasSchemaErrors(){return this.schemaErrors.length>0}get messages(){const e=[];for(const t of Object.keys(this.validationErrors))e.push(...this.validationErrors[t]);return e}toString(){return`There were some validation errors: ${this.messages.join(", ")}`}}}],__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AbstractClassError:()=>b.AbstractClassError,AbstractError:()=>b.AbstractError,AbstractMethodError:()=>b.AbstractMethodError,ApiError:()=>w.default,DeletedState:()=>a.DeletedState,DummyFlow:()=>m.default,Enum:()=>s.default,ImplicitFlow:()=>d,ImplicitFlowPopup:()=>p,Mapcreator:()=>e.default,OAuth:()=>i.default,OAuthToken:()=>n.default,PasswordFlow:()=>y,RequestParameters:()=>t.default,ResourceLister:()=>P.default,ResultStatus:()=>a.ResultStatus,StaticClassError:()=>v.default,StorageManager:()=>r.default,ValidationError:()=>x.default,errors:()=>E,geo:()=>j,helpers:()=>_,proxies:()=>O,resources:()=>k,version:()=>N});var e=__webpack_require__(16),t=__webpack_require__(7),r=__webpack_require__(22),s=__webpack_require__(11),a=__webpack_require__(6),i=__webpack_require__(19),n=__webpack_require__(12),o=__webpack_require__(37),u=__webpack_require__(5),l=__webpack_require__(17),c=__webpack_require__(9),h=__webpack_require__(8);class d extends i.default{constructor(e,t="",r=["*"],s=!0){if(super(e,r),(0,c.isNode)())throw new Error(`${this.constructor.name} can't be used under nodejs`);if(this.path="/oauth/authorize",this.callbackUrl=t,this.useState=s,this.callbackUrl||(this.callbackUrl=window.location.toString().split("#")[0]),this._anchorParams=["access_token","token_type","expires_in"],this.useState&&this._anchorParams.push("state"),this._anchorContainsOAuthResponse()){const e=this._getOAuthAnchorParams();if(this._cleanAnchorParams(),this.useState&&!o.default.validate(e.state))throw Error("Invalid state in url");this.token=n.default.fromResponseObject(e)}}authenticate(){return new Promise(((e,t)=>{if(this.authenticated)e(this.token);else if(this._anchorContainsError()){const e=this._getError();this._cleanAnchorParams(),t(e)}else window.location=this._buildRedirectUrl()}))}_buildRedirectUrl(){const e={client_id:this.clientId,redirect_uri:this.callbackUrl,response_type:"token",scope:this.scopes.join(" ")};return this.useState&&(e.state=o.default.generate()),`${this.host+this.path}?${(0,u.encodeQueryString)(e)}`}_getAnchorParams(e=window.location.hash){const t={};e=e.replace(/^#\/?/g,"");for(const r of e.split("&")){const e=r.split("=").map(decodeURIComponent);t[e[0]]=e[1]}return t}_getOAuthAnchorParams(e=this._getAnchorParams()){return Object.keys(e).filter((e=>this._anchorParams.includes(e))).reduce(((t,r)=>(t[r]=e[r],t)),{})}_cleanAnchorParams(){const e=this._getAnchorParams(),t=this._anchorParams;t.push("state","error");for(const r of t)delete e[r];window.location.hash=(0,u.encodeQueryString)(e)}_anchorContainsOAuthResponse(){const e=Object.keys(this._getOAuthAnchorParams());return this._anchorParams.reduce(((t,r)=>t&&e.includes(r)),!0)}_anchorContainsError(){return Boolean(this._getAnchorParams().error)}_getError(){if(!this._anchorContainsError())throw Error("No OAuthError found in anchor");const e=this._getAnchorParams();return e.message?new l.default(e.error,e.message):new l.default(e.error,(0,h.title)(e.error))}}class p extends d{constructor(e,t="",r=["*"],s=!1,a="width=800, height=600"){if(super(e,t,r,s),this.windowOptions=a,window.name===p.popupWindowName)throw new Error("We're a flow popup")}static get popupWindowName(){return"m4n_api_auth"}authenticate(){return window.name===p.popupWindowName?new Promise((()=>{})):this.authenticated?new Promise((e=>{e(this.token)})):new Promise(((e,t)=>{const r=window.open(this._buildRedirectUrl(),p.popupWindowName,this.windowOptions),s=setInterval((()=>{r.closed&&t(new l.default("window_closed","Pop-up window was closed before data could be extracted"));let a=!1;try{a=!["","about:blank"].includes(r.location.href)}catch(e){}if(a){clearInterval(s);const a=this._getAnchorParams(r.location.hash);r.close(),a.error?t(new l.default(a.error,a.message)):e(this.token=n.default.fromResponseObject(a))}}),250)}))}}var f=__webpack_require__(31),g=__webpack_require__.n(f),_=__webpack_require__(1);class y extends i.default{constructor(e,t,r,s,a=["*"]){super(e,a),this._secret=t,this._username=r,this._password=s,this._path="/oauth/token",(0,c.isNode)()||(console.warn("Using PasswordFlow in the browser is unrecommended"),"https:"!==window.location.protocol&&console.warn("Page was not loaded using https. You're most likely leaking secrets right now"))}get secret(){return this._secret}set secret(e){this._secret=e}get username(){return this._username}set username(e){this._username=e}get password(){return this._password}set password(e){this._password=e}get path(){return this._path}set path(e){this._path=e}authenticate(){const e=this.host+this.path,t={grant_type:"password",client_id:this.clientId,client_secret:this._secret,username:this.username,password:this.password,scope:this.scopes.join(" ")};return(0,_.makeCancelable)((async r=>{const s=await g().post(e,{json:t,signal:r}).json();if(s.error)throw new l.default(s.error,s.message);return this.token=n.default.fromResponseObject(s),this.token.scopes=this.scopes,this.token}))}}var m=__webpack_require__(72),w=__webpack_require__(62),b=__webpack_require__(21),x=__webpack_require__(74),v=__webpack_require__(57),k=__webpack_require__(30),P=__webpack_require__(73),j=__webpack_require__(60),E=__webpack_require__(35),O=__webpack_require__(71);const N="v3.3.1"})(),module.exports=__webpack_exports__})();
|
|
3
3
|
//# sourceMappingURL=bundle.min.js.map
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
30
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
31
|
*
|
|
32
|
-
* hash:
|
|
32
|
+
* hash:af26823235a66e3e14db, chunkhash:fc717a4738ca81ad84bc, name:bundle.min, version:v3.3.1
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -14,6 +14,7 @@ export default class Organisation extends CrudBase {
|
|
|
14
14
|
* @returns {OwnedResourceProxy} - A proxy for accessing the resource
|
|
15
15
|
*/
|
|
16
16
|
get mapstyleSets(): OwnedResourceProxy;
|
|
17
|
+
get notes(): ResourceProxy;
|
|
17
18
|
/**
|
|
18
19
|
* Get a proxy for svg sets linked to the organisation
|
|
19
20
|
* @returns {OwnedResourceProxy} - A proxy for accessing the resource
|
|
@@ -94,4 +95,5 @@ export default class Organisation extends CrudBase {
|
|
|
94
95
|
}
|
|
95
96
|
import CrudBase from "./base/CrudBase";
|
|
96
97
|
import OwnedResourceProxy from "../proxy/OwnedResourceProxy";
|
|
98
|
+
import ResourceProxy from "../proxy/ResourceProxy";
|
|
97
99
|
//# sourceMappingURL=Organisation.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font family
|
|
3
|
+
* @extends CrudSetBase
|
|
4
|
+
* @mixes OwnableResource
|
|
5
|
+
*
|
|
6
|
+
* @property {number} id
|
|
7
|
+
* @property {number} organisationId
|
|
8
|
+
* @property {number} userId
|
|
9
|
+
* @property {string} content
|
|
10
|
+
* @property {Date} createdAt
|
|
11
|
+
* @property {Date} updatedAt
|
|
12
|
+
*/
|
|
13
|
+
export default class OrganisationNote {
|
|
14
|
+
static get resourcePath(): string;
|
|
15
|
+
static get resourceName(): string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=OrganisationNote.d.ts.map
|
|
@@ -6,8 +6,9 @@ export default class CrudBase extends ResourceBase {
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {Mapcreator} api - Api instance
|
|
8
8
|
* @param {Object<String, *>} data - Item data
|
|
9
|
+
* @param {String} [altUrl] - Internal use, Optional alternative url for more complex routing
|
|
9
10
|
*/
|
|
10
|
-
constructor(api: Mapcreator, data?: any);
|
|
11
|
+
constructor(api: Mapcreator, data?: any, altUrl?: string);
|
|
11
12
|
/**
|
|
12
13
|
* Build data for create operation
|
|
13
14
|
* @returns {Object<String, *>} - Create data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrudBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/CrudBase.js"],"names":[],"mappings":"AAoCA;;;GAGG;AACH;IACE
|
|
1
|
+
{"version":3,"file":"CrudBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/CrudBase.js"],"names":[],"mappings":"AAoCA;;;GAGG;AACH;IACE;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,kCAgBC;IAED;;;;;OAKG;IACH,oCAEC;IAED;;;;;;OAMG;IACH,gBAaC;IAED;;;;;;OAMG;IACH,iDAwBC;IAED;;;;;;OAMG;IACH,0DAUC;IAED;;;;;;OAMG;IACH,2DAcC;IAED;;;;;OAKG;IACH,qBAYC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrudSetItemBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/CrudSetItemBase.js"],"names":[],"mappings":"AAoCA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"CrudSetItemBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/CrudSetItemBase.js"],"names":[],"mappings":"AAoCA;;;GAGG;AACH;IAkCE;;;OAGG;IACH,+BAEC;IA1BD,yBAIC;IAED;;;OAGG;IACH,uBAQC;CASF"}
|
|
@@ -15,14 +15,14 @@ export default class DownloadedResource {
|
|
|
15
15
|
* @param {string} [fileName=Untitled] - File name
|
|
16
16
|
*/
|
|
17
17
|
constructor(data: ArrayBuffer | Buffer, type?: string, fileName?: string);
|
|
18
|
-
_data:
|
|
18
|
+
_data: Buffer | ArrayBuffer;
|
|
19
19
|
_type: string;
|
|
20
20
|
_fileName: string;
|
|
21
21
|
/**
|
|
22
22
|
* In Nodejs it will return a {@link Buffer} and in the browser it will respond with a {@link ArrayBuffer}
|
|
23
23
|
* @returns {ArrayBuffer|Buffer} - Resource data
|
|
24
24
|
*/
|
|
25
|
-
get data():
|
|
25
|
+
get data(): Buffer | ArrayBuffer;
|
|
26
26
|
/**
|
|
27
27
|
* Resource mime-type
|
|
28
28
|
* @return {string} - Mime-type
|
|
@@ -33,8 +33,10 @@ export default class ResourceBase {
|
|
|
33
33
|
/**
|
|
34
34
|
* @param {Mapcreator} api - Api instance
|
|
35
35
|
* @param {Object<String, *>} data - Item data
|
|
36
|
+
* @param {String} [altUrl] - Internal use, Optional alternative url for more complex routing
|
|
36
37
|
*/
|
|
37
|
-
constructor(api: Mapcreator, data?: any);
|
|
38
|
+
constructor(api: Mapcreator, data?: any, altUrl?: string);
|
|
39
|
+
__baseUrl: string;
|
|
38
40
|
/**
|
|
39
41
|
* Set the api instance
|
|
40
42
|
* @param {Mapcreator} value - Api instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/ResourceBase.js"],"names":[],"mappings":"AA6CA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"ResourceBase.d.ts","sourceRoot":"","sources":["../../../src/resources/base/ResourceBase.js"],"names":[],"mappings":"AA6CA;;;GAGG;AACH;IAyFE;;;OAGG;IACH,kCAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;OAGG;IACH,oCAEC;IAED;;;;OAIG;IACH,iDAEC;IAED;;;OAGG;IACH,+BAEC;IAhID;;;;OAIG;IACH,iBAJW,UAAU,+BAiEpB;IArDG,kBAAuB;IA+D3B;;;OAGG;IACH,yBAMC;IAlBD;;;OAGG;IACH,sBAEC;IAnCC,qBAAiC;IACjC,gBAAqB;IACrB,iBAAe;IAwBf,uBAA+D;IAiEjE;;;OAGG;IACH,oCA2BC;IAED;;;;;OAKG;IACH,iBAIC;IAED;;;OAGG;IACH,eAFW,MAAM,MAAM,CAAC,GAAC,MAAM,GAAC,IAAI,QAenC;IAED;;;OAGG;IACH,SAFa,YAAY,CAYxB;IAED;;;;;OAKG;IACH,+DAaC;IAED;;;;OAIG;IACH,uBAwBC;IAED;;;;;;OAMG;IACH,2BALW,MAAM,mBAahB;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,kBAWC;IAJG,aAAe;IAMnB;;;OAGG;IACH,sBAQC;IAED;;;OAGG;IACH,2BAOC;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,yBAHW,OAAO,GACL,EAAE,CAoBd;IAED;;;;;;;OAOG;IACH,qCANW,MAAM,sBAAoB,kCAE1B,MAAM,GACJ,mBAAmB,CAa/B;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAlBW,MAAM,QAAM;YAEL,MAAM;QACX,mBAAmB,CA2C/B;CACF"}
|
|
@@ -24,6 +24,7 @@ export { default as MapstyleSet } from "./MapstyleSet";
|
|
|
24
24
|
export { default as Message } from "./Message";
|
|
25
25
|
export { default as Notification } from "./Notification";
|
|
26
26
|
export { default as Organisation } from "./Organisation";
|
|
27
|
+
export { default as OrganisationNote } from "./OrganisationNote";
|
|
27
28
|
export { default as Permission } from "./Permission";
|
|
28
29
|
export { default as ProductTour } from "./ProductTour";
|
|
29
30
|
export { default as ProductTourStep } from "./ProductTourStep";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapcreator/api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Mapcreator JavaScript API",
|
|
5
5
|
"main": "dist/bundle.js",
|
|
6
6
|
"repository": "https://gitlab.com/mapcreator/api-wrapper.git",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"nyc": "^15.1.0",
|
|
50
50
|
"tap-nyc": "^1.0.3",
|
|
51
51
|
"terser-webpack-plugin": "^5.3.1",
|
|
52
|
-
"webpack": "^5.68.0",
|
|
53
52
|
"typescript": "^4.9.4",
|
|
53
|
+
"webpack": "^5.68.0",
|
|
54
54
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
55
55
|
"webpack-cli": "^4.9.2",
|
|
56
56
|
"webpack-merge": "^5.8.0",
|
|
@@ -126,7 +126,7 @@ export default class GeoResourceProxy extends ResourceProxy {
|
|
|
126
126
|
throw new TypeError(`Invalid resource limit ${limit}, maximum allowed is ${RequestParameters.maxPerPage}`);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const url = `${this.new().baseUrl}/for-point`;
|
|
129
|
+
const url = `${this.new().baseUrl}/for-point?per_page=${limit}`;
|
|
130
130
|
|
|
131
131
|
return makeCancelable(async signal => {
|
|
132
132
|
const { data } = await this.api.ky.post(url, { json: { limit, point }, signal }).json();
|
|
@@ -105,7 +105,7 @@ export default class SimpleResourceProxy {
|
|
|
105
105
|
// Merge but don't overwrite using seed data
|
|
106
106
|
data = { ...this._seedData, ...data };
|
|
107
107
|
|
|
108
|
-
return new this.Target(this._api, data);
|
|
108
|
+
return new this.Target(this._api, data, this.__baseUrl);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -49,6 +49,8 @@ import User from './User';
|
|
|
49
49
|
import { makeCancelable } from '../utils/helpers';
|
|
50
50
|
import { encodeQueryString } from '../utils/requests';
|
|
51
51
|
import LayerGroup from './LayerGroup';
|
|
52
|
+
import { OrganisationNote } from './index';
|
|
53
|
+
import ResourceProxy from '../proxy/ResourceProxy';
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
export default class Organisation extends CrudBase {
|
|
@@ -81,6 +83,19 @@ export default class Organisation extends CrudBase {
|
|
|
81
83
|
return new OwnedResourceProxy(this.api, this, MapstyleSet);
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
get notes () {
|
|
87
|
+
const data = {
|
|
88
|
+
organisationId: this.id,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return new ResourceProxy(
|
|
92
|
+
this.api,
|
|
93
|
+
OrganisationNote,
|
|
94
|
+
`${this.api.url}/organisations/${this.id}/notes`,
|
|
95
|
+
data
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
84
99
|
/**
|
|
85
100
|
* Get a proxy for svg sets linked to the organisation
|
|
86
101
|
* @returns {OwnedResourceProxy} - A proxy for accessing the resource
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020, Mapcreator
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
|
9
|
+
*
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
11
|
+
* list of conditions and the following disclaimer.
|
|
12
|
+
*
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
* and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* Neither the name of the copyright holder nor the names of its
|
|
18
|
+
* contributors may be used to endorse or promote products derived from
|
|
19
|
+
* this software without specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import OwnableResource from '../traits/OwnableResource';
|
|
34
|
+
import { mix } from '../utils/reflection';
|
|
35
|
+
import CrudBase from './base/CrudBase';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Font family
|
|
39
|
+
* @extends CrudSetBase
|
|
40
|
+
* @mixes OwnableResource
|
|
41
|
+
*
|
|
42
|
+
* @property {number} id
|
|
43
|
+
* @property {number} organisationId
|
|
44
|
+
* @property {number} userId
|
|
45
|
+
* @property {string} content
|
|
46
|
+
* @property {Date} createdAt
|
|
47
|
+
* @property {Date} updatedAt
|
|
48
|
+
*/
|
|
49
|
+
export default class OrganisationNote extends mix(CrudBase, OwnableResource) {
|
|
50
|
+
static get resourcePath () {
|
|
51
|
+
return '/organisations/{organisation_id}/notes/{id}';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get resourceName () {
|
|
55
|
+
return 'notes';
|
|
56
|
+
}
|
|
57
|
+
}
|