@pacem/pacem 1.0.0-bernoulli → 1.0.0-bessel

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.
Files changed (55) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/pacem-2d.js +1 -1
  3. package/dist/browser/pacem-2d.min.js +1 -2
  4. package/dist/browser/pacem-3d.js +1 -1
  5. package/dist/browser/pacem-3d.min.js +1 -2
  6. package/dist/browser/pacem-charts.js +1 -1
  7. package/dist/browser/pacem-charts.min.js +1 -2
  8. package/dist/browser/pacem-cms.js +1 -1
  9. package/dist/browser/pacem-cms.min.js +1 -2
  10. package/dist/browser/pacem-core.js +50 -24
  11. package/dist/browser/pacem-core.js.map +1 -1
  12. package/dist/browser/pacem-core.min.js +2 -3
  13. package/dist/browser/pacem-foundation.js +1 -1
  14. package/dist/browser/pacem-foundation.min.js +1 -2
  15. package/dist/browser/pacem-fx.js +1 -1
  16. package/dist/browser/pacem-fx.min.js +1 -2
  17. package/dist/browser/pacem-logging.js +1 -1
  18. package/dist/browser/pacem-logging.min.js +1 -2
  19. package/dist/browser/pacem-maps.js +1 -1
  20. package/dist/browser/pacem-maps.min.js +1 -2
  21. package/dist/browser/pacem-media.js +1 -1
  22. package/dist/browser/pacem-media.min.js +1 -2
  23. package/dist/browser/pacem-networking.js +1 -1
  24. package/dist/browser/pacem-networking.min.js +1 -2
  25. package/dist/browser/pacem-numerical.js +1 -1
  26. package/dist/browser/pacem-numerical.min.js +1 -2
  27. package/dist/browser/pacem-plus.js +188 -74
  28. package/dist/browser/pacem-plus.js.map +1 -1
  29. package/dist/browser/pacem-plus.min.js +2 -3
  30. package/dist/browser/pacem-scaffolding.js +1 -1
  31. package/dist/browser/pacem-scaffolding.min.js +1 -2
  32. package/dist/browser/pacem-ui.js +24 -2
  33. package/dist/browser/pacem-ui.js.map +1 -1
  34. package/dist/browser/pacem-ui.min.js +2 -3
  35. package/dist/bundle/pacem.min.mjs +184 -184
  36. package/dist/bundle/pacem.mjs +359 -215
  37. package/dist/bundle/pacem.mjs.map +4 -4
  38. package/dist/typings/index.d.ts +64 -11
  39. package/dist/vscode.html-custom.json +33 -0
  40. package/package.json +1 -1
  41. package/dist/browser/pacem-2d.min.js.map +0 -1
  42. package/dist/browser/pacem-3d.min.js.map +0 -1
  43. package/dist/browser/pacem-charts.min.js.map +0 -1
  44. package/dist/browser/pacem-cms.min.js.map +0 -1
  45. package/dist/browser/pacem-core.min.js.map +0 -1
  46. package/dist/browser/pacem-foundation.min.js.map +0 -1
  47. package/dist/browser/pacem-fx.min.js.map +0 -1
  48. package/dist/browser/pacem-logging.min.js.map +0 -1
  49. package/dist/browser/pacem-maps.min.js.map +0 -1
  50. package/dist/browser/pacem-media.min.js.map +0 -1
  51. package/dist/browser/pacem-networking.min.js.map +0 -1
  52. package/dist/browser/pacem-numerical.min.js.map +0 -1
  53. package/dist/browser/pacem-plus.min.js.map +0 -1
  54. package/dist/browser/pacem-scaffolding.min.js.map +0 -1
  55. package/dist/browser/pacem-ui.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(){"use strict";Number.prototype.isCloseTo=function(t,e=14){const r=Number(`1e-${e}`);return this>t-r&&this<t+r},Number.prototype.roundoff=function(t=14){return parseFloat(this.toFixed(t))},Number.prototype.clamp=function(t,e){let r=this;return null==t||isNaN(t)||(r=Math.max(r,t)),null==e||isNaN(e)||(r=Math.min(r,e)),r},Number.prototype.toBase62=function(){for(var t=this,e="";0!=t;){e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(t%62)+e,t=Math.floor(t/62)}return e},Number.prototype.toBase36=function(){return this.toString(36)};const t=/^\/Date\([\d]+\)\/$/i;class Dates{static parse(e){let r;return"string"==typeof e?(r=t.test(e)?parseInt(e.substring(6)):Date.parse(e),new Date(r)):"number"==typeof e?new Date(e):e}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static daysInMonth(t,e){return[31,Dates.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static isDate(t){return t instanceof Date&&!isNaN(t.valueOf())}static dateOnly(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}static addMonths(t,e){let r=t.getDate(),n=new Date(t),s=n.getMonth()+e,a=0;for(;s<0;)s+=12,a--;return n.setDate(1),n.setMonth(s%12),n.setFullYear(n.getFullYear()+a+Math.floor(s/12)),n.setDate(Math.min(r,Dates.daysInMonth(n.getFullYear(),n.getMonth()))),n}static addDays(t,e){return new Date(t.valueOf()+864e5*e)}static daysBetween(t,e){return(e.valueOf()-t.valueOf())/864e5}}class NullChecker{static isNull(t){return null==t}static isEmpty(t){try{return Array.isArray(t)&&0===t.length||"string"==typeof t&&""===t||"object"==typeof t&&0===Object.keys(t).length&&!Dates.isDate(t)&&!(t instanceof RegExp)&&!(t instanceof FileSystemDirectoryHandle)&&!(t instanceof FileSystemFileHandle)}catch(t){return!1}}static isNullOrEmpty(t){return NullChecker.isNull(t)||NullChecker.isEmpty(t)}}function e(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)&&(t.constructor===Object||void 0===t.constructor)}function r(t,n){const s=t;for(const t of Object.keys(n)){const a=n[t],i=s[t];e(a)?s[t]=r(e(i)?i:{},a):Array.isArray(a)?s[t]=a.slice():s[t]=a}return s}Array.prototype.distinct=function(){return Array.from(new Set(this))},Array.prototype.union=function(t){const e=NullChecker.isNullOrEmpty(this),r=NullChecker.isNullOrEmpty(t);return e&&r?[]:r?this.slice():e?t.slice():this.concat(t).distinct()},Array.prototype.moveWithin=function(t,e){const r="Index must be greater or equal than 0 and less or equal than the length of the array.";var n=this;if(t<0||t>n.length)throw new Error(r);if(e<0||e>n.length)throw new Error(r);n.splice(e,0,Array.prototype.splice.apply(n,[t,1])[0])},Array.prototype.equalsContent=function(t){if(null==t||this.length!==t.length)return!1;for(let e=0;e<this.length;e++)if(this[e]!==t[e])return!1;return!0},Array.prototype.cloneFrom=function(t){if(null==t)throw"Cannot clone array from null object.";const e=t.length;var r=this.length!==t.length;for(let n=0;n<e;n++){const e=t[n];this.length>n?this[n]!==e&&(this[n]=e,r=!0):(Array.prototype.push.apply(this,[e]),r=!0)}r&&this.splice(e)};class DeepMerger{constructor(){}static merge(t,e){return e??=globalThis.Pacem??={},r(e,t)}}class Blobs{static blobToDataURL(t){return new Promise((e,r)=>{const n=new FileReader;n.onload=t=>{e(t.target.result)},n.readAsDataURL(t)})}static _b64ToUint8Array(t){let e=t.length;const r=new Uint8Array(e);for(;e--;)r[e]=t.charCodeAt(e);return r}static base64ToBlob(t,e){const r=Blobs._b64ToUint8Array(atob(t));return new Blob([r],e)}static dataURLToBlob(t){const e=t.indexOf(",");if(-1===e)return Blobs.base64ToBlob(t);{const r=t.substring(e+1),n=t.substring(0,e).match(/:(.*?);/)[1];return Blobs.base64ToBlob(r,{type:n})}}static async blobToText(t,e){const r=await t.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(r)}static textToBlob(t,e="text/plain",r="utf-8",n,s=63){let a=r.toLowerCase();const i=()=>`${e};charset=${a}`;switch(a){case"utf-8":{const e=(new TextEncoder).encode(t),r=n?[new Uint8Array([239,187,191]),e]:[e];return new Blob(r,{type:i()})}case"utf-16":a="utf-16le",n??=!0;case"utf-16le":case"utf-16be":{const e="utf-16be"!==a,r=n?1:0,s=new ArrayBuffer(2*(t.length+r)),o=new DataView(s);n&&o.setUint16(0,65279,e);for(let n=0;n<t.length;n++)o.setUint16(2*(n+r),t.charCodeAt(n),e);return new Blob([s],{type:i()})}case"ascii":case"iso-8859-1":case"latin1":{const e="ascii"===a?127:255,n=new Uint8Array(t.length),o=s>0;for(let a=0;a<t.length;a++){const i=t.charCodeAt(a);if(i>e){if(!o)throw new Error(`Character "${t[a]}" cannot be encoded in ${r}.`);n[a]=s}else n[a]=i}return new Blob([n],{type:i()})}default:throw new Error(`Encoding "${r}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}}const n=(t,e)=>{const r=t.match(e);return r?r[2]:null};const s=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,a=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,i=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,o=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,c=/^#[a-f0-9]{6}$/,l=/^#[a-f0-9]{3}$/;function u(t){return!NullChecker.isNullOrEmpty(t)&&"object"==typeof t&&"r"in t&&"g"in t&&"b"in t&&"number"==typeof t.r&&"number"==typeof t.b&&"number"==typeof t.g&&(t.a??=1,t.r>=0&&t.r<=1&&t.g>=0&&t.g<=1&&t.b>=0&&t.b<=1&&t.a>=0&&t.a<=1)}function h(t){return!NullChecker.isNullOrEmpty(t)&&"object"==typeof t&&"h"in t&&"s"in t&&"l"in t&&"number"==typeof t.h&&"number"==typeof t.s&&"number"==typeof t.l&&(t.a??=1,t.h>=0&&t.h<=360&&t.s>=0&&t.s<=1&&t.l>=0&&t.l<=1&&t.a>=0&&t.a<=1)}const d={adjustRgbChannel:t=>t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),adjustRgbChannelInv:t=>t<=.00304?12.92*t:1.055*(Math.pow(t,1/2.4)-.055),adjustRgb:t=>({r:d.adjustRgbChannel(t.r),g:d.adjustRgbChannel(t.g),b:d.adjustRgbChannel(t.b),a:t.a}),adjustRgbInv:t=>({r:d.adjustRgbChannelInv(t.r),g:d.adjustRgbChannelInv(t.g),b:d.adjustRgbChannelInv(t.b),a:t.a}),X:t=>.4125*t.r+.3576*t.g+.1804*t.b,Y:t=>.2126*t.r+.7152*t.g+.0722*t.b,Z:t=>.0193*t.r+.1191*t.g+.9503*t.b,relativeLuminance:t=>{const e=d.adjustRgb(t);return d.Y(e)},rgbToCieXYZ:t=>{const e=d.adjustRgb(t);return{x:d.X(e),y:d.Y(e),z:d.Z(e),a:t.a}},cieXYZToRgb:t=>{const e=3.241*t.x-1.5374*t.y-.4986*t.z,r=-.9692*t.x+1.876*t.y+.0416*t.z,n=.0556*t.x-.204*t.y+1.057*t.z;return d.adjustRgbInv({r:e,g:r,b:n,a:t.a})},contrastRatio:(t,e)=>{const r=d.relativeLuminance(t)+.05,n=d.relativeLuminance(e)+.05;return r>n?r/n:n/r}};function p(t){return t.toString(16).padStart(2,"0")}class Colors{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(t){const e=t=>Math.min(1,Math.max(0,t));return null==t[3]&&(t[3]=1),{r:e(t[0]),g:e(t[1]),b:e(t[2]),a:Math.min(1,Math.max(0,t[3]))}}static _normalize(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}static parse(t){if(t=(t||"").toLowerCase(),i.test(t)){let e=i.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(o.test(t)){let e=o.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(c.test(t)){let e=c.exec(t)[0];return this._clampRGB(this._normalize([parseInt("0x"+e.substr(1,2)),parseInt("0x"+e.substr(3,2)),parseInt("0x"+e.substr(5,2)),1]))}if(l.test(t)){let e=l.exec(t)[0],r=e.substr(1,1),n=e.substr(2,1),s=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+r+r),parseInt("0x"+n+n),parseInt("0x"+s+s),1]))}if(s.test(t)){let e=s.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3])};return this.rgb(r)}if(a.test(t)){let e=a.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3]),a:parseFloat(e[4])};return this.rgb(r)}}static hsl(t){const e=function(t){const e=t.r,r=t.g,n=t.b;return(.5*(Math.max(e,r,n)+Math.min(e,r,n))).clamp(0,1)}(t),r=function(t,e){const r=t.r,n=t.g,s=t.b,a=Math.max(r,n,s),i=Math.min(r,n,s);return(0===e||1===e?0:(a-i)/(1-Math.abs(2*e-1))).clamp(0,1)}(t,e),n=function(t){const e=t.r,r=t.g,n=t.b,s=Math.max(e,r,n),a=Math.min(e,r,n);let i=0;return s!==a&&(i=s===e?((r-n)/(s-a)*60+360)%360:s===r?((n-e)/(s-a)*60+120)%360:((e-r)/(s-a)*60+240)%360),i.clamp(0,360)}(t);return{h:n,s:r,l:e,a:t.a}}static cieXYZ(t){return h(t)&&(t=this.rgb(t)),d.rgbToCieXYZ(t)}static rgb(t){if(!h(t)){const e=d.cieXYZToRgb(t);return this._clampRGB([e.r,e.g,e.b,e.a])}{const e=t.h,r=t.s,n=t.l,s=e/60,a=(1-Math.abs(2*n-1))*r,i=a*(1-Math.abs(s%2-1)),o=n-a/2,c=(e,r,n)=>this._clampRGB([e+o,r+o,n+o,t.a]);if(s<=1)return c(a,i,0);if(s<=2)return c(i,a,0);if(s<=3)return c(0,a,i);if(s<=4)return c(0,i,a);if(s<=5)return c(i,0,a);if(s<=6)return c(a,0,i)}}static stringify(t,e=1){if(h(t)){e??=1,t.a??=1;const r="number"==typeof e?e:1;return`hsla(${t.h.roundoff(r)},${(100*t.s).roundoff(r)}%,${(100*t.l).roundoff(r)}%,${t.a.roundoff()})`}if(u(t)){e??=!0,t.a??=1;const r="boolean"==typeof e?e:!!e,n=Math.round(255*t.r),s=Math.round(255*t.g),a=Math.round(255*t.b),i=t.a.roundoff();return 1===i?r?("#"+p(n)+p(s)+p(a)).toUpperCase():`rgb(${n},${s},${a})`:`rgba(${n},${s},${a},${i})`}}static contrastRatio(t,e){return h(t)&&(t=this.rgb(t)),h(e)&&(e=this.rgb(e)),d.contrastRatio(t,e)}static luminance(t){return h(t)&&(t=Colors.rgb(t)),d.relativeLuminance(t)}static lighten(t,e=.1){if(e||=0,h(t)){const r=Math.min(1,Math.max(0,t.l+e));return Object.assign({},t,{l:r})}if(u(t)){const r=this.lighten(this.hsl(t),e);return this.rgb(r)}return t}static darken(t,e=.1){return this.lighten(t,-e)}static saturate(t,e=.1){if(e||=0,h(t)){const r=Math.min(1,Math.max(0,t.s+e));return Object.assign({},t,{s:r})}if(u(t)){const r=this.saturate(this.hsl(t),e);return this.rgb(r)}return t}static desaturate(t,e=.1){return this.saturate(t,-e)}static interpolate(t,e,r,n){r??=.5,n??=r;const s=(r+n).roundoff(),a=(r/s).roundoff(),i=(n/s).roundoff(),o=u(t),c=h(t),l=t=>u(t)||h(t)?Colors.cieXYZ(t):t;t=l(t),e=l(e);const d={x:(t.x*a+e.x*i).roundoff(),y:(t.y*a+e.y*i).roundoff(),z:(t.z*a+e.z*i).roundoff(),a:(t.a*a+e.a*i).roundoff()};return o?Colors.rgb(d):c?Colors.hsl(Colors.rgb(d)):d}}const g=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function f(t){const e=[];let r=t.match(g);return r&&r.length>0&&r.forEach(t=>e.push(parseFloat(t))),e}class Angle{static isAngle(t){return"object"==typeof t&&"vertex"in t&&Point.isPoint(t.vertex)&&"start"in t&&Point.isPoint(t.start)&&"end"in t&&Point.isPoint(t.end)}static value(t){if(NullChecker.isNullOrEmpty(t)||!Angle.isAngle(t))return Number.NaN;const{vertex:e,start:r,end:n}=t;return Angle.angleBetween(e,r,n)}static angleBetween(t,e,r){const n=e.x-t.x,s=e.y-t.y,a=r.x-t.x,i=r.y-t.y,o=n*a+s*i,c=n*i-s*a;return-Math.atan2(c,o)}}class Size{static parse(t){let e=f(t);if(e&&2===e.length)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${t}" as a valid Size.`)}static isSize(t){return"object"==typeof t&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}}class Point{static parse(t){let e=f(t);if(e&&2===e.length)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${t}" as a valid Point.`)}static isPoint(t){return"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y}static distance(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static subtract(t,e){return{x:e.x-t.x,y:e.y-t.y}}static add(...t){var e={x:0,y:0};for(var r of t)e.x+=r.x,e.y+=r.y;return e}static multiply(t,e){return{x:t.x*e,y:t.y*e}}}class Matrix2D{static isIdentity(t){return 1===t.a&&1===t.d&&0===t.b&&0===t.f&&0===t.c&&0===t.e}static get identity(){return{a:1,b:0,c:0,d:1,e:0,f:0}}static copy(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}static scale(t,e,r=e){return{a:t.a*e,b:t.b,c:t.c,d:t.d*r,e:t.e,f:t.f}}static translate(t,e){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e+e.x,f:t.f+e.y}}static rotate(t,e){const r=Math.cos(e),n=Math.sin(e);return Matrix2D.multiply(t,{a:r,b:n,c:-n,d:r,e:0,f:0})}static multiply(t,e){return"x"in t&&"y"in t?"number"==typeof e?{x:t.x*e,y:t.y*e}:{x:t.x*e.a+t.y*e.c+e.e,y:t.x*e.b+t.y*e.d+e.f}:"number"==typeof e?{a:t.a*e,b:t.b*e,c:t.c*e,d:t.d*e,e:t.e*e,f:t.f*e}:{a:t.a*e.a+t.b*e.c,b:t.a*e.b+t.b*e.d,c:t.c*e.a+t.d*e.c,d:t.c*e.b+t.d*e.d,e:t.e*e.a+t.f*e.c+e.e,f:t.e*e.b+t.f*e.d+e.f}}static det(t){return t.a*t.d-t.c*t.b}static invert(t){const e=this.det(t);if(0===e)return null;const r=1/e;return this.multiply({a:t.d,b:-t.b,c:-t.c,d:t.a,e:-t.e*t.d+t.c*t.f,f:t.e*t.b-t.a*t.f},r)}static toComponents(t,e={x:0,y:0}){const r=Math.sqrt(t.a*t.a+t.c*t.c),n=Math.sqrt(t.b*t.b+t.d*t.d),s=0!=r?t.a/r:0,a=0!=r?t.c/r:0,i=Math.atan2(a,s),{x:o,y:c}=e;return{scaleX:r,scaleY:n,rotation:i,translation:{x:t.e-o*(r*s-1)+c*r*a,y:t.f-c*(n*s-1)-o*n*a}}}static fromTransform([t,e,r],[n,s,a]){const i=t.x*(e.y-r.y)-t.y*(e.x-r.x)+(e.x*r.y-r.x*e.y);if(Math.abs(i)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");const o=1/i;return{a:o*(n.x*(e.y-r.y)+s.x*(r.y-t.y)+a.x*(t.y-e.y)),b:o*(n.y*(e.y-r.y)+s.y*(r.y-t.y)+a.y*(t.y-e.y)),c:o*(n.x*(r.x-e.x)+s.x*(t.x-r.x)+a.x*(e.x-t.x)),d:o*(n.y*(r.x-e.x)+s.y*(t.x-r.x)+a.y*(e.x-t.x)),e:o*(n.x*(e.x*r.y-r.x*e.y)+s.x*(r.x*t.y-t.x*r.y)+a.x*(t.x*e.y-e.x*t.y)),f:o*(n.y*(e.x*r.y-r.x*e.y)+s.y*(r.x*t.y-t.x*r.y)+a.y*(t.x*e.y-e.x*t.y))}}static areClose(t,e,r=12){return t.a.isCloseTo(e.a,r)&&t.b.isCloseTo(e.b,r)&&t.c.isCloseTo(e.c,r)&&t.d.isCloseTo(e.d,r)&&t.e.isCloseTo(e.e,r)&&t.f.isCloseTo(e.f,r)}}class Rect{static parse(t){let e=f(t);if(e&&4===e.length)return{x:e[0],y:e[1],width:e[2],height:e[3]};throw new Error(`Cannot parse "${t}" as a valid Rect.`)}static isRect(t){return Point.isPoint(t)&&Size.isSize(t)}static _stretch(t,e){return{a:e.width/t.width,b:0,c:0,d:e.height/t.height,e:e.x-t.x,f:e.y-t.y}}static _contain(t,e,r,n){let s=1;s=t.width/t.height>=e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return Matrix2D.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _cover(t,e,r,n){let s=1;s=t.width/t.height<e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return Matrix2D.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _align(t,e,r,n){let s=0,a=0;switch(r){case"left":s=e.x-t.x;break;case"right":s=e.x+e.width-t.width-t.x;break;default:s=e.x+.5*e.width-.5*t.width-t.x}switch(n){case"top":a=e.y-t.y;break;case"bottom":a=e.y+e.height-t.height-t.y;break;default:a=e.y+.5*e.height-.5*t.height-t.y}return{x:s,y:a}}static findTransform(t,e,r="stretch",n="center",s="middle"){switch(r){case"contain":return this._contain(t,e,n,s);case"cover":return this._cover(t,e,n,s);default:return this._stretch(t,e)}}static intersect(...t){const e={x:0,y:0,height:0,width:0},r=Array.from(t||[]);if(r.length<=0)return e;for(var n=r[0],s=1;s<r.length;s++){const t=r[s],a=Math.max(t.x,n.x),i=Math.max(t.y,n.y),o=Math.min(t.x+t.width,n.x+n.width)-a,c=Math.min(t.y+t.height,n.y+n.height)-i;if(o<0||c<=0)return e;n={x:a,y:i,width:o,height:c}}return n}static expand(t,...e){const r=Array.from(e||[]);let n=t.x,s=t.y,a=n,i=s;Rect.isRect(t)&&(a+=t.width,i+=t.height);for(let t of r)n=Math.min(t.x,n),s=Math.min(t.y,s),a=Math.max(t.x,a),i=Math.max(t.y,i);return{x:n,y:s,width:a-n,height:i-s}}}const y={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"};class Imaging{static async loadImage(t){const e=await fetch(t);if(!e.ok)return null;return await e.blob()}static async resizeImage(t,e,r,n){if(e<=0||r<=0||isNaN(e)||isNaN(r))throw new Error("Invalid target size");"string"==typeof t&&(t=await Imaging.loadImage(t));const s=await self.createImageBitmap(t),a=s.width,i=s.height,o=new OffscreenCanvas(a,i),c=o.getContext("2d");c.imageSmoothingEnabled=c.mozImageSmoothingEnabled=c.oImageSmoothingEnabled=c.webkitImageSmoothingEnabled=!0;const{quality:l,type:u,mode:h,align:d,valign:p,background:g}=Object.assign({},y,n??{}),f={width:a,height:i,x:0,y:0},x={x:0,y:0,width:e,height:r},m=Rect.findTransform(f,x,h,d,p);o.width=e,o.height=r,g&&(c.fillStyle=g,c.fillRect(0,0,o.width,o.height)),c.setTransform(m),c.drawImage(s,0,0);return await o.convertToBlob({quality:l,type:u})}}class Keys{static#t;static uniqueId(){let t=Keys.#t||Date.now();return Keys.#t=++t}static uniqueCode(){return Keys.uniqueId().toBase62()}static randomString(t){let e="";do{e+=(62*Math.random()).toBase62()}while(e.length<t);return e}}function x(t,e){const r=t.length,n=e.length,s=Array.from({length:r+1},()=>Array(n+1).fill(0));for(let a=1;a<=r;a++)for(let r=1;r<=n;r++)t[a-1]===e[r-1]?s[a][r]=s[a-1][r-1]+1:s[a][r]=Math.max(s[a-1][r],s[a][r-1]);return s}function m(t,e,r,n=""){const s=t.length,a=e.length,i=[];let o=s,c=a,l=null;const u=()=>{l&&(i.push(l),l=null)};for(;o>0||c>0;){var h=null;let s=null;o>0&&c>0&&t[o-1]===e[c-1]?(h="=",s=t[o-1],o--,c--):c>0&&(0===o||r[o][c-1]>=r[o-1][c])?(h="+",s=e[c-1],c--):o>0&&(0===c||r[o-1][c]>r[o][c-1])&&(h="-",s=t[o-1],o--),h&&null!==s?l&&l.type===h?l.value=s+(l.value?n:"")+l.value:(u(),l={type:h,value:s}):u()}return u(),i.reverse()}class LexerClass{tokenize(t,e){const r=[];for(;t;){const n=t.length;for(let n of e){const e=n.exec(t,this),s=e?.length;if(s>0){Array.prototype.push.apply(r,e);const n=e[s-1];t=t.substr((n.index||0)+n.raw.length);break}}if(t.length>=n)throw new Error(`Cannot parse\n"${t}"\n using the provided grammar.`)}return r}}let b=class Parser{constructor(t=new LexerClass){this._lexer=t}parse(t,e,r){const n=this._lexer.tokenize(t,e);return r.render(n)}};function w(t){return(t??"").replace(/</g,"&lt;")}function k(t){return t?.index||void 0}function C(t){return t?.replace(/[^\w]+/g," ").trim().replace(/ +/g,"-").toLowerCase()}function $(t,e,r){const n=e.exec(t);return n&&n.length?r(n):null}const N=/(<!--)([\s\S]*?)(-->|$)/,M=/^ {0,3}(={3,}|_{3,}|-{3,})(\r?\n|$)/,R=/^ {0,3}(#{1,6})\s+([^\n]+)(\r?\n|$)+/,S=/^ {0,3}([^\n]+)(\r?\n=+(\r?\n|$))+/,I=/^ {0,3}([^\n]+)(\r?\n-+(\r?\n|$))+/,v=/^ {4,}.+(\r?\n {4,}.+)*(\r?\n|$)+/,A=/^ {0,3}``` *([^\n]*)\r?\n(([\s\S](?!\r?\n {0,3}```))*.(\r?\n)+) {0,3}```(\r?\n|$)+/,L=/^ {0,3}> *([^\n]+)(\r?\n {0,3}> *([^\n]*))*(\r?\n|$)+/,_=/^( {0,3}([-+]).*\r?\n|$)((?!(?: {0,3}(?:\d+[.\)]|\r?\n\S))).*(\r?\n|$))*/,B=/^( {0,3}(\d+[.\)]).*\r?\n|$)((?!(?: {0,3}(?:[+-]|\r?\n\S))).*(\r?\n|$))*/,z=/^(?:[-+*]|\d+[.\)])/m,E=/^(?! {4,})(.+(\n(?! {0,3}```)(?! {0,3}([-+]|\d+[.\)]))(?! {4,})(?! {0,3}>).+)*)/,O=/^ {0,3}(!?)\[([^\]]+)\]: +(\S+)(?: +['"\(](.+)['"\)])?(\r?\n|$)+/,T=/!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?(\[[^\[\]]*\]|\([^\(\)]*\))?/,D=/(\*\*?|__?)(\[[^\]]*]\([^\)]+\))\1/,j=/(?:(?<!\\)`)(.+?)(?:(?<!\\)`)/,H=/(\*\*?|__?)((?!\1\s?)(?:(?!\1)[\S\s])*[^\s])\1/,P=/(~~?|__?)(?!\1\s?)([^\s][\s\S]*?(?!\1)[^\s])\1/,F=/(:")(?!":\s?)([^\s][\s\S]*?(?!":)[^\s])":/,U=/^\s+/,q=/ {2,}\r?\n/,Y=/^[^\r\n]+/;var G,Q;function X(t=[]){const e={[Q.Comment]:{exec:(t,e)=>$(t,N,r=>{const n=k(r),s=[{type:G.Html,index:n,raw:r[0],text:r[2]}];if(n>0){const r=t.substr(0,n),a=e.tokenize(r,g);Array.prototype.unshift.apply(s,a)}return s})},[Q.Reference]:{exec:t=>$(t,O,t=>{const e=k(t),r=t[0],n=r,s="!"===t[1],a=t[2],i=t[3],o=t[4];return[{type:G.Reference,index:e,raw:r,text:n,id:a,image:s,url:i,title:o}]})}},r=[],n=[],s={};for(let e of t){let t,a="inline";switch("type"in e?(a=e.type,t=e.rule):t=e,a){case"block":r.push(t);break;case"code":if("lang"in e){const r=e.lang.toLowerCase();(s[r]=s[r]||[]).push(t)}break;default:const a={exec:(e,r)=>{const n=t.exec(e,r);return o(e,n,r),n}};n.push(a)}}const a={[Q.Text]:{exec:t=>$(t,Y,t=>{const e=t[0],r=e;return[{index:k(t),raw:e,text:r,type:G.Text}]})},[Q.Space]:{exec:t=>$(t,U,t=>{const e=t[0];return[{type:G.Space,raw:e,text:e}]})}},i={[Q.ImageOrLink]:{exec:(t,e)=>c(t,T,e,t=>{const r=k(t),n=t[0],s="!"===n.charAt(0),a=t[1],i=function(t){if(!(NullChecker.isNullOrEmpty(t)||/^\[/.test(t)&&/\]$/.test(t)))return/^\(/.test(t)&&/\)$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2]),o=C(function(t){if(!(NullChecker.isNullOrEmpty(t)||/^\(/.test(t)&&/\)$/.test(t)))return/^\[/.test(t)&&/\]$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2])??a);return s?[{index:r,type:i?G.Image:G.ImageLike,raw:n,text:a,src:i,ref:o,tokens:e.tokenize(a,l)}]:[{index:r,type:i?G.Link:G.LinkLike,raw:n,text:a,href:i,ref:o,tokens:e.tokenize(a,l)}]})},[Q.Code]:{exec:(t,e)=>c(t,j,e,t=>{const e=w(t[1]);return[{type:G.Code,raw:t[0],text:e,index:k(t)}]})},[Q.EmphasizedLink]:{exec:(t,e)=>c(t,D,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=t[1].length>1?G.Bold:G.Italic,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.Emphasize]:{exec:(t,e)=>c(t,H,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=t[1].length>1?G.Bold:G.Italic,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.StrikeThrough]:{exec:(t,e)=>c(t,P,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=G.StrikeThrough,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.Quote]:{exec:(t,e)=>c(t,F,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=G.Quote,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.LineBreak]:{exec:(t,e)=>c(t,q,e,t=>{const e=t[0],r=e;return[{index:k(t),raw:e,text:r,type:G.LineBreak}]})}},o=(t,e,r)=>{const n=e?.length>0&&e[0].index;if(n>0){const s=t.substr(0,n),a=r.tokenize(s,l)||[];Array.prototype.unshift.apply(e,a)}},c=(t,e,r,n)=>{const s=$(t,e,r=>{if(e!=j){const e=j.exec(t);if(e&&e.length&&e.index<r.index)return null}return n(r)});return o(t,s,r),s},l=Object.values(i);Array.prototype.push.apply(l,n),l.push(a[Q.Text],a[Q.Space]);const u=t=>{const e=[a[Q.Text],a[Q.Space]],r=t?.toLowerCase()||"";return r&&r in s&&Array.prototype.unshift.apply(e,s[r]),e},h={[Q.Paragraph]:{exec:(t,e)=>$(t,E,t=>{const r=t[0],n=r;return[{type:G.Paragraph,raw:r,text:n,tokens:e.tokenize(n,l)}]})},[Q.Space]:a[Q.Space]},d=(t,e)=>{const r=/^ {0,3}(`{3,}|$|>|[+-]\s|\d+[.\)])/m.test(t)?g:l;return e.tokenize(t,r)},p={[Q.HorizontalRule]:{exec:(t,e)=>$(t,M,t=>{const e=t[0],r=e;return[{type:G.HorizontalRule,raw:e,text:r}]})},[Q.Heading]:{exec:(t,e)=>$(t,R,t=>{const r=t[2];return[{type:G.Heading,raw:t[0],text:r,level:t[1].length,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.Heading1]:{exec:(t,e)=>$(t,S,t=>{const r=t[1];return[{type:G.Heading,raw:t[0],text:r,level:1,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.Heading2]:{exec:(t,e)=>$(t,I,t=>{const r=t[1];return[{type:G.Heading,raw:t[0],text:r,level:2,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.CodeBlock]:{exec:(t,e)=>$(t,v,t=>{const r=t[0],n=w(r);return[{type:G.CodeBlock,raw:r,text:n,tokens:e.tokenize(n,[])}]})},[Q.Fences]:{exec:(t,e)=>$(t,A,t=>{const r=w(t[2]),n=t[1]?.toLowerCase();return[{type:G.CodeBlock,raw:t[0],text:r,lang:n,tokens:e.tokenize(r,u(n))}]})},[Q.BlockQuote]:{exec:(t,e)=>$(t,L,t=>{const r=t[0],n=r.replace(/^ {0,3}> */gm,"");return[{type:G.BlockQuote,raw:r,text:n,tokens:e.tokenize(n,[h[Q.Paragraph],h[Q.Space]])}]})},[Q.OrderedList]:{exec:(t,e)=>$(t,B,t=>{const r=t[0],n=r.replace(/^ {0,3}/gm,"").split(z).filter(t=>!NullChecker.isNullOrEmpty(t)).map(t=>t.trim());return[{type:G.OrderedList,start:parseInt(/\d/.exec(t[0])[0]),raw:r,text:r,tokens:n.map(t=>({type:G.ListItem,raw:t,text:t,tokens:d(t,e)}))}]})},[Q.UnorderedList]:{exec:(t,e)=>$(t,_,t=>{const r=t[0],n=r.replace(/^ {0,3}/gm,"").split(z).filter(t=>!NullChecker.isNullOrEmpty(t)).map(t=>t.trim());return[{type:G.UnorderedList,raw:r,text:r,tokens:n.map(t=>({type:G.ListItem,raw:t,text:t,tokens:d(t,e)}))}]})}},g=Object.values(p);return Array.prototype.push.apply(g,r),g.push(h[Q.Paragraph],h[Q.Space]),[e[Q.Comment],e[Q.Reference]].concat(g)}!function(t){t.Html="html",t.Text="text",t.Paragraph="paragraph",t.BlockQuote="blockquote",t.Space="space",t.Heading="heading",t.Bold="bold",t.Italic="italic",t.CodeBlock="codeblock",t.Code="code",t.Image="img",t.ImageLike="imglike",t.Link="link",t.LinkLike="linklike",t.LineBreak="br",t.StrikeThrough="strike",t.Quote="quote",t.HorizontalRule="hr",t.OrderedList="ol",t.UnorderedList="ul",t.ListItem="listitem",t.Reference="ref"}(G||(G={})),function(t){t[t.Comment=0]="Comment",t[t.Reference=1]="Reference",t[t.HorizontalRule=2]="HorizontalRule",t[t.Heading=3]="Heading",t[t.Heading1=4]="Heading1",t[t.Heading2=5]="Heading2",t[t.CodeBlock=6]="CodeBlock",t[t.Fences=7]="Fences",t[t.BlockQuote=8]="BlockQuote",t[t.OrderedList=9]="OrderedList",t[t.UnorderedList=10]="UnorderedList",t[t.Paragraph=11]="Paragraph",t[t.EmphasizedLink=12]="EmphasizedLink",t[t.ImageOrLink=13]="ImageOrLink",t[t.Emphasize=14]="Emphasize",t[t.StrikeThrough=15]="StrikeThrough",t[t.Quote=16]="Quote",t[t.Code=17]="Code",t[t.LineBreak=18]="LineBreak",t[t.Text=254]="Text",t[t.Space=255]="Space"}(Q||(Q={}));const Z=/[ \r\n]*\0+[ \r\n]*/g;class HtmlRenderer{constructor(t=(t,e)=>t?.text||""){this._extraItemRender=t,this._renderContent=t=>{const e=t.tokens;return NullChecker.isNullOrEmpty(e)?t.text:this._render(e)}}_rendeItem(t,e){const r=this._renderContent,n="\0";switch(t?.type){case G.Reference:return"";case G.Html:return t.raw;case G.BlockQuote:return`<blockquote>\n${r(t)}</blockquote>${n}`;case G.Bold:return`<b>${r(t)}</b>`;case G.CodeBlock:const s=t.lang;return`<pre>${n}<code${s?' class="'+s+'"':""}>${r(t)}</code>${n}</pre>${n}`;case G.Code:return`<code>${r(t)}</code>`;case G.HorizontalRule:return`<hr />${n}`;case G.Heading:const a=t.level;return`<h${a} id="${t.ref}">${r(t)}</h${a}>${n}`;case G.Image:case G.ImageLike:const i=t;let o=i.src,c="";const l=i.text,u=i.ref;if(!o&&u){const t=e.find(t=>t.type===G.Reference&&!0===t.image&&t.id?.toLowerCase()===u.toLowerCase());t&&(o=t.url,c=t.title??"")}return o?`<img src="${o}" alt="${l}"${c?' title="'+c+'"':""} />`:`![${r(t)}]`;case G.Italic:return`<i>${r(t)}</i>`;case G.StrikeThrough:return`<s>${r(t)}</s>`;case G.Quote:return`<q>${r(t)}</q>`;case G.LineBreak:return"<br />\0";case G.OrderedList:return`<ol start="${t.start}">\n${r(t)}</ol>${n}`;case G.UnorderedList:return`<ul>\n${r(t)}</ul>${n}`;case G.ListItem:return`\t<li>${r(t)}</li>${n}`;case G.Link:case G.LinkLike:const h=t;let d=h.href,p="";const g=h.ref;if(!d&&g){const t=e.find(t=>t.type===G.Reference&&!0!==t.image&&t.id?.toLowerCase()===g.toLowerCase());t&&(d=t.url,p=t.title??"")}return d?`<a href="${d}"${p?' title="'+p+'"':""}>${r(t)}</a>`:`[${r(t)}]`;case G.Paragraph:return`<p>${r(t)}</p>${n}`;case G.Text:case G.Space:return t.text}return this._extraItemRender(t,e)}_render(t){let e="";for(let r of t||[])e+=this._rendeItem(r,t);return e}render(t){return e=this._render(t),e?.replace(Z,"\n").trim();var e}}class TokenRenderer{_render(t){return NullChecker.isNullOrEmpty(t)?"":JSON.stringify(t)}render(t){return"["+t.filter(t=>!NullChecker.isNullOrEmpty(t)).map(this._render).join(",")+"]"}}var K=Object.freeze({__proto__:null,Parser:class Parser extends b{toHtml(t,e,r){const n=new HtmlRenderer(r);return NullChecker.isNullOrEmpty(e)?this.parse(t,n):this.parse(t,X(e),n)}tokenize(t,e){const r=this.parse(t,X(e),new TokenRenderer);return JSON.parse(r)}parse(t,e=X(),r=new HtmlRenderer){return(n=e)&&"object"==typeof n&&"function"==typeof n.render?super.parse(t,X(),e):super.parse(t,e,r);var n}}}),W=Object.freeze({__proto__:null,Markdown:K,Parser:b}),J=Object.freeze({__proto__:null,Angle:Angle,Arrays:class Arrays{static range(t,e,r=2){let n=t;NullChecker.isNull(e)&&(e=r=t,t=1);const s=(e-t)/(r-1),a=[];if(s>0)for(;a.length<r;)a.push(n.roundoff()),n+=s;return a}static chunkify(t,e){if(NullChecker.isNullOrEmpty(t))return[];if(e<=0||e%1!=0)throw new Error("Provide a positive integer number.");const r=Math.ceil(t.length/e);return Array.from({length:r},(r,n)=>{const s=n*e,a=s+e;return t.slice(s,a)})}},Blobs:Blobs,Colors:Colors,Compile:W,Dates:Dates,DeepMerger:DeepMerger,HistoryService:class HistoryService{constructor(t,e){this.#e=t,this.#r=e}#n=[];#s=[];#r;#e;get current(){return this.#e}get canUndo(){return this.#n.length>0}get canRedo(){return this.#s.length>0}set maxlength(t){this.#r=t}undo(){if(this.canUndo){const t=this.#n,e=this.#s,r=this.#e;e.unshift(r),this.#e=t.pop()}}redo(){if(this.canRedo){const t=this.#n,e=this.#s,r=this.#e;t.push(r),this.#e=e.shift()}}push(t){this.#s.splice(0),this.#n.push(this.#e),this.#e=t;const e=this.#r,r=this.#n;e>0&&r.length>e&&r.splice(0,r.length-e)}reset(){this.#s.splice(0),this.#n.splice(0)}},Imaging:Imaging,Keys:Keys,Matrix2D:Matrix2D,NullChecker:NullChecker,Numbers:class Numbers{static round(t,e=1){return Math.round(t/e)*e}static log(t,e){return Math.log10(t)/Math.log10(e)}static rebase(t,e,r){const n=t.toString(),s=parseInt(n,e);return n.endsWith(s.toString(e))?parseInt(t.toString(),e).toString(r):Number.NaN.toString()}},Point:Point,Rect:Rect,Size:Size,Strings:class Strings{static leftPad(t,e,r){return t.toString().padStart(e,r)}static format(t,...e){const r=Array.from(e);let n=t;for(let t=0;t<r.length;t++){const e=new RegExp("(^|[^\\{])\\{"+t+"\\}($|[^\\}])","g");n=n.replaceAll(e,(e,...n)=>e.replace("{"+t+"}",r[t]))}const s=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(n);if(!NullChecker.isNullOrEmpty(s))throw new Error(`Missing argument at index ${s[2]}.`);return n}static diff(t,e,r="char"){switch(r){case"line":return function(t,e){const r=/\r?\n/,n=t.split(r),s=e.split(r);return m(n,s,x(n,s),"\n")}(t,e);case"word":return function(t,e){const r=/(\S+|\s+)/g,n=t.match(r)||[],s=e.match(r)||[];return m(n,s,x(n,s),"")}(t,e);default:return function(t,e){const r=t.split(""),n=e.split("");return m(r,n,x(r,n),"")}(t,e)}}static async hash(t,e="SHA-256"){const r=await crypto.subtle.digest(e,(new TextEncoder).encode(t));return Array.from(new Uint8Array(r)).map(t=>t.toString(16).padStart(2,"0")).join("")}},detect:function(t=navigator.userAgent){let e="unknown",r=null;switch(/ucbrowser/i.test(t)?e="UCBrowser":/edg/i.test(t)?e="Edge":/googlebot/i.test(t)?e="GoogleBot":/chromium/i.test(t)?e="Chromium":/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t)?e="Firefox":/; msie|trident/i.test(t)&&!/ucbrowser/i.test(t)?e="IE":/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t)?e="Chrome":/safari/i.test(t)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(t)?e="Safari":/opr|opera/i.test(t)&&(e="Opera"),e){case"UCBrowser":r=n(t,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":r=n(t,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":r=n(t,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":r=n(t,/(chromium)\/([\d\.]+)/i);break;case"Firefox":r=n(t,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":r=n(t,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":r=n(t,/(safari)\/([\d\.]+)/i);break;case"Opera":r=n(t,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{const e=n(t,/(trident)\/([\d\.]+)/i);r=e?`${parseFloat(e)+4}`:"7.0";break}default:r="0.0.0.0"}return{name:e,version:r}},parseAsNumericalArray:f});DeepMerger.merge(J)}();
7
- //# sourceMappingURL=pacem-foundation.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(e,t){"use strict";var r=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};class PacemFxElement extends t.PacemEventTarget{}r([t.Watch({converter:t.PropertyConverters.Element})],PacemFxElement.prototype,"target",void 0);var i=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};const s="ripple";let n=class PacemFxRippleElement extends PacemFxElement{constructor(){super(...arguments),this._lock=!1,this._remove=!1,this._rippleHandler=r=>{if(this.disabled||this.target instanceof t.PacemEventTarget&&this.target.disabled)return;if(r instanceof MouseEvent&&0!==r.button)return;const i=t.Utils.offset(this.target),s=getComputedStyle(this.target),n=this.style;n.top=i.top+"px",n.left=i.left+"px",n.width=i.width+"px",n.height=i.height+"px",n.borderRadius=s.borderRadius;const a="touchstart"===r.type?r.touches[0]:r,o={x:a.pageX,y:a.pageY},l={x:i.left,y:i.top},c={x:i.left+i.width,y:i.top},h={x:i.left,y:i.top+i.height},d={x:c.x,y:h.y},p=Math.max(e.Point.distance(o,l),e.Point.distance(o,c),e.Point.distance(o,d),e.Point.distance(o,h)),u=this._wave;u.style.left=o.x-i.left-p+"px",u.style.top=o.y-i.top-p+"px",u.style.width=u.style.height=2*p+"px",t.Utils.addAnimationEndCallback(u,()=>{this._lock=!1,this._tryRemove()}),this._lock=!0,t.Utils.addClass(u,"ripple-go")},this._unrippleHandler=e=>{this._remove=!0,this._tryRemove()}}propertyChangedCallback(e,r,i,s){super.propertyChangedCallback(e,r,i,s),"target"===e&&(t.Utils.isNull(r)||this._reset(r),t.Utils.isNull(i)||this._set(i))}viewActivatedCallback(){super.viewActivatedCallback(),t.Utils.isNull(this.target)||this._set()}disconnectedCallback(){t.Utils.isNull(this.target)||this._reset(),super.disconnectedCallback()}_tryRemove(){!this._lock&&this._remove&&(this._remove=!1,t.Utils.removeClass(this._wave,"ripple-go"))}_set(e=this.target){e.addEventListener("mousedown",this._rippleHandler,!1),e.addEventListener("touchstart",this._rippleHandler,!1),e.addEventListener("touchend",this._unrippleHandler,!1),e.addEventListener("mouseup",this._unrippleHandler,!1),e.addEventListener("mousemove",this._unrippleHandler,!1)}_reset(e=this.target){e.removeEventListener("mousedown",this._rippleHandler,!1),e.removeEventListener("touchstart",this._rippleHandler,!1),e.removeEventListener("touchend",this._unrippleHandler,!1),e.removeEventListener("mouseup",this._unrippleHandler,!1),e.removeEventListener("mousemove",this._unrippleHandler,!1)}};i([t.ViewChild("."+s)],n.prototype,"_wave",void 0),n=i([t.CustomElement({tagName:t.P+"-fx-ripple",shadow:t.Defaults.USE_SHADOW_ROOT,template:`<div class="${s}"></div>`})],n);var a=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};function o(e){return`${t.PCSS}-fx-pulse-${e}`}let l=class PacemFxPulseElement extends PacemFxElement{constructor(){super(),this._resizeHandler=e=>{this._pulse(e.detail)},this.#e=t.Utils.uniqueCode()}#e;viewActivatedCallback(){super.viewActivatedCallback(),this._pulse()}disconnectedCallback(){t.Utils.isNull(this._sheet)||(this._sheet.remove(),this._sheet=null),super.disconnectedCallback()}propertyChangedCallback(e,t,r,i){super.propertyChangedCallback(e,t,r,i),"disabled"!==e||i||this._pulse()}_pulse(e=this._resize.currentSize){const r=t.Utils.isNull(this.target)||t.Utils.isNull(e)||!(e.height>0)||!(e.width>0);if(this._resize.disabled=this.disabled,this.disabled||r)return void t.Utils.addClass(this,"pulse-off");t.Utils.removeClass(this,"pulse-off");const i=e,s=getComputedStyle(this.target),n=this.style,a=Math.max(i.width,i.height);n.width=a+"px",n.height=a+"px",n.top=i.top+.5*(i.height-a)+"px",n.left=i.left+.5*(i.width-a)+"px";const l=this._rect1,c=this._rect2,h=l.style,d=c.style;this._sheet=function(e,r,i="0",s=i){const n="style#"+e,a=document.querySelector(n);if(t.Utils.isNull(a)){const t=document.createElement("style");t.id=e,document.head.appendChild(t)}const l=document.querySelector(n),c=r.width,h=r.height,d=Math.max(c,h),p=.5*(d-c),u=.5*(d-h);l.sheet.insertRule(`@keyframes ${o(e)} {\n 0%{\n opacity: .25; stroke-thickness: 0; rx: ${i}; ry: ${s}; x: ${p}px; y: ${u}px; width: ${r.width}px; height: ${r.height}px;\n }\n 50%{\n width: ${r.width}px; height: ${r.height}px; transform: scale(1); stroke-width: 10px; rx: ${i}; ry: ${s}; opacity: .333; x: ${p}px; y: ${u}px; width: ${c}px; height: ${h}px;\n }\n 80%{\n stroke-width: 10px;\n }\n 100%{\n opacity: 0; rx: 50%; ry: 50%; transform: scale(2); stroke-width: 0; width: ${d}px; height: ${d}px; x: 0; y: 0\n }\n}`,0);for(let e=l.sheet.rules.length-1;e>0;e--)l.sheet.deleteRule(e);return l}(this.#e,e,s.borderTopLeftRadius);const p=o(this.#e);h.animation=d.animation=`${p} both cubic-bezier(0.37, 0, 0.63, 1) 1.25s infinite`,d.animationDelay=".175s"}};a([t.ViewChild(t.P+"-resize")],l.prototype,"_resize",void 0),a([t.ViewChild("svg")],l.prototype,"_svg",void 0),a([t.ViewChild("svg > rect[rect1]")],l.prototype,"_rect1",void 0),a([t.ViewChild("svg > rect[rect2]")],l.prototype,"_rect2",void 0),l=a([t.CustomElement({tagName:t.P+"-fx-pulse",shadow:t.Defaults.USE_SHADOW_ROOT,template:`<${t.P}-resize target="{{ :host.target }}" watch-position="true" on-${t.Components.ResizeEventName}=":host._resizeHandler($event)"></${t.P}-resize>\n<svg class="pulse" xmlns="http://www.w3.org/2000/svg">\n <rect rect1 /><rect rect2 />\n</svg>`})],l);var c=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};const h=t.PCSS+"-hero",d={convert:e=>e.trim().startsWith("#")?t.PropertyConverters.Element.convert(e):t.PropertyConverters.Json.convert(e)};let p=class PacemFxHeroElement extends PacemFxElement{propertyChangedCallback(e,r,i,s){super.propertyChangedCallback(e,r,i,s),"target"!==e||t.Utils.isNull(r)||this._resetTarget(r),"from"===e&&this.hero&&!t.Utils.isNull(i)&&(this._originalState=this._computeFromState()),"hero"!==e&&"target"!==e&&"goal"!==e||t.Utils.isNull(this.target)||(this.hero?this.start():this.reset())}viewActivatedCallback(){super.viewActivatedCallback(),this.hero&&!t.Utils.isNull(this.target)&&this.start()}disconnectedCallback(){t.Utils.isNull(this.target)||this.reset(),super.disconnectedCallback()}_computeFromState(){const e=this.target,r=t.Utils.offset(e);if(this.from instanceof Element){let e=t.Utils.offset(this.from);return{x:e.left,y:e.top,width:e.width,height:e.height}}return{x:r.left,y:r.top,width:r.width,height:r.height}}_resetTarget(e=this.target){const r=e.style;r.top=r.left=r.height=r.width="";for(let e=0;e<r.length;e++){let t=r.item(e);r[t]=""}for(let e in this._originalStyle)r[e]=this._originalStyle[e];t.Utils.removeClass(e,h)}reset(){if(!t.Utils.isNull(this._originalState)&&!t.Utils.isNull(this._targetState))return this.dispatchEvent(new Event("exiting")),this._animate(this._targetState,this._originalState).then(()=>{this._resetTarget(),this.dispatchEvent(new Event("exited"))})}start(){if(!this.disabled&&!t.Utils.isNull(this.target)){let e;if(this.to instanceof Element){let r=t.Utils.offset(this.to);e={x:r.left,y:r.top,width:r.width,height:r.height}}else e=this.to;const r=this.target,i=t.Utils.windowSize,s=e||{x:0,y:0,width:i.width,height:i.height},n=r.style;this._targetState=s;let a=this._originalState=this._computeFromState();this._originalStyle={};for(let e=0;e<n.length;e++){let t=n.item(e);this._originalStyle[t]=n[t]}return t.Utils.addClass(r,h),this.dispatchEvent(new Event("entering")),this._animate(a,s).then(()=>{this.dispatchEvent(new Event("entered"))})}return Promise.resolve()}_animate(e,r){const i=this.target,s=i.style,n=e.width/r.width,a=e.height/r.height,o=e.x-r.x+"px",l=e.y-r.y+"px";return s.transformOrigin="0 0",s.transition="none",s.transform=`translate(${o}, ${l}) scale(${n}, ${a})`,s.width=r.width+"px",s.height=r.height+"px",s.top=r.y+"px",s.left=r.x+"px",requestAnimationFrame(()=>{let e=this.duration||200;s.transition=`transform cubic-bezier(0.445, 0.05, 0.55, 0.95) ${e}ms, opacity ${e}ms`,s.transform="translate(0, 0) scale(1)"}),t.Utils.waitForAnimationEnd(i,210)}};c([t.Watch({converter:t.PropertyConverters.Boolean})],p.prototype,"hero",void 0),c([t.Watch({converter:d,emit:!1})],p.prototype,"to",void 0),c([t.Watch({converter:d,emit:!1})],p.prototype,"from",void 0),c([t.Watch({converter:t.PropertyConverters.Number,emit:!1})],p.prototype,"duration",void 0),p=c([t.CustomElement({tagName:t.P+"-fx-hero"})],p);var u=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};const m=t.PCSS+"-fx-list";let g=class PacemFxListElement extends PacemFxElement{constructor(){super(...arguments),this._observed=e=>{const t=Array.from(this.target.children);for(let r of e)r.removedNodes.forEach(e=>{e instanceof Element&&this.dispatchEvent(new CustomEvent("itemremoved",{detail:e}))}),r.addedNodes.forEach((e,r)=>{e instanceof Element&&this.dispatchEvent(new CustomEvent("itemadded",{detail:{item:e,index:t.indexOf(e)}}))})}}viewActivatedCallback(){super.viewActivatedCallback(),t.Utils.isNull(this.target)||this._setup()}disconnectedCallback(){t.Utils.isNull(this._observer)||this._observer.disconnect(),super.disconnectedCallback()}propertyChangedCallback(e,t,r,i){super.propertyChangedCallback(e,t,r,i),"target"===e&&(t?this._reset(t):this._setup())}_reset(e){t.Utils.removeClass(e,m),this._observer.disconnect()}_setup(){const e=this.target;t.Utils.addClass(e,m);(this._observer=new MutationObserver(this._observed)).observe(e,{childList:!0})}};g=u([t.CustomElement({tagName:t.P+"-fx-list"})],g);var f=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};const v="gradientchange";class GradientChangeEvent extends Event{constructor(){super(v,{cancelable:!1,bubbles:!1})}}const y={convert:(r,i)=>{try{return e.Size.parse(r)}catch{return t.PropertyConverters.Number.convert(r,i)}}};function C(e){return Math.round(1e3*e)/10+"%"}let _=class PacemFxGradientStopElement extends t.Components.PacemItemElement{findContainer(){return t.CustomElementUtils.findAncestor(this,e=>e instanceof PacemFxGradientItemElement)}propertyChangedCallback(e,t,r,i){super.propertyChangedCallback(e,t,r,i),i||"offset"!==e&&"color"!==e&&"opacity"!==e&&"disabled"!==e&&"hide"!==e||this.dispatchEvent(new GradientChangeEvent)}};f([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],_.prototype,"offset",void 0),f([t.Watch({emit:!1,converter:t.PropertyConverters.String})],_.prototype,"color",void 0),f([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],_.prototype,"opacity",void 0),_=f([t.CustomElement({tagName:t.P+"-fx-gradient-stop"})],_);class PacemFxGradientItemElement extends t.Components.PacemCrossItemsContainerElement{constructor(){super(...arguments),this._dispatchGradientChangeHandler=e=>{this._dispatchGradientChange()}}validate(e){return e instanceof _}register(e){const t=super.register(e);return t&&e.addEventListener(v,this._dispatchGradientChangeHandler,!1),t}unregister(e){const t=super.unregister(e);return t&&e.removeEventListener(v,this._dispatchGradientChangeHandler,!1),t}propertyChangedCallback(e,t,r,i){super.propertyChangedCallback(e,t,r,i),!i&&this.doesPropertyTriggerGradientChange(e)&&this._dispatchGradientChange()}_dispatchGradientChange(){this.dispatchEvent(new GradientChangeEvent)}buildColor(r,i){if(i>=0&&i<=1){const s=e.Colors.parse(r);return e.Colors.stringify(t.Utils.extend(s,{a:i}))}return r}}let x=class PacemFxRadialGradientElement extends PacemFxGradientItemElement{doesPropertyTriggerGradientChange(e){return["shape","size","center","items","hide","disabled"].indexOf(e)>=0}buildGradient(){const e=this.items;if(t.Utils.isNullOrEmpty(e))return"";const r="circle"===this.shape?"circle":"ellipse",i=this.center??{x:.5,y:.5},s=this.size;let n="";t.Utils.isNullOrEmpty(s)||(n="number"==typeof s?`${s}px`:`${C(s.width/2)} ${C(s.height/2)}`);let a=[];for(let{offset:t,color:r,hide:i,disabled:s,opacity:n}of e){if(i||s)continue;const e=this.buildColor(r,n);a.push(`${e} ${C(t)}`)}return`radial-gradient(${r} ${n} at ${C(i.x)} ${C(i.y)} in oklab, ${a.join(", ")})`}};f([t.Watch({emit:!1,converter:t.PropertyConverters.String})],x.prototype,"shape",void 0),f([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],x.prototype,"center",void 0),f([t.Watch({emit:!1,converter:y})],x.prototype,"size",void 0),x=f([t.CustomElement({tagName:t.P+"-fx-gradient-radial"})],x);let b=class PacemFxLinearGradientElement extends PacemFxGradientItemElement{doesPropertyTriggerGradientChange(e){return["angle","items","hide","disabled"].indexOf(e)>=0}buildGradient(){const e=this.items;if(t.Utils.isNullOrEmpty(e))return"";const r=this.angle??0;let i=[];for(let{offset:t,color:r,hide:s,disabled:n,opacity:a}of e){if(s||n)continue;const e=this.buildColor(r,a);i.push(`${e} ${C(t)}`)}return`linear-gradient(${r}deg in oklab, ${i.join(", ")})`}};f([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"angle",void 0),b=f([t.CustomElement({tagName:t.P+"-fx-gradient-linear"})],b);let E=class PacemFxGradientElement extends t.Components.PacemItemsContainerElement{constructor(){super(...arguments),this._gradientChangeHandler=e=>{this._buildGradient()}}validate(e){return e instanceof PacemFxGradientItemElement}register(e){const t=super.register(e);return t&&e.addEventListener(v,this._gradientChangeHandler,!1),t}unregister(e){const t=super.unregister(e);return t&&e.removeEventListener(v,this._gradientChangeHandler,!1),t}viewActivatedCallback(){super.viewActivatedCallback(),this._buildGradient()}propertyChangedCallback(e,t,r,i){if(super.propertyChangedCallback(e,t,r,i),!i)switch(e){case"target":t&&this._removeGradient(t);case"mode":case"disabled":this._buildGradient()}}_removeGradient(e){t.Utils.removeClass(e,t.PCSS+"-fx-gradient-text"),t.Utils.removeClass(e,t.PCSS+"-fx-gradient-fill"),e.style.backgroundImage=""}_buildGradient(){const e=this.target;if(t.Utils.isNull(e))return;let r="";const i=this.disabled?[]:this.items??[];for(let e of i){if(e.hide||e.disabled)continue;const i=e.buildGradient();t.Utils.isNullOrEmpty(i)||(r+=i,r.trim().endsWith(",")||(r+=","))}if(t.Utils.isNullOrEmpty(r))this._removeGradient(e);else{const i=t.PCSS+"-fx-gradient-text",s=t.PCSS+"-fx-gradient-fill",n="text"===this.mode;t.Utils.removeClass(e,n?s:i),t.Utils.addClass(e,n?i:s),e.style.backgroundImage=r.substring(0,r.length-1)}}};f([t.Watch({converter:t.PropertyConverters.Element})],E.prototype,"target",void 0),f([t.Watch({converter:t.PropertyConverters.String})],E.prototype,"mode",void 0),f([t.Debounce(!0)],E.prototype,"_buildGradient",null),E=f([t.CustomElement({tagName:t.P+"-fx-gradient"})],E);var P=function(e,t,r,i){var s,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,r,a):s(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};const w=t.PCSS+"-fancy",N=t.PCSS+"-fancify";let k=class PacemFxFancyElement extends PacemFxElement{constructor(){super(...arguments),this._progress=0,this._started=!1}get progress(){return this._progress}get started(){return this._started}propertyChangedCallback(e,r,i,s){super.propertyChangedCallback(e,r,i,s),"fancify"!==e&&"target"!==e||t.Utils.isNull(this.target)||(this.fancify?this.start():this._reset())}viewActivatedCallback(){super.viewActivatedCallback(),this.fancify&&!t.Utils.isNull(this.target)&&this.start()}disconnectedCallback(){cancelAnimationFrame(this._handle),clearTimeout(this._handle1),t.Utils.isNull(this.target)||this._reset(),super.disconnectedCallback()}_reset(){t.Utils.removeClass(this.target,w),this._started&&this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"started",oldValue:this._started,currentValue:this._started=!1})),this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"progress",oldValue:this._progress,currentValue:this._progress=0})),t.Utils.isNull(this._originalContent)?this._originalContent=this.target.innerHTML:this.target.innerHTML=this._originalContent}_parse(){let e,t=[],r=document.createTreeWalker(this.target,NodeFilter.SHOW_TEXT);for(;e=r.nextNode();)e.textContent&&t.push(e);this._textNodes=t}start(){this.disabled||(this._reset(),this._parse(),this._startShow(),this._handle1=setTimeout(()=>{this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"started",oldValue:this._started,currentValue:this._started=!0}))},this.delay||0))}_startShow(e=0){t.Utils.addClass(this.target,w);const r=this._textNodes,i=r.length;this._fancify(r[e]);const s=this._progress;e++;const n=this._progress=e/i;this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"progress",oldValue:s,currentValue:n})),e<i&&(this._handle=requestAnimationFrame(()=>{this._startShow(e)}))}_fancify(e){const r=e.textContent;if(t.Utils.isNullOrEmpty(r)||!/[^\s]/.test(r))return;const i=/^\s/.test(r),s=/\s$/.test(r);e.textContent="";const n=r.trim().split(" "),a=this.gap||20,o=this.delay||0;let l=0;for(let t of n){var c=document.createElement("span");c.className=N,c.style.animationDelay=`${o+l*a}ms`,(i||l>0)&&e.parentElement.insertBefore(document.createTextNode(" "),e),c.textContent=t,e.parentElement.insertBefore(c,e),l++}s&&e.parentElement.insertBefore(document.createTextNode(" "),e)}};P([t.Watch({converter:t.PropertyConverters.Boolean})],k.prototype,"fancify",void 0),P([t.Watch({converter:t.PropertyConverters.Number})],k.prototype,"delay",void 0),P([t.Watch({converter:t.PropertyConverters.Number})],k.prototype,"gap",void 0),k=P([t.CustomElement({tagName:t.P+"-fx-fancy"})],k);var U=Object.freeze({__proto__:null,PacemFxElement:PacemFxElement,get PacemFxFancyElement(){return k},get PacemFxGradientElement(){return E},PacemFxGradientItemElement:PacemFxGradientItemElement,get PacemFxGradientStopElement(){return _},get PacemFxHeroElement(){return p},get PacemFxLinearGradientElement(){return b},get PacemFxListElement(){return g},get PacemFxPulseElement(){return l},get PacemFxRadialGradientElement(){return x},get PacemFxRippleElement(){return n}}),S=Object.freeze({__proto__:null,Fx:U}),$=Object.freeze({__proto__:null,Components:S});e.DeepMerger.merge($)}(Pacem,Pacem);
7
- //# sourceMappingURL=pacem-fx.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(e,t){"use strict";var r=function(e,t,r,o){var n,a=arguments.length,c=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(c=(a<3?n(c):a>3?n(t,r,c):n(t,r))||c);return a>3&&c&&Object.defineProperty(t,r,c),c};const o={current:0,count:0,average:0,max:Number.MIN_VALUE,min:Number.MAX_VALUE};class PacemTrackerElement extends t.PacemEventTarget{constructor(){super(),this.data=o}propertyChangedCallback(e,t,r,o){super.propertyChangedCallback(e,t,r,o),"entry"===e&&this._update(r).then(e=>this.data=e)}_update(e){return t.Utils.fromResultAsync(()=>{const t=this.data,r=Math.min(e,t.min),o=Math.max(e,t.max),n=t.count+1;return{count:n,min:r,max:o,average:(t.count*t.average+e)/n,current:e}})}reset(){this.data=o}}r([t.Watch({converter:t.PropertyConverters.Json})],PacemTrackerElement.prototype,"data",void 0),r([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemTrackerElement.prototype,"entry",void 0),r([t.Concurrent()],PacemTrackerElement.prototype,"_update",null);var n=function(e,t,r,o){var n,a=arguments.length,c=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(c=(a<3?n(c):a>3?n(t,r,c):n(t,r))||c);return a>3&&c&&Object.defineProperty(t,r,c),c};const a={error:!0,info:!0,warn:!0};let c=class PacemConsoleElement extends t.PacemEventTarget{constructor(){super(...arguments),this._config=a}propertyChangedCallback(e,r,o,n){super.propertyChangedCallback(e,r,o,n),"configuration"===e&&(this._config=t.Utils.extend({},a,o??{}))}log(e,t,r){try{this._log(e,t,r)}catch(e){}}_log(e,r,o){if(!this.disabled&&!0===this._config[e]){o!==this._category&&(t.Utils.isNullOrEmpty(this._category)||console.groupEnd(),t.Utils.isNullOrEmpty(o)||console.group(o),this._category=o);var n=e=>{};switch(e){case t.Logging.LogLevel.Debug:n=console.debug;break;case t.Logging.LogLevel.Error:n=console.error;break;case t.Logging.LogLevel.Info:n=console.info;break;case t.Logging.LogLevel.Trace:n=console.trace;break;case t.Logging.LogLevel.Warn:n=console.warn;break;case t.Logging.LogLevel.Log:n=console.log}n((new Date).toISOString()+": "+r)}}};n([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],c.prototype,"configuration",void 0),c=n([t.CustomElement({tagName:t.P+"-console"})],c);var l=function(e,t,r,o){var n,a=arguments.length,c=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(c=(a<3?n(c):a>3?n(t,r,c):n(t,r))||c);return a>3&&c&&Object.defineProperty(t,r,c),c};let s=class PacemFpsElement extends PacemTrackerElement{constructor(){super()}_start(e=Date.now()){this._handle=requestAnimationFrame(()=>{const t=Date.now(),r=t-e;this.entry=Math.min(60,1e3/r),this._start(t)})}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){cancelAnimationFrame(this._handle),super.disconnectedCallback()}};s=l([t.CustomElement({tagName:t.P+"-fps"})],s);var i=Object.freeze({__proto__:null,get PacemConsoleElement(){return c},get PacemFpsElement(){return s},PacemTrackerElement:PacemTrackerElement}),g=Object.freeze({__proto__:null,Logging:i}),u=Object.freeze({__proto__:null,Components:g});e.DeepMerger.merge(u)}(Pacem,Pacem);
7
- //# sourceMappingURL=pacem-logging.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(e,t){"use strict";var s=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};const o={lat:Number.NaN,lng:Number.NaN};class LatLng{static get Empty(){return o}static isEmpty(e){return e===o||isNaN(e.lat)&&isNaN(e.lng)}static isLatLng(e){return"lat"in e&&"number"==typeof e.lat&&"lng"in e&&"number"==typeof e.lng}static translate(e,t){return{lat:e.lat+t.lat,lng:e.lng+t.lng}}static equals(e,t){return e===t||e.lat===t.lat&&e.lng===t.lng}}const r={ne:LatLng.Empty,sw:LatLng.Empty};class LatLngBounds{static get Empty(){return r}static isEmpty(e){return e===r||LatLng.isEmpty(e.ne)&&LatLng.isEmpty(e.sw)}static isPoint(e){return!this.isEmpty(e)&&(e.ne===e.sw||e.ne.lat===e.sw.lat&&e.ne.lng===e.sw.lng)}static isLatLngBounds(e){return"object"==typeof e&&"ne"in e&&LatLng.isLatLng(e.ne)&&"sw"in e&&LatLng.isLatLng(e.sw)}static union(e,t){if(LatLngBounds.isEmpty(e))return LatLngBounds.isLatLngBounds(t)?t:{ne:t,sw:t};if(LatLngBounds.isLatLngBounds(t)){if(LatLngBounds.isEmpty(t))return e;return{ne:{lat:Math.max(e.ne.lat,t.ne.lat),lng:Math.max(e.ne.lng,t.ne.lng)},sw:{lat:Math.min(e.sw.lat,t.sw.lat),lng:Math.min(e.sw.lng,t.sw.lng)}}}if(LatLng.isLatLng(t)){if(LatLng.isEmpty(t))return e;return{ne:{lat:Math.max(e.ne.lat,t.lat),lng:Math.max(e.ne.lng,t.lng)},sw:{lat:Math.min(e.sw.lat,t.lat),lng:Math.min(e.sw.lng,t.lng)}}}return e}static equals(e,t){return e===t||LatLng.equals(e.ne,t.ne)&&LatLng.equals(e.sw,t.sw)}}const a={SIZE:256,RAD:Math.PI/180,DEG:180/Math.PI,SIN_LIMIT:1-1e-15,EARTH_RADIUS:6378137},n="maps";class MapProjection{constructor(e,t,s=a.SIZE){this._pixelSize=e,this._bounds=t,this._normalizedSize=s;const o=s/2;this.#e={x:o,y:o},this.#t=s/360,this.#s=o/Math.PI,this.#o=this._latLngToWorldNormalizedPoint(t.sw),this.#r=this._latLngToWorldNormalizedPoint(t.ne)}#e;#o;#r;#t;#s;_latLngToWorldNormalizedPoint(e){const t=this.#e.x+e.lng*this.#s,s=e.lat*a.RAD,o=a.SIN_LIMIT,r=Math.sin(s).clamp(-o,o);return{x:t,y:this.#e.y+.5*Math.log((1+r)/(1-r))*-this.#t}}_worldNormalizedPointToLatLng(e){return{lat:a.DEG*(2*Math.atan(Math.exp((e.y-this.#e.y)/-this.#t))-Math.PI/2),lng:(e.x-this.#e.x)/this.#s}}_latLngToPoint(e){const t=this.#r,s=this.#o,o=-t.y+s.y,r=t.x-s.x,a=this._latLngToWorldNormalizedPoint(e),{width:n,height:i}=this._pixelSize;return{x:(a.x-s.x)*(n/r),y:(a.y-t.y)*(i/o)}}_pointToLatLng(e){const t=this.#r,s=this.#o,o=-t.y+s.y,r=t.x-s.x,{width:a,height:n}=this._pixelSize,i=e.x/(a/r)+this.#o.x,l=e.y/(n/o)+this.#r.y;return this._worldNormalizedPointToLatLng({x:i,y:l})}static _haversine(e,t){const s=a.RAD,o=e.lng*s,r=t.lng*s,n=e.lat*s,i=t.lat*s;return 2*Math.asin(Math.sqrt(Math.pow(Math.sin((n-i)/2),2)+Math.cos(n)*Math.cos(i)*Math.pow(Math.sin((o-r)/2),2)))}static _offsetByMeters(e,t,s,o){const{RAD:r,DEG:n}=a,i=e.lat*r;return{lat:(i+t/o)*n,lng:(e.lng*r+s/(o*Math.cos(i)))*n}}static offsetBy(e,t,s,o=a.EARTH_RADIUS){return MapProjection._offsetByMeters(e,t,s,o)}static distanceBetween(e,t,s=a.EARTH_RADIUS){return MapProjection._haversine(e,t)*s}static latLngToPoint(e,t,s){return new MapProjection(s,t)._latLngToPoint(e)}static pointToLatLng(e,t,s){return new MapProjection(t,s)._pointToLatLng(e)}}s([t.Transformer(n+".")],MapProjection,"offsetBy",null),s([t.Transformer(n+".")],MapProjection,"distanceBetween",null),s([t.Transformer(n+".")],MapProjection,"latLngToPoint",null),s([t.Transformer(n+".")],MapProjection,"pointToLatLng",null);var i,l,p=Object.freeze({__proto__:null,LatLng:LatLng,LatLngBounds:LatLngBounds,MapProjection:MapProjection}),d=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};!function(e){e.ROAD="road",e.SATELLITE="satellite",e.HYBRID="hybrid",e.TERRAIN="terrain",e.HIGH_CONTRAST="high_contrast"}(i||(i={})),function(e){e.LIGHT="light",e.DARK="dark",e.SYSTEM="system"}(l||(l={}));const c={MAP_SELECTOR:t.P+"-map",MARKER_SELECTOR:t.P+"-map-marker",POLYLINE_SELECTOR:t.P+"-map-polyline",CIRCLE_SELECTOR:t.P+"-map-circle",POLYGON_SELECTOR:t.P+"-map-polygon",LAYER_SELECTOR:t.P+"-map-layer",OVERLAY_IMAGE_SELECTOR:t.P+"-map-overlay-image",GEOCODER_SELECTOR:t.P+"-map-geocode",DEFAULT_COORDS:{lat:44.71418802507798,lng:10.296516444873811}},h={DEFAULT_COORDS:c.DEFAULT_COORDS};const m="defaultMapTarget",u={convert:e=>{const t=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(e);return t&&t.length>2?{lat:parseFloat(t[1]),lng:parseFloat(t[2])}:JSON.parse(e)},convertBack:e=>JSON.stringify(e)},g={convert:e=>{const t=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(e);return t&&t.length>4?{sw:{lat:parseFloat(t[3]),lng:parseFloat(t[4])},ne:{lat:parseFloat(t[1]),lng:parseFloat(t[2])}}:JSON.parse(e)},convertBack:e=>JSON.stringify(e)};class MapUtils{static parseCoords(e){if(e&&!isNaN(e.lat)&&!isNaN(e.lng))return[e.lat,e.lng];if(t.Utils.isArray(e)&&e.length>1)return[e[0],e[1]];if(/^\s*(\+|-)?[\d]+(.[\d]+)?\s*,\s*(\+|-)?[\d]+(.[\d]+)?\s*$/.test(e)){var s=e.split(",");return[parseFloat(s[0]),parseFloat(s[1])]}return[c.DEFAULT_COORDS.lat,c.DEFAULT_COORDS.lng]}static expandBounds(e,t){t&&(Array.isArray(t)||(t=[t.lat,t.lng]),e.push(t))}static isContentEmpty(e){return 0==e.children.length}}class MapRelevantElement extends t.PacemEventTarget{get map(){return this._map=this._map||t.CustomElementUtils.findAncestorOfType(this,b)}propertyChangedCallback(e,t,s,o){if(super.propertyChangedCallback(e,t,s,o),!o&&"hide"===e){const e=this.map;e?.adapter?.fitBounds(e,!0)}}viewActivatedCallback(){super.viewActivatedCallback(),this.map&&this.map.register(this)}disconnectedCallback(){this.map&&this.map.unregister(this),super.disconnectedCallback()}}d([t.Watch({converter:t.PropertyConverters.Boolean})],MapRelevantElement.prototype,"hide",void 0),d([t.Watch({converter:t.PropertyConverters.Boolean})],MapRelevantElement.prototype,"inactive",void 0);class MapEvent extends t.CustomTypedEvent{constructor(e,t){super(e,t)}}let y=class PacemMapGeocodeElement extends t.PacemEventTarget{constructor(){super(...arguments),this.debounce=1e3,this.#a=!1}#a;#n;#i;get fetching(){return this.#a}_guards(){const e=this.results;if(!t.Utils.isNullOrEmpty(e)){const s=e[0];if(!t.Utils.isNull(this.position)&&LatLng.equals(this.position,s.position)&&this.search===s.fullAddress)return Promise.resolve(e)}const s=this.adapter;return t.Utils.isNull(s)||s.disabled||!s.active?Promise.resolve([]):null}propertyChangedCallback(e,s,o,r){switch(super.propertyChangedCallback(e,s,o,r),e){case"search":this.geocode(o);break;case"position":this.reverseGeocode(o);break;case"results":if(t.Utils.isNullOrEmpty(o))this.search="",this.position=null;else{const e=o[0];this.search=e.fullAddress,this.position=e.position}}}_broadcastFetchingUpdate(e){e!==this.#a&&(this.#a=e,this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"fetching",oldValue:!e,currentValue:e})))}_fetch(e){const{promise:s,search:o,position:r,key:a}=e,n=this.#i;!t.Utils.isNull(n)&&LatLng.equals(n.position,r)&&(n.search||"")===(o||"")||(this.#i={key:a,promise:s,position:r,search:o},this._broadcastFetchingUpdate(!0),s.then(e=>{a===this.#i.key&&(this._broadcastFetchingUpdate(!1),this._successCallback(e))},e=>this._errorCallback(e)))}_debounce(e,t=this.debounce){this.#n&&clearTimeout(this.#n),this.#n=window.setTimeout(()=>{e()},t||0)}reverseGeocode(e=this.position,s=this.maxResults){this.disabled||this._debounce(()=>{const o=this._guards()??this.adapter.reverseGeocode(e,s||1);this._fetch({promise:o,position:e,key:t.Utils.uniqueCode()})})}geocode(e=this.search,s=this.maxResults){this.disabled||this._debounce(()=>{const o=this._guards()??this.adapter.geocode(e,s||10);this._fetch({promise:o,search:e,position:LatLng.Empty,key:t.Utils.uniqueCode()})})}_successCallback(e){const s=!t.Utils.isNullOrEmpty(e);!s&&t.Utils.isNullOrEmpty(this.results)||e!==this.results&&(this.results=e,s&&this.dispatchEvent(new CustomEvent("success",{detail:e,bubbles:!1,cancelable:!1})))}_errorCallback(e){t.Utils.isNullOrEmpty(this.results)||(this.results=[]),this.dispatchEvent(new CustomEvent("error",{detail:e,bubbles:!1,cancelable:!1}))}};d([t.Watch({emit:!1,converter:t.PropertyConverters.Element})],y.prototype,"adapter",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],y.prototype,"maxResults",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],y.prototype,"debounce",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],y.prototype,"results",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.String})],y.prototype,"search",void 0),d([t.Watch({emit:!0,converter:u})],y.prototype,"position",void 0),y=d([t.CustomElement({tagName:c.GEOCODER_SELECTOR})],y);class PacemMapAdapterElement extends t.PacemEventTarget{constructor(){super(...arguments),this.active=!0,this.#l=new Map,this.#p=new WeakMap,this.#d=new WeakMap,this.#c=new WeakMap,this.#h=new WeakMap}propertyChangedCallback(e,t,s,o){super.propertyChangedCallback(e,t,s,o),o||(this.active=!this.disabled&&this.isActive())}#l;#p;#d;#c;#h;get layerAdapters(){return this.#c}get overlayAdapters(){return this.#h}get markerAdapters(){return this.#p}get shapeAdapters(){return this.#d}hasMap(e){return this.#l.has(e)}enrolledMaps(){return this.#l.keys()}tryGetMap(e){const t=this.#l;return t.has(e)?t.get(e):null}getMap(e){const t=this.tryGetMap(e);return t?.map}async initialize(e){const t=this.#l;if(!t.has(e)){const s=await this.init(e);t.set(e,s);const o=this.#c;o.has(e)||o.set(e,this.buildLayerAdapterFor(e));const r=this.#h;r.has(e)||r.set(e,this.buildOverlayAdapterFor(e));const a=this.#p;a.has(e)||a.set(e,this.buildMarkerAdapterFor(e));const n=this.#d;return n.has(e)||n.set(e,this.buildShapeAdapterFor(e)),s.container}return t.get(e).container}destroy(e){const t=this.#c;t.has(e)&&t.delete(e);const s=this.#h;s.has(e)&&s.delete(e);const o=this.#p;o.has(e)&&o.delete(e);const r=this.#d;r.has(e)&&r.delete(e);const a=this.#l;a.has(e)&&(this.dispose(e),a.delete(e))}removeItem(e){const t=e.map;if(e instanceof f){const s=this.layerAdapters;if(s.has(t)){s.get(t).removeLayer(e)}}else if(e instanceof E){const s=this.markerAdapters;if(s.has(t)){s.get(t).removeMarker(e)}}else if(e instanceof PacemMapShapeElement){const s=this.shapeAdapters;if(s.has(t)){s.get(t).removeShape(e)}}else if(e instanceof PacemMapOverlayElement){const s=this.overlayAdapters;if(s.has(t)){s.get(t).removeOverlay(e)}}e.inactive||this.fitBounds(t,!0)}drawItem(e){const t=e.map;if(e instanceof f){const s=this.layerAdapters;if(s.has(t)){s.get(t).drawLayer(e)}}else if(e instanceof E){const s=this.markerAdapters;if(s.has(t)){s.get(t).drawMarker(e)}}else if(e instanceof PacemMapShapeElement){const s=this.shapeAdapters;if(s.has(t)){s.get(t).drawShape(e)}}else if(e instanceof PacemMapOverlayElement){const s=this.overlayAdapters;if(s.has(t)){s.get(t).drawOverlay(e)}}e.inactive||this.fitBounds(t,!0)}popupInfoWindow(e){const t=e.map;if(e instanceof E){const s=this.markerAdapters;s.has(t)&&s.get(t).openInfoWindow(e)}}popoutInfoWindow(e){const t=e.map;if(e instanceof E){const s=this.markerAdapters;s.has(t)&&s.get(t).closeInfoWindow(e)}}setView(e,s,o){if(!this.hasMap(e))return;let r={};r="number"==typeof s?t.Utils.extend({},{zoom:s}):LatLng.isLatLng(s)?t.Utils.extend({},{center:s,zoom:o}):s,this.setViewNative(e,r)}fitBounds(e,s){if(t.Utils.isNull(e))for(let e of this.enrolledMaps()||[])this._fitBounds(e,s);else this._fitBounds(e,s)}_fitBounds(e,s){if(!this.hasMap(e))return;if(!e.autofit&&!0===s)return;if(LatLngBounds.isLatLngBounds(s)&&!LatLngBounds.isEmpty(s))return void this.fitBoundsNative(e,s);const o=this.markerAdapters.get(e)?.getBounds(),r=this.shapeAdapters.get(e)?.getBounds(),a=t.Utils.isNull(o)||LatLngBounds.isEmpty(o),n=t.Utils.isNull(r)||LatLngBounds.isEmpty(r);if(a&&n)return void this.setView(e,{center:e.center,zoom:e.zoom});let i=LatLngBounds.Empty;a||(i=LatLngBounds.union(i,o)),n||(i=LatLngBounds.union(i,r)),LatLngBounds.isPoint(i)?this.setView(e,{zoom:e.zoom,center:i.ne}):this.fitBoundsNative(e,i)}updateMapElement(e,s,o){["type","tilt","heading"].forEach(t=>{t in s&&(e[t]=s[t])});const r="zoom"in s?s.zoom:o;t.Utils.isNullOrEmpty(r)||r===e.zoom||(e.zoom=r);const a=LatLng.isLatLng(s)?s:s.center;t.Utils.isNullOrEmpty(a)||a.lat==e.center?.lat&&a.lng==e.center?.lng||(e.center=a),e.updateBounds(this.getBounds(e))}}d([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],PacemMapAdapterElement.prototype,"active",void 0),d([t.Debounce(1e3,(e,t)=>`pacem:debounce:${e}:${t.id}`)],PacemMapAdapterElement.prototype,"_fitBounds",null);class MapItemAdapter{constructor(e,t=e.adapter){this._map=e,this._adapter=t}get adapter(){return this._adapter}get map(){return this._map}getMap(e){return this._adapter.getMap(e.map)}}class PacemOverlayAdapter extends MapItemAdapter{constructor(e,t=e.adapter){super(e,t)}#h=new Map;get layers(){return this.#h}onOverlayLoad(e,t){e.dispatchEvent(new Event("overlayload"))}ensureOverlay(e,s){const o=this.#h;let r;return o.has(e)?r=o.get(e):(r=this.buildOverlay(e,s),t.Utils.isNull(r)||o.set(e,r)),r}removeOverlay(e){const t=this,s=t.getMap(e),o=this.#h;if(o.has(e)){const r=o.get(e);t.deleteOverlay(r,s),o.delete(e)}}drawOverlay(e){const s=this,o=s.getMap(e);if(t.Utils.isNull(o))return;if(t.Utils.isNullOrEmpty(e)||e.hide)return void s.removeOverlay(e);const r=this.ensureOverlay(e,o);this.setBounds(r,o,e.bounds),this.updateOverlay(r,o,e)}}class PacemMapOverlayElement extends MapRelevantElement{}d([t.Watch({emit:!1,converter:g})],PacemMapOverlayElement.prototype,"bounds",void 0);let v=class PacemMapOverlayImageElement extends PacemMapOverlayElement{};d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],v.prototype,"src",void 0),v=d([t.CustomElement({tagName:c.OVERLAY_IMAGE_SELECTOR})],v);class PacemLayerAdapter extends MapItemAdapter{constructor(e,t=e.adapter){super(e,t)}#c=new Map;#m=new Map;get layers(){return this.#c}onTileLoad(e,t){e.dispatchEvent(new Event("tileload"))}ensureLayer(e,t){const s=this,o=s.#c;let r;if(o.has(e))r=o.get(e);else if(r=this.buildLayer(e,t),null!=r){const a=t=>{s.onTileLoad(e,t)};this.#m.set(e,a),this.addLoadEventListener(r,t,a),o.set(e,r)}return r}removeLayer(e){const t=this,s=t.getMap(e),o=this.#c;if(o.has(e)){const r=o.get(e),a=this.#m;if(a.has(e)){const t=a.get(e);this.removeLoadEventListener(r,s,t),a.delete(e)}t.deleteLayer(r,s),o.delete(e)}}drawLayer(e){const s=this,o=s.getMap(e);t.Utils.isNull(o)||(t.Utils.isNullOrEmpty(e)||e.hide?s.removeLayer(e):this.ensureLayer(e,o))}}let f=class PacemMapLayerElement extends MapRelevantElement{};d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],f.prototype,"url",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],f.prototype,"include",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],f.prototype,"mode",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],f.prototype,"minZoom",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],f.prototype,"maxZoom",void 0),f=d([t.CustomElement({tagName:c.LAYER_SELECTOR})],f);class PacemMarkerAdapter extends MapItemAdapter{constructor(e,t=e.adapter){super(e,t)}get mapAutomaticallyScrollsOnDrag(){return!1}#p=new Map;#u=new Map;getBounds(e=e=>!0){const s=this.markers;let o=LatLngBounds.Empty;for(var r of s.keys()){if(!e(r)||r.inactive)continue;let a=s.get(r);t.Utils.isNull(a)||(o=LatLngBounds.union(o,this.getMarkerPosition(a)))}return o}get markers(){return this.#p}get infoWindows(){return this.#u}onDragEnd(e,t){const s=this.markers.get(e),o=this.getMarkerPosition(s);e.onDragEnd(o)}onClick(e,t){const s=this.markers.get(e),o=this.getMarkerPosition(s);e.onClick(o)}onInfoOpen(e){e.onInfoOpen()}onInfoClose(e){e.onInfoClose()}ensureMarker(e,t){const s=this;let o;return s.markers.has(e)?o=s.markers.get(e):(o=this.buildMarker(e,t),null!=o&&(this.addClickEventListener(o,t,t=>{s.onClick(e,t),s.openInfoWindow(e,t)}),this.addDragEventListener(o,t,t=>{this.mapAutomaticallyScrollsOnDrag||s.adapter.fitBounds(e.map,!0)}),this.addDragEndEventListener(o,t,t=>s.onDragEnd(e,t)),s.markers.set(e,o))),o}removeMarker(e){const t=this,s=t.getMap(e),o=this.#u,r=this.#p;if(o.has(e)&&o.delete(e),r.has(e)){const o=r.get(e);t.deleteMarker(o,s),r.delete(e)}}drawMarker(e){const s=this,o=s.getMap(e);if(t.Utils.isNull(o))return;if(t.Utils.isNullOrEmpty(e&&e.position)||e.hide)return void s.removeMarker(e);const r=this.ensureMarker(e,o);this.setPosition(r,e.position),this.setIcon(r,e.icon),this.setLabel(r,e.caption),this.setDraggable(r,e.draggable)}closeInfoWindow(e,t){const s=this;if(s.infoWindows.has(e)){const t=s.infoWindows.get(e);this.closeInfo(t)}}ensureInfoWindow(e,t){var s=this;let o;return s.infoWindows.has(e)?o=s.infoWindows.get(e):(o=this.buildInfoWindow(e),this.addCloseClickEventListener(o,t,r=>{s.deleteInfoWindow(o,t),s.onInfoClose(e)}),s.infoWindows.set(e,o)),o}openInfoWindow(e,s){var o=this,r=o.markers.get(e),a=e.caption,n=o.getMap(e);if(MapUtils.isContentEmpty(e)||(a=e.innerHTML),!t.Utils.isNullOrEmpty(a)){const t=this.ensureInfoWindow(e,n);this.setContent(t,a),this.openInfo(t,a,n,r),o.onInfoOpen(e)}}}let E=class PacemMapMarkerElement extends MapRelevantElement{onDragEnd(e){this.position=e,this.dispatchEvent(new MapEvent("dragend",{position:e}))}onClick(e){this.position=e,this.dispatchEvent(new MapEvent("click",{position:e}))}onInfoOpen(){this.dispatchEvent(new MapEvent("openinfo"))}onInfoClose(){this.dispatchEvent(new MapEvent("closeinfo"))}};d([t.Watch({converter:u})],E.prototype,"position",void 0),d([t.Watch({converter:t.PropertyConverters.Json})],E.prototype,"icon",void 0),d([t.Watch({converter:t.PropertyConverters.String})],E.prototype,"caption",void 0),d([t.Watch({converter:t.PropertyConverters.Boolean})],E.prototype,"draggable",void 0),E=d([t.CustomElement({tagName:c.MARKER_SELECTOR})],E);class PacemShapeAdapter extends MapItemAdapter{constructor(e,t=e.adapter){super(e,t)}#d=new Map;get shapes(){return this.#d}getBounds(e=e=>!0){const s=this.shapes;let o=LatLngBounds.Empty;for(var r of s.keys()){if(!e(r)||r.inactive)continue;let a=s.get(r);t.Utils.isNull(a)||(o=LatLngBounds.union(o,this.getShapeBounds(a)))}return o}removeShape(e){const t=this,s=t.getMap(e),o=this.#d;if(o.has(e)){const r=o.get(e);t.deleteShape(r,s),o.delete(e)}}_dispatchEvent(e,t,s){const o=this.shapes.get(e),r=this.getShapePosition(s??o);e.dispatchEvent(new MapEvent(t,{position:r}))}#g=new Map;onDragStart(e,t){const s=this.shapes.get(e),o=this.getShapeBounds(s);this.#g.set(e,o.ne),this._dispatchEvent(e,"dragstart",t)}onDragEnd(e,t){const s=this.shapes.get(e),o=this.getShapeBounds(s),r=this.#g.get(e),a=o.ne,n={lat:a.lat-r.lat,lng:a.lng-r.lng};this._translateShape(e,n),this._dispatchEvent(e,"dragend",t)}_translateShape(e,t){if(e instanceof w)e.center=LatLng.translate(e.center,t);else{if(e instanceof M){const s=e.vertices.map(e=>LatLng.translate(e,t));return void(e.vertices=s)}if(e instanceof P){const s=e.vertices.map(e=>LatLng.translate(e,t));return void(e.vertices=s)}}}onDrag(e,t){this._dispatchEvent(e,"drag",t)}onClick(e,t){this._dispatchEvent(e,"click",t)}ensureShape(e,t){const s=this;let o;return s.shapes.has(e)?o=s.shapes.get(e):(o=this.buildShape(e,t),null!=o&&(this.addClickEventListener(o,t=>s.onClick(e,t)),this.addDragEventListener(o,t=>{s.onDrag(e,t),s.adapter.fitBounds(e.map,!0)}),this.addDragEndEventListener(o,t=>s.onDragEnd(e,t)),this.addDragStartEventListener(o,t=>s.onDragStart(e,t)),s.shapes.set(e,o))),o}drawShape(e){const s=this,o=s.getMap(e);if(t.Utils.isNull(o))return;if(t.Utils.isNullOrEmpty(e)||e.hide)return void s.removeShape(e);const r=this.ensureShape(e,o);this.setShape(r,e),this.setEditable(r,e.editable),this.setDraggable(r,e.draggable)}}class PacemMapShapeElement extends MapRelevantElement{}d([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],PacemMapShapeElement.prototype,"draggable",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],PacemMapShapeElement.prototype,"editable",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],PacemMapShapeElement.prototype,"stroke",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],PacemMapShapeElement.prototype,"fill",void 0);let M=class PacemMapPolylineElement extends PacemMapShapeElement{};d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],M.prototype,"vertices",void 0),M=d([t.CustomElement({tagName:c.POLYLINE_SELECTOR})],M);let P=class PacemMapPolygonElement extends PacemMapShapeElement{};d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],P.prototype,"vertices",void 0),P=d([t.CustomElement({tagName:c.POLYGON_SELECTOR})],P);let w=class PacemMapCircleElement extends PacemMapShapeElement{};d([t.Watch({emit:!0,converter:u})],w.prototype,"center",void 0),d([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],w.prototype,"radius",void 0),w=d([t.CustomElement({tagName:c.CIRCLE_SELECTOR})],w);let b=class PacemMapElement extends t.PacemEventTarget{constructor(){super(...arguments),this.zoom=12,this.center=c.DEFAULT_COORDS,this.#y=LatLngBounds.Empty,this.scale=!0,this.mousewheel=!0,this.draggable=!0,this.doubleClickZoom=!0,this.keyboardShortcuts=!0,this.autofit=!0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.tilt=0,this.heading=0,this._drawHandler=e=>{this._draw(e.target)},this._listenToActiveAdapter=e=>{const s=e.target;"active"===e.detail.propertyName&&e.detail.currentValue&&(s.removeEventListener(t.PropertyChangeEventName,this._listenToActiveAdapter,!1),this._switchAdapter(s))},this._initialized=!1,this._afterInit=(e,s)=>{for(var o of(this._initialized=!0,t.CustomElementUtils.findDescendants(this,e=>e instanceof MapRelevantElement)))this._erase(o,s),this._draw(o);s&&s?.destroy(this)},this._resizeHandler=e=>{this.onResize(e)}}updateBounds(e){if(!LatLngBounds.equals(e,this.#y)){const s=this.#y,o=this.#y=e;this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"bounds",oldValue:s,currentValue:o}))}}#y;get bounds(){return this.#y}get container(){return this._container}register(e){e.addEventListener(t.PropertyChangeEventName,this._drawHandler,!1),this._draw(e)}unregister(e){this._erase(e),e.removeEventListener(t.PropertyChangeEventName,this._drawHandler,!1)}_draw(e,t=this.adapter){this._initialized&&t&&t.drawItem(e)}_erase(e,t=this.adapter){this._initialized&&t&&t.removeItem(e)}_switchAdapter(e,s){e.active?e.initialize(this).then(e=>this._afterInit(e,s)):(s&&this._afterInit(null,s),e.addEventListener(t.PropertyChangeEventName,this._listenToActiveAdapter,!1))}viewActivatedCallback(){super.viewActivatedCallback(),this._setupContainer(),this.adapter&&this._switchAdapter(this.adapter)}propertyChangedCallback(e,s,o,r){if(super.propertyChangedCallback(e,s,o,r),"bounds"!==e)if("adapter"===e)t.Utils.isNull(this._container)||(this._initialized=!1,o?this._switchAdapter(o,s):s&&this._afterInit(null,s));else{switch(e){case"zoom":case"center":case"type":case"theme":case"tilt":case"heading":this.adapter?.setView(this,{type:this.type,tilt:this.tilt,heading:this.heading,zoom:this.zoom,center:this.center,theme:this.theme});break;case"autofit":o&&this.adapter?.fitBounds(this);break;case"target":s&&this._dismissContainer(s),o?(this._setupContainer(o),this._setupResizer()):this._dismissResizer()}this.adapter&&this.adapter.invalidateSize(this)}}_dismissContainer(e=this._container){"true"===e.dataset[m]?e.remove():t.Utils.removeClass(e,t.PCSS+"-map"),e===this._container&&(this._container=null)}_dismissResizer(){const e=this._resizer;e.removeEventListener("resize",this._resizeHandler,!1),e.remove(),this._resizer=null}_setupContainer(e=this.target){t.Utils.isNull(e)&&((e=document.createElement("div")).dataset[m]="true",this.insertAdjacentElement("afterend",e));const s=this._container=e;return t.Utils.addClass(s,t.PCSS+"-map"),s}_setupResizer(){const e=this._container;if(t.Utils.isNull(e))throw new Error("You must set up the map container before its resizing listener.");if(t.Utils.isNull(this._resizer)){const s=this._resizer=document.createElement(t.P+"-resize");s.addEventListener("resize",this._resizeHandler,!1),e.insertAdjacentElement("afterend",s)}return this._resizer.target=e,this._resizer}_detach(){t.Utils.isNull(this._container)||this._dismissContainer(),t.Utils.isNull(this._resizer)||this._dismissResizer()}disconnectedCallback(){this._detach(),super.disconnectedCallback()}onResize(e){this.adapter&&this.adapter.invalidateSize(this)}};d([t.Watch({emit:!0,converter:t.PropertyConverters.Number})],b.prototype,"zoom",void 0),d([t.Watch({emit:!0,converter:u})],b.prototype,"center",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],b.prototype,"type",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],b.prototype,"theme",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"scale",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"mousewheel",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.String})],b.prototype,"zoomControl",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"draggable",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"doubleClickZoom",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"keyboardShortcuts",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],b.prototype,"autofit",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"paddingTop",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"paddingLeft",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"paddingRight",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"paddingBottom",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Element})],b.prototype,"adapter",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Element})],b.prototype,"target",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"tilt",void 0),d([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],b.prototype,"heading",void 0),b=d([t.CustomElement({tagName:c.MAP_SELECTOR})],b);var _=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};const C="geolocation_unavailable",A="position_unavailable",O="permission_denied",k="timeout",S="unknown_error";let U=class PacemMapGeolocateElement extends t.PacemEventTarget{constructor(){super(...arguments),this.permission="prompt",this.maximumAge=15e3,this.timeout=3e4,this.#a=!1,this._successCallback=e=>{this.permission="granted",this._setFetching(!1);const t={lat:e.coords.latitude,lng:e.coords.longitude,timestamp:e.timestamp,altitude:e.coords.altitude,heading:e.coords.heading,speed:e.coords.speed};this.position=t,this.dispatchEvent(new CustomEvent("success",{detail:t}))},this._errorCallback=e=>{this._setFetching(!1);const t="string"==typeof e?e:this._errToString(e);this.dispatchEvent(new CustomEvent("error",{detail:t}))}}_checkPermission(){return new Promise(e=>{const s=navigator.permissions;t.Utils.isNull(s)?e("prompt"):s.query({name:"geolocation"}).then(t=>{e(this.permission=t.state)})})}#a;get fetching(){return this.#a}_setFetching(e){e!==this.fetching&&(this.#a=e,this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"fetching",currentValue:e,oldValue:!e})))}fetch(){this.disabled||(navigator.geolocation?this._checkPermission().then(e=>{this._setFetching(!0),navigator.geolocation.getCurrentPosition(this._successCallback,this._errorCallback,{enableHighAccuracy:!0,maximumAge:this.maximumAge})}):this._errorCallback(C))}viewActivatedCallback(){super.viewActivatedCallback(),this._checkPermission()}_errToString(e){switch(e.code){case GeolocationPositionError.PERMISSION_DENIED:return O;case GeolocationPositionError.POSITION_UNAVAILABLE:return A;case GeolocationPositionError.TIMEOUT:return k;default:return S}}};_([t.Watch({emit:!0,converter:u})],U.prototype,"position",void 0),_([t.Watch({emit:!0,converter:t.PropertyConverters.String})],U.prototype,"permission",void 0),_([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],U.prototype,"maximumAge",void 0),_([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],U.prototype,"timeout",void 0),U=_([t.CustomElement({tagName:t.P+"-map-geolocate"})],U);var N,T=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};const R="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js",I="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css";function z(e){return{city:e.municipality,state:e.countrySubdivision,province:e.countrySecondarySubdivision,village:e.municipalitySubdivision??e.localName,zipCode:e.postalCode,streetName:e.street??e.streetName,houseNumber:e.buildingNumber??e.streetNumber,countryCode:e.countryCode,country:e.country}}class AtlasMapUtils{static getPosition(e){return Array.isArray(e)&&(e={lat:e[0],lng:e[1]}),atlas.data.Position.fromLatLng(e)}static getBounds(e){if(t.Utils.isArray(e))return atlas.data.BoundingBox.fromPositions(e.map(e=>[e[1],e[0]]));const s=AtlasMapUtils.getPosition(e.ne),o=AtlasMapUtils.getPosition(e.sw);return atlas.data.BoundingBox.fromPositions([s,o])}static getLatLng(e){return{lat:e[1],lng:e[0]}}static getLatLngBounds(e){const t=atlas.data.BoundingBox.getNorthEast(e),s=atlas.data.BoundingBox.getSouthWest(e);return{ne:AtlasMapUtils.getLatLng(t),sw:AtlasMapUtils.getLatLng(s)}}static parseGeocoding(e){return t.Utils.isNullOrEmpty(e.results)?[]:e.results.map(e=>({fullAddress:e.address.freeformAddress,address:z(e.address),position:{lat:e.position.lat,lng:e.position.lon,altitude:null}}))}static parseReverseGeocoding(e,t){if(e.summary.numResults<1)return{fullAddress:"",address:{},position:null};const s=e.addresses[0],o=(t??s.position).split(",").map(e=>parseFloat(e)),r=s.address;return{fullAddress:r.freeformAddress,address:z(r),position:{lat:o[0],lng:o[1],altitude:o.length>2?o[2]:null}}}}class PacemAzureOverlayAdapter extends PacemOverlayAdapter{deleteOverlay(e,t){throw new Error("Method not implemented.")}buildOverlay(e,t){throw new Error("Method not implemented.")}setBounds(e,t,s){throw new Error("Method not implemented.")}updateOverlay(e,t,s){throw new Error("Method not implemented.")}}class PacemAzureLayerAdapter extends PacemLayerAdapter{addLoadEventListener(e,t,s){throw new Error("Method not implemented.")}removeLoadEventListener(e,t,s){throw new Error("Method not implemented.")}deleteLayer(e,t){throw new Error("Method not implemented.")}buildLayer(e,t){throw new Error("Method not implemented.")}}class PacemAzureMarkerAdapter extends PacemMarkerAdapter{getMarkerPosition(e){const t=e.getOptions().position;return AtlasMapUtils.getLatLng(t)}buildMarker(e,t){const s=new atlas.HtmlMarker;return t.markers.add(s),s.setOptions({popup:new atlas.Popup}),s}addClickEventListener(e,t,s){t.events.add("click",e,s)}addDragEventListener(e,t,s){t.events.add("drag",e,s)}addDragEndEventListener(e,t,s){t.events.add("dragend",e,s)}_setPopupPosition(e,s){const o=this._getPopup(e);t.Utils.isNull(o)||o.setOptions({position:s})}setPosition(e,t){const s=AtlasMapUtils.getPosition(t);e.setOptions({position:s}),this._setPopupPosition(e,s)}setIcon(e,s){let o={pixelOffset:[0,-36]},r={popup:new atlas.Popup},a=(e,t,s)=>`<img width="${t||"auto"}" height="${s||"auto"}" style="pointer-events: none" src="${e}" />`;if("string"==typeof s)r.htmlContent=a(s);else if(!t.Utils.isNull(s)){const e=s.size,t=s.anchor;r.htmlContent=a(s.url,e&&e.width,e&&e.height),t?(r.anchor="top-left",r.pixelOffset=[-t.x,-t.y],o.pixelOffset=[0,-t.y]):e&&e.height&&(o.pixelOffset=[0,-e.height/2])}r.popup.setOptions(o),e.setOptions(r)}setLabel(e,t){let s={text:t};e.setOptions(s)}setDraggable(e,t){let s={draggable:t};e.setOptions(s)}deleteMarker(e,t){t.markers.remove(e)}deleteInfoWindow(e,t){this._getPopup(e).remove()}closeInfo(e){const t=this._getPopup(e);!0===t?.isOpen()&&t.close()}openInfo(e,t,s,o){const{popup:r,position:a}=e.getOptions();this._setContent(r,t,a),o.togglePopup(),s.events.addOnce("close",r,e=>{r.setOptions({content:""})})}buildInfoWindow(e){return this.markers.get(e)}addCloseClickEventListener(e,t,s){const o=this._getPopup(e);t.events.add("close",o,s)}setContent(e,t){const{popup:s,position:o}=e.getOptions();this._setContent(s,t,o)}_getPopup(e){return e.getOptions().popup}_setContent(e,t,s){e.setOptions({content:`<div style="padding: 8px 24px 8px 8px;">${t}</div>`,position:s})}}class PacemAzureShapeAdapter extends PacemShapeAdapter{addDragStartEventListener(e,t){throw new Error("Method not implemented.")}deleteShape(e,t){throw new Error("Method not implemented.")}getShapeBounds(e){throw new Error("Method not implemented.")}getShapePosition(e){throw new Error("Method not implemented.")}buildShape(e,t){throw new Error("Method not implemented.")}addClickEventListener(e,t){throw new Error("Method not implemented.")}addDragEventListener(e,t){throw new Error("Method not implemented.")}addDragEndEventListener(e,t){throw new Error("Method not implemented.")}setShape(e,t){throw new Error("Method not implemented.")}setEditable(e,t){throw new Error("Method not implemented.")}setDraggable(e,t){throw new Error("Method not implemented.")}}class PacemAzureMapGeocoder{_buildGeocodeRequest(e,s,o=10,r=""){const a={"subscription-key":e,query:s,limit:""+o,language:r};return{uri:t.Utils.URIs.appendQuery("https://atlas.microsoft.com/search/address/json?api-version=1.0",a),options:{mode:"cors"}}}parseGeocodeResponse(e){return new Promise((t,s)=>{e.json().then(e=>{const s=AtlasMapUtils.parseGeocoding(e);t(s)},e=>s(e))})}geocode(e,t,s=10,o=""){return new Promise((r,a)=>{const n=this._buildGeocodeRequest(e,t,s,o);return fetch(n.uri,n.options).then(e=>{e.ok?this.parseGeocodeResponse(e).then(r,a):a(e)},e=>a(e))})}reverseGeocode(e,t,s=""){return new Promise((o,r)=>{const a=this._buildReverseRequest(e,t,s);return fetch(a.uri,a.options).then(e=>{e.ok?this._parseReverseResponse(e).then(o,r):r(e)},e=>r(e))})}_buildReverseRequest(e,s,o=""){const r=MapUtils.parseCoords(s),a={"subscription-key":e,query:r[0]+","+r[1],language:o};return{uri:t.Utils.URIs.appendQuery("https://atlas.microsoft.com/search/address/reverse/json?api-version=1.0",a),options:{mode:"cors"}}}_parseReverseResponse(e){return new Promise((t,s)=>{e.json().then(e=>{const s=AtlasMapUtils.parseReverseGeocoding(e);t([s])},e=>s(e))})}}const x=["moveend","dragend","zoomend","rotateend"];let B=N=class PacemAzureMapAdapterElement extends PacemMapAdapterElement{geocode(e,s){return(new PacemAzureMapGeocoder).geocode(this.subscriptionKey,e,s,t.Utils.lang(this))}reverseGeocode(e,s){return(new PacemAzureMapGeocoder).reverseGeocode(this.subscriptionKey,e,t.Utils.lang(this))}getBounds(e){const t=this.getMap(e),{bounds:s}=t.getCamera();return AtlasMapUtils.getLatLngBounds(s)}isActive(){return!t.Utils.isNullOrEmpty(this.subscriptionKey)}buildOverlayAdapterFor(e){return new PacemAzureOverlayAdapter(e,this)}buildMarkerAdapterFor(e){return new PacemAzureMarkerAdapter(e,this)}buildShapeAdapterFor(e){return new PacemAzureShapeAdapter(e,this)}buildLayerAdapterFor(e){return new PacemAzureLayerAdapter(e,this)}setViewNative(e,s){const o=this.getMap(e),r=function(e){const t=e.theme==l.DARK||e.theme!==l.LIGHT&&window.matchMedia("(prefers-color-scheme: dark)").matches;switch(e.type){case"satellite":case"satellite_road_labels":case"grayscale_dark":case"grayscale_light":case"night":case"road_shaded_relief":case"road":case"high_constrast_dark":case"high_constrast_light":return e.type;case i.HYBRID:return"satellite_road_labels";case i.SATELLITE:return"satellite";case i.TERRAIN:return"road_shaded_relief";case i.HIGH_CONTRAST:return t?"high_constrast_dark":"high_constrast_light";default:return t?"night":"road"}}(s=t.Utils.extend({type:e.type,theme:e.theme},s));o.setStyle({style:r});const a=s.center&&AtlasMapUtils.getPosition(s.center)||o.getCamera().center,n=s.zoom||o.getCamera().zoom;o.setCamera({center:a,zoom:n})}#v=new WeakMap;snapshot(e,s="image/png",o){if(!this.hasMap(e))return Promise.reject();const{map:r}=this.tryGetMap(e);return new Promise((a,n)=>{t.Utils.blobToDataURL(this.#f.get(e)).then(e=>{const n=r.getCanvasContainer();n.style.backgroundImage=`url(${e})`,n.style.backgroundSize="contain",t.Utils.snapshotElement(n,null,s,o).then(a)})})}#f=new WeakMap;dispose(e){if(!this.hasMap(e))return;const{map:t}=this.tryGetMap(e);this.#v.get(e).forEach(e=>{t.events.remove(e.eventName,e.handler)}),this.#v.delete(e),t.dispose()}async init(e){await Promise.all([t.CustomElementUtils.importjs(R),t.CustomElementUtils.importcss(I,void 0,!0)]);const s=e,o=s.scale,r=s.draggable,a=s.doubleClickZoom,n=s.keyboardShortcuts,i={center:AtlasMapUtils.getPosition(s.center),zoom:s.zoom,subscriptionKey:this.subscriptionKey,dragPanInteraction:r,scrollZoomInteraction:s.mousewheel,dblClickZoomInteraction:!a,keyboardInteraction:n,language:this.language||t.Utils.lang(e)},l=s.container,p=document.createElement("div");p.id=`azure-maps-${t.Utils.uniqueCode()}`,p.style.width="100%",p.style.height="100%",l.innerHTML="",l.appendChild(p);const d=new atlas.Map(p.id,i),c=[];return this.#v.set(s,c),x.forEach(e=>{const t=this._spinMapUpdateHandler(s,d);d.events.add(e,t),c.push({eventName:e,handler:t})}),o&&s.zoomControl&&d.events.addOnce("ready",e=>{let t=atlas.ControlPosition.NonFixed;switch(s.zoomControl){case"topleft":t=atlas.ControlPosition.TopLeft;break;case"topright":t=atlas.ControlPosition.TopRight;break;case"bottomright":t=atlas.ControlPosition.BottomRight;break;case"bottomleft":t=atlas.ControlPosition.BottomLeft}d.controls.add(new atlas.control.ZoomControl,{position:t})}),d.events.add("idle",t=>{d.getCanvas().toBlob(t=>{this.#f.set(e,t)})}),d.events.addOnce("ready",()=>{e.dispatchEvent(new MapEvent("maploaded"))}),{map:d,container:p}}invalidateSize(e){if(!this.hasMap(e))return;const{map:t}=this.tryGetMap(e);t&&t.resize()}propertyChangedCallback(e,s,o,r){if(super.propertyChangedCallback(e,s,o,r),!r&&"language"===e)for(let e of this.enrolledMaps()){const{map:s}=this.tryGetMap(e);s.setStyle({language:o||t.Utils.lang(e)})}}_spinMapUpdateHandler(e,t){return()=>{this._updateMap(e,t)}}_updateMap(e,s){if(!t.Utils.isNull(s)&&!t.Utils.isNull(e)){const t=s.getCamera(),o=t.center,r=t.zoom;1===t.zoom?console.warn("Azure Maps control lacks in reflecting the actual map zoom onto the camera property. Cannot reflect info back to PacemMapElement."):this.updateMapElement(e,AtlasMapUtils.getLatLng(o),r)}}static _getBounds(e){const t=e.paddingTop||0,s=e.paddingLeft||0,o=e.paddingRight||0;return{top:t,bottom:e.paddingBottom||0,left:s,right:o}}fitBoundsNative(e,t,s=N._getBounds(e)){this.getMap(e).setCamera({bounds:AtlasMapUtils.getBounds(t),padding:s})}};T([t.Watch({emit:!1,converter:t.PropertyConverters.String})],B.prototype,"subscriptionKey",void 0),T([t.Watch({emit:!1,converter:t.PropertyConverters.String})],B.prototype,"language",void 0),T([t.Debounce(500)],B.prototype,"_updateMap",null),B=N=T([t.CustomElement({tagName:t.P+"-map-adapter-azure"})],B);var G=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};const W="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js",D=null,j="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css",F=null;function Z(e){return{fullAddress:e.display_name,address:(t=e.address,{city:t.city,state:t.state,provinceCode:t["ISO3166-2-lvl6"]?.split("-")[1],province:t.county,village:t.village,zipCode:t.postcode,streetName:t.road,houseNumber:t.house_number,countryCode:t.country_code?.toUpperCase(),country:t.country}),position:{lat:parseFloat(e.lat),lng:parseFloat(e.lon),altitude:null}};var t}class LeafletUtils{static toLiteral(e){return{ne:e.getNorthEast(),sw:e.getSouthWest()}}static parseGeocoding(e){return t.Utils.isNullOrEmpty(e)?[]:e.map(Z)}static parseReverseGeocoding(e){return t.Utils.isNullOrEmpty(e)?[]:[Z(e)]}}const H="layerload";class LayerLoadEvent extends t.CustomTypedEvent{constructor(e){super(H,e,{bubbles:!0})}}class PacemLeafletMarkerAdapter extends PacemMarkerAdapter{deleteInfoWindow(e,t){e.unbindPopup()}deleteMarker(e,t){e.removeFrom(t)}getMarkerPosition(e){return e.getLatLng()}buildMarker(e,t){return L.marker(e.position).addTo(t)}addClickEventListener(e,t,s){e.on("click",s)}addDragEventListener(e,t,s){e.on("drag",s)}addDragEndEventListener(e,t,s){e.on("dragend",s)}setPosition(e,t){e.setLatLng(t)}setIcon(e,s){const o=this;if("string"==typeof s)o._setIcon(e,s);else if(!t.Utils.isNull(s)){let r={iconUrl:s.url};t.Utils.isNullOrEmpty(s.size)||t.Utils.extend(r,{iconSize:[s.size.width,s.size.height],iconAnchor:[s.size.width/2,s.size.height],popupAnchor:[0,-s.size.height]}),t.Utils.isNullOrEmpty(s.anchor)||t.Utils.extend(r,{iconAnchor:[s.anchor.x,s.anchor.y]}),o._setIcon(e,new L.Icon(r))}}setLabel(e,t){}setDraggable(e,t){!0===t?e.dragging.enable():e.dragging.disable()}closeInfo(e){e.closePopup()}openInfo(e,t,s,o){e.bindPopup(t).openPopup()}buildInfoWindow(e){return this.markers.get(e)}addCloseClickEventListener(e,t,s){e.on("popupclose",s)}setContent(e,t){const s=e.getPopup();s&&s.getContent()!=t&&e.setPopupContent(t)}_setIcon(e,t){if("string"==typeof t){var s,o,r,a={iconUrl:t};if((s=this.size)&&/[\d]+,[\d]+/.test(s)){var n=-1,i=[parseInt(s.substring(0,n=s.indexOf(","))),parseInt(s.substring(n+1))];Object.assign(a,{iconSize:i})}if((o=this.anchor)&&/[\d]+,[\d]+/.test(o)){n=-1;var l=[parseInt(o.substring(0,n=o.indexOf(","))),parseInt(o.substring(n+1))];Object.assign(a,{iconAnchor:l,popupAnchor:[0,-l[1]]})}if((r=this.popupAnchor)&&/[\d]+,[\d]+/.test(r)){n=-1,l=[parseInt(o.substring(0,n=o.indexOf(","))),parseInt(o.substring(n+1))];Object.assign(a,{popupAnchor:l})}e.setIcon(L.icon(a))}else t&&e.setIcon(t)}}class PacemLeafletShapeAdapter extends PacemShapeAdapter{addDragStartEventListener(e,t){throw new Error("Method not implemented.")}deleteShape(e,t){throw new Error("Method not implemented.")}getShapeBounds(e){throw new Error("Method not implemented.")}getShapePosition(e){throw new Error("Method not implemented.")}buildShape(e,t){throw new Error("Method not implemented.")}addClickEventListener(e,t){throw new Error("Method not implemented.")}addDragEventListener(e,t){throw new Error("Method not implemented.")}addDragEndEventListener(e,t){throw new Error("Method not implemented.")}setShape(e,t){throw new Error("Method not implemented.")}setEditable(e,t){throw new Error("Method not implemented.")}setDraggable(e,t){throw new Error("Method not implemented.")}}class PacemLeafletLayerAdapter extends PacemLayerAdapter{addLoadEventListener(e,t,s){e.on("load",s)}removeLoadEventListener(e,t,s){e.off("load",s)}deleteLayer(e,t){e.remove()}buildLayer(e,t){const s=(e.mode||"").toLowerCase();return"wms"===s?L.tileLayer.wms(e.url,{layers:(e.include||[]).join(","),minZoom:e.minZoom,maxZoom:e.maxZoom,transparent:!0,format:"image/png"}).addTo(t):L.tileLayer(e.url,{tms:"tms"===s,minZoom:e.minZoom,maxZoom:e.maxZoom}).addTo(t)}}class PacemLeafletOverlayAdapter extends PacemOverlayAdapter{deleteOverlay(e,t){throw new Error("Method not implemented.")}buildOverlay(e,t){throw new Error("Method not implemented.")}setBounds(e,t,s){throw new Error("Method not implemented.")}updateOverlay(e,t,s){throw new Error("Method not implemented.")}}let q=class PacemLeafletMapAdapterElement extends PacemMapAdapterElement{constructor(){super(...arguments),this.#E=new WeakMap,this.tiles="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",this.attribution='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',this._tileLayerLoadHandler=e=>{this.dispatchLayerLoadEvent(e.sourceTarget)},this._mapUpdateHandler=e=>{const s=this.getMap(e);t.Utils.isNull(s)||t.Utils.isNull(e)||this.updateMapElement(e,s.getCenter(),s.getZoom())}}buildOverlayAdapterFor(e){return new PacemLeafletOverlayAdapter(e,this)}geocode(e,s){return(new PacemNominatimMapGeocoder).geocode(e,s,t.Utils.lang(this))}reverseGeocode(e,s){return(new PacemNominatimMapGeocoder).reverseGeocode(e,t.Utils.lang(this))}getBounds(e){const t=this.getMap(e).getBounds();return LeafletUtils.toLiteral(t)}isActive(){return!0}setViewNative(e,t){const s=this.getMap(e);t.center?s.setView(t.center,t.zoom??s.getZoom(),{animate:!0}):"number"==typeof t.zoom&&s.setZoom(t.zoom,{animate:!0})}buildMarkerAdapterFor(e){return new PacemLeafletMarkerAdapter(e,this)}buildShapeAdapterFor(e){return new PacemLeafletShapeAdapter(e,this)}buildLayerAdapterFor(e){return new PacemLeafletLayerAdapter(e,this)}#E;snapshot(e,s="image/png",o){return t.Utils.snapshotElement(e.container.firstElementChild,null,s,o)}propertyChangedCallback(e,t,s,o){if(super.propertyChangedCallback(e,t,s,o),"tiles"===e)for(let e of this.enrolledMaps())this._redrawMap(e);for(let e of this.enrolledMaps())this.invalidateSize(e)}dispose(e){const{map:t}=this.tryGetMap(e),s=this.#E.get(e);s&&s.off("load",this._tileLayerLoadHandler),t.clearAllEventListeners(),this.#E.delete(e)}async init(e){await Promise.all([t.CustomElementUtils.importjs(W,D,!0),t.CustomElementUtils.importcss(j,F,!0)]);const s=e;var o=s.scale,r=s.draggable,a=s.doubleClickZoom,n=s.keyboardShortcuts,i=L.latLng(MapUtils.parseCoords(s.center)),l={zoomControl:o&&!t.Utils.isNullOrEmpty(s.zoomControl),scrollWheelZoom:s.mousewheel,dragging:r,doubleClickZoom:!a,keyboard:n};const p=s.container,d=document.createElement("div");d.style.width="100%",d.style.height="100%",p.innerHTML="",p.appendChild(d);const c=L.map(d,l);["zoomend","moveend"].forEach(e=>{c.on(e,e=>{this._idleFiller(s),this._mapUpdateHandler(s)})}),c.on("load",()=>{o&&s.zoomControl&&c.zoomControl.setPosition(s.zoomControl),this._idleFiller(s)});const h=L.tileLayer(this.tiles,{attribution:this.attribution}).addTo(c);h.on("load",this._tileLayerLoadHandler),this.#E.set(s,h),c.setView(i,s.zoom),c.once("idle",function(){c.fire("resize"),e.dispatchEvent(new MapEvent("maploaded"))});const m=MapUtils.parseCoords(s.center),u=[m[0],m[1]];return c.setView(u,s.zoom),{map:c,container:d}}dispatchLayerLoadEvent(e){this.dispatchEvent(new LayerLoadEvent(e))}invalidateSize(e){if(this.hasMap(e)){this.getMap(e).invalidateSize()}}_idleFiller(e){if(this.hasMap(e)){this.getMap(e).fire("idle")}}fitBoundsNative(e,t,s={top:e.paddingTop||0,left:e.paddingLeft||0,right:e.paddingRight||0,bottom:e.paddingBottom||0}){const o=this.getMap(e),r={paddingTopLeft:new L.Point(s.left,s.top),paddingBottomRight:new L.Point(s.right,s.bottom)},a=t.ne,n=t.sw;try{o.fitBounds([[a.lat,a.lng],[n.lat,n.lng]],r)}catch(e){throw e}}_redrawMap(e){var s=this,o=s.#E.get(e);t.Utils.isNull(s.tiles&&o)||o.setUrl(s.tiles)}};G([t.Watch({emit:!1,converter:t.PropertyConverters.String})],q.prototype,"tiles",void 0),G([t.Watch({emit:!1,converter:t.PropertyConverters.String})],q.prototype,"attribution",void 0),G([t.Debounce(500)],q.prototype,"_idleFiller",null),q=G([t.CustomElement({tagName:t.P+"-map-adapter-leaflet"})],q);class PacemNominatimMapGeocoder{_buildGeocodeRequest(e,s=10,o=""){const r={q:e,limit:""+s,"accept-language":o};return{uri:t.Utils.URIs.appendQuery("https://nominatim.openstreetmap.org/search?addressdetails=1&format=json",r),options:{mode:"cors"}}}parseGeocodeResponse(e){return new Promise((t,s)=>{e.json().then(e=>{const s=LeafletUtils.parseGeocoding(e);t(s)},e=>s(e))})}geocode(e,t=10,s=""){return new Promise((o,r)=>{const a=this._buildGeocodeRequest(e,t,s);return fetch(a.uri,a.options).then(e=>{e.ok?this.parseGeocodeResponse(e).then(o,r):r(e)},e=>r(e))})}reverseGeocode(e,t=""){return new Promise((s,o)=>{const r=this._buildReverseRequest(e,t);return fetch(r.uri,r.options).then(e=>{e.ok?this._parseReverseResponse(e).then(s,o):o(e)},e=>o(e))})}_buildReverseRequest(e,s=""){const o=MapUtils.parseCoords(e),r={lat:""+o[0],lon:""+o[1],"accept-language":s};return{uri:t.Utils.URIs.appendQuery("https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json",r),options:{mode:"cors"}}}_parseReverseResponse(e){return new Promise((t,s)=>{e.json().then(e=>{const s=LeafletUtils.parseReverseGeocoding(e);t(s)},e=>s(e))})}}var K=function(e,t,s,o){var r,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(n=(a<3?r(n):a>3?r(t,s,n):r(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};const V={DETACH_TIMEOUT:200,API_URI:"https://maps.googleapis.com/maps/api/js",MAX_ROADMAP_ZOOM:22,BOOTSTRAP_SNIPPET:(e,t,s,o)=>`(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=\`https://maps.\${c}apis.com/maps/api/js?\`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({\n key: "${e}", v: "${o}", language: "${t}", region: "${s}",\n // Add other bootstrap parameters as needed, using camel case.\n });`,MAPS_NOT_FOUND:"google.maps not found.",GEOCODER_UNAVAILABLE:"google.maps geocoder unavailable.",INVALID_KEY:"invalid google.maps api key.",TILE_EXTENT:[6378137*-Math.PI,6378137*Math.PI]};class Bootstrapper{#i;#L;_equivalent(e,s,o,r){const a=this.#L;return!t.Utils.isNull(a)&&a.key===e&&a.language===(s||a.language)&&a.region===(o||a.region)&&a.version===(r||a.version)}_spinFuture(e,t,s,o){return new Promise((r,a)=>{this._equivalent(e,t,s,o)||Bootstrapper._ensureBootstrapScript(e,t,s,o),this.#L={language:t,region:s,version:o,key:e},google.maps.importLibrary("maps").then(e=>{r(),this.#i=null},e=>{a(e),this.#i=null})})}boostrap(e,s,o,r="weekly"){return t.Utils.isNullOrEmpty(e)?Promise.reject(V.INVALID_KEY):(!t.Utils.isNull(this.#i)&&this._equivalent(e,s,o,r)||(this.#i=this._spinFuture(e,s,o,r)),this.#i)}static _ensureBootstrapScript(e,s,o,r){const a="pacem-googlemaps",n=`v=${r},l=${s},r=${o}`;let i=document.querySelector(`script[${a}]`);if(!t.Utils.isNull(i)){if(i.getAttribute(a)===n)return;i.remove(),document.querySelectorAll("script[src^='https://maps.googleapis.com/maps']").forEach(e=>e.remove()),delete window.google}t.Utils.isNullOrEmpty(e)||(i=document.createElement("script"),i.setAttribute(a,n),i.textContent=V.BOOTSTRAP_SNIPPET(e,s,o,r),document.head.appendChild(i))}}const $=new Bootstrapper;class GMapsUtils{static getPosition(e){return Array.isArray(e)?{lat:e[0],lng:e[1]}:e}static getBounds(e){return t.Utils.isNullOrEmpty(e)?null:{north:e.ne.lat,east:e.ne.lng,south:e.sw.lat,west:e.sw.lng}}static mapGeocodeResults(e,t=[]){const s=[];e??=[];for(let o=0;o<e.length;o++){const r=t.length>o?t[o]:null,a=GMapsUtils.mapGeocodeResult(e[o],r);s.push(a)}return s}static mapGeocodeResult(e,t){const s=e?.address_components||[],o=s.find(e=>e.types.indexOf("street_number")>=0)?.long_name,r=s.find(e=>e.types.indexOf("route")>=0)?.long_name,a=s.find(e=>e.types.indexOf("locality")>=0)?.long_name,n=s.find(e=>e.types.indexOf("administrative_area_level_3")>=0)?.long_name,i=s.find(e=>e.types.indexOf("administrative_area_level_2")>=0),l=s.find(e=>e.types.indexOf("administrative_area_level_1")>=0)?.short_name,p=s.find(e=>e.types.indexOf("country")>=0),d=s.find(e=>e.types.indexOf("postal_code")>=0)?.short_name,c={houseNumber:o,city:n||a,provinceCode:i?.short_name,province:i?.long_name,countryCode:p?.short_name,country:p?.long_name,zipCode:d,streetName:r,state:l,village:a,type:e.geometry.location_type};return{fullAddress:e.formatted_address,position:GMapsUtils.toLiteral(e.geometry.location,t?.elevation),address:c}}static toLiteral(e,s){if(t.Utils.isNull(e))return null;if("lat"in e&&"function"==typeof e.lat&&"lng"in e&&"function"==typeof e.lng)return{lat:e.lat(),lng:e.lng(),altitude:s};if("getNorthEast"in e&&"function"==typeof e.getNorthEast&&"getSouthWest"in e&&"function"==typeof e.getSouthWest){const t=e.getNorthEast(),s=e.getSouthWest();return{ne:GMapsUtils.toLiteral(t),sw:GMapsUtils.toLiteral(s)}}return"north"in e&&"number"==typeof e.north&&"south"in e&&"number"==typeof e.south&&"west"in e&&"number"==typeof e.west&&"east"in e&&"number"==typeof e.east?{ne:{lat:e.north,lng:e.east},sw:{lat:e.south,lng:e.west}}:t.Utils.extend({altitude:s},e)}static areEqual(e,s){if(t.Utils.isNull(e)||t.Utils.isNull(s))return!1;const o=GMapsUtils.toLiteral(e),r=GMapsUtils.toLiteral(s);return o.lat===r.lat&&o.lng===r.lng}static fitBounds(e,t,s){e?.fitBounds(t,s)}static setCenter(e,s){t.Utils.isNull(e)||GMapsUtils.areEqual(e.getCenter(),s)||e.panTo(s)}}class PacemGoogleShapeAdapter extends PacemShapeAdapter{getShapeBounds(e){const t=new google.maps.LatLngBounds;if(e instanceof google.maps.Circle){const s=e.getBounds();s&&(t.extend(s.getNorthEast()),t.extend(s.getSouthWest()))}else(e instanceof google.maps.Polygon||e instanceof google.maps.Polyline)&&e.getPath().forEach(e=>t.extend(e));return!1!==t.isEmpty()?LatLngBounds.Empty:GMapsUtils.toLiteral(t)}deleteShape(e,t){e.setMap(null)}getShapePosition(e){return"latLng"in e?e.latLng:null}buildShape(e,t){const s=!0;return e instanceof M?new google.maps.Polyline({path:e.vertices,clickable:s,map:t}):e instanceof P?new google.maps.Polygon({paths:[e.vertices],clickable:s,map:t}):e instanceof w?new google.maps.Circle({center:e.center,radius:e.radius,clickable:s,map:t}):null}addClickEventListener(e,t){e.addListener("click",t)}addDragEventListener(e,t){e.addListener("drag",t)}addDragStartEventListener(e,t){e.addListener("dragstart",t)}addDragEndEventListener(e,t){e.addListener("dragend",t)}setShape(e,t){if(t instanceof M){e.setOptions({strokeColor:t.stroke?.color,strokeOpacity:t.stroke?.alpha??1,strokeWeight:t.stroke?.thickness,path:t.vertices})}if(t instanceof P){e.setOptions({strokeColor:t.stroke?.color,strokeOpacity:t.stroke?.alpha??1,strokeWeight:t.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:t.fill?.color,fillOpacity:t.fill?.alpha,paths:[t.vertices]})}if(t instanceof w){e.setOptions({strokeColor:t.stroke?.color,strokeOpacity:t.stroke?.alpha??1,strokeWeight:t.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:t.fill?.color,fillOpacity:t.fill?.alpha,center:t.center,radius:t.radius})}}setEditable(e,t){e.setOptions({editable:t})}setDraggable(e,t){e.setOptions({draggable:t})}}class PacemGoogleMarkerAdapter extends PacemMarkerAdapter{deleteInfoWindow(e,t){e.unbindAll()}deleteMarker(e,t){e.setMap(null)}get mapAutomaticallyScrollsOnDrag(){return!0}getMarkerPosition(e){const t=e.getPosition();return{lat:t.lat(),lng:t.lng()}}buildMarker(e,t){return new google.maps.Marker({position:e.position,map:t})}addClickEventListener(e,t,s){e.addListener("click",s)}addDragEventListener(e,t,s){e.addListener("drag",s)}addDragEndEventListener(e,t,s){e.addListener("dragend",s)}setPosition(e,t){e.setPosition(t)}setIcon(e,s){if("string"==typeof s)e.setIcon(s);else if(!t.Utils.isNull(s)){let o={url:s.url};t.Utils.isNullOrEmpty(s.size)||(o.size=new google.maps.Size(s.size.width,s.size.height),o.anchor=new google.maps.Point(s.size.width/2,s.size.height)),t.Utils.isNullOrEmpty(s.anchor)||(o.anchor=new google.maps.Point(s.anchor.x,s.anchor.y)),e.setIcon(o)}}setLabel(e,t){e.setLabel(t)}setDraggable(e,t){e.setDraggable(t)}closeInfo(e){e.close()}openInfo(e,t,s,o){e.open(s,o)}buildInfoWindow(e){let s=0;return"string"==typeof e.icon||t.Utils.isNull(e.icon)||(s=(e.icon.size?.width??0)/2-(e.icon.anchor?.x??0)),new google.maps.InfoWindow({pixelOffset:new google.maps.Size(-s,0)})}addCloseClickEventListener(e,t,s){e.addListener("closeclick",s)}setContent(e,t){e.setContent(t)}}class PacemGoogleLayerAdapter extends PacemLayerAdapter{addLoadEventListener(e,t,s){e.addListener("tilesloaded",s)}removeLoadEventListener(e,t,s){}deleteLayer(e,t){const s=t.overlayMapTypes.getArray().findIndex(t=>t===e);s>=0&&t.overlayMapTypes.removeAt(s)}_getBounds(e,t,s){const o=V.TILE_EXTENT;var r=2*o[1]/Math.pow(2,s),a=o[0]+e*r,n=o[0]+(e+1)*r;return[a,o[1]-(t+1)*r,n,o[1]-t*r]}_getWmsTileUrl(e,s){return(o,r)=>t.Utils.URIs.appendQuery(e,{service:"WMS",styles:"",transparent:"true",request:"GetMap",srs:"EPSG:3857",format:"image/png",version:"1.1.1",layers:s?.join(",")||"",width:"256",height:"256",bbox:this._getBounds(o.x,o.y,r).join(",")})}_getWmsLayer(e,t){const s=new google.maps.ImageMapType({getTileUrl:this._getWmsTileUrl(e.url,e.include),minZoom:e.minZoom,maxZoom:e.maxZoom,opacity:1});return t.overlayMapTypes.push(s),s}_getTmsTileUrl(e){return(t,s)=>{const o={r:"",s:(r=t,"abc"[Math.abs(r.x+r.y)%3]),x:""+t.x,y:""+t.y,z:""+s};var r;let a=e;for(let e in o)a=a.replaceAll("{"+e+"}",o[e]);return a}}_getTmsLayer(e,t){const s=new google.maps.ImageMapType({getTileUrl:this._getTmsTileUrl(e.url),minZoom:e.minZoom,maxZoom:e.maxZoom,opacity:1});return t.overlayMapTypes.push(s),s}buildLayer(e,t){switch((e.mode||"").toLowerCase()){case"wms":return this._getWmsLayer(e,t);case"tms":return this._getTmsLayer(e,t);default:throw new Error(`"${e.mode}" overlays not supported for the Google Maps integration.`)}}}class PacemGoogleOverlayAdapter extends PacemOverlayAdapter{updateOverlay(e,t,s){e.set,e.draw()}deleteOverlay(e,t){e.setMap(null)}buildOverlay(e,s){let o=function(e){class PacemGoogleOverlay extends google.maps.OverlayView{constructor(e){super(),this._item=e}get element(){return this._item}get bounds(){const e=this._item.bounds;return t.Utils.isNull(e)?null:GMapsUtils.getBounds(e)}getBoundingBox(){const e=this.getProjection(),s=this.bounds;if(t.Utils.isNullOrEmpty(s))return null;const o=e.fromLatLngToDivPixel({lat:s.south,lng:s.west}),r=e.fromLatLngToDivPixel({lat:s.north,lng:s.east});return{x:o.x,y:r.y,width:r.x-o.x,height:o.y-r.y}}}class PacemGoogleImageOverlay extends PacemGoogleOverlay{get src(){return this.element.src}#M;onAdd(){const e=this.#M=this.#M||document.createElement("div");e.style.position="absolute",this.getPanes().overlayLayer.appendChild(e)}onRemove(){const e=this.#M;t.Utils.isNull(e)||(e.remove(),this.#M=null)}draw(){const e=this.#M;if(t.Utils.isNull(e))return;const s=this.getBoundingBox();t.Utils.isNull(s)||(e.style.top=s.y+"px",e.style.left=s.x+"px",e.style.width=s.width+"px",e.style.height=s.height+"px",e.style.backgroundSize=`${s.width}px ${s.height}px`,e.style.backgroundImage=`url(${this.src})`)}}return e instanceof v?new PacemGoogleImageOverlay(e):null}(e);return o.setMap(s),o}setBounds(e,t,s){e.draw()}}const Y=["dragend","zoom_changed","center_changed","maptypeid_changed","tilt_changed","heading_changed","bounds_changed"];function J(e){const t=e.theme==l.DARK?google.maps.ColorScheme.DARK:e.theme!=l.LIGHT?google.maps.ColorScheme.FOLLOW_SYSTEM:google.maps.ColorScheme.LIGHT;switch(e.type){case google.maps.MapTypeId.HYBRID:case google.maps.MapTypeId.ROADMAP:case google.maps.MapTypeId.TERRAIN:case google.maps.MapTypeId.SATELLITE:return{type:e.type,theme:t};case i.HYBRID:return{type:google.maps.MapTypeId.HYBRID,theme:t};case i.SATELLITE:return{type:google.maps.MapTypeId.SATELLITE,theme:t};case i.TERRAIN:return{type:google.maps.MapTypeId.TERRAIN,theme:t};default:return{type:google.maps.MapTypeId.ROADMAP,theme:t}}}let Q=class PacemGoogleMapAdapterElement extends PacemMapAdapterElement{geocode(e,t){const s=this.language||"",o=this.region||"",r=this.version||"weekly";return new PacemGoogleMapGeocoder(this.apiKey,s,o,r).geocode(e,t)}reverseGeocode(e,t){const s=this.language||"",o=this.region||"",r=this.version||"weekly";return new PacemGoogleMapGeocoder(this.apiKey,s,o,r).reverseGeocode(e,t)}getBounds(e){if(!this.hasMap(e))return LatLngBounds.Empty;const t=this.getMap(e).getBounds();return GMapsUtils.toLiteral(t)}isActive(){return!t.Utils.isNullOrEmpty(this.apiKey)}buildMarkerAdapterFor(e){return new PacemGoogleMarkerAdapter(e,this)}buildOverlayAdapterFor(e){return new PacemGoogleOverlayAdapter(e,this)}buildShapeAdapterFor(e){return new PacemGoogleShapeAdapter(e,this)}buildLayerAdapterFor(e){return new PacemGoogleLayerAdapter(e,this)}getMaxAvailableZoom(e){return new Promise((t,s)=>{(new google.maps.MaxZoomService).getMaxZoomAtLatLng(e,e=>{e.status===google.maps.MaxZoomStatus.OK?t(e.zoom):s()})})}#v=new WeakMap;snapshot(e,s="image/png",o){const{container:r}=this.tryGetMap(e);return t.Utils.snapshotElement(r,null,s,o)}setViewNative(e,s){const o=this.getMap(e);s=t.Utils.extend({type:e.type,theme:e.theme},s);const{type:r,theme:a}=J(s);if(this.#P&&a!==o.get("colorScheme"))return void this._bootstrapDebounced();o.setOptions({colorScheme:a,mapTypeId:r}),"number"==typeof s.tilt&&o.setTilt(s.tilt),"number"==typeof s.heading&&o.setHeading(s.heading);const n=()=>{s.center&&GMapsUtils.setCenter(o,s.center)};if("number"==typeof s.zoom&&s.zoom!==o.getZoom()){switch(o.getMapTypeId()){case google.maps.MapTypeId.SATELLITE:case google.maps.MapTypeId.HYBRID:const e=GMapsUtils.toLiteral(o.getCenter());this.getMaxAvailableZoom(e).then(e=>{const t=Math.min(e,s.zoom);o.setZoom(t),n()});break;default:const t=Math.min(V.MAX_ROADMAP_ZOOM,s.zoom);o.setZoom(t),n()}}else n()}propertyChangedCallback(e,t,s,o){if(super.propertyChangedCallback(e,t,s,o),!o)switch(e){case"libraries":case"apiKey":case"language":case"region":this.#P&&this._bootstrapDebounced();break;case"defaultOptions":for(let e of this.enrolledMaps())this._updateMapOptions(e);break;default:for(let e of this.enrolledMaps())this.invalidateSize(e)}}dispose(e){const t=this.#v.get(e);for(;t.length;)google.maps.event.removeListener(t.pop());this.#v.delete(e)}_updateMapOptions(e){if(!this.hasMap(e))return;const{map:t}=this.tryGetMap(e);t.setOptions(this._buildMapOptions(e))}_buildMapOptions(e){const s=e.scale,o=e.draggable,r=e.doubleClickZoom,a=e.keyboardShortcuts,{type:n,theme:i}=J({type:e.type,theme:e.theme});return t.Utils.extend({},this.defaultOptions||{streetViewControl:!1,zoomControl:!1,mapTypeControl:!1,fullscreenControl:!1,cameraControl:!1},{zoomControl:s&&!t.Utils.isNullOrEmpty(e.zoomControl),zoomControlOptions:{position:function(e){switch(e){case"topright":return google.maps.ControlPosition.RIGHT_TOP;case"bottomleft":return google.maps.ControlPosition.LEFT_BOTTOM;case"bottomright":return google.maps.ControlPosition.RIGHT_BOTTOM;default:return google.maps.ControlPosition.LEFT_TOP}}(e.zoomControl)},scrollwheel:e.mousewheel,disableDoubleClickZoom:r,keyboardShortcuts:a,draggable:o,mapTypeId:n,colorScheme:i,tilt:e.tilt,heading:e.heading})}#P=!1;_bootstrapDebounced(){this._bootstrap().then(e=>{for(let e of this.enrolledMaps())e.adapter=null,e.adapter=this})}_bootstrap(){return new Promise((e,t)=>{const s=this.apiKey,o=this.language||"",r=this.region||"",a=this.version||"weekly";$.boostrap(s,o,r,a).then(s=>{const o=[];for(let e of this.libraries||[])o.push(google.maps.importLibrary(e));Promise.all(o).then(t=>{e(),this.#P=!0},t)},t)})}async init(e){await this._bootstrap();const t=e,s=MapUtils.parseCoords(t.center),o=new google.maps.LatLng(s[0],s[1]),r=this._buildMapOptions(t),a=t.container,n=document.createElement("div");n.style.width="100%",n.style.height="100%",a.innerHTML="",a.appendChild(n);const i=new google.maps.Map(n,r),l=[];this.#v.set(t,l),Y.forEach(e=>{l.push(i.addListener(e,this._spinMapUpdateHandler(t,i)))}),i.setZoom(t.zoom),i.setCenter(o);var p=i.addListener("idle",function(t){p.remove(),e.dispatchEvent(new MapEvent("maploaded"))});l.push(i.addListener("tilesloaded",t=>{e.dispatchEvent(new MapEvent("tilesloaded"))}));const d=MapUtils.parseCoords(t.center),c=new google.maps.LatLng(d[0],d[1]);return i.setZoom(t.zoom),i.setCenter(c),{map:i,container:n}}invalidateSize(e){if(!this.hasMap(e))return;const{map:t}=this.tryGetMap(e);google.maps.event.trigger(t,"resize")}_spinMapUpdateHandler(e,s){return()=>{if(!t.Utils.isNull(s)&&!t.Utils.isNull(e)){const o=s.getCenter();if(t.Utils.isNull(o))return;this.updateMapElement(e,{center:{lat:o.lat(),lng:o.lng()},zoom:s.getZoom(),type:s.getMapTypeId(),tilt:s.getTilt(),heading:s.getHeading()})}}}fitBoundsNative(e,s,o=this._getPadding(e)){const r=this.tryGetMap(e)?.map;if(t.Utils.isNull(r))return;const a=GMapsUtils.getBounds(s);GMapsUtils.fitBounds(r,a,o)}_getPadding(e){const t=e.paddingTop||0,s=e.paddingLeft||0,o=e.paddingRight||0,r=e.paddingBottom||0;return s||t||o||r?{top:t,bottom:r,left:s,right:o}:null}_padBounds(e){const t=e.paddingTop||0,s=e.paddingLeft||0,o=e.paddingRight||0,r=e.paddingBottom||0;if(s||t||o||r){const a=this.tryGetMap(e).map,n=a.getBounds(),i=a.getDiv().clientWidth,l=a.getDiv().clientHeight,p=a.getProjection().fromPointToLatLng(new google.maps.Point(-s,-t)),d=a.getProjection().fromPointToLatLng(new google.maps.Point(i+o,l+r));n.extend(p),n.extend(d)}}_redrawMap(){}};K([t.Watch({emit:!1,converter:t.PropertyConverters.String})],Q.prototype,"apiKey",void 0),K([t.Watch({emit:!1,converter:t.PropertyConverters.String})],Q.prototype,"version",void 0),K([t.Watch({emit:!1,converter:t.PropertyConverters.String})],Q.prototype,"language",void 0),K([t.Watch({emit:!1,converter:t.PropertyConverters.String})],Q.prototype,"region",void 0),K([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],Q.prototype,"defaultOptions",void 0),K([t.Watch({emit:!1,converter:t.PropertyConverters.StringArray})],Q.prototype,"libraries",void 0),K([t.Debounce(V.DETACH_TIMEOUT)],Q.prototype,"_bootstrapDebounced",null),Q=K([t.CustomElement({tagName:t.P+"-map-adapter-google"})],Q);class PacemGoogleMapGeocoder{constructor(e,t="",s="",o="weekly"){this.apiKey=e,this.language=t,this.region=s,this.version=o}_elevateResults(e){return new Promise((t,s)=>{(new google.maps.ElevationService).getElevationForLocations({locations:e.map(e=>e.geometry.location)},(s,o)=>{if(o===google.maps.ElevationStatus.OK){const o=GMapsUtils.mapGeocodeResults(e,s);t(o)}else{const s=GMapsUtils.mapGeocodeResults(e);t(s)}})})}geocode(e,t=10){return new Promise((s,o)=>{$.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(r=>{(new google.maps.Geocoder).geocode({address:e},(e,r)=>{if(r===google.maps.GeocoderStatus.OK||r==google.maps.GeocoderStatus.ZERO_RESULTS){const o=(e||[]).filter((e,s)=>s<(t||10));this._elevateResults(o).then(s)}else o(r)})},o)})}_reverseGeocodeInternal(e,t){const s=GMapsUtils.getPosition(e);return new Promise((e,o)=>{$.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(r=>{(new google.maps.Geocoder).geocode({location:s},(s,r)=>{if(r===google.maps.GeocoderStatus.OK||r==google.maps.GeocoderStatus.ZERO_RESULTS){const o=(s||[]).filter((e,s)=>s<(t||10));this._elevateResults(o).then(e)}else o(r)})},o)})}reverseGeocode(e,t=1){return this._reverseGeocodeInternal(e,t)}}var X=Object.freeze({__proto__:null,LatLngBoundsConverter:g,LatLngConverter:u,LayerLoadEventName:H,get MapColorScheme(){return l},MapConsts:h,MapEvent:MapEvent,MapItemAdapter:MapItemAdapter,MapRelevantElement:MapRelevantElement,get MapType(){return i},MapUtils:MapUtils,get PacemAzureMapAdapterElement(){return B},get PacemGoogleMapAdapterElement(){return Q},PacemLayerAdapter:PacemLayerAdapter,get PacemLeafletMapAdapterElement(){return q},PacemMapAdapterElement:PacemMapAdapterElement,get PacemMapCircleElement(){return w},get PacemMapElement(){return b},get PacemMapGeocodeElement(){return y},get PacemMapGeolocateElement(){return U},get PacemMapLayerElement(){return f},get PacemMapMarkerElement(){return E},PacemMapOverlayElement:PacemMapOverlayElement,get PacemMapOverlayImageElement(){return v},get PacemMapPolygonElement(){return P},get PacemMapPolylineElement(){return M},PacemMapShapeElement:PacemMapShapeElement,PacemMarkerAdapter:PacemMarkerAdapter,PacemOverlayAdapter:PacemOverlayAdapter,PacemShapeAdapter:PacemShapeAdapter,isLatLng:function(e){return LatLng.isLatLng(e)},isLatLngBounds:function(e){return LatLngBounds.isLatLngBounds(e)}}),ee=Object.freeze({__proto__:null,Maps:X}),te=Object.freeze({__proto__:null,Components:ee,Maps:p});e.DeepMerger.merge(te)}(Pacem,Pacem);
7
- //# sourceMappingURL=pacem-maps.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(e,t){"use strict";var r=function(e,t,r,a){var s,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(i=(o<3?s(i):o>3?s(t,r,i):s(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};let a=class PacemAudioElement extends t.PacemEventTarget{constructor(){super(...arguments),this._endedHandler=e=>{this.dispatchEvent(new Event("end"))},this._canPlayHandler=e=>{this.#e=!0,this._autoplay()},this._canPlayThroughHandler=e=>{this.#t=!0,this._autoplay()}}#r;#e;#t;connectedCallback(){super.connectedCallback();const e=this.#r=new Audio;e.addEventListener("canplay",this._canPlayHandler,!1),e.addEventListener("ended",this._endedHandler,!1),e.addEventListener("canplaythrough",this._canPlayThroughHandler,!1)}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a&&"src"===e)this._init()}viewActivatedCallback(){super.viewActivatedCallback(),this._init()}disconnectedCallback(){const e=this.#r;e.removeEventListener("ended",this._endedHandler,!1),e.removeEventListener("canplaythrough",this._canPlayThroughHandler,!1),e.removeEventListener("canplay",this._canPlayHandler,!1),super.disconnectedCallback()}play(){return this.disabled?Promise.reject("disabled"):this.#r.play().then(e=>{this.dispatchEvent(new Event("start"))},e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))})}pause(){this.#r.pause()}reset(){this.#r.load()}get _canPlay(){return this.stream&&this.#e||this.#t}_autoplay(){this.autoplay&&this._canPlay&&this.play()}_init(e=this.src){const t=this.#r;this.#e=this.#t=!1,t.src=e}};r([t.Watch({emit:!1,converter:t.PropertyConverters.String})],a.prototype,"src",void 0),r([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],a.prototype,"stream",void 0),r([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],a.prototype,"autoplay",void 0),a=r([t.CustomElement({tagName:t.P+"-audio"})],a);var s=function(e,t,r,a){var s,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(i=(o<3?s(i):o>3?s(t,r,i):s(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};const o="video/mp4",i=["start","stop","dataavailable","pause","resume","error","warning"];let c=class PacemMediaRecorderElement extends t.PacemEventTarget{constructor(){super(...arguments),this._recorderLifecycleHandler=e=>{switch(this.state=this.#a.state,e.type){case"start":this.output=null;break;case"stop":this.flush();break;case"dataavailable":var t=e;this.#s.push(t.data)}},this.#a=null,this.#s=[]}viewActivatedCallback(){super.viewActivatedCallback(),this._setupMediaRecorder()}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a)switch(e){case"source":case"fps":case"mimeType":case"audioBitsPerSecond":case"videoBitsPerSecond":this._setupMediaRecorder()}}disconnectedCallback(){this._closeMediaRecorder(),super.disconnectedCallback()}#a;#s;_setupMediaRecorder(e=this.source,r={mimeType:this.mimeType||o,audioBitsPerSecond:this.audioBitsPerSecond??128e3,videoBitsPerSecond:this.videoBitsPerSecond??25e5}){if(this._closeMediaRecorder(),!t.Utils.isNull(e)){if((a=e)instanceof HTMLCanvasElement||"captureStream"in a&&"function"==typeof a.captureStream){const t=this.fps||25;e=e.captureStream(t)}try{this.#a=new MediaRecorder(e,r)}catch(e){console.error(e)}const t=this.#a;i.forEach(e=>{t.addEventListener(e,this._recorderLifecycleHandler,!1)})}var a}_closeMediaRecorder(){const e=this.#a;t.Utils.isNull(e)||("inactive"!==e.state&&e.stop(),i.forEach(t=>{e.removeEventListener(t,this._recorderLifecycleHandler,!1)}),this.#a=null)}flush(){const e=new Blob(this.#s,{type:this.mimeType||o});this.#s=[],this.output=e}start(){const e=this.#a;t.Utils.isNull(e)||"inactive"!==e.state||e.start()}stop(){const e=this.#a;t.Utils.isNull(e)||"inactive"===e.state||e.stop()}resume(){const e=this.#a;t.Utils.isNull(e)||"paused"!==e.state||e.start()}pause(){const e=this.#a;t.Utils.isNull(e)||"paused"===e.state||e.pause()}};s([t.Watch({emit:!1,converter:t.PropertyConverters.Element})],c.prototype,"source",void 0),s([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],c.prototype,"fps",void 0),s([t.Watch({emit:!1,converter:t.PropertyConverters.String})],c.prototype,"mimeType",void 0),s([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],c.prototype,"audioBitsPerSecond",void 0),s([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],c.prototype,"videoBitsPerSecond",void 0),s([t.Watch({converter:t.PropertyConverters.String})],c.prototype,"state",void 0),s([t.Watch()],c.prototype,"output",void 0),c=s([t.CustomElement({tagName:t.P+"-media-recorder"})],c);var n=Object.freeze({__proto__:null,get PacemAudioElement(){return a},get PacemMediaRecorderElement(){return c}}),l=Object.freeze({__proto__:null,Media:n}),d=Object.freeze({__proto__:null,Components:l});e.DeepMerger.merge(d)}(Pacem,Pacem);
7
- //# sourceMappingURL=pacem-media.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(e,t){"use strict";var n=function(e,t,n,s){var r,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,s);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o};const s="https://cdn.jsdelivr.net/npm/@microsoft/signalr@10.0.0/dist/browser/signalr.min.js";let r=class PacemHubListenerElement extends t.Components.PacemItemElement{constructor(){super(...arguments),this._receiveHandler=(...e)=>{this.dispatchEvent(new CustomEvent("receive",{detail:Array.from(e)}))},this._completeHandler=()=>{this.dispatchEvent(new Event("complete"))},this._errorHandler=e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))},this._connectedHandler=e=>{"connected"===e.detail.propertyName&&!0===e.detail.currentValue&&this._start()}}#e;get _isConnected(){return this.container instanceof i&&this.container.connected||!1}get _connection(){return this.container instanceof i&&this.container.connection||null}start(){this.disabled||this._start()}stop(){this._stop()}_stop(e=this.method,n=this.stream){if(!this._isConnected)return;const s=this._connection;t.Utils.isNullOrEmpty(e)||(n?this.#e?.dispose():s.off(e,this._receiveHandler))}_start(e=this.method,n=this.stream){if(!this._isConnected)return;const s=this._connection;if(!t.Utils.isNullOrEmpty(e))if(n){const t=this.arguments||[],n=signalR.HubConnection.prototype.stream.apply(s,[e].concat(t));this.#e=n.subscribe({next:this._receiveHandler,complete:this._completeHandler,error:this._errorHandler})}else s.on(e,this._receiveHandler)}viewActivatedCallback(){super.viewActivatedCallback();const e=this.container;t.Utils.isNull(e)||e.addEventListener(t.PropertyChangeEventName,this._connectedHandler,!1),this.start()}disconnectedCallback(){const e=this.container;t.Utils.isNull(e)||e.removeEventListener(t.PropertyChangeEventName,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,n,s,r){switch(super.propertyChangedCallback(e,n,s,r),e){case"arguments":this._stop(),this._start();break;case"method":t.Utils.isNullOrEmpty(n)||this._stop(n,this.stream),t.Utils.isNullOrEmpty(s)||this._start(s,this.stream);break;case"stream":const e=this.method;t.Utils.isNullOrEmpty(e)||(this._stop(e,n),this._start(e,s));break;case"disabled":if(!t.Utils.isNullOrEmpty(this.method)){(s?this._stop:this._start)()}}}};n([t.Watch({emit:!1,converter:t.PropertyConverters.String})],r.prototype,"method",void 0),n([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],r.prototype,"stream",void 0),n([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],r.prototype,"arguments",void 0),r=n([t.CustomElement({tagName:t.P+"-hub-listener"})],r);let i=class PacemHubProxyElement extends t.Components.PacemItemsContainerElement{validate(e){return e instanceof r}get connection(){return this._hub}invoke(e,...t){if(this.connected)return this._hub.invoke.apply(this._hub,arguments);throw"Hub is not connected. Cannot call `invoke` method."}send(e,...t){if(this.connected)return this._hub.send(e,...t);throw"Hub is not connected. Cannot call `send` method."}start(){return this._resetProxy()}async stop(){this.connected&&await this._hub.stop()}propertyChangedCallback(e,t,n,s){super.propertyChangedCallback(e,t,n,s),s||"url"!==e&&"disabled"!==e&&"accesstoken"!==e||this._resetProxy()}viewActivatedCallback(){super.viewActivatedCallback(),this.start()}disconnectedCallback(){this.stop(),super.disconnectedCallback()}async _resetProxy(){t.Utils.isNull(this._hub)||await this._hub.stop(),this._setupProxy()}async _initialize(){"signalR"in window||await t.CustomElementUtils.importjs(s)}async _setupProxy(){const e=this.items||[];if(!this.disabled&&!t.Utils.isNullOrEmpty(this.url)){await this._initialize();const t=new signalR.HubConnectionBuilder;t.withUrl(this.url,{accessTokenFactory:()=>this.accesstoken});const n=this._hub=t.build();n.onclose(()=>{for(var t of e)t.stop();this.connected=!1,this._hub=null}),await n.start(),this.connected=!0}}};n([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"url",void 0),n([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"accesstoken",void 0),n([t.Watch({converter:t.PropertyConverters.Boolean})],i.prototype,"connected",void 0),i=n([t.CustomElement({tagName:t.P+"-hub-proxy"})],i);var o=function(e,t,n,s){var r,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,s);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o};let c=class PacemServerSentEventsListenerElement extends t.Components.PacemItemElement{constructor(){super(...arguments),this._receiveHandler=e=>{this.dispatchEvent(new CustomEvent("receive",{detail:e.data}))},this._connectedHandler=e=>{"connected"===e.detail.propertyName&&!0===e.detail.currentValue&&this._start()}}get _isConnected(){return this.container instanceof a&&this.container.connected||!1}get _connection(){return this.container instanceof a&&this.container.eventSource||null}_stop(e=this.method){if(!this._isConnected)return;const n=this._connection;t.Utils.isNullOrEmpty(e)||n.removeEventListener(e,this._receiveHandler)}_start(e=this.method){if(!this._isConnected)return;const n=this._connection;t.Utils.isNullOrEmpty(e)||n.addEventListener(e,this._receiveHandler)}start(){this.disabled||this._start()}stop(){this._stop()}viewActivatedCallback(){super.viewActivatedCallback();const e=this.container;t.Utils.isNull(e)||e.addEventListener(t.PropertyChangeEventName,this._connectedHandler,!1),this.start()}disconnectedCallback(){const e=this.container;t.Utils.isNull(e)||e.removeEventListener(t.PropertyChangeEventName,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,n,s,r){switch(super.propertyChangedCallback(e,n,s,r),e){case"method":t.Utils.isNullOrEmpty(n)||this._stop(n),t.Utils.isNullOrEmpty(s)||this._start(s);break;case"disabled":if(!t.Utils.isNullOrEmpty(this.method)){(s?this._stop:this._start)()}}}};o([t.Watch({emit:!1,converter:t.PropertyConverters.String})],c.prototype,"method",void 0),c=o([t.CustomElement({tagName:t.P+"-sse-listener"})],c);let a=class PacemServerSentEventsProxyElement extends t.Components.PacemItemsContainerElement{constructor(){super(...arguments),this._connectHandler=e=>{this.connected=!0,this.#t.onmessage=this._receiveHandler},this._errorHandler=e=>{this.connected=!1},this._receiveHandler=e=>{this.dispatchEvent(new CustomEvent("receive",{detail:e.data}))}}validate(e){return e instanceof c}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,s){super.propertyChangedCallback(e,t,n,s),s||"url"!==e&&"disabled"!==e||this._restart()}#t;_restart(){this._stop(),this._start()}_start(e=this.url){if(!t.Utils.isNullOrEmpty(e)&&!this.disabled){const t=this.#t=new EventSource(e);t.onopen=this._connectHandler,t.onerror=this._errorHandler}}get eventSource(){return this.#t}_stop(){const e=this.items||[];for(var n of e)n.stop();const s=this.#t;t.Utils.isNull(s)||(s.onopen=null,s.onerror=null,s.onmessage=null,s.close()),this.connected=!1,this.#t=null}};o([t.Watch({emit:!1,converter:t.PropertyConverters.String})],a.prototype,"url",void 0),o([t.Watch({converter:t.PropertyConverters.Boolean})],a.prototype,"connected",void 0),o([t.Debounce(!0)],a.prototype,"_restart",null),a=o([t.CustomElement({tagName:t.P+"-sse-proxy"})],a);var l=Object.freeze({__proto__:null,get PacemHubListenerElement(){return r},get PacemHubProxyElement(){return i},get PacemServerSentEventsListenerElement(){return c},get PacemServerSentEventsProxyElement(){return a}}),h=Object.freeze({__proto__:null,Networking:l}),d=Object.freeze({__proto__:null,Components:h});e.DeepMerger.merge(d)}(Pacem,Pacem);
7
- //# sourceMappingURL=pacem-networking.min.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bessel (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
6
  !function(t){"use strict";class Vector{static unit(t){const e={x:t.x,y:t.y};return this.normalize(e),e}static magSqr(t){return t.x*t.x+t.y*t.y}static mag(t){return Math.sqrt(Vector.magSqr(t))}static normalize(t){const e=Vector.mag(t);if(e<=0)throw"Cannot normalize a vector of length 0.";const r=1/e;t.x*=r,t.y*=r}static from(e,r){return t.Point.subtract(e,r)}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static areClose(t,e){return(e.x-t.x).isCloseTo(0)&&(e.y-t.y).isCloseTo(0)}}class Vertex{constructor(t,e,r=-1){this.x=t,this.y=e,this.index=r}equals(t){return this.x===t.x&&this.y===t.y}}class Triangle{constructor(t,e,r){this.v0=t,this.v1=e,this.v2=r,this.circumCirc=function(t,e,r){const n=t.x,s=t.y,o=e.x,i=e.y,a=r.x,m=r.y,c=2*(n*(i-m)+o*(m-s)+a*(s-i));if(Math.abs(c)<1e-12)return{c:{x:0,y:0},r:1/0};const l=((n*n+s*s)*(i-m)+(o*o+i*i)*(m-s)+(a*a+m*m)*(s-i))/c,u=((n*n+s*s)*(a-o)+(o*o+i*i)*(n-a)+(a*a+m*m)*(o-n))/c;return{c:{x:l,y:u},r:Math.hypot(l-n,u-s)}}(t,e,r)}inCircumcircle(t){const e=this.circumCirc.c.x-t.x,r=this.circumCirc.c.y-t.y;return Math.hypot(e,r)<=this.circumCirc.r+1e-9}}function e(t,e){const r=[];e=e.filter(e=>!e.inCircumcircle(t)||(r.push({v0:e.v0,v1:e.v1}),r.push({v0:e.v1,v1:e.v2}),r.push({v0:e.v2,v1:e.v0}),!1));const n=function(t){const e=[];for(let r=0;r<t.length;++r){let n=!0;for(let e=0;e<t.length;++e)if(r!==e){const s=t[r],o=t[e];if(s.v0.equals(o.v0)&&s.v1.equals(o.v1)||s.v0.equals(o.v1)&&s.v1.equals(o.v0)){n=!1;break}}n&&e.push(t[r])}return e}(r);for(const r of n)e.push(new Triangle(r.v0,r.v1,t));return e}function r(t){if(t.length<3)return[];const r=function(t){let e=1/0,r=1/0,n=-1/0,s=-1/0;for(const o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),s=Math.max(s,o.y);const o=10*(n-e),i=10*(s-r),a=new Vertex(e-o,r-3*i),m=new Vertex(e-o,s+i),c=new Vertex(n+3*o,s+i);return new Triangle(a,m,c)}(t);let n=[r];for(const r of t)n=e(r,n);return n=n.filter(t=>!(t.v0===r.v0||t.v0===r.v1||t.v0===r.v2||t.v1===r.v0||t.v1===r.v1||t.v1===r.v2||t.v2===r.v0||t.v2===r.v1||t.v2===r.v2)),n}class Delaunay{static triangulate(t){return function(t){if(t.length<3)return[];const e=r(t.map((t,e)=>new Vertex(t.x,t.y,e))),n=[];for(const t of e)n.push(t.v0.index,t.v1.index,t.v2.index);return n}(t)}}const n=180/Math.PI,s=2*Math.PI;function o(e){return t.Point.isPoint(e)}let i=class Utils{static slopeRad(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}static slopeRad2(t,e){return(s+Utils.slopeRad(t,e))%s}static slopeDeg(t,e){return Utils.slopeRad(t,e)*n}static slopeDeg2(t,e){return(360+Utils.slopeDeg(t,e))%360}static intersect(e,r,...n){return Array.isArray(e)&&Array.isArray(r)?Utils._intersectSegments(e,r,!0):t.Rect.isRect(e)?Utils._intersectRects(...arguments):"vertices"in e?Utils._mergePolygons(e,r,"intersect")?.polygons??null:null}static boundingBox(t){let e=Number.MAX_VALUE,r=Number.MAX_VALUE,n=-Number.MAX_VALUE,s=-Number.MAX_VALUE;t.length;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),s=Math.max(s,o.y);return{x:e,y:r,width:n-e,height:s-r}}static combinePolygons(t,e,r){return Utils._mergePolygons(t,e,r)}static _mergePolygons(e,r,n){if(t.NullChecker.isNullOrEmpty(e?.vertices)||t.NullChecker.isNullOrEmpty(r?.vertices))return null;const s=e.vertices.filter(t=>Utils.inPolygon(t,r.vertices));if(e.vertices.length==s.length)return{polygons:"intersect"===n?[e]:[r]};const o=r.vertices.filter(t=>Utils.inPolygon(t,e.vertices));if(r.vertices.length===o.length)return{polygons:"intersect"===n?[r]:[e]};const i=Utils.boundingBox(e.vertices),a=Utils.boundingBox(r.vertices),m=Utils.intersect(i,a);if(!("union"===n||t.Rect.isRect(m)&&m.width>0&&m.height>0))return null;const{vertices:c}=e,{vertices:l}=r;if(c.length<3||l.length<3)return null;const u=(t,e,r)=>[t,r[(e+1)%r.length]],f=(t,e)=>t.x===e.x?t.y-e.y:t.x-e.x,h=c.map(u),y=l.map(u),x=c.concat(l),g=new Map,p=t=>{if(!g.has(t)){const e=[];g.set(t,e)}return g.get(t)};let M=!1;for(let e of h){const r=p(e);for(let n of y){const s=p(n),o=Utils.intersect(e,n);t.NullChecker.isNull(o)||(M=!0,x.push(o),r.push(o),s.push(o))}}if(0===s.length&&0===o.length&&!M)return"union"===n?{polygons:[e,r]}:null;const d=[];for(let e of h.concat(y)){const r=p(e);if(t.NullChecker.isNullOrEmpty(r))d.push(e);else{const t=e.concat(r).sort(f);for(let e=0;e<t.length-1;e++)d.push([t[e],t[e+1]])}}var v,b=!1;do{x.sort(f),x.filter((t,e,r)=>0===e||!Utils.areClose(t,r[e-1])),v=Utils.mesh(x);const{vertices:e,triangleIndices:r}=v;b=!1;for(let n=0;n<r.length;n+=3){const s=r[n],o=r[n+1],i=r[n+2],a=e[s],m=e[o],c=e[i],l=[[a,m],[m,c],[c,a]];for(let e of d)for(let r of l){const n=Utils.areClose(r[0],e[0])||Utils.areClose(r[1],e[1])||Utils.areClose(r[0],e[1])||Utils.areClose(r[1],e[0])?null:Utils.intersect(r,e);t.NullChecker.isNull(n)||-1!==x.findIndex(t=>Utils.areClose(t,n,4))||(b=!0,x.push(n))}}}while(b);const{vertices:w,triangleIndices:z}=v,U=[];for(let t=0;t<z.length;t+=3){const e=t+1,r=t+2,s=w[z[t]],o=w[z[e]],i=w[z[r]],a={x:(s.x+o.x+i.x)/3,y:(s.y+o.y+i.y)/3},m=Utils.inPolygon(a,c),u=Utils.inPolygon(a,l);(m&&u&&"intersect"===n||(m||u)&&"union"===n||(m&&!u||!m&&u)&&"difference"===n)&&U.push([s,o,i])}const D=U.flatMap(([t,e,r])=>[[t,e],[e,r],[r,t]]),C=[];for(let t=0;t<D.length;t++){const e=D[t];if(0==t){C.push(e);continue}const r=C.findIndex(t=>Utils.areClose(t[0],e[0])&&Utils.areClose(t[1],e[1])||Utils.areClose(t[0],e[1])&&Utils.areClose(t[1],e[0]));-1===r?C.push(e):C.splice(r,1)}if(C.length<3)return null;const A=[],N=t=>{const{length:e}=t,r=Utils.areClose(t[0],t[e-1]),n=t.slice(0,r?e-1:e);return n.length>3&&Utils.inSegment(n[0],[n[1],n[n.length-1]])&&n.shift(),n},[V,_]=C.shift(),P=[V,_];for(;C.length>1;){const t=P[P.length-1],e=C.findIndex(e=>Utils.areClose(e[0],t)||Utils.areClose(e[1],t));if(-1===e){A.push({vertices:N(P.splice(0))});const[t,e]=C.shift();P.push(t,e)}else{const[r]=C.splice(e,1),n=Utils.areClose(r[0],t)?r[1]:Utils.areClose(r[1],t)?r[0]:null;P.length>1&&Utils.inSegment(P[P.length-1],[P[P.length-2],n])?P.splice(P.length-1,1,n):P.push(n)}}return A.push({vertices:N(P)}),{polygons:A,mesh:v,triangles:U.map(t=>({vertices:t}))}}static mesh(t,...e){const r=[].concat(t).concat(e);return{vertices:r,triangleIndices:Delaunay.triangulate(r)}}static intersectLines(t,e,r,n){let s,o;if(Array.isArray(t)&&Array.isArray(e)&&2===t.length&&2===e.length&&"number"==typeof t[0]&&"number"==typeof e[0]&&"number"==typeof t[1]&&"number"==typeof e[1]&&(r=e[0],n=e[1],e=t[1],t=t[0]),"number"==typeof t&&"number"==typeof e){s=[{x:0,y:e},{x:1,y:t+e}],o=[{x:0,y:n},{x:1,y:r+n}]}else s=t,o=e;return Utils._intersectSegments(s,o,!1)}static cramer(t,e){Array.isArray(t)&&(t={a:t[0],b:t[1],c:t[2]}),Array.isArray(e)&&(e={a:e[0],b:e[1],c:e[2]});let r=(t.b*e.c-t.c*e.b)/(t.b*e.a-t.a*e.b),n=(t.c*e.a-t.a*e.c)/(t.b*e.a-t.a*e.b);return{x:-r.roundoff(),y:-n.roundoff()}}static mq(t,e){let r;if(o(t)?r=t:(r=t[0],e=t[1]),r.x===e.x)return[Number.NaN,Number.NaN];const n=(e.y-r.y)/(e.x-r.x);return[n,r.y-n*r.x]}static _intersectSegments(t,e,r){const n=t[0],s=t[1],o=e[0],i=e[1],a=Math.min(n.x,s.x),m=Math.min(n.y,s.y),c=Math.max(n.x,s.x),l=c-a,u=Math.max(n.y,s.y),f=u-m,h=Math.min(o.x,i.x),y=Math.min(o.y,i.y),x=Math.max(o.x,i.x),g=x-h,p=Math.max(o.y,i.y),M=p-y;if(0===l&&0===g)return null;if(0===f&&0===M)return null;const d=t=>t.x<h||t.x>x||t.x<a||t.x>c,v=t=>t.y<y||t.y>p||t.y<m||t.y>u;var b=null;if(0===l){if(r&&(h>a||x<c))return null;const t=Utils.mq(o,i);b=Utils.cramer([1,0,-a],[t[0],-1,t[1]]),r&&v(b)&&(b=null)}else if(0===g){if(r&&(a>h||c<x))return null;const t=Utils.mq(n,s);b=Utils.cramer([t[0],-1,t[1]],[1,0,-h]),r&&v(b)&&(b=null)}else if(0===f){if(r&&(y>m||p<u))return null;const t=Utils.mq(o,i);b=Utils.cramer([0,1,-m],[t[0],-1,t[1]]),r&&d(b)&&(b=null)}else if(0===M){if(r&&(m>y||u<p))return null;const t=Utils.mq(n,s);b=Utils.cramer([t[0],-1,t[1]],[0,1,-y]),r&&d(b)&&(b=null)}else{let t;if(!r||(t=Utils._intersectRects({x:a,y:m,width:l,height:f},{x:h,y:y,width:g,height:M}))&&t.width>0&&t.height>0){const e=Utils.mq(n,s),a=Utils.mq(o,i),m=e[0],c=a[0],l=e[1],u=a[1];if(m!==c){let e=(b=Utils.cramer([m,-1,l],[c,-1,u])).x,n=b.y;r&&(e<t.x||e>t.x+t.width||n<t.y||n>t.y+t.height)&&(b=null)}}}return null===b?null:{x:b.x,y:b.y}}static _intersectRects(...e){return t.Rect.intersect(...e)}static _areClose(t,e,r=12){return Math.abs(t.x-e.x).isCloseTo(0,r)&&Math.abs(t.y-e.y).isCloseTo(0,r)}static areClose(t,e,r=12){return Utils._areClose(t,e,r)}static dot(t,e){return Vector.dot(t,e)}static cross(t,e){return Vector.cross(t,e)}static distance(e,r){if(null!=(n=e)&&Array.isArray(n)&&2===n.length&&o(n[0])&&o(n[1]))return t.Point.distance(e[0],e[1]);if(o(r))return t.Point.distance(e,r);{const t=r[0],n=r[1];return Math.abs(t*e.x-e.y+n)/Math.sqrt(Math.pow(t,2)+1)}var n}static _pointSegmentDistance(t,e){const r=Vector.from(e[0],e[1]),n=Vector.from(e[0],t);return Utils.cross(r,n)}static isWithin(t,e,r,n=12){const s=Utils._pointSegmentDistance(t,e);return!s.isCloseTo(0,n)&&(r?s<0:s>0)}static isBeyond(t,e,r,n=12){return Utils.isWithin(t,e,!r,n)}static inLine(t,e,r=12){return Utils._pointSegmentDistance(t,e).isCloseTo(0,r)}static inSegment(t,e,r=12){const n=Math.min(e[0].x,e[1].x),s=Math.max(e[0].x,e[1].x),o=Math.min(e[0].y,e[1].y),i=Math.max(e[0].y,e[1].y);return t.x>=n&&t.x<=s&&t.y>=o&&t.y<=i&&Utils.inLine(t,e,r)}static inTriangle(e,r){let n;for(let s=0;s<3;s++){const o=r[s],i=r[(s+1)%3],a=t.Point.subtract(i,e),m=t.Point.subtract(o,e),c=Utils.cross(a,m);if(s>0&&c*n<=0)return!1;n=c}return!0}static inPolygon(t,e,r=12){if(!(e?.length>=3))throw"Not enough vertices";const n=e.length;if(3===n)return Utils.inTriangle(t,[e[0],e[1],e[2]]);r>0&&(e=e.map(t=>({x:t.x.roundoff(r),y:t.y.roundoff(r)})),t={x:t.x.roundoff(r),y:t.y.roundoff(r)});let s=Number.MAX_VALUE,o=Number.MAX_VALUE,i=Number.MIN_VALUE,a=Number.MIN_VALUE;for(let t=0;t<n;t++){const r=e[t];s=Math.min(s,r.x),o=Math.min(o,r.y),i=Math.max(i,r.x),a=Math.max(a,r.y)}if(t.x<s||t.x>i||t.y<o||t.y>a)return!1;const m=[{x:s-1,y:t.y},t];let c=0;for(let r=0;r<n;r++){const s=e[r],o=e[(r+1)%n],i=[s,o];if(s.y===t.y){const i=e[(r-1+n)%n];t.x>s.x&&(i.y-t.y)*(o.y-t.y)<0&&c++}else{if(o.y===t.y)continue;null!=Utils.intersect(i,m)&&c++}}return c%2==1}static area(t,...e){const r=[].concat(t).concat(e);let n=0;const s=r.length;if(s>=3){for(let t=0;t<r.length;t++){const{x:e,y:o}=r[t],i=t===s-1?0:t+1,{x:a,y:m}=r[i];n+=e*m-o*a}n*=.5}return Math.abs(n.roundoff())}static convexHull(t,...e){const r=[].concat(t).concat(e);if(!(r?.length>1))return r?.slice()??[];const n=r.map(t=>({x:t.x,y:t.y})).sort((t,e)=>t.x===e.x?t.y-e.y:t.x-e.x),s=[];for(const t of n){const e=s[s.length-1];e&&e.x===t.x&&e.y===t.y||s.push(t)}if(s.length<=2)return s;const o=(t,e,r)=>(e.x-t.x)*(r.y-t.y)-(e.y-t.y)*(r.x-t.x),i=[];for(const t of s){for(;i.length>=2&&o(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}const a=[];for(let t=s.length-1;t>=0;t--){const e=s[t];for(;a.length>=2&&o(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}return i.pop(),a.pop(),i.concat(a)}};class Polygon{static{this._eps=1e-12}static isPolygon(e){return function(e){let r;return"vertices"in e&&Array.isArray(e.vertices)&&(r=e.vertices).length>=3&&r.every(e=>t.Point.isPoint(e))}(e)}static from(...t){return{vertices:Array.from(t)}}static contains(t,e){return i.inPolygon(e,t.vertices,12)}static centroid(t){const e=Polygon.boundingBox(t);return{x:e.x+e.width/2,y:e.y+e.height/2}}static boundingBox(t){return i.boundingBox(t.vertices)}static sides(t){const{vertices:e}=t,r=[];for(let t=1;t<=e.length;t++){const n=e[t%e.length],s=e[t-1];r.push([s,n])}return r}static isConvex(e){const{vertices:r}=e,n=r.length;if(n<=3)return!0;let s=0;for(let e=0;e<r.length;e++){const o=r[(e-1+n)%n],i=r[e],a=r[(e+1)%n],m=t.Angle.angleBetween(i,o,a);if(0!==s){if(s!=Math.sign(m))return!1}else s=Math.sign(m)}return!0}static isSelfIntersecting(e){const{vertices:r}=e;if(r.length<=3)return!1;const n=Polygon.sides(e);for(let e of n)for(let r of n){if(r===e||r[0]===e[1]||e[0]===r[1])continue;const n=i.intersect(r,e);if(!t.NullChecker.isNull(n))return!0}return!1}static isCounterClockwise(e){const{vertices:[r,n,s]}=e;return t.Angle.angleBetween(n,r,s)>0}static expand(e,r){const{vertices:n}=e,s=n.length,o=[];for(let e=0;e<n.length;e++){const i=n[(e-1+s)%s],a=n[e],m=n[(e+1)%s],c=t.Angle.angleBetween(a,i,m),l=-r/Math.sin(Math.abs(c)/2),u=t.Matrix2D.scale(t.Matrix2D.identity,l),f=t.Point.subtract(a,i);Vector.normalize(f);const h=t.Point.subtract(a,m);Vector.normalize(h);const y=t.Point.add(f,h);Vector.normalize(y);const x=t.Matrix2D.multiply(y,u);o.push(t.Point.add(a,{x:x.x.roundoff(),y:x.y.roundoff()}))}return{vertices:o}}static area(t){return i.area(t.vertices)}static intersect(t,e){return i.intersect(t,e)}static convexHull(t){return{vertices:i.convexHull(t.vertices)}}}const a=180/Math.PI,m=1/a;class Vector3D{static from(...t){if(3!==t.length)throw new RangeError("Must provide exactly 3 numbers");return{x:t[0],y:t[1],z:t[2]}}static parse(e){const r=t.parseAsNumericalArray(e);if(r&&3===r.length)return Vector3D.from.apply(null,r);throw new Error(`Cannot parse "${e}" as a valid Vector3D.`)}static i(){return{x:1,y:0,z:0}}static j(){return{x:0,y:1,z:0}}static k(){return{x:0,y:0,z:1}}static zero(){return{x:0,y:0,z:0}}static subtract(t,e){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}static add(...t){var e={x:0,y:0,z:0};for(var r of t)e.x+=r.x,e.y+=r.y,e.z+=r.z;return e}static dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}static cross(t,e){return{x:t.y*e.z-t.z*e.y,y:t.z*e.x-t.x*e.z,z:t.x*e.y-t.y*e.x}}static scale(t,e,r=e,n=e){return{x:t.x*e,y:t.y*r,z:t.z*n}}static magSqr(t){return t.x*t.x+t.y*t.y+t.z*t.z}static areClose(t,e){return(e.x-t.x).isCloseTo(0)&&(e.y-t.y).isCloseTo(0)&&(e.z-t.z).isCloseTo(0)}static mag(t){return Math.sqrt(Vector3D.magSqr(t))}static negate(t){return{x:-t.x,y:-t.y,z:-t.z}}static unit(t){const e={x:t.x,y:t.y,z:t.z};return this.normalize(e),e}static normalize(t){const e=Vector3D.mag(t);if(e<=0)throw"Cannot normalize a vector of length 0.";const r=1/e;t.x*=r,t.y*=r,t.z*=r}static angleBetween(t,e){let r;const n=Vector3D.unit(t),s=Vector3D.unit(e);if(Vector3D.dot(n,s)<0){const t={x:-n.x-s.x,y:-n.y-s.y,z:-n.z-s.z},e=Vector3D.mag(t);r=Math.PI-2*Math.asin(e/2)}else{const t={x:n.x-s.x,y:n.y-s.y,z:n.z-s.z},e=Vector3D.mag(t);r=2*Math.asin(e/2)}return a*r}}class Spherical{static from(t,e,r){return{rho:t.clamp(0,1/0),theta:e.clamp(-180,180),phi:r.clamp(0,360)}}static fromVector(t,e,r){"number"==typeof t&&(t=Vector3D.from(t,e,r));const n=Vector3D.mag(t);if(n.isCloseTo(0))return Spherical.from(0,0,0);const s=Math.atan2(t.x,t.z),o=Math.acos((t.y/n).clamp(-1,1));return Spherical.from(n,s*a,o*a)}static toVector(t){const{rho:e,theta:r,phi:n}=t,s=n*m,o=r*m,i=Math.sin(s)*e;return{x:i*Math.sin(o),y:Math.cos(s)*e,z:i*Math.cos(o)}}static toRotationMatrix(t){const{theta:e,phi:r}=t,n=m*e,s=Math.sin(n),o=Math.cos(n),i=m*r,a=Math.sin(i),c=Math.cos(i);return Matrix3D.from(s*c,s*a,o,0,o*c,o*a,-s,0,-a,c,0,0,0,0,0,1)}}class Matrix3DUtils{static modify(t,e){const{m11:r,m12:n,m13:s,m14:o,m21:i,m22:a,m23:m,m24:c,m31:l,m32:u,m33:f,m34:h,offsetX:y,offsetY:x,offsetZ:g,m44:p}=t,M={m11:r,m12:n,m13:s,m14:o,m21:i,m22:a,m23:m,m24:c,m31:l,m32:u,m33:f,m34:h,offsetX:y,offsetY:x,offsetZ:g,m44:p};return e(M),M}static clone(t){return Matrix3DUtils.modify(t,t=>{})}static multiply(t,e){return Matrix3D.isIdentity(t)?e:Matrix3D.isIdentity(e)?t:Matrix3D.from(t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.offsetX,t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.offsetY,t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.offsetZ,t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.offsetX,t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.offsetY,t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.offsetZ,t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.offsetX,t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.offsetY,t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.offsetZ,t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,t.offsetX*e.m11+t.offsetY*e.m21+t.offsetZ*e.m31+t.m44*e.offsetX,t.offsetX*e.m12+t.offsetY*e.m22+t.offsetZ*e.m32+t.m44*e.offsetY,t.offsetX*e.m13+t.offsetY*e.m23+t.offsetZ*e.m33+t.m44*e.offsetZ,t.offsetX*e.m14+t.offsetY*e.m24+t.offsetZ*e.m34+t.m44*e.m44)}}class Matrix3D{static identity(){return{m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,offsetX:0,offsetY:0,offsetZ:0,m44:1}}static from(...t){if(16!==t.length)throw new RangeError("Must provide exactly 16 numbers");return{m11:t[0],m12:t[1],m13:t[2],m14:t[3],m21:t[4],m22:t[5],m23:t[6],m24:t[7],m31:t[8],m32:t[9],m33:t[10],m34:t[11],offsetX:t[12],offsetY:t[13],offsetZ:t[14],m44:t[15]}}static transpose(t){return Matrix3D.from(t.m11,t.m21,t.m31,t.offsetX,t.m12,t.m22,t.m32,t.offsetY,t.m13,t.m23,t.m33,t.offsetZ,t.m14,t.m24,t.m34,t.m44)}static toArray(t){return[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.offsetX,t.offsetY,t.offsetZ,t.m44]}static clone(t,e){return"function"==typeof e?Matrix3DUtils.modify(t,e):Matrix3DUtils.clone(t)}static scale(t,e,r,n){return"number"==typeof e?(r??=e,n??=e):(n=e.z,r=e.y,e=e.x),Matrix3DUtils.modify(t,t=>{t.m11*=e,t.m22*=r,t.m33*=n})}static translate(t,e){return Matrix3DUtils.modify(t,t=>{t.offsetX+=e.x,t.offsetY+=e.y,t.offsetZ+=e.z})}static parse(e){const r=t.parseAsNumericalArray(e);if(r&&16===r.length)return Matrix3D.from.apply(null,r);throw new Error(`Cannot parse "${e}" as a valid Matrix3D.`)}static isIdentity(t){return 1==t.m11&&0==t.m12&&0==t.m13&&0==t.m14&&0==t.m21&&1==t.m22&&0==t.m23&&0==t.m24&&0==t.m31&&0==t.m32&&1==t.m33&&0==t.m34&&0==t.offsetX&&0==t.offsetY&&0==t.offsetZ&&1==t.m44}static isAffine(t){return 0==t.m14&&0==t.m24&&0==t.m34&&1==t.m44}static determinant(t){if(Matrix3D.isIdentity(t))return 1;if(Matrix3D.isAffine(t))return t.m11*(t.m22*t.m33-t.m32*t.m23)-t.m12*(t.m21*t.m33-t.m31*t.m23)+t.m13*(t.m21*t.m32-t.m31*t.m22);{const e=t.m13*t.m24-t.m23*t.m14,r=t.m13*t.m34-t.m33*t.m14,n=t.m13*t.m44-t.offsetZ*t.m14,s=t.m23*t.m34-t.m33*t.m24,o=t.m23*t.m44-t.offsetZ*t.m24,i=t.m33*t.m44-t.offsetZ*t.m34,a=t.m22*r-t.m32*e-t.m12*s,m=t.m12*o-t.m22*n+t.offsetY*e,c=t.m32*n-t.offsetY*r-t.m12*i,l=t.m22*i-t.m32*o+t.offsetY*s;return t.offsetX*a+t.m31*m+t.m21*c+t.m11*l}}static multiply(...t){if(0===t.length)throw new ReferenceError("Matrix not provided.");const e=Array.from(t);let r=e[0];for(let t=1;t<e.length;t++)r=Matrix3DUtils.multiply(r,e[t]);return r}static invert(t){if(Matrix3D.isAffine(t)){const e=Matrix3D.determinant(t);if(0==e)return null;const r=t.m12*t.m23-t.m22*t.m13,n=t.m32*t.m13-t.m12*t.m33,s=t.m22*t.m33-t.m32*t.m23,o=t.m21*t.m13-t.m11*t.m23,i=t.m11*t.m33-t.m31*t.m13,a=t.m31*t.m23-t.m21*t.m33,m=t.m11*t.m22-t.m21*t.m12,c=t.m11*t.m32-t.m31*t.m12,l=t.m11*t.offsetY-t.offsetX*t.m12,u=t.m21*t.m32-t.m31*t.m22,f=t.m21*t.offsetY-t.offsetX*t.m22,h=t.m31*t.offsetY-t.offsetX*t.m32,y=t.m23*l-t.offsetZ*m-t.m13*f,x=t.m13*h-t.m33*l+t.offsetZ*c,g=t.m33*f-t.offsetZ*u-t.m23*h,p=m,M=-c,d=u,v=1/e;return Matrix3D.from(s*v,n*v,r*v,0,a*v,i*v,o*v,0,d*v,M*v,p*v,0,g*v,x*v,y*v,1)}{const e=Matrix3D.determinant(t);if(0==e)return null;const r=t.m33*t.m44-t.m34*t.offsetZ,n=t.m32*t.m44-t.m34*t.offsetY,s=t.m31*t.m44-t.m34*t.offsetX,o=t.m32*t.offsetZ-t.m33*t.offsetY,i=t.m31*t.offsetZ-t.m33*t.offsetX,a=t.m31*t.offsetY-t.m32*t.offsetX,m=t.m33*t.m44-t.m34*t.offsetZ,c=t.m32*t.m44-t.m34*t.offsetY,l=t.m31*t.m44-t.m34*t.offsetX,u=t.m32*t.offsetZ-t.m33*t.offsetY,f=t.m31*t.offsetZ-t.m33*t.offsetX,h=t.m31*t.offsetY-t.m32*t.offsetX,y=t.m23*t.m44-t.m24*t.offsetZ,x=t.m22*t.m44-t.m24*t.offsetY,g=t.m21*t.m44-t.m24*t.offsetX,p=t.m22*t.offsetZ-t.m23*t.offsetY,M=t.m21*t.offsetZ-t.m23*t.offsetX,d=t.m21*t.offsetY-t.m22*t.offsetX,v=t.m23*t.m34-t.m24*t.m33,b=t.m22*t.m34-t.m24*t.m32,w=t.m21*t.m34-t.m24*t.m31,z=t.m22*t.m33-t.m23*t.m32,U=t.m21*t.m33-t.m23*t.m31,D=t.m21*t.m32-t.m22*t.m31,C=t.m22*r-t.m23*n+t.m24*o,A=-(t.m21*r-t.m23*s+t.m24*i),N=t.m21*n-t.m22*s+t.m24*a,V=-(t.m21*o-t.m22*i+t.m23*a),_=-(t.m12*m-t.m13*c+t.m14*u),P=t.m11*m-t.m13*l+t.m14*f,q=-(t.m11*c-t.m12*l+t.m14*h),X=t.m11*u-t.m12*f+t.m13*h,S=t.m12*y-t.m13*x+t.m14*p,Y=-(t.m11*y-t.m13*g+t.m14*M),Z=t.m11*x-t.m12*g+t.m14*d,E=-(t.m11*p-t.m12*M+t.m13*d),T=-(t.m12*v-t.m13*b+t.m14*z),I=t.m11*v-t.m13*w+t.m14*U,R=-(t.m11*b-t.m12*w+t.m14*D),Q=t.m11*z-t.m12*U+t.m13*D,L=1/e;return Matrix3D.from(C*L,_*L,S*L,T*L,A*L,P*L,Y*L,I*L,N*L,q*L,Z*L,R*L,V*L,X*L,E*L,Q*L)}}static transform(t,e){var r={x:t.x,y:t.y,z:t.z};if(!Matrix3D.isIdentity(e)){var n=r.x,s=r.y,o=r.z;if(r.x=n*e.m11+s*e.m21+o*e.m31+e.offsetX,r.y=n*e.m12+s*e.m22+o*e.m32+e.offsetY,r.z=n*e.m13+s*e.m23+o*e.m33+e.offsetZ,!Matrix3D.isAffine(e)){var i=n*e.m14+s*e.m24+o*e.m34+e.m44;0!=i&&(r.x/=i,r.y/=i,r.z/=i)}}return r}}class Quaternion{static identity(){return Quaternion.from(0,0,0,1)}static from(...t){if(4!==t.length)throw new RangeError("Must provide exactly 4 numbers");return{x:t[0],y:t[1],z:t[2],w:t[3]}}static parse(e){const r=t.parseAsNumericalArray(e);if(r&&4===r.length)return Quaternion.from.apply(null,r);throw new Error(`Cannot parse "${e}" as a valid Quaternion.`)}static fromVectors(t,e){Vector3D.normalize(t),Vector3D.normalize(e);const r=(t,e,r,n)=>{const s=Quaternion.from(t,e,r,n);return Quaternion.normalize(s),s};let n=Vector3D.dot(t,e)+1;return n.isCloseTo(0)?Math.abs(t.x)>Math.abs(t.z)?r(-t.y,t.x,0,0):r(0,-t.z,t.y,0):r(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z,t.x*e.y-t.y*e.x,n)}static normalize(t){const e=Quaternion.mag(t);if(e.isCloseTo(0))t.x=t.y=t.z=0,t.w=1;else{const r=1/e;t.x*=r,t.y*=r,t.z*=r,t.w*=r}}static unit(t){const e=Quaternion.from(t.x,t.y,t.z,t.w);return Quaternion.normalize(e),e}static fromAxisAngle(t,e){var r=m*(e%=360),n=Vector3D.mag(t);if(0==n)throw new RangeError("Invalid argument");var s=Math.sin(.5*r)/n,o=t.x*s,i=t.y*s,a=t.z*s;return Quaternion.from(o,i,a,Math.cos(.5*r))}static fromRotationMatrix(t){const e=t.m11+t.m22+t.m33+t.m44;if(e>0){const r=.5/Math.sqrt(e),n=.25/r,s=(t.m23-t.m32)*r,o=(t.m31-t.m13)*r,i=(t.m12-t.m21)*r;return Quaternion.from(s,o,i,n)}if(t.m11>t.m22&&t.m11>t.m22){const e=.5/Math.sqrt(t.m44+t.m11-t.m22-t.m33),r=(t.m23-t.m32)*e,n=.25/e,s=(t.m12+t.m21)*e,o=(t.m31+t.m13)*e;return Quaternion.from(n,s,o,r)}if(t.m22>t.m33){const e=.5/Math.sqrt(t.m44+t.m22-t.m11-t.m33),r=(t.m23+t.m32)*e,n=.25/e,s=(t.m12+t.m21)*e,o=(t.m31-t.m13)*e;return Quaternion.from(s,n,r,o)}{const e=.5/Math.sqrt(t.m44+t.m33-t.m11-t.m22),r=(t.m23+t.m32)*e,n=.25/e,s=(t.m12-t.m21)*e,o=(t.m31-t.m13)*e;return Quaternion.from(o,r,n,s)}}static conjugate(t){return Quaternion.from(-t.x,-t.y,-t.z,t.w)}static mag(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)}static norm(t){return t.x*t.x+t.y*t.y+t.z*t.z}static axis(t){return 0==t.x&&0==t.y&&0==t.z?Vector3D.j():Vector3D.unit(t)}static transform(t,e){Quaternion.normalize(e);const r=Vector3D.cross(e,t),n=Vector3D.scale(r,2),s=Vector3D.cross(e,n);return{x:t.x+e.w*n.x+s.x,y:t.y+e.w*n.y+s.y,z:t.z+e.w*n.z+s.z}}static angle(t){let e=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z),r=t.w;if(e>Number.MAX_VALUE){const n=Math.max(Math.abs(t.x),Math.max(Math.abs(t.y),Math.abs(t.z))),s=t.x/n,o=t.y/n,i=t.z/n;e=Math.sqrt(s*s+o*o+i*i),r/=n}return 114.59155902616465*Math.atan2(e,r)}static toRotationMatrix(t){var e=Matrix3D.identity(),r=t.x,n=t.y,s=t.z,o=t.w;return e.m11=1-2*n*n-2*s*s,e.m12=2*r*n+2*o*s,e.m13=2*r*s-2*o*n,e.m21=2*r*n-2*o*s,e.m22=1-2*r*r-2*s*s,e.m23=2*n*s+2*o*r,e.m31=2*o*n+2*r*s,e.m32=2*n*s-2*o*r,e.m33=1-2*r*r-2*n*n,e}static invert(t){const e=Quaternion.unit(t);return Quaternion.conjugate(e)}static multiply(t,e){return Quaternion.from(t.w*e.x+t.x+e.w+t.y*e.z-t.z*e.y,t.w*e.y-t.x*e.z+t.y*e.w+t.z*e.x,t.w*e.z+t.x*e.y-t.y*e.x+t.z*e.w,t.w*e.w-t.x*e.x-t.y*e.y-t.z*e.z)}static dot(t,e){return Quaternion.multiply(t,Quaternion.conjugate(e)).w}}var c,l=Object.freeze({__proto__:null,Matrix3D:Matrix3D,Quaternion:Quaternion,Spherical:Spherical,Vector:Vector,Vector3D:Vector3D}),u=Object.freeze({__proto__:null,LinearAlgebra:l,Polygon:Polygon,Utils:i,Utils3D:class Utils3D{static intersect(t,e){const[r,n]=t,s=Vector3D.subtract(r,n),[o,i,a]=e,m=Vector3D.subtract(o,i),c=Vector3D.subtract(o,a),l=Vector3D.cross(s,c),u=Vector3D.dot(m,l);if(u.isCloseTo(0))return null;const f=1/u,h=Vector3D.subtract(r,o),y=f*Vector3D.dot(h,l);if(y<0||y>1)return null;const x=Vector3D.cross(h,m),g=f*Vector3D.dot(s,x);if(g<0||y+g>1)return null;const p=f*Vector3D.dot(c,x);return p<0||p.isCloseTo(0)?null:Vector3D.add(r,Vector3D.scale(s,p))}}});function f(t){return"number"==typeof t&&(t={real:t,img:0}),t}function h(t,e){const r={};return Object.defineProperty(r,"real",{value:t,writable:!1}),Object.defineProperty(r,"img",{value:e,writable:!1}),r}function y(){return c||(c=h(Number.NaN,Number.NaN))}class Complex{static build(t,e){return this.isComplex(t)?t:(e??=0,"number"!=typeof t||"number"!=typeof e?y():h(t,e||0))}static add(t,e){const r=f(t),n=f(e);return h(r.real+n.real,r.img+n.img)}static subtract(t,e){const r=f(t),n=f(e);return h(r.real-n.real,r.img-n.img)}static multiply(t,e){const r=f(t),n=f(e);return h(r.real*n.real-r.img*n.img,r.real*n.img+r.img*n.real)}static divide(t,e){const r=f(t),n=f(e),s=this.absSquare(n).roundoff();if(0===s)return y();const o=1/s;return h(o*(r.real*n.real+r.img*n.img),o*(r.img*n.real-r.real*n.img))}static absSquare(t){const e=f(t);return Math.pow(e.real,2)+Math.pow(e.img,2)}static modulus(t){return Math.sqrt(this.absSquare(t))}static isComplex(t){return null!=t&&"object"==typeof t&&"real"in t&&"img"in t&&"number"==typeof t.real&&"number"==typeof t.img}static conjugate(t){return h((t=f(t)).real,0==Math.abs(t.img)?0:-t.img)}static equals(t,e){const r=this.build(t),n=this.build(e);return!(!this.isComplex(t)||!this.isComplex(e))&&(r.real===n.real&&r.img===n.img)}static get NaC(){return y()}}const x={};function g(t,e){const r=x[e]=x[e]||{};return r[t]=r[t]||function(t,e){const r=2*Math.PI*t/e;return Complex.build(Math.cos(r),Math.sin(r))}(t,e)}function p(t){const e=[],r=t.length;if(1===r)return[Complex.build(t[0])];const n=p(t.filter((t,e)=>e%2==0)),s=p(t.filter((t,e)=>e%2==1));for(var o=0;o<r/2;o++){const t=n[o],i=Complex.multiply(g(o,r),s[o]);e[o]=Complex.add(t,i),e[o+r/2]=Complex.subtract(t,i)}return e}const M=Math.sqrt(Math.PI);class Gaussian{constructor(t,e){this.mean=t,this.stdev=Math.abs(e),this.variance=Math.pow(e,2)}static get normal(){return d}weight(t){return Math.exp(-.5*Math.pow(this._z(t),2))}probabilityDensity(t){const e=this.stdev*Math.SQRT2*M;return this.weight(t)/e}_z(t){return(t-this.mean)/this.stdev}probability(t){return.5*function(t){const e=Math.abs(t),r=1/(1+.5*e),n=r*Math.exp(-e*e-1.26551223+r*(1.00002368+r*(.37409196+r*(.09678418+r*(r*(.27886807+r*(r*(1.48851587+r*(.17087277*r-.82215223))-1.13520398))-.18628806)))));return t>=0?n:2-n}(-this._z(t)/Math.SQRT2)}}const d=new Gaussian(0,1);class Lagrange{constructor(t){this.#t=t}#t;#e=null;_prepareBarycentric(){if(this.#e)return;const t=this.#t||[],e=t.length;if(0===e)return void(this.#e=[]);const r=new Array(e),n=new Array(e);for(let s=0;s<e;s++){let o=0,i=1;const a=t[s].x;for(let r=0;r<e;r++){if(r===s)continue;const e=a-t[r].x;if(0===e)throw new Error("Invalid function provided.");e<0&&(i=-i),o+=Math.log(Math.abs(e))}r[s]=-o,n[s]=i}let s=r[0];for(let t=1;t<e;t++)r[t]>s&&(s=r[t]);const o=new Array(e);for(let t=0;t<e;t++){const e=Math.exp(r[t]-s);o[t]=n[t]*e}this.#e=o}_computeBarycentric(t){const e=this.#t||[];this.#e||this._prepareBarycentric();const r=this.#e||[];let n=0,s=0;for(let o=0;o<e.length;o++){const i=e[o].x;if(t===i)return e[o].y;const a=r[o]/(t-i);n+=a*e[o].y,s+=a}return n/s}interpolate(t){return this._computeBarycentric(t)}static create(...t){const e=(arguments.length>0&&Array.isArray(arguments[0])?arguments[0]:Array.from(t)).map((t,e)=>"number"==typeof t?{x:e,y:t}:t);return new Lagrange(e)}}const v={create:Lagrange.create};class Pchip{constructor(t){if(!t||t.length<2)throw new Error("Need at least 2 points");const e=t.slice().sort((t,e)=>t.x-e.x);this.xs=e.map(t=>t.x),this.ys=e.map(t=>t.y),this.ms=this.computeDerivatives()}computeDerivatives(){const t=this.xs.length,e=new Array(t-1),r=new Array(t-1);for(let n=0;n<t-1;n++)e[n]=this.xs[n+1]-this.xs[n],r[n]=(this.ys[n+1]-this.ys[n])/e[n];const n=new Array(t).fill(0);n[0]=r[0],n[t-1]=r[t-2];for(let s=1;s<t-1;s++){const t=r[s-1],o=r[s];if(0===t||0===o||t*o<=0)n[s]=0;else{const r=2*e[s]+e[s-1],i=e[s]+2*e[s-1];n[s]=(r+i)/(r/t+i/o)}}for(let e=0;e<t-1;e++)if(0===r[e])n[e]=0,n[e+1]=0;else{const t=n[e]/r[e],s=n[e+1]/r[e],o=t*t+s*s;if(o>9){const i=3/Math.sqrt(o);n[e]=i*t*r[e],n[e+1]=i*s*r[e]}}return n}interpolate(t){const e=this.xs,r=this.ys,n=this.ms,s=e.length;if(t<=e[0]){const s=n[0];return r[0]+s*(t-e[0])}if(t>=e[s-1]){const o=n[s-1];return r[s-1]+o*(t-e[s-1])}let o=0,i=s-1;for(;i-o>1;){const r=o+i>>1;e[r]<=t?o=r:i=r}const a=e[o+1]-e[o],m=(t-e[o])/a,c=m*m,l=c*m,u=l-2*c+m,f=-2*l+3*c,h=l-c;return(2*l-3*c+1)*r[o]+u*(n[o]*a)+f*r[o+1]+h*(n[o+1]*a)}static create(...t){const e=(arguments.length>0&&Array.isArray(arguments[0])?arguments[0]:Array.from(t)).map((t,e)=>"number"==typeof t?{x:e,y:t}:t);return new Pchip(e)}}class Newton{constructor(t){if(!t||0===t.length)throw new Error("Need at least 1 point");const e=t.slice().sort((t,e)=>t.x-e.x);this.xs=e.map(t=>t.x);const r=e.length,n=e.map(t=>t.y);for(let t=1;t<r;t++)for(let e=r-1;e>=t;e--){const r=this.xs[e]-this.xs[e-t];if(0===r)throw new Error("Invalid function provided.");n[e]=(n[e]-n[e-1])/r}this.coeffs=n}interpolate(t){const e=this.xs,r=this.coeffs,n=r.length;if(0===n)return NaN;let s=r[n-1];for(let o=n-2;o>=0;o--)s=s*(t-e[o])+r[o];return s}static create(...t){const e=(arguments.length>0&&Array.isArray(arguments[0])?arguments[0]:Array.from(t)).map((t,e)=>"number"==typeof t?{x:e,y:t}:t);return new Newton(e)}}const b=(t,e)=>t;function w(t,e=b){return t.reduce((t,r,n)=>t+e(r,n),0)}function z(t,e=b){return w(t,e)/t.length}function U(t,e=b,r=!1){const n=z(t,e);return t.reduce((t,e)=>Math.pow(e-n,2)+t,0)/(t.length-(r?1:0))}function D(t,e=b,r=!1){const n=U(t,e,r);return Math.sqrt(n)}function C(t,e){return(r,n,s,o)=>{let i=r,a=n,m=t(i,a),c=e(i,a),l=s(m),u=s(c);for(;a-i>o;)l<u?(a=c,c=m,u=l,m=t(i,a),l=s(m)):(i=m,m=c,l=u,c=e(i,a),u=s(c));return.5*(m+c)}}const A={linear:(t=2)=>function(t){if(t<=1)throw new RangeError("segments must be a number grater than 1.");return(e,r,n,s=.001)=>C((e,r)=>e+(r-e)/t,(e,r)=>r-(r-e)/t)(e,r,n,s)}(t),goldenRatio:(t,e,r,n=.001)=>C((t,e)=>e-(e-t)/1.618,(t,e)=>t+(e-t)/1.618)(t,e,r,n),gaussian:(t,e,r,n=.001)=>{var s=null,o=null;const i=(t,e)=>(o??=e-t,s??=o/Math.sqrt(12),s*(e-t)/o);return C((t,e)=>Math.max(t,(e+t)/2-i(t,e)),(t,e)=>Math.min(e,(e+t)/2+i(t,e)))(t,e,r,n)}};var N=Object.freeze({__proto__:null,Fourier:class Fourier{static transform(t,e=!0){return(r=(t=t||[]).length)>0&&!(r&r-1)?this.fft(t,e):this.dft(t,e);var r}static invert(t,e=!0){return this.idft(t||[],e)}static dft(t,e=!0){const r=(t||[])?.length,n=e?1/Math.sqrt(r):1,s=[];for(let e=0;e<r;e++){s.push({real:0,img:0});for(let o=0;o<r;o++){const i=g(e*o,r),a=Complex.multiply(t[o],i),m=Complex.multiply(a,n);s[e]=Complex.add(s[e],m)}}return s}static idft(t,e=!0){const r=t.map(t=>Complex.build(t.img,t.real));return this.transform(r,e).map(t=>Complex.build(t.img,t.real))}static fft(t,e=!0){const r=p(t);if(!e)return r;const n=1/Math.sqrt(t.length);return r.map(t=>Complex.multiply(t,n))}},Gaussian:Gaussian,Lagrange:Lagrange,Lagrangian:v,Newton:Newton,Pchip:Pchip,SearchFunctions:A,Utils:class Utils{static sum(t,e){return w(t,e)}static mean(t,e){return z(t,e)}static median(t,e){return function(t,e=b){const r=t.slice(0),n=r.length;r.sort((t,r)=>e(t)-e(r));const s=Math.ceil(r.length/2)-1;return n%2==1?r[s]:.5*(r[s+1]+r[s])}(t,e)}static mode(t,e){return function(t,e=b){const r=Object.groupBy(t,e);let n,s=0;for(let t in r){const e=r[t].length;e>s&&(n=parseInt(t),s=e)}return n}(t,e)}static var(t,e){return U(t,e,!0)}static varp(t,e){return U(t,e,!1)}static stdevp(t,e){return D(t,e,!1)}static stdev(t,e){return D(t,e,!0)}static correlation(t,e,r,n){return function(t,e,r=b,n=b){const s=Array.isArray(e);if(s&&e.length!==t.length)throw new Error("Sets must be of the same length.");const o=t.length,i=t,a=s?e:t,m=s?r:e,c=s?n:r,l=z(i,m),u=z(a,c);let f=0,h=0,y=0;for(let t=0;t<o;t++){const e=i[t],r=a[t],n=m(e,t)-l,s=c(r,t)-u;f+=n*s,h+=n*n,y+=s*s}return f/Math.sqrt(h*y)}(t,e,r,n)}static linearRegression(t,e,r,n){return function(t,e,r=b,n=b){const s=Array.isArray(e);if(s&&e.length!==t.length)throw new Error("Sets must be of the same length.");const o=t,i=s?e:t,a=s?r:e,m=a??(t=>t.x),c=(s?n:a)??(t=>t.y),l=t.length;let u=0,f=0,h=0,y=0;for(let t=0;t<l;t++){const e=o[t],r=i[t],n=m(e,t),s=c(r,t);u+=n*s,f+=n,h+=s,y+=n*n}const x=(l*u-f*h)/(l*y-Math.pow(f,2));return[x,(h-x*f)/l]}(t,e,r,n)}static gaussian(t,e){return new Gaussian(t,e)}}});const V="0123456789abcdefghijklmnopqrstuvwxyz",_="Radix out of range: possible values go between positive 1 exclusive and 36 inclusive";class Utils{static lcd(...e){if(t.NullChecker.isNullOrEmpty(e)||e.length<=1)throw"Insufficient set of numbers.";function r(t,e){return e?r(e,t%e):0===e?t:NaN}function n(t,e){return t*e/r(t,e)}let s=Math.round(e[0]);for(let t=1;t<e.length;t++)s=n(s,Math.round(e[t]));return s}static gcd(t,e){return t=Math.round(t),e=Math.round(e),0===t?e:Utils.gcd(e%t,t)}static rebaseInt(e,r,n){return t.Numbers.rebase(e,r,n)}static rebaseFloat(t,e,r,n=12){const s=Utils.rebaseFloat10ToN,o=Utils.rebaseFloatNTo10;if(10===e){const e=parseFloat(t.toString());return r%1==0?Utils.rebaseFloat10ToNIntBase(e,r,n):s(e,r,n)}if(10===r)return o(t.toString(),e,n);return s(o(t.toString(),e,n+1),r,n)}static rebaseFloatNTo10(t,e,r=12){const n=V;if(e<=1||e>n.length)throw new Error(_);const s=(t??"0").toString().toLowerCase(),o=Number.NaN;if("0"===s)return 0;const i=/^([-+]?) *([\da-z]+)?(.[\da-z]+)?$/.exec(s);if(i.length<2)return o;const a="-"===i[1]?-1:1,m=i[2]||"0",c=i[3]||".0";let l=0,u=0;for(let t of m+c.substr(1)){const r=n.indexOf(t);if(-1===r||r>=e)return o;l+=r*Math.pow(e,m.length-u-1),u++}return a*l}static rebaseFloat10ToNIntBase(t,e,r=12){const n=V;if(e<=1||e>36)throw new Error(_);const s=e;let o=Math.abs(t??0);if(0===o||Number.isNaN(o))return t.toString();let i=(o%1).roundoff(),a="";for(;;){let t=o/s,e=Math.floor(t),r=(o-e*s).roundoff(),i=Math.floor(r);if(a=i>=36?`[${i}]`+a:n[i]+a,e<=0)break;o=e}if(a=a.replace(/^0+/,""),a||="0",0===i)return a;let m="";do{o=(i*s).roundoff();const t=Math.floor(o),e=(o-t).roundoff();t>=36?m=`[${t}]`:m+=n[t],i=e}while(!i.isCloseTo(0)&&m.length<r);return/^0*$/.test(m)?a:(Math.sign(t)<0?"-":"")+a+"."+m.replace(/0+$/,"")}static rebaseFloat10ToN(e,r,n=12){const s=V;if(r<=1||r>s.length)throw new Error(_);const o=r;let i=Math.abs(e??0);if(0===i||Number.isNaN(i))return e.toString();let a=Math.sign(e)<0?"-":"",m=[],c=[];for(let t=0;t<20;t++)m.push("0"),c.push("0");const l=o%1==0?o:Math.ceil(o);function u(t,e,r){const n=t?m:c,o=n[e]=n[e]||"0",i=s.indexOf(o)+r,a=i%l,f=Math.floor(i/l);return n[e]=s[a],f>0&&(t?u(t,e+1,f):0===e?u(!0,0,f):u(!1,e-1,f)),f}let f=0;for(;;){const e=Math.floor(t.Numbers.log(i,o)),r=e>=0;if(u(r,r?e:Math.abs(1+e),1),i=(i-Math.pow(o,e).roundoff()).roundoff(),r||f++,0===i||f>=100){const t=a+(m.reverse().map(t=>t||"0").join("").replace(/^0+/,"")||"0"),e=c.map(t=>t||"0").join("").substr(0,n).replace(/0+$/,"");return/^0*$/.test(e)?t:t+"."+e}}}}var P=Object.freeze({__proto__:null,Utils:Utils}),q=Object.freeze({__proto__:null,Complex:Complex,DataAnalysis:N,NumberTheory:P}),X=Object.freeze({__proto__:null,Geometry:u,Mathematics:q});t.DeepMerger.merge(X)}(Pacem);
7
- //# sourceMappingURL=pacem-numerical.min.js.map