@pacem/pacem-foundation 1.0.0-abel → 1.0.0-amaldi
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/pacem-foundation.js +5 -0
- package/dist/browser/pacem-foundation.min.js +5 -0
- package/dist/bundle/pacem-foundation.min.mjs +5 -0
- package/dist/bundle/pacem-foundation.mjs +5 -0
- package/dist/esm/array-extensions.js +5 -0
- package/dist/esm/arrays.js +5 -0
- package/dist/esm/blobs.js +5 -0
- package/dist/esm/browser.js +5 -0
- package/dist/esm/colors.js +5 -0
- package/dist/esm/dates.js +5 -0
- package/dist/esm/deepmerger.js +5 -0
- package/dist/esm/geom.js +5 -0
- package/dist/esm/history-svc.js +5 -0
- package/dist/esm/imaging.js +5 -0
- package/dist/esm/index-compile-markdown.js +5 -0
- package/dist/esm/index-compile.js +5 -0
- package/dist/esm/index-iife.js +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/keygenerator.js +5 -0
- package/dist/esm/matrix2d.js +5 -0
- package/dist/esm/null-checker.js +5 -0
- package/dist/esm/number-extensions.js +5 -0
- package/dist/esm/numbers.js +5 -0
- package/dist/esm/rect.js +5 -0
- package/dist/esm/strings.js +5 -0
- package/package.json +1 -1
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @pacem/pacem-foundation v1.0.0-amaldi (https://js.pacem.it)
|
|
3
|
+
* Pacem (https://pacem.it)
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
|
+
*/
|
|
1
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 e{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,r){return[31,e.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][r]}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,r){let n=t.getDate(),s=new Date(t),a=s.getMonth()+r,i=0;for(;a<0;)a+=12,i--;return s.setDate(1),s.setMonth(a%12),s.setFullYear(s.getFullYear()+i+Math.floor(a/12)),s.setDate(Math.min(n,e.daysInMonth(s.getFullYear(),s.getMonth()))),s}static addDays(t,e){return new Date(t.valueOf()+864e5*e)}static daysBetween(t,e){return(e.valueOf()-t.valueOf())/864e5}}class r{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&&!e.isDate(t)&&!(t instanceof RegExp)&&!(t instanceof FileSystemDirectoryHandle)&&!(t instanceof FileSystemFileHandle)}catch(t){return!1}}static isNullOrEmpty(t){return r.isNull(t)||r.isEmpty(t)}}function n(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)&&(t.constructor===Object||void 0===t.constructor)}function s(t,e){const r=t;for(const t of Object.keys(e)){const a=e[t],i=r[t];n(a)?r[t]=s(n(i)?i:{},a):Array.isArray(a)?r[t]=a.slice():r[t]=a}return r}Array.prototype.distinct=function(){return Array.from(new Set(this))},Array.prototype.union=function(t){const e=r.isNullOrEmpty(this),n=r.isNullOrEmpty(t);return e&&n?[]:n?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 a{constructor(){}static merge(t,e){return e??=globalThis.Pacem??={},s(e,t)}}class i{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=i._b64ToUint8Array(atob(t));return new Blob([r],e)}static dataURLToBlob(t){const e=t.indexOf(",");if(-1===e)return i.base64ToBlob(t);{const r=t.substring(e+1),n=t.substring(0,e).match(/:(.*?);/)[1];return i.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 o=(t,e)=>{const r=t.match(e);return r?r[2]:null};const c=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,l=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,u=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,h=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,d=/^#[a-f0-9]{6}$/,p=/^#[a-f0-9]{3}$/;function f(t){return!r.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 g(t){return!r.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 y={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:y.adjustRgbChannel(t.r),g:y.adjustRgbChannel(t.g),b:y.adjustRgbChannel(t.b),a:t.a}),adjustRgbInv:t=>({r:y.adjustRgbChannelInv(t.r),g:y.adjustRgbChannelInv(t.g),b:y.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=y.adjustRgb(t);return y.Y(e)},rgbToCieXYZ:t=>{const e=y.adjustRgb(t);return{x:y.X(e),y:y.Y(e),z:y.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 y.adjustRgbInv({r:e,g:r,b:n,a:t.a})},contrastRatio:(t,e)=>{const r=y.relativeLuminance(t)+.05,n=y.relativeLuminance(e)+.05;return r>n?r/n:n/r}};function x(t){return t.toString(16).padStart(2,"0")}class m{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(),u.test(t)){let e=u.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(h.test(t)){let e=h.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(d.test(t)){let e=d.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(p.test(t)){let e=p.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(c.test(t)){let e=c.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3])};return this.rgb(r)}if(l.test(t)){let e=l.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 g(t)&&(t=this.rgb(t)),y.rgbToCieXYZ(t)}static rgb(t){if(!g(t)){const e=y.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(g(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(f(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?("#"+x(n)+x(s)+x(a)).toUpperCase():`rgb(${n},${s},${a})`:`rgba(${n},${s},${a},${i})`}}static contrastRatio(t,e){return g(t)&&(t=this.rgb(t)),g(e)&&(e=this.rgb(e)),y.contrastRatio(t,e)}static luminance(t){return g(t)&&(t=m.rgb(t)),y.relativeLuminance(t)}static lighten(t,e=.1){if(e||=0,g(t)){const r=Math.min(1,Math.max(0,t.l+e));return Object.assign({},t,{l:r})}if(f(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,g(t)){const r=Math.min(1,Math.max(0,t.s+e));return Object.assign({},t,{s:r})}if(f(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=f(t),c=g(t),l=t=>f(t)||g(t)?m.cieXYZ(t):t;t=l(t),e=l(e);const u={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?m.rgb(u):c?m.hsl(m.rgb(u)):u}}const b=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function w(t){const e=[];let r=t.match(b);return r&&r.length>0&&r.forEach(t=>e.push(parseFloat(t))),e}class k{static isAngle(t){return"object"==typeof t&&"vertex"in t&&C.isPoint(t.vertex)&&"start"in t&&C.isPoint(t.start)&&"end"in t&&C.isPoint(t.end)}static value(t){if(r.isNullOrEmpty(t)||!k.isAngle(t))return Number.NaN;const{vertex:e,start:n,end:s}=t;return k.angleBetween(e,n,s)}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 ${static parse(t){let e=w(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 C{static parse(t){let e=w(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 M{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 M.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 I{static parse(t){let e=w(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 C.isPoint(t)&&$.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 M.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 M.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;I.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 S={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"};class v{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 v.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:f}=Object.assign({},S,n??{}),g={width:a,height:i,x:0,y:0},y={x:0,y:0,width:e,height:r},x=I.findTransform(g,y,h,d,p);o.width=e,o.height=r,f&&(c.fillStyle=f,c.fillRect(0,0,o.width,o.height)),c.setTransform(x),c.drawImage(s,0,0);return await o.convertToBlob({quality:l,type:u})}}class _{static#t;static uniqueId(){let t=_.#t||Date.now();return _.#t=++t}static uniqueCode(){return _.uniqueId().toBase62()}static randomString(t){let e="";do{e+=(62*Math.random()).toBase62()}while(e.length<t);return e}}function L(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 R(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 A{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 E=class{constructor(t=new A){this._lexer=t}parse(t,e,r){const n=this._lexer.tokenize(t,e);return r.render(n)}};function B(t){return(t??"").replace(/</g,"<")}function N(t){return t?.index||void 0}function O(t){return t?.replace(/[^\w]+/g," ").trim().replace(/ +/g,"-").toLowerCase()}function z(t,e,r){const n=e.exec(t);return n&&n.length?r(n):null}const T=/(<!--)([\s\S]*?)(-->|$)/,j=/^ {0,3}(={3,}|_{3,}|-{3,})(\r?\n|$)/,F=/^ {0,3}(#{1,6})\s+([^\n]+)(\r?\n|$)+/,H=/^ {0,3}([^\n]+)(\r?\n=+(\r?\n|$))+/,U=/^ {0,3}([^\n]+)(\r?\n-+(\r?\n|$))+/,D=/^ {4,}.+(\r?\n {4,}.+)*(\r?\n|$)+/,P=/^ {0,3}``` *([^\n]*)\r?\n(([\s\S](?!\r?\n {0,3}```))*.(\r?\n)+) {0,3}```(\r?\n|$)+/,q=/^ {0,3}> *([^\n]+)(\r?\n {0,3}> *([^\n]*))*(\r?\n|$)+/,Y=/^( {0,3}([-+]).*\r?\n|$)((?!(?: {0,3}(?:\d+[.\)]|\r?\n\S))).*(\r?\n|$))*/,G=/^( {0,3}(\d+[.\)]).*\r?\n|$)((?!(?: {0,3}(?:[+-]|\r?\n\S))).*(\r?\n|$))*/,Q=/^(?:[-+*]|\d+[.\)])/m,X=/^(?! {4,})(.+(\n(?! {0,3}```)(?! {0,3}([-+]|\d+[.\)]))(?! {4,})(?! {0,3}>).+)*)/,Z=/^ {0,3}(!?)\[([^\]]+)\]: +(\S+)(?: +['"\(](.+)['"\)])?(\r?\n|$)+/,W=/!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?(\[[^\[\]]*\]|\([^\(\)]*\))?/,J=/(\*\*?|__?)(\[[^\]]*]\([^\)]+\))\1/,K=/(?:(?<!\\)`)(.+?)(?:(?<!\\)`)/,V=/(\*\*?|__?)((?!\1\s?)(?:(?!\1)[\S\s])*[^\s])\1/,tt=/(~~?|__?)(?!\1\s?)([^\s][\s\S]*?(?!\1)[^\s])\1/,et=/(:")(?!":\s?)([^\s][\s\S]*?(?!":)[^\s])":/,rt=/^\s+/,nt=/ {2,}\r?\n/,st=/^[^\r\n]+/;var at,it;function ot(t=[]){const e={[it.Comment]:{exec:(t,e)=>z(t,T,r=>{const n=N(r),s=[{type:at.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})},[it.Reference]:{exec:t=>z(t,Z,t=>{const e=N(t),r=t[0],n=r,s="!"===t[1],a=t[2],i=t[3],o=t[4];return[{type:at.Reference,index:e,raw:r,text:n,id:a,image:s,url:i,title:o}]})}},n=[],s=[],a={};for(let e of t){let t,r="inline";switch("type"in e?(r=e.type,t=e.rule):t=e,r){case"block":n.push(t);break;case"code":if("lang"in e){const r=e.lang.toLowerCase();(a[r]=a[r]||[]).push(t)}break;default:const r={exec:(e,r)=>{const n=t.exec(e,r);return c(e,n,r),n}};s.push(r)}}const i={[it.Text]:{exec:t=>z(t,st,t=>{const e=t[0],r=e;return[{index:N(t),raw:e,text:r,type:at.Text}]})},[it.Space]:{exec:t=>z(t,rt,t=>{const e=t[0];return[{type:at.Space,raw:e,text:e}]})}},o={[it.ImageOrLink]:{exec:(t,e)=>l(t,W,e,t=>{const n=N(t),s=t[0],a="!"===s.charAt(0),i=t[1],o=function(t){if(!(r.isNullOrEmpty(t)||/^\[/.test(t)&&/\]$/.test(t)))return/^\(/.test(t)&&/\)$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2]),c=O(function(t){if(!(r.isNullOrEmpty(t)||/^\(/.test(t)&&/\)$/.test(t)))return/^\[/.test(t)&&/\]$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2])??i);return a?[{index:n,type:o?at.Image:at.ImageLike,raw:s,text:i,src:o,ref:c,tokens:e.tokenize(i,u)}]:[{index:n,type:o?at.Link:at.LinkLike,raw:s,text:i,href:o,ref:c,tokens:e.tokenize(i,u)}]})},[it.Code]:{exec:(t,e)=>l(t,K,e,t=>{const e=B(t[1]);return[{type:at.Code,raw:t[0],text:e,index:N(t)}]})},[it.EmphasizedLink]:{exec:(t,e)=>l(t,J,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=t[1].length>1?at.Bold:at.Italic,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.Emphasize]:{exec:(t,e)=>l(t,V,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=t[1].length>1?at.Bold:at.Italic,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.StrikeThrough]:{exec:(t,e)=>l(t,tt,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=at.StrikeThrough,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.Quote]:{exec:(t,e)=>l(t,et,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=at.Quote,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.LineBreak]:{exec:(t,e)=>l(t,nt,e,t=>{const e=t[0],r=e;return[{index:N(t),raw:e,text:r,type:at.LineBreak}]})}},c=(t,e,r)=>{const n=e?.length>0&&e[0].index;if(n>0){const s=t.substr(0,n),a=r.tokenize(s,u)||[];Array.prototype.unshift.apply(e,a)}},l=(t,e,r,n)=>{const s=z(t,e,r=>{if(e!=K){const e=K.exec(t);if(e&&e.length&&e.index<r.index)return null}return n(r)});return c(t,s,r),s},u=Object.values(o);Array.prototype.push.apply(u,s),u.push(i[it.Text],i[it.Space]);const h=t=>{const e=[i[it.Text],i[it.Space]],r=t?.toLowerCase()||"";return r&&r in a&&Array.prototype.unshift.apply(e,a[r]),e},d={[it.Paragraph]:{exec:(t,e)=>z(t,X,t=>{const r=t[0],n=r;return[{type:at.Paragraph,raw:r,text:n,tokens:e.tokenize(n,u)}]})},[it.Space]:i[it.Space]},p=(t,e)=>{const r=/^ {0,3}(`{3,}|$|>|[+-]\s|\d+[.\)])/m.test(t)?g:u;return e.tokenize(t,r)},f={[it.HorizontalRule]:{exec:(t,e)=>z(t,j,t=>{const e=t[0],r=e;return[{type:at.HorizontalRule,raw:e,text:r}]})},[it.Heading]:{exec:(t,e)=>z(t,F,t=>{const r=t[2];return[{type:at.Heading,raw:t[0],text:r,level:t[1].length,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.Heading1]:{exec:(t,e)=>z(t,H,t=>{const r=t[1];return[{type:at.Heading,raw:t[0],text:r,level:1,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.Heading2]:{exec:(t,e)=>z(t,U,t=>{const r=t[1];return[{type:at.Heading,raw:t[0],text:r,level:2,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.CodeBlock]:{exec:(t,e)=>z(t,D,t=>{const r=t[0],n=B(r);return[{type:at.CodeBlock,raw:r,text:n,tokens:e.tokenize(n,[])}]})},[it.Fences]:{exec:(t,e)=>z(t,P,t=>{const r=B(t[2]),n=t[1]?.toLowerCase();return[{type:at.CodeBlock,raw:t[0],text:r,lang:n,tokens:e.tokenize(r,h(n))}]})},[it.BlockQuote]:{exec:(t,e)=>z(t,q,t=>{const r=t[0],n=r.replace(/^ {0,3}> */gm,"");return[{type:at.BlockQuote,raw:r,text:n,tokens:e.tokenize(n,[d[it.Paragraph],d[it.Space]])}]})},[it.OrderedList]:{exec:(t,e)=>z(t,G,t=>{const n=t[0],s=n.replace(/^ {0,3}/gm,"").split(Q).filter(t=>!r.isNullOrEmpty(t)).map(t=>t.trim());return[{type:at.OrderedList,start:parseInt(/\d/.exec(t[0])[0]),raw:n,text:n,tokens:s.map(t=>({type:at.ListItem,raw:t,text:t,tokens:p(t,e)}))}]})},[it.UnorderedList]:{exec:(t,e)=>z(t,Y,t=>{const n=t[0],s=n.replace(/^ {0,3}/gm,"").split(Q).filter(t=>!r.isNullOrEmpty(t)).map(t=>t.trim());return[{type:at.UnorderedList,raw:n,text:n,tokens:s.map(t=>({type:at.ListItem,raw:t,text:t,tokens:p(t,e)}))}]})}},g=Object.values(f);return Array.prototype.push.apply(g,n),g.push(d[it.Paragraph],d[it.Space]),[e[it.Comment],e[it.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"}(at||(at={})),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"}(it||(it={}));const ct=/[ \r\n]*\0+[ \r\n]*/g;class lt{constructor(t=(t,e)=>t?.text||""){this._extraItemRender=t,this._renderContent=t=>{const e=t.tokens;return r.isNullOrEmpty(e)?t.text:this._render(e)}}_rendeItem(t,e){const r=this._renderContent,n="\0";switch(t?.type){case at.Reference:return"";case at.Html:return t.raw;case at.BlockQuote:return`<blockquote>\n${r(t)}</blockquote>${n}`;case at.Bold:return`<b>${r(t)}</b>`;case at.CodeBlock:const s=t.lang;return`<pre>${n}<code${s?' class="'+s+'"':""}>${r(t)}</code>${n}</pre>${n}`;case at.Code:return`<code>${r(t)}</code>`;case at.HorizontalRule:return`<hr />${n}`;case at.Heading:const a=t.level;return`<h${a} id="${t.ref}">${r(t)}</h${a}>${n}`;case at.Image:case at.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===at.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 at.Italic:return`<i>${r(t)}</i>`;case at.StrikeThrough:return`<s>${r(t)}</s>`;case at.Quote:return`<q>${r(t)}</q>`;case at.LineBreak:return"<br />\0";case at.OrderedList:return`<ol start="${t.start}">\n${r(t)}</ol>${n}`;case at.UnorderedList:return`<ul>\n${r(t)}</ul>${n}`;case at.ListItem:return`\t<li>${r(t)}</li>${n}`;case at.Link:case at.LinkLike:const h=t;let d=h.href,p="";const f=h.ref;if(!d&&f){const t=e.find(t=>t.type===at.Reference&&!0!==t.image&&t.id?.toLowerCase()===f.toLowerCase());t&&(d=t.url,p=t.title??"")}return d?`<a href="${d}"${p?' title="'+p+'"':""}>${r(t)}</a>`:`[${r(t)}]`;case at.Paragraph:return`<p>${r(t)}</p>${n}`;case at.Text:case at.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(ct,"\n").trim();var e}}class ut{_render(t){return r.isNullOrEmpty(t)?"":JSON.stringify(t)}render(t){return"["+t.filter(t=>!r.isNullOrEmpty(t)).map(this._render).join(",")+"]"}}var ht=Object.freeze({__proto__:null,Parser:class extends E{toHtml(t,e,n){const s=new lt(n);return r.isNullOrEmpty(e)?this.parse(t,s):this.parse(t,ot(e),s)}tokenize(t,e){const r=this.parse(t,ot(e),new ut);return JSON.parse(r)}parse(t,e=ot(),r=new lt){return(n=e)&&"object"==typeof n&&"function"==typeof n.render?super.parse(t,ot(),e):super.parse(t,e,r);var n}}}),dt=Object.freeze({__proto__:null,Markdown:ht,Parser:E}),pt=Object.freeze({__proto__:null,Angle:k,Arrays:class{static range(t,e,n=2){let s=t;r.isNull(e)&&(e=n=t,t=1);const a=(e-t)/(n-1),i=[];if(a>0)for(;i.length<n;)i.push(s.roundoff()),s+=a;return i}static chunkify(t,e){if(r.isNullOrEmpty(t))return[];if(e<=0||e%1!=0)throw new Error("Provide a positive integer number.");const n=Math.ceil(t.length/e);return Array.from({length:n},(r,n)=>{const s=n*e,a=s+e;return t.slice(s,a)})}},Blobs:i,Colors:m,Compile:dt,Dates:e,DeepMerger:a,HistoryService:class{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:v,Keys:_,Matrix2D:M,NullChecker:r,Numbers:class{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:C,Rect:I,Size:$,Strings:class{static leftPad(t,e,r){return t.toString().padStart(e,r)}static format(t,...e){const n=Array.from(e);let s=t;for(let t=0;t<n.length;t++){const e=new RegExp("(^|[^\\{])\\{"+t+"\\}($|[^\\}])","g");s=s.replaceAll(e,(e,...r)=>e.replace("{"+t+"}",n[t]))}const a=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(s);if(!r.isNullOrEmpty(a))throw new Error(`Missing argument at index ${a[2]}.`);return s}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 R(n,s,L(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 R(n,s,L(n,s),"")}(t,e);default:return function(t,e){const r=t.split(""),n=e.split("");return R(r,n,L(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=o(t,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":r=o(t,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":r=o(t,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":r=o(t,/(chromium)\/([\d\.]+)/i);break;case"Firefox":r=o(t,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":r=o(t,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":r=o(t,/(safari)\/([\d\.]+)/i);break;case"Opera":r=o(t,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{const e=o(t,/(trident)\/([\d\.]+)/i);r=e?`${parseFloat(e)+4}`:"7.0";break}default:r="0.0.0.0"}return{name:e,version:r}},parseAsNumericalArray:w});a.merge(pt)}();
|
|
2
7
|
//# sourceMappingURL=pacem-foundation.min.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @pacem/pacem-foundation v1.0.0-amaldi (https://js.pacem.it)
|
|
3
|
+
* Pacem (https://pacem.it)
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
var wt=Object.defineProperty;var W=(r,t)=>{for(var e in t)wt(r,e,{get:t[e],enumerable:!0})};Number.prototype.isCloseTo=function(r,t=14){let e=+`1e-${t}`;return this>r-e&&this<r+e};Number.prototype.roundoff=function(r=14){return parseFloat(this.toFixed(r))};Number.prototype.clamp=function(r,t){let e=this;return r!=null&&!isNaN(r)&&(e=Math.max(e,r)),t!=null&&!isNaN(t)&&(e=Math.min(e,t)),e};Number.prototype.toBase62=function(){for(var r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",t=this,e="";t!=0;){var n=t%62;e=r.charAt(n)+e,t=Math.floor(t/62)}return e};Number.prototype.toBase36=function(){return this.toString(36)};var mt=/^\/Date\([\d]+\)\/$/i,M=class r{static parse(t){let e;return typeof t=="string"?(mt.test(t)?e=parseInt(t.substring(6)):e=Date.parse(t),new Date(e)):typeof t=="number"?new Date(t):t}static isLeapYear(t){return t%4===0&&t%100!==0||t%400===0}static daysInMonth(t,e){return[31,r.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 n=t.getDate(),s=new Date(t),i=s.getMonth()+e,a=0;for(;i<0;)i+=12,a--;return s.setDate(1),s.setMonth(i%12),s.setFullYear(s.getFullYear()+a+Math.floor(i/12)),s.setDate(Math.min(n,r.daysInMonth(s.getFullYear(),s.getMonth()))),s}static addDays(t,e){return new Date(t.valueOf()+e*864e5)}static daysBetween(t,e){return(e.valueOf()-t.valueOf())/864e5}};var k=class r{static isNull(t){return t==null}static isEmpty(t){try{return Array.isArray(t)&&t.length===0||typeof t=="string"&&t===""||typeof t=="object"&&Object.keys(t).length===0&&!M.isDate(t)&&!(t instanceof RegExp)&&!(t instanceof FileSystemDirectoryHandle)&&!(t instanceof FileSystemFileHandle)}catch{return!1}}static isNullOrEmpty(t){return r.isNull(t)||r.isEmpty(t)}};Array.prototype.distinct=function(){return Array.from(new Set(this))};Array.prototype.union=function(r){let t=k.isNullOrEmpty(this),e=k.isNullOrEmpty(r);return t&&e?[]:e?this.slice():t?r.slice():this.concat(r).distinct()};Array.prototype.moveWithin=function(r,t){let e="Index must be greater or equal than 0 and less or equal than the length of the array.";var n=this;if(r<0||r>n.length)throw new Error(e);if(t<0||t>n.length)throw new Error(e);n.splice(t,0,Array.prototype.splice.apply(n,[r,1])[0])};Array.prototype.equalsContent=function(r){if(r==null||this.length!==r.length)return!1;for(let t=0;t<this.length;t++)if(this[t]!==r[t])return!1;return!0};Array.prototype.cloneFrom=function(r){if(r==null)throw"Cannot clone array from null object.";let t=r.length;var e=this.length!==r.length;for(let n=0;n<t;n++){let s=r[n];this.length>n?this[n]!==s&&(this[n]=s,e=!0):(Array.prototype.push.apply(this,[s]),e=!0)}e&&this.splice(t)};function K(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)&&(r.constructor===Object||r.constructor===void 0)}function et(r,t){let e=r;for(let n of Object.keys(t)){let s=t[n],i=e[n];K(s)?e[n]=et(K(i)?i:{},s):Array.isArray(s)?e[n]=s.slice():e[n]=s}return e}var tt=class{constructor(){}static merge(t,e){return e??=globalThis.Pacem??={},et(e,t)}};var rt=class{static range(t,e,n=2){let s=t;k.isNull(e)&&(e=n=t,t=1);let i=(e-t)/(n-1),a=[];if(i>0)for(;a.length<n;)a.push(s.roundoff()),s+=i;return a}static chunkify(t,e){if(k.isNullOrEmpty(t))return[];if(e<=0||e%1!==0)throw new Error("Provide a positive integer number.");let n=Math.ceil(t.length/e);return Array.from({length:n},(s,i)=>{let a=i*e,h=a+e;return t.slice(a,h)})}};var nt=class r{static blobToDataURL(t){return new Promise((e,n)=>{let s=new FileReader;s.onload=i=>{e(i.target.result)},s.readAsDataURL(t)})}static _b64ToUint8Array(t){let e=t.length,n=new Uint8Array(e);for(;e--;)n[e]=t.charCodeAt(e);return n}static base64ToBlob(t,e){let n=r._b64ToUint8Array(atob(t));return new Blob([n],e)}static dataURLToBlob(t){let e=t.indexOf(",");if(e===-1)return r.base64ToBlob(t);{let n=t.substring(e+1),i=t.substring(0,e).match(/:(.*?);/)[1];return r.base64ToBlob(n,{type:i})}}static async blobToText(t,e){let n=await t.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(n)}static textToBlob(t,e="text/plain",n="utf-8",s,i=63){let a=n.toLowerCase(),h=()=>`${e};charset=${a}`;switch(a){case"utf-8":{let f=new TextEncoder().encode(t),w=s?[new Uint8Array([239,187,191]),f]:[f];return new Blob(w,{type:h()})}case"utf-16":a="utf-16le",s??=!0;case"utf-16le":case"utf-16be":{let u=a!=="utf-16be",f=s?1:0,w=new ArrayBuffer((t.length+f)*2),g=new DataView(w);s&&g.setUint16(0,65279,u);for(let b=0;b<t.length;b++)g.setUint16((b+f)*2,t.charCodeAt(b),u);return new Blob([w],{type:h()})}case"ascii":case"iso-8859-1":case"latin1":{let u=a==="ascii"?127:255,f=new Uint8Array(t.length),w=i>0;for(let g=0;g<t.length;g++){let b=t.charCodeAt(g);if(b>u)if(w)f[g]=i;else throw new Error(`Character "${t[g]}" cannot be encoded in ${n}.`);else f[g]=b}return new Blob([f],{type:h()})}default:throw new Error(`Encoding "${n}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}};var E=(r,t)=>{let e=r.match(t);return e?e[2]:null};function he(r=navigator.userAgent){let t="unknown",e=null;switch(/ucbrowser/i.test(r)?t="UCBrowser":/edg/i.test(r)?t="Edge":/googlebot/i.test(r)?t="GoogleBot":/chromium/i.test(r)?t="Chromium":/firefox|fxios/i.test(r)&&!/seamonkey/i.test(r)?t="Firefox":/; msie|trident/i.test(r)&&!/ucbrowser/i.test(r)?t="IE":/chrome|crios/i.test(r)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(r)?t="Chrome":/safari/i.test(r)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(r)?t="Safari":/opr|opera/i.test(r)&&(t="Opera"),t){case"UCBrowser":e=E(r,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":e=E(r,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":e=E(r,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":e=E(r,/(chromium)\/([\d\.]+)/i);break;case"Firefox":e=E(r,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":e=E(r,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":e=E(r,/(safari)\/([\d\.]+)/i);break;case"Opera":e=E(r,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{let n=E(r,/(trident)\/([\d\.]+)/i);e=n?`${parseFloat(n)+4}`:"7.0";break}default:e="0.0.0.0";break}return{name:t,version:e}}var st=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,it=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,at=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,ot=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,ct=/^#[a-f0-9]{6}$/,lt=/^#[a-f0-9]{3}$/;function L(r){return!k.isNullOrEmpty(r)&&typeof r=="object"&&"r"in r&&"g"in r&&"b"in r&&typeof r.r=="number"&&typeof r.b=="number"&&typeof r.g=="number"?(r.a??=1,r.r>=0&&r.r<=1&&r.g>=0&&r.g<=1&&r.b>=0&&r.b<=1&&r.a>=0&&r.a<=1):!1}function B(r){return!k.isNullOrEmpty(r)&&typeof r=="object"&&"h"in r&&"s"in r&&"l"in r&&typeof r.h=="number"&&typeof r.s=="number"&&typeof r.l=="number"?(r.a??=1,r.h>=0&&r.h<=360&&r.s>=0&&r.s<=1&&r.l>=0&&r.l<=1&&r.a>=0&&r.a<=1):!1}function kt(r){let t=r.r,e=r.g,n=r.b;return(.5*(Math.max(t,e,n)+Math.min(t,e,n))).clamp(0,1)}var C={adjustRgbChannel:r=>r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),adjustRgbChannelInv:r=>r<=.00304?r*12.92:1.055*(Math.pow(r,1/2.4)-.055),adjustRgb:r=>({r:C.adjustRgbChannel(r.r),g:C.adjustRgbChannel(r.g),b:C.adjustRgbChannel(r.b),a:r.a}),adjustRgbInv:r=>({r:C.adjustRgbChannelInv(r.r),g:C.adjustRgbChannelInv(r.g),b:C.adjustRgbChannelInv(r.b),a:r.a}),X:r=>.4125*r.r+.3576*r.g+.1804*r.b,Y:r=>.2126*r.r+.7152*r.g+.0722*r.b,Z:r=>.0193*r.r+.1191*r.g+.9503*r.b,relativeLuminance:r=>{let t=C.adjustRgb(r);return C.Y(t)},rgbToCieXYZ:r=>{let t=C.adjustRgb(r);return{x:C.X(t),y:C.Y(t),z:C.Z(t),a:r.a}},cieXYZToRgb:r=>{let t=3.241*r.x-1.5374*r.y-.4986*r.z,e=-.9692*r.x+1.876*r.y+.0416*r.z,n=.0556*r.x-.204*r.y+1.057*r.z;return C.adjustRgbInv({r:t,g:e,b:n,a:r.a})},contrastRatio:(r,t)=>{let e=C.relativeLuminance(r)+.05,n=C.relativeLuminance(t)+.05;return e>n?e/n:n/e}};function Ct(r,t){let e=r.r,n=r.g,s=r.b,i=Math.max(e,n,s),a=Math.min(e,n,s);return(t===0||t===1?0:(i-a)/(1-Math.abs(2*t-1))).clamp(0,1)}function It(r){let t=r.r,e=r.g,n=r.b,s=Math.max(t,e,n),i=Math.min(t,e,n),a=0;return s!==i&&(s===t?a=(60*((e-n)/(s-i))+360)%360:s===e?a=(60*((n-t)/(s-i))+120)%360:a=(60*((t-e)/(s-i))+240)%360),a.clamp(0,360)}function V(r){return r.toString(16).padStart(2,"0")}var ut=class r{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(t){let e=n=>Math.min(1,Math.max(0,n));return t[3]==null&&(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(),at.test(t)){let e=at.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(ot.test(t)){let e=ot.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(ct.test(t)){let e=ct.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(lt.test(t)){let e=lt.exec(t)[0],n=e.substr(1,1),s=e.substr(2,1),i=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+n+n),parseInt("0x"+s+s),parseInt("0x"+i+i),1]))}if(st.test(t)){let e=st.exec(t),n={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01};return this.rgb(n)}if(it.test(t)){let e=it.exec(t),n={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01,a:parseFloat(e[4])};return this.rgb(n)}}static hsl(t){let e=kt(t),n=Ct(t,e);return{h:It(t),s:n,l:e,a:t.a}}static cieXYZ(t){return B(t)&&(t=this.rgb(t)),C.rgbToCieXYZ(t)}static rgb(t){if(B(t)){let e=t.h,n=t.s,s=t.l,i=e/60,a=(1-Math.abs(2*s-1))*n,h=a*(1-Math.abs(i%2-1)),u=s-a/2,f=(w,g,b)=>this._clampRGB([w+u,g+u,b+u,t.a]);if(i<=1)return f(a,h,0);if(i<=2)return f(h,a,0);if(i<=3)return f(0,a,h);if(i<=4)return f(0,h,a);if(i<=5)return f(h,0,a);if(i<=6)return f(a,0,h)}else{let e=C.cieXYZToRgb(t);return this._clampRGB([e.r,e.g,e.b,e.a])}}static stringify(t,e=1){if(B(t)){e??=1,t.a??=1;let n=typeof e=="number"?e:1;return`hsla(${t.h.roundoff(n)},${(t.s*100).roundoff(n)}%,${(t.l*100).roundoff(n)}%,${t.a.roundoff()})`}else if(L(t)){e??=!0,t.a??=1;let n=typeof e=="boolean"?e:!!e,s=Math.round(t.r*255),i=Math.round(t.g*255),a=Math.round(t.b*255),h=t.a.roundoff();return h===1?n?("#"+V(s)+V(i)+V(a)).toUpperCase():`rgb(${s},${i},${a})`:`rgba(${s},${i},${a},${h})`}}static contrastRatio(t,e){return B(t)&&(t=this.rgb(t)),B(e)&&(e=this.rgb(e)),C.contrastRatio(t,e)}static luminance(t){return B(t)&&(t=r.rgb(t)),C.relativeLuminance(t)}static lighten(t,e=.1){if(e||=0,B(t)){let n=Math.min(1,Math.max(0,t.l+e));return Object.assign({},t,{l:n})}if(L(t)){let n=this.lighten(this.hsl(t),e);return this.rgb(n)}return t}static darken(t,e=.1){return this.lighten(t,-e)}static saturate(t,e=.1){if(e||=0,B(t)){let n=Math.min(1,Math.max(0,t.s+e));return Object.assign({},t,{s:n})}if(L(t)){let n=this.saturate(this.hsl(t),e);return this.rgb(n)}return t}static desaturate(t,e=.1){return this.saturate(t,-e)}static interpolate(t,e,n,s){n??=.5,s??=n;let i=(n+s).roundoff(),a=(n/i).roundoff(),h=(s/i).roundoff(),u=L(t),f=B(t),w=b=>L(b)||B(b)?r.cieXYZ(b):b;t=w(t),e=w(e);let g={x:(t.x*a+e.x*h).roundoff(),y:(t.y*a+e.y*h).roundoff(),z:(t.z*a+e.z*h).roundoff(),a:(t.a*a+e.a*h).roundoff()};return u?r.rgb(g):f?r.hsl(r.rgb(g)):g}};var $t=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function X(r){let t=[],e=r.match($t);return e&&e.length>0&&e.forEach(n=>t.push(parseFloat(n))),t}var ht=class r{static isAngle(t){return typeof t=="object"&&"vertex"in t&&z.isPoint(t.vertex)&&"start"in t&&z.isPoint(t.start)&&"end"in t&&z.isPoint(t.end)}static value(t){if(k.isNullOrEmpty(t)||!r.isAngle(t))return Number.NaN;let{vertex:e,start:n,end:s}=t;return r.angleBetween(e,n,s)}static angleBetween(t,e,n){let s={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},a=s.x*i.x+s.y*i.y,h=s.x*i.y-s.y*i.x;return-Math.atan2(h,a)}},P=class{static parse(t){let e=X(t);if(e&&e.length===2)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${t}" as a valid Size.`)}static isSize(t){return typeof t=="object"&&"width"in t&&typeof t.width=="number"&&"height"in t&&typeof t.height=="number"}},z=class{static parse(t){let e=X(t);if(e&&e.length===2)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${t}" as a valid Point.`)}static isPoint(t){return typeof t=="object"&&"x"in t&&typeof t.x=="number"&&"y"in t&&typeof t.y=="number"}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 n of t)e.x+=n.x,e.y+=n.y;return e}static multiply(t,e){return{x:t.x*e,y:t.y*e}}};var G=class r{static isIdentity(t){return t.a===1&&t.d===1&&t.b===0&&t.f===0&&t.c===0&&t.e===0}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,n=e){return{a:t.a*e,b:t.b,c:t.c,d:t.d*n,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){let n=Math.cos(e),s=Math.sin(e);return r.multiply(t,{a:n,b:s,c:-s,d:n,e:0,f:0})}static multiply(t,e){return"x"in t&&"y"in t?typeof e=="number"?{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}:typeof e=="number"?{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){let e=this.det(t);if(e===0)return null;let n=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},n)}static toComponents(t,e={x:0,y:0}){let n=Math.sqrt(t.a*t.a+t.c*t.c),s=Math.sqrt(t.b*t.b+t.d*t.d),i=n!=0?t.a/n:0,a=n!=0?t.c/n:0,h=Math.atan2(a,i),{x:u,y:f}=e,w={x:t.e-u*(n*i-1)+f*n*a,y:t.f-f*(s*i-1)-u*s*a};return{scaleX:n,scaleY:s,rotation:h,translation:w}}static fromTransform([t,e,n],[s,i,a]){let h=t.x*(e.y-n.y)-t.y*(e.x-n.x)+(e.x*n.y-n.x*e.y);if(Math.abs(h)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");let u=1/h;return{a:u*(s.x*(e.y-n.y)+i.x*(n.y-t.y)+a.x*(t.y-e.y)),b:u*(s.y*(e.y-n.y)+i.y*(n.y-t.y)+a.y*(t.y-e.y)),c:u*(s.x*(n.x-e.x)+i.x*(t.x-n.x)+a.x*(e.x-t.x)),d:u*(s.y*(n.x-e.x)+i.y*(t.x-n.x)+a.y*(e.x-t.x)),e:u*(s.x*(e.x*n.y-n.x*e.y)+i.x*(n.x*t.y-t.x*n.y)+a.x*(t.x*e.y-e.x*t.y)),f:u*(s.y*(e.x*n.y-n.x*e.y)+i.y*(n.x*t.y-t.x*n.y)+a.y*(t.x*e.y-e.x*t.y))}}static areClose(t,e,n=12){return t.a.isCloseTo(e.a,n)&&t.b.isCloseTo(e.b,n)&&t.c.isCloseTo(e.c,n)&&t.d.isCloseTo(e.d,n)&&t.e.isCloseTo(e.e,n)&&t.f.isCloseTo(e.f,n)}};var Q=class r{static parse(t){let e=X(t);if(e&&e.length===4)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 z.isPoint(t)&&P.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,n,s){let i=1,a=t.width/t.height,h=e.width/e.height;a>=h?i=e.width/t.width:i=e.height/t.height;let u=t.width*i,f=t.height*i,w=this._align({x:t.x,y:t.y,width:u,height:f},e,n,s);return G.translate({a:i,b:0,c:0,d:i,e:0,f:0},w)}static _cover(t,e,n,s){let i=1,a=t.width/t.height,h=e.width/e.height;a<h?i=e.width/t.width:i=e.height/t.height;let u=t.width*i,f=t.height*i,w=this._align({x:t.x,y:t.y,width:u,height:f},e,n,s);return G.translate({a:i,b:0,c:0,d:i,e:0,f:0},w)}static _align(t,e,n,s){let i=0,a=0;switch(n){case"left":i=e.x-t.x;break;case"right":i=e.x+e.width-t.width-t.x;break;default:i=e.x+e.width*.5-t.width*.5-t.x;break}switch(s){case"top":a=e.y-t.y;break;case"bottom":a=e.y+e.height-t.height-t.y;break;default:a=e.y+e.height*.5-t.height*.5-t.y;break}return{x:i,y:a}}static findTransform(t,e,n="stretch",s="center",i="middle"){switch(n){case"contain":return this._contain(t,e,s,i);case"cover":return this._cover(t,e,s,i);default:return this._stretch(t,e)}}static intersect(...t){let e={x:0,y:0,height:0,width:0},n=Array.from(t||[]);if(n.length<=0)return e;for(var s=n[0],i=1;i<n.length;i++){let a=n[i],h=Math.max(a.x,s.x),u=Math.max(a.y,s.y),f=Math.min(a.x+a.width,s.x+s.width),w=Math.min(a.y+a.height,s.y+s.height),g=f-h,b=w-u;if(g<0||b<=0)return e;s={x:h,y:u,width:g,height:b}}return s}static expand(t,...e){let n=Array.from(e||[]),s=t.x,i=t.y,a=s,h=i;r.isRect(t)&&(a+=t.width,h+=t.height);for(let u of n)s=Math.min(u.x,s),i=Math.min(u.y,i),a=Math.max(u.x,a),h=Math.max(u.y,h);return{x:s,y:i,width:a-s,height:h-i}}};var ft=class{constructor(t,e){this.#e=t,this.#n=e}#t=[];#r=[];#n;#e;get current(){return this.#e}get canUndo(){return this.#t.length>0}get canRedo(){return this.#r.length>0}set maxlength(t){this.#n=t}undo(){if(this.canUndo){let t=this.#t,e=this.#r,n=this.#e;e.unshift(n),this.#e=t.pop()}}redo(){if(this.canRedo){let t=this.#t,e=this.#r,n=this.#e;t.push(n),this.#e=e.shift()}}push(t){this.#r.splice(0),this.#t.push(this.#e),this.#e=t;let e=this.#n,n=this.#t;e>0&&n.length>e&&n.splice(0,n.length-e)}reset(){this.#r.splice(0),this.#t.splice(0)}};var vt={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"},dt=class r{static async loadImage(t){let e=await fetch(t);return e.ok?await e.blob():null}static async resizeImage(t,e,n,s){if(e<=0||n<=0||isNaN(e)||isNaN(n))throw new Error("Invalid target size");typeof t=="string"&&(t=await r.loadImage(t));let i=await self.createImageBitmap(t),a=i.width,h=i.height,u=new OffscreenCanvas(a,h),f=u.getContext("2d");f.imageSmoothingEnabled=f.mozImageSmoothingEnabled=f.oImageSmoothingEnabled=f.webkitImageSmoothingEnabled=!0;let{quality:w,type:g,mode:b,align:F,valign:v,background:d}=Object.assign({},vt,s??{}),l={width:a,height:h,x:0,y:0},o={x:0,y:0,width:e,height:n},c=Q.findTransform(l,o,b,F,v);return u.width=e,u.height=n,d&&(f.fillStyle=d,f.fillRect(0,0,u.width,u.height)),f.setTransform(c),f.drawImage(i,0,0),await u.convertToBlob({quality:w,type:g})}};var xt=class r{static#t;static uniqueId(){let t=r.#t||Date.now();return r.#t=++t}static uniqueCode(){return r.uniqueId().toBase62()}static randomString(t){let e="";do e+=(Math.random()*62).toBase62();while(e.length<t);return e}};var pt=class{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,n){let s=t.toString(),i=parseInt(s,e);return s.endsWith(i.toString(e))?parseInt(t.toString(),e).toString(n):Number.NaN.toString()}};function A(r,t){let e=r.length,n=t.length,s=Array.from({length:e+1},()=>Array(n+1).fill(0));for(let i=1;i<=e;i++)for(let a=1;a<=n;a++)r[i-1]===t[a-1]?s[i][a]=s[i-1][a-1]+1:s[i][a]=Math.max(s[i-1][a],s[i][a-1]);return s}function q(r,t,e,n=""){let s=r.length,i=t.length,a=[],h=s,u=i,f=null,w=()=>{f&&(a.push(f),f=null)};for(;h>0||u>0;){var g=null;let b=null;h>0&&u>0&&r[h-1]===t[u-1]?(g="=",b=r[h-1],h--,u--):u>0&&(h===0||e[h][u-1]>=e[h-1][u])?(g="+",b=t[u-1],u--):h>0&&(u===0||e[h-1][u]>e[h][u-1])&&(g="-",b=r[h-1],h--),g&&b!==null?f&&f.type===g?f.value=b+(f.value?n:"")+f.value:(w(),f={type:g,value:b}):w()}return w(),a.reverse()}function Bt(r,t){let e=r.split(""),n=t.split(""),s=A(e,n);return q(e,n,s,"")}function Tt(r,t){let e=/(\S+|\s+)/g,n=r.match(e)||[],s=t.match(e)||[],i=A(n,s);return q(n,s,i,"")}function Et(r,t){let e=/\r?\n/,n=r.split(e),s=t.split(e),i=A(n,s);return q(n,s,i,`
|
|
2
7
|
`)}var yt=class{static leftPad(t,e,n){return t.toString().padStart(e,n)}static format(t,...e){let n=Array.from(e),s=t;for(let a=0;a<n.length;a++){let h=new RegExp("(^|[^\\{])\\{"+a+"\\}($|[^\\}])","g");s=s.replaceAll(h,(u,...f)=>u.replace("{"+a+"}",n[a]))}let i=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(s);if(!k.isNullOrEmpty(i))throw new Error(`Missing argument at index ${i[2]}.`);return s}static diff(t,e,n="char"){switch(n){case"line":return Et(t,e);case"word":return Tt(t,e);default:return Bt(t,e)}}static async hash(t,e="SHA-256"){let n=await crypto.subtle.digest(e,new TextEncoder().encode(t));return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}};var bt={};W(bt,{Markdown:()=>D,Parser:()=>j});var D={};W(D,{Parser:()=>R});var J=class{tokenize(t,e){let n=[];for(;t;){let s=t.length;for(let i of e){let a=i.exec(t,this),h=a?.length;if(h>0){Array.prototype.push.apply(n,a);let u=a[h-1];t=t.substr((u.index||0)+u.raw.length);break}}if(t.length>=s)throw new Error(`Cannot parse
|
|
3
8
|
"${t}"
|
package/dist/esm/arrays.js
CHANGED
package/dist/esm/blobs.js
CHANGED
package/dist/esm/browser.js
CHANGED
package/dist/esm/colors.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @pacem/pacem-foundation v1.0.0-amaldi (https://js.pacem.it)
|
|
3
|
+
* Pacem (https://pacem.it)
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
//namespace Pacem {
|
|
2
7
|
import { NullChecker } from "./null-checker";
|
|
3
8
|
const HSL_PATTERN = /^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/;
|
package/dist/esm/dates.js
CHANGED
package/dist/esm/deepmerger.js
CHANGED
package/dist/esm/geom.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @pacem/pacem-foundation v1.0.0-amaldi (https://js.pacem.it)
|
|
3
|
+
* Pacem (https://pacem.it)
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
import { NullChecker } from "./null-checker";
|
|
2
7
|
// 1.7763568394002505e-15 -20.4551920341394 40 40
|
|
3
8
|
const FLOAT_PATTERN = /[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;
|
package/dist/esm/history-svc.js
CHANGED
package/dist/esm/imaging.js
CHANGED
package/dist/esm/index-iife.js
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/keygenerator.js
CHANGED
package/dist/esm/matrix2d.js
CHANGED
package/dist/esm/null-checker.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @pacem/pacem-foundation v1.0.0-amaldi (https://js.pacem.it)
|
|
3
|
+
* Pacem (https://pacem.it)
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
Number.prototype.isCloseTo = function (other, precision = 14) {
|
|
2
7
|
const delta = Number(`1e-${precision}`);
|
|
3
8
|
return this > (other - delta) && this < (other + delta);
|
package/dist/esm/numbers.js
CHANGED
package/dist/esm/rect.js
CHANGED
package/dist/esm/strings.js
CHANGED