@pacem/pacem 1.0.5-archimedes → 1.0.5-bartels
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser/pacem-2d.js +1 -1
- package/dist/browser/pacem-2d.min.js +1 -1
- package/dist/browser/pacem-3d.js +1 -1
- package/dist/browser/pacem-3d.min.js +1 -1
- package/dist/browser/pacem-charts.js +1 -1
- package/dist/browser/pacem-charts.min.js +1 -1
- package/dist/browser/pacem-cms.js +1 -1
- package/dist/browser/pacem-cms.min.js +1 -1
- package/dist/browser/pacem-core.js +1 -1
- package/dist/browser/pacem-core.min.js +1 -1
- package/dist/browser/pacem-foundation.js +1 -1
- package/dist/browser/pacem-foundation.min.js +1 -1
- package/dist/browser/pacem-fx.js +1 -1
- package/dist/browser/pacem-fx.min.js +1 -1
- package/dist/browser/pacem-logging.js +1 -1
- package/dist/browser/pacem-logging.min.js +1 -1
- package/dist/browser/pacem-maps.js +1 -1
- package/dist/browser/pacem-maps.min.js +1 -1
- package/dist/browser/pacem-media.js +1 -1
- package/dist/browser/pacem-media.min.js +1 -1
- package/dist/browser/pacem-networking.js +1 -1
- package/dist/browser/pacem-networking.min.js +1 -1
- package/dist/browser/pacem-numerical.js +1 -1
- package/dist/browser/pacem-numerical.min.js +1 -1
- package/dist/browser/pacem-plus.js +7 -2
- package/dist/browser/pacem-plus.js.map +1 -1
- package/dist/browser/pacem-plus.min.js +2 -2
- package/dist/browser/pacem-scaffolding.js +1 -1
- package/dist/browser/pacem-scaffolding.min.js +1 -1
- package/dist/browser/pacem-ui.js +1 -1
- package/dist/browser/pacem-ui.min.js +1 -1
- package/dist/bundle/pacem.min.mjs +76 -76
- package/dist/bundle/pacem.mjs +32 -26
- package/dist/bundle/pacem.mjs.map +3 -3
- package/dist/docs/pacem-plus.json +6363 -6351
- package/dist/typings/index.d.ts +48 -42
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem v1.0.5-
|
|
2
|
+
* @pacem/pacem v1.0.5-bartels (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
var $v=Object.defineProperty;var ux=Object.getOwnPropertyDescriptor;var Hv=o=>{throw TypeError(o)};var Le=(o,r)=>{for(var e in r)$v(o,e,{get:r[e],enumerable:!0})};var c=(o,r,e,t)=>{for(var n=t>1?void 0:t?ux(r,e):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&$v(r,e,n),n};var Bv=(o,r,e)=>r.has(o)||Hv("Cannot "+e);var M=(o,r,e)=>(Bv(o,r,"read from private field"),e?e.call(o):r.get(o)),z=(o,r,e)=>r.has(o)?Hv("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),H=(o,r,e,t)=>(Bv(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);Number.prototype.isCloseTo=function(o,r=14){let e=+`1e-${r}`;return this>o-e&&this<o+e};Number.prototype.roundoff=function(o=14){return parseFloat(this.toFixed(o))};Number.prototype.clamp=function(o,r){let e=this;return o!=null&&!isNaN(o)&&(e=Math.max(e,o)),r!=null&&!isNaN(r)&&(e=Math.min(e,r)),e};Number.prototype.toBase62=function(){for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",r=this,e="";r!=0;){var t=r%62;e=o.charAt(t)+e,r=Math.floor(r/62)}return e};Number.prototype.toBase36=function(){return this.toString(36)};var hx=/^\/Date\([\d]+\)\/$/i,br=class o{static parse(r){let e;return typeof r=="string"?(hx.test(r)?e=parseInt(r.substring(6)):e=Date.parse(r),new Date(e)):typeof r=="number"?new Date(r):r}static isLeapYear(r){return r%4===0&&r%100!==0||r%400===0}static daysInMonth(r,e){return[31,o.isLeapYear(r)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static isDate(r){return r instanceof Date&&!isNaN(r.valueOf())}static dateOnly(r){return new Date(r.getFullYear(),r.getMonth(),r.getDate())}static addMonths(r,e){let t=r.getDate(),n=new Date(r),i=n.getMonth()+e,s=0;for(;i<0;)i+=12,s--;return n.setDate(1),n.setMonth(i%12),n.setFullYear(n.getFullYear()+s+Math.floor(i/12)),n.setDate(Math.min(t,o.daysInMonth(n.getFullYear(),n.getMonth()))),n}static addDays(r,e){return new Date(r.valueOf()+e*864e5)}static daysBetween(r,e){return(e.valueOf()-r.valueOf())/864e5}};var be=class o{static isNull(r){return r==null}static isEmpty(r){try{return Array.isArray(r)&&r.length===0||typeof r=="string"&&r===""||typeof r=="object"&&Object.keys(r).length===0&&!br.isDate(r)&&!(r instanceof RegExp)&&!(r instanceof FileSystemDirectoryHandle)&&!(r instanceof FileSystemFileHandle)}catch{return!1}}static isNullOrEmpty(r){return o.isNull(r)||o.isEmpty(r)}};Array.prototype.distinct=function(){return Array.from(new Set(this))};Array.prototype.union=function(o){let r=be.isNullOrEmpty(this),e=be.isNullOrEmpty(o);return r&&e?[]:e?this.slice():r?o.slice():this.concat(o).distinct()};Array.prototype.moveWithin=function(o,r){let e="Index must be greater or equal than 0 and less or equal than the length of the array.";var t=this;if(o<0||o>t.length)throw new Error(e);if(r<0||r>t.length)throw new Error(e);t.splice(r,0,Array.prototype.splice.apply(t,[o,1])[0])};Array.prototype.equalsContent=function(o){if(o==null||this.length!==o.length)return!1;for(let r=0;r<this.length;r++)if(this[r]!==o[r])return!1;return!0};Array.prototype.cloneFrom=function(o){if(o==null)throw"Cannot clone array from null object.";let r=o.length;var e=this.length!==o.length;for(let t=0;t<r;t++){let n=o[t];this.length>t?this[t]!==n&&(this[t]=n,e=!0):(Array.prototype.push.apply(this,[n]),e=!0)}e&&this.splice(r)};function Vv(o){return o!=null&&typeof o=="object"&&!Array.isArray(o)&&(o.constructor===Object||o.constructor===void 0)}function zv(o,r){let e=o;for(let t of Object.keys(r)){let n=r[t],i=e[t];Vv(n)?e[t]=zv(Vv(i)?i:{},n):Array.isArray(n)?e[t]=n.slice():e[t]=n}return e}var Uv=class{constructor(){}static merge(r,e){return e??=globalThis.Pacem??={},zv(e,r)}};var Pp=class{static range(r,e,t=2){let n=r;be.isNull(e)&&(e=t=r,r=1);let i=(e-r)/(t-1),s=[];if(i>0)for(;s.length<t;)s.push(n.roundoff()),n+=i;return s}static chunkify(r,e){if(be.isNullOrEmpty(r))return[];if(e<=0||e%1!==0)throw new Error("Provide a positive integer number.");let t=Math.ceil(r.length/e);return Array.from({length:t},(n,i)=>{let s=i*e,l=s+e;return r.slice(s,l)})}};var mo=class o{static blobToDataURL(r){return new Promise((e,t)=>{let n=new FileReader;n.onload=i=>{e(i.target.result)},n.readAsDataURL(r)})}static _b64ToUint8Array(r){let e=r.length,t=new Uint8Array(e);for(;e--;)t[e]=r.charCodeAt(e);return t}static base64ToBlob(r,e){let t=o._b64ToUint8Array(atob(r));return new Blob([t],e)}static dataURLToBlob(r){let e=r.indexOf(",");if(e===-1)return o.base64ToBlob(r);{let t=r.substring(e+1),i=r.substring(0,e).match(/:(.*?);/)[1];return o.base64ToBlob(t,{type:i})}}static async blobToText(r,e){let t=await r.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(t)}static textToBlob(r,e="text/plain",t="utf-8",n,i=63){let s=t.toLowerCase(),l=()=>`${e};charset=${s}`;switch(s){case"utf-8":{let u=new TextEncoder().encode(r),f=n?[new Uint8Array([239,187,191]),u]:[u];return new Blob(f,{type:l()})}case"utf-16":s="utf-16le",n??=!0;case"utf-16le":case"utf-16be":{let p=s!=="utf-16be",u=n?1:0,f=new ArrayBuffer((r.length+u)*2),g=new DataView(f);n&&g.setUint16(0,65279,p);for(let v=0;v<r.length;v++)g.setUint16((v+u)*2,r.charCodeAt(v),p);return new Blob([f],{type:l()})}case"ascii":case"iso-8859-1":case"latin1":{let p=s==="ascii"?127:255,u=new Uint8Array(r.length),f=i>0;for(let g=0;g<r.length;g++){let v=r.charCodeAt(g);if(v>p)if(f)u[g]=i;else throw new Error(`Character "${r[g]}" cannot be encoded in ${t}.`);else u[g]=v}return new Blob([u],{type:l()})}default:throw new Error(`Encoding "${t}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}};var Ui=(o,r)=>{let e=o.match(r);return e?e[2]:null};function Bu(o=navigator.userAgent){let r="unknown",e=null;switch(/ucbrowser/i.test(o)?r="UCBrowser":/edg/i.test(o)?r="Edge":/googlebot/i.test(o)?r="GoogleBot":/chromium/i.test(o)?r="Chromium":/firefox|fxios/i.test(o)&&!/seamonkey/i.test(o)?r="Firefox":/; msie|trident/i.test(o)&&!/ucbrowser/i.test(o)?r="IE":/chrome|crios/i.test(o)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(o)?r="Chrome":/safari/i.test(o)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(o)?r="Safari":/opr|opera/i.test(o)&&(r="Opera"),r){case"UCBrowser":e=Ui(o,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":e=Ui(o,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":e=Ui(o,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":e=Ui(o,/(chromium)\/([\d\.]+)/i);break;case"Firefox":e=Ui(o,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":e=Ui(o,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":e=Ui(o,/(safari)\/([\d\.]+)/i);break;case"Opera":e=Ui(o,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{let t=Ui(o,/(trident)\/([\d\.]+)/i);e=t?`${parseFloat(t)+4}`:"7.0";break}default:e="0.0.0.0";break}return{name:r,version:e}}var Gv=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,Fv=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,Wv=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,jv=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,Yv=/^#[a-f0-9]{6}$/,Xv=/^#[a-f0-9]{3}$/;function Ip(o){return!be.isNullOrEmpty(o)&&typeof o=="object"&&"r"in o&&"g"in o&&"b"in o&&typeof o.r=="number"&&typeof o.b=="number"&&typeof o.g=="number"?(o.a??=1,o.r>=0&&o.r<=1&&o.g>=0&&o.g<=1&&o.b>=0&&o.b<=1&&o.a>=0&&o.a<=1):!1}function Fn(o){return!be.isNullOrEmpty(o)&&typeof o=="object"&&"h"in o&&"s"in o&&"l"in o&&typeof o.h=="number"&&typeof o.s=="number"&&typeof o.l=="number"?(o.a??=1,o.h>=0&&o.h<=360&&o.s>=0&&o.s<=1&&o.l>=0&&o.l<=1&&o.a>=0&&o.a<=1):!1}function mx(o){let r=o.r,e=o.g,t=o.b;return(.5*(Math.max(r,e,t)+Math.min(r,e,t))).clamp(0,1)}var yt={adjustRgbChannel:o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),adjustRgbChannelInv:o=>o<=.00304?o*12.92:1.055*(Math.pow(o,1/2.4)-.055),adjustRgb:o=>({r:yt.adjustRgbChannel(o.r),g:yt.adjustRgbChannel(o.g),b:yt.adjustRgbChannel(o.b),a:o.a}),adjustRgbInv:o=>({r:yt.adjustRgbChannelInv(o.r),g:yt.adjustRgbChannelInv(o.g),b:yt.adjustRgbChannelInv(o.b),a:o.a}),X:o=>.4125*o.r+.3576*o.g+.1804*o.b,Y:o=>.2126*o.r+.7152*o.g+.0722*o.b,Z:o=>.0193*o.r+.1191*o.g+.9503*o.b,relativeLuminance:o=>{let r=yt.adjustRgb(o);return yt.Y(r)},rgbToCieXYZ:o=>{let r=yt.adjustRgb(o);return{x:yt.X(r),y:yt.Y(r),z:yt.Z(r),a:o.a}},cieXYZToRgb:o=>{let r=3.241*o.x-1.5374*o.y-.4986*o.z,e=-.9692*o.x+1.876*o.y+.0416*o.z,t=.0556*o.x-.204*o.y+1.057*o.z;return yt.adjustRgbInv({r,g:e,b:t,a:o.a})},contrastRatio:(o,r)=>{let e=yt.relativeLuminance(o)+.05,t=yt.relativeLuminance(r)+.05;return e>t?e/t:t/e}};function fx(o,r){let e=o.r,t=o.g,n=o.b,i=Math.max(e,t,n),s=Math.min(e,t,n);return(r===0||r===1?0:(i-s)/(1-Math.abs(2*r-1))).clamp(0,1)}function gx(o){let r=o.r,e=o.g,t=o.b,n=Math.max(r,e,t),i=Math.min(r,e,t),s=0;return n!==i&&(n===r?s=(60*((e-t)/(n-i))+360)%360:n===e?s=(60*((t-r)/(n-i))+120)%360:s=(60*((r-e)/(n-i))+240)%360),s.clamp(0,360)}function zm(o){return o.toString(16).padStart(2,"0")}var Be=class o{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(r){let e=t=>Math.min(1,Math.max(0,t));return r[3]==null&&(r[3]=1),{r:e(r[0]),g:e(r[1]),b:e(r[2]),a:Math.min(1,Math.max(0,r[3]))}}static _normalize(r){return[r[0]/255,r[1]/255,r[2]/255,r[3]]}static parse(r){if(r=(r||"").toLowerCase(),Wv.test(r)){let e=Wv.exec(r);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(jv.test(r)){let e=jv.exec(r);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(Yv.test(r)){let e=Yv.exec(r)[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(Xv.test(r)){let e=Xv.exec(r)[0],t=e.substr(1,1),n=e.substr(2,1),i=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+t+t),parseInt("0x"+n+n),parseInt("0x"+i+i),1]))}if(Gv.test(r)){let e=Gv.exec(r),t={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01};return this.rgb(t)}if(Fv.test(r)){let e=Fv.exec(r),t={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01,a:parseFloat(e[4])};return this.rgb(t)}}static hsl(r){let e=mx(r),t=fx(r,e);return{h:gx(r),s:t,l:e,a:r.a}}static cieXYZ(r){return Fn(r)&&(r=this.rgb(r)),yt.rgbToCieXYZ(r)}static rgb(r){if(Fn(r)){let e=r.h,t=r.s,n=r.l,i=e/60,s=(1-Math.abs(2*n-1))*t,l=s*(1-Math.abs(i%2-1)),p=n-s/2,u=(f,g,v)=>this._clampRGB([f+p,g+p,v+p,r.a]);if(i<=1)return u(s,l,0);if(i<=2)return u(l,s,0);if(i<=3)return u(0,s,l);if(i<=4)return u(0,l,s);if(i<=5)return u(l,0,s);if(i<=6)return u(s,0,l)}else{let e=yt.cieXYZToRgb(r);return this._clampRGB([e.r,e.g,e.b,e.a])}}static stringify(r,e=1){if(Fn(r)){e??=1,r.a??=1;let t=typeof e=="number"?e:1;return`hsla(${r.h.roundoff(t)},${(r.s*100).roundoff(t)}%,${(r.l*100).roundoff(t)}%,${r.a.roundoff()})`}else if(Ip(r)){e??=!0,r.a??=1;let t=typeof e=="boolean"?e:!!e,n=Math.round(r.r*255),i=Math.round(r.g*255),s=Math.round(r.b*255),l=r.a.roundoff();return l===1?t?("#"+zm(n)+zm(i)+zm(s)).toUpperCase():`rgb(${n},${i},${s})`:`rgba(${n},${i},${s},${l})`}}static contrastRatio(r,e){return Fn(r)&&(r=this.rgb(r)),Fn(e)&&(e=this.rgb(e)),yt.contrastRatio(r,e)}static luminance(r){return Fn(r)&&(r=o.rgb(r)),yt.relativeLuminance(r)}static lighten(r,e=.1){if(e||=0,Fn(r)){let t=Math.min(1,Math.max(0,r.l+e));return Object.assign({},r,{l:t})}if(Ip(r)){let t=this.lighten(this.hsl(r),e);return this.rgb(t)}return r}static darken(r,e=.1){return this.lighten(r,-e)}static saturate(r,e=.1){if(e||=0,Fn(r)){let t=Math.min(1,Math.max(0,r.s+e));return Object.assign({},r,{s:t})}if(Ip(r)){let t=this.saturate(this.hsl(r),e);return this.rgb(t)}return r}static desaturate(r,e=.1){return this.saturate(r,-e)}static interpolate(r,e,t,n){t??=.5,n??=t;let i=(t+n).roundoff(),s=(t/i).roundoff(),l=(n/i).roundoff(),p=Ip(r),u=Fn(r),f=v=>Ip(v)||Fn(v)?o.cieXYZ(v):v;r=f(r),e=f(e);let g={x:(r.x*s+e.x*l).roundoff(),y:(r.y*s+e.y*l).roundoff(),z:(r.z*s+e.z*l).roundoff(),a:(r.a*s+e.a*l).roundoff()};return p?o.rgb(g):u?o.hsl(o.rgb(g)):g}};var vx=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function yr(o){let r=[],e=o.match(vx);return e&&e.length>0&&e.forEach(t=>r.push(parseFloat(t))),r}var Wn=class o{static isAngle(r){return typeof r=="object"&&"vertex"in r&&se.isPoint(r.vertex)&&"start"in r&&se.isPoint(r.start)&&"end"in r&&se.isPoint(r.end)}static value(r){if(be.isNullOrEmpty(r)||!o.isAngle(r))return Number.NaN;let{vertex:e,start:t,end:n}=r;return o.angleBetween(e,t,n)}static angleBetween(r,e,t){let n={x:e.x-r.x,y:e.y-r.y},i={x:t.x-r.x,y:t.y-r.y},s=n.x*i.x+n.y*i.y,l=n.x*i.y-n.y*i.x;return-Math.atan2(l,s)}},Zs=class{static parse(r){let e=yr(r);if(e&&e.length===2)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${r}" as a valid Size.`)}static isSize(r){return typeof r=="object"&&"width"in r&&typeof r.width=="number"&&"height"in r&&typeof r.height=="number"}},se=class{static parse(r){let e=yr(r);if(e&&e.length===2)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${r}" as a valid Point.`)}static isPoint(r){return typeof r=="object"&&"x"in r&&typeof r.x=="number"&&"y"in r&&typeof r.y=="number"}static distance(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}static subtract(r,e){return{x:e.x-r.x,y:e.y-r.y}}static add(...r){var e={x:0,y:0};for(var t of r)e.x+=t.x,e.y+=t.y;return e}static multiply(r,e){return{x:r.x*e,y:r.y*e}}};var ke=class o{static isIdentity(r){return r.a===1&&r.d===1&&r.b===0&&r.f===0&&r.c===0&&r.e===0}static get identity(){return{a:1,b:0,c:0,d:1,e:0,f:0}}static copy(r){return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e,f:r.f}}static scale(r,e,t=e){return{a:r.a*e,b:r.b,c:r.c,d:r.d*t,e:r.e,f:r.f}}static translate(r,e){return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e+e.x,f:r.f+e.y}}static rotate(r,e){let t=Math.cos(e),n=Math.sin(e);return o.multiply(r,{a:t,b:n,c:-n,d:t,e:0,f:0})}static multiply(r,e){return"x"in r&&"y"in r?typeof e=="number"?{x:r.x*e,y:r.y*e}:{x:r.x*e.a+r.y*e.c+e.e,y:r.x*e.b+r.y*e.d+e.f}:typeof e=="number"?{a:r.a*e,b:r.b*e,c:r.c*e,d:r.d*e,e:r.e*e,f:r.f*e}:{a:r.a*e.a+r.b*e.c,b:r.a*e.b+r.b*e.d,c:r.c*e.a+r.d*e.c,d:r.c*e.b+r.d*e.d,e:r.e*e.a+r.f*e.c+e.e,f:r.e*e.b+r.f*e.d+e.f}}static det(r){return r.a*r.d-r.c*r.b}static invert(r){let e=this.det(r);if(e===0)return null;let t=1/e;return this.multiply({a:r.d,b:-r.b,c:-r.c,d:r.a,e:-r.e*r.d+r.c*r.f,f:r.e*r.b-r.a*r.f},t)}static toComponents(r,e={x:0,y:0}){let t=Math.sqrt(r.a*r.a+r.c*r.c),n=Math.sqrt(r.b*r.b+r.d*r.d),i=t!=0?r.a/t:0,s=t!=0?r.c/t:0,l=Math.atan2(s,i),{x:p,y:u}=e,f={x:r.e-p*(t*i-1)+u*t*s,y:r.f-u*(n*i-1)-p*n*s};return{scaleX:t,scaleY:n,rotation:l,translation:f}}static fromTransform([r,e,t],[n,i,s]){let l=r.x*(e.y-t.y)-r.y*(e.x-t.x)+(e.x*t.y-t.x*e.y);if(Math.abs(l)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");let p=1/l;return{a:p*(n.x*(e.y-t.y)+i.x*(t.y-r.y)+s.x*(r.y-e.y)),b:p*(n.y*(e.y-t.y)+i.y*(t.y-r.y)+s.y*(r.y-e.y)),c:p*(n.x*(t.x-e.x)+i.x*(r.x-t.x)+s.x*(e.x-r.x)),d:p*(n.y*(t.x-e.x)+i.y*(r.x-t.x)+s.y*(e.x-r.x)),e:p*(n.x*(e.x*t.y-t.x*e.y)+i.x*(t.x*r.y-r.x*t.y)+s.x*(r.x*e.y-e.x*r.y)),f:p*(n.y*(e.x*t.y-t.x*e.y)+i.y*(t.x*r.y-r.x*t.y)+s.y*(r.x*e.y-e.x*r.y))}}static areClose(r,e,t=12){return r.a.isCloseTo(e.a,t)&&r.b.isCloseTo(e.b,t)&&r.c.isCloseTo(e.c,t)&&r.d.isCloseTo(e.d,t)&&r.e.isCloseTo(e.e,t)&&r.f.isCloseTo(e.f,t)}};var Ze=class o{static parse(r){let e=yr(r);if(e&&e.length===4)return{x:e[0],y:e[1],width:e[2],height:e[3]};throw new Error(`Cannot parse "${r}" as a valid Rect.`)}static isRect(r){return se.isPoint(r)&&Zs.isSize(r)}static _stretch(r,e){return{a:e.width/r.width,b:0,c:0,d:e.height/r.height,e:e.x-r.x,f:e.y-r.y}}static _contain(r,e,t,n){let i=1,s=r.width/r.height,l=e.width/e.height;s>=l?i=e.width/r.width:i=e.height/r.height;let p=r.width*i,u=r.height*i,f=this._align({x:r.x,y:r.y,width:p,height:u},e,t,n);return ke.translate({a:i,b:0,c:0,d:i,e:0,f:0},f)}static _cover(r,e,t,n){let i=1,s=r.width/r.height,l=e.width/e.height;s<l?i=e.width/r.width:i=e.height/r.height;let p=r.width*i,u=r.height*i,f=this._align({x:r.x,y:r.y,width:p,height:u},e,t,n);return ke.translate({a:i,b:0,c:0,d:i,e:0,f:0},f)}static _align(r,e,t,n){let i=0,s=0;switch(t){case"left":i=e.x-r.x;break;case"right":i=e.x+e.width-r.width-r.x;break;default:i=e.x+e.width*.5-r.width*.5-r.x;break}switch(n){case"top":s=e.y-r.y;break;case"bottom":s=e.y+e.height-r.height-r.y;break;default:s=e.y+e.height*.5-r.height*.5-r.y;break}return{x:i,y:s}}static findTransform(r,e,t="stretch",n="center",i="middle"){switch(t){case"contain":return this._contain(r,e,n,i);case"cover":return this._cover(r,e,n,i);default:return this._stretch(r,e)}}static intersect(...r){let e={x:0,y:0,height:0,width:0},t=Array.from(r||[]);if(t.length<=0)return e;for(var n=t[0],i=1;i<t.length;i++){let s=t[i],l=Math.max(s.x,n.x),p=Math.max(s.y,n.y),u=Math.min(s.x+s.width,n.x+n.width),f=Math.min(s.y+s.height,n.y+n.height),g=u-l,v=f-p;if(g<0||v<=0)return e;n={x:l,y:p,width:g,height:v}}return n}static expand(r,...e){let t=Array.from(e||[]),n=r.x,i=r.y,s=n,l=i;o.isRect(r)&&(s+=r.width,l+=r.height);for(let p of t)n=Math.min(p.x,n),i=Math.min(p.y,i),s=Math.max(p.x,s),l=Math.max(p.y,l);return{x:n,y:i,width:s-n,height:l-i}}};var Fl=class{constructor(r,e){this.#n=r,this.#r=e}#e=[];#t=[];#r;#n;get current(){return this.#n}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}set maxlength(r){this.#r=r}undo(){if(this.canUndo){let r=this.#e,e=this.#t,t=this.#n;e.unshift(t),this.#n=r.pop()}}redo(){if(this.canRedo){let r=this.#e,e=this.#t,t=this.#n;r.push(t),this.#n=e.shift()}}push(r){this.#t.splice(0),this.#e.push(this.#n),this.#n=r;let e=this.#r,t=this.#e;e>0&&t.length>e&&t.splice(0,t.length-e)}reset(){this.#t.splice(0),this.#e.splice(0)}};var bx={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"},fo=class o{static async loadImage(r){let e=await fetch(r);return e.ok?await e.blob():null}static async resizeImage(r,e,t,n){if(e<=0||t<=0||isNaN(e)||isNaN(t))throw new Error("Invalid target size");typeof r=="string"&&(r=await o.loadImage(r));let i=await self.createImageBitmap(r),s=i.width,l=i.height,p=new OffscreenCanvas(s,l),u=p.getContext("2d");u.imageSmoothingEnabled=u.mozImageSmoothingEnabled=u.oImageSmoothingEnabled=u.webkitImageSmoothingEnabled=!0;let{quality:f,type:g,mode:v,align:y,valign:_,background:x}=Object.assign({},bx,n??{}),w={width:s,height:l,x:0,y:0},E={x:0,y:0,width:e,height:t},k=Ze.findTransform(w,E,v,y,_);return p.width=e,p.height=t,x&&(u.fillStyle=x,u.fillRect(0,0,p.width,p.height)),u.setTransform(k),u.drawImage(i,0,0),await p.convertToBlob({quality:f,type:g})}};var Qs=class o{static#e;static uniqueId(){let r=o.#e||Date.now();return o.#e=++r}static uniqueCode(){return o.uniqueId().toBase62()}static randomString(r){let e="";do e+=(Math.random()*62).toBase62();while(e.length<r);return e}};var go=class{static round(r,e=1){return Math.round(r/e)*e}static log(r,e){return Math.log10(r)/Math.log10(e)}static rebase(r,e,t){let n=r.toString(),i=parseInt(n,e);return n.endsWith(i.toString(e))?parseInt(r.toString(),e).toString(t):Number.NaN.toString()}};function Gm(o,r){let e=o.length,t=r.length,n=Array.from({length:e+1},()=>Array(t+1).fill(0));for(let i=1;i<=e;i++)for(let s=1;s<=t;s++)o[i-1]===r[s-1]?n[i][s]=n[i-1][s-1]+1:n[i][s]=Math.max(n[i-1][s],n[i][s-1]);return n}function Fm(o,r,e,t=""){let n=o.length,i=r.length,s=[],l=n,p=i,u=null,f=()=>{u&&(s.push(u),u=null)};for(;l>0||p>0;){var g=null;let v=null;l>0&&p>0&&o[l-1]===r[p-1]?(g="=",v=o[l-1],l--,p--):p>0&&(l===0||e[l][p-1]>=e[l-1][p])?(g="+",v=r[p-1],p--):l>0&&(p===0||e[l-1][p]>e[l][p-1])&&(g="-",v=o[l-1],l--),g&&v!==null?u&&u.type===g?u.value=v+(u.value?t:"")+u.value:(f(),u={type:g,value:v}):f()}return f(),s.reverse()}function yx(o,r){let e=o.split(""),t=r.split(""),n=Gm(e,t);return Fm(e,t,n,"")}function _x(o,r){let e=/(\S+|\s+)/g,t=o.match(e)||[],n=r.match(e)||[],i=Gm(t,n);return Fm(t,n,i,"")}function xx(o,r){let e=/\r?\n/,t=o.split(e),n=r.split(e),i=Gm(t,n);return Fm(t,n,i,`
|
|
7
|
-
`)}var gn=class{static leftPad(r,e,t){return r.toString().padStart(e,t)}static format(r,...e){let t=Array.from(e),n=r;for(let s=0;s<t.length;s++){let l=new RegExp("(^|[^\\{])\\{"+s+"\\}($|[^\\}])","g");n=n.replaceAll(l,(p,...u)=>p.replace("{"+s+"}",t[s]))}let i=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(n);if(!be.isNullOrEmpty(i))throw new Error(`Missing argument at index ${i[2]}.`);return n}static diff(r,e,t="char"){switch(t){case"line":return
|
|
6
|
+
var Hv=Object.defineProperty;var hx=Object.getOwnPropertyDescriptor;var Bv=o=>{throw TypeError(o)};var Se=(o,r)=>{for(var e in r)Hv(o,e,{get:r[e],enumerable:!0})};var c=(o,r,e,t)=>{for(var n=t>1?void 0:t?hx(r,e):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Hv(r,e,n),n};var Vv=(o,r,e)=>r.has(o)||Bv("Cannot "+e);var M=(o,r,e)=>(Vv(o,r,"read from private field"),e?e.call(o):r.get(o)),z=(o,r,e)=>r.has(o)?Bv("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),H=(o,r,e,t)=>(Vv(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);Number.prototype.isCloseTo=function(o,r=14){let e=+`1e-${r}`;return this>o-e&&this<o+e};Number.prototype.roundoff=function(o=14){return parseFloat(this.toFixed(o))};Number.prototype.clamp=function(o,r){let e=this;return o!=null&&!isNaN(o)&&(e=Math.max(e,o)),r!=null&&!isNaN(r)&&(e=Math.min(e,r)),e};Number.prototype.toBase62=function(){for(var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",r=this,e="";r!=0;){var t=r%62;e=o.charAt(t)+e,r=Math.floor(r/62)}return e};Number.prototype.toBase36=function(){return this.toString(36)};var mx=/^\/Date\([\d]+\)\/$/i,br=class o{static parse(r){let e;return typeof r=="string"?(mx.test(r)?e=parseInt(r.substring(6)):e=Date.parse(r),new Date(e)):typeof r=="number"?new Date(r):r}static isLeapYear(r){return r%4===0&&r%100!==0||r%400===0}static daysInMonth(r,e){return[31,o.isLeapYear(r)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static isDate(r){return r instanceof Date&&!isNaN(r.valueOf())}static dateOnly(r){return new Date(r.getFullYear(),r.getMonth(),r.getDate())}static addMonths(r,e){let t=r.getDate(),n=new Date(r),i=n.getMonth()+e,s=0;for(;i<0;)i+=12,s--;return n.setDate(1),n.setMonth(i%12),n.setFullYear(n.getFullYear()+s+Math.floor(i/12)),n.setDate(Math.min(t,o.daysInMonth(n.getFullYear(),n.getMonth()))),n}static addDays(r,e){return new Date(r.valueOf()+e*864e5)}static daysBetween(r,e){return(e.valueOf()-r.valueOf())/864e5}};var be=class o{static isNull(r){return r==null}static isEmpty(r){try{return Array.isArray(r)&&r.length===0||typeof r=="string"&&r===""||typeof r=="object"&&Object.keys(r).length===0&&!br.isDate(r)&&!(r instanceof RegExp)&&!(r instanceof FileSystemDirectoryHandle)&&!(r instanceof FileSystemFileHandle)}catch{return!1}}static isNullOrEmpty(r){return o.isNull(r)||o.isEmpty(r)}};Array.prototype.distinct=function(){return Array.from(new Set(this))};Array.prototype.union=function(o){let r=be.isNullOrEmpty(this),e=be.isNullOrEmpty(o);return r&&e?[]:e?this.slice():r?o.slice():this.concat(o).distinct()};Array.prototype.moveWithin=function(o,r){let e="Index must be greater or equal than 0 and less or equal than the length of the array.";var t=this;if(o<0||o>t.length)throw new Error(e);if(r<0||r>t.length)throw new Error(e);t.splice(r,0,Array.prototype.splice.apply(t,[o,1])[0])};Array.prototype.equalsContent=function(o){if(o==null||this.length!==o.length)return!1;for(let r=0;r<this.length;r++)if(this[r]!==o[r])return!1;return!0};Array.prototype.cloneFrom=function(o){if(o==null)throw"Cannot clone array from null object.";let r=o.length;var e=this.length!==o.length;for(let t=0;t<r;t++){let n=o[t];this.length>t?this[t]!==n&&(this[t]=n,e=!0):(Array.prototype.push.apply(this,[n]),e=!0)}e&&this.splice(r)};function Uv(o){return o!=null&&typeof o=="object"&&!Array.isArray(o)&&(o.constructor===Object||o.constructor===void 0)}function Gv(o,r){let e=o;for(let t of Object.keys(r)){let n=r[t],i=e[t];Uv(n)?e[t]=Gv(Uv(i)?i:{},n):Array.isArray(n)?e[t]=n.slice():e[t]=n}return e}var zv=class{constructor(){}static merge(r,e){return e??=globalThis.Pacem??={},Gv(e,r)}};var Pp=class{static range(r,e,t=2){let n=r;be.isNull(e)&&(e=t=r,r=1);let i=(e-r)/(t-1),s=[];if(i>0)for(;s.length<t;)s.push(n.roundoff()),n+=i;return s}static chunkify(r,e){if(be.isNullOrEmpty(r))return[];if(e<=0||e%1!==0)throw new Error("Provide a positive integer number.");let t=Math.ceil(r.length/e);return Array.from({length:t},(n,i)=>{let s=i*e,l=s+e;return r.slice(s,l)})}};var mo=class o{static blobToDataURL(r){return new Promise((e,t)=>{let n=new FileReader;n.onload=i=>{e(i.target.result)},n.readAsDataURL(r)})}static _b64ToUint8Array(r){let e=r.length,t=new Uint8Array(e);for(;e--;)t[e]=r.charCodeAt(e);return t}static base64ToBlob(r,e){let t=o._b64ToUint8Array(atob(r));return new Blob([t],e)}static dataURLToBlob(r){let e=r.indexOf(",");if(e===-1)return o.base64ToBlob(r);{let t=r.substring(e+1),i=r.substring(0,e).match(/:(.*?);/)[1];return o.base64ToBlob(t,{type:i})}}static async blobToText(r,e){let t=await r.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(t)}static textToBlob(r,e="text/plain",t="utf-8",n,i=63){let s=t.toLowerCase(),l=()=>`${e};charset=${s}`;switch(s){case"utf-8":{let u=new TextEncoder().encode(r),f=n?[new Uint8Array([239,187,191]),u]:[u];return new Blob(f,{type:l()})}case"utf-16":s="utf-16le",n??=!0;case"utf-16le":case"utf-16be":{let p=s!=="utf-16be",u=n?1:0,f=new ArrayBuffer((r.length+u)*2),g=new DataView(f);n&&g.setUint16(0,65279,p);for(let v=0;v<r.length;v++)g.setUint16((v+u)*2,r.charCodeAt(v),p);return new Blob([f],{type:l()})}case"ascii":case"iso-8859-1":case"latin1":{let p=s==="ascii"?127:255,u=new Uint8Array(r.length),f=i>0;for(let g=0;g<r.length;g++){let v=r.charCodeAt(g);if(v>p)if(f)u[g]=i;else throw new Error(`Character "${r[g]}" cannot be encoded in ${t}.`);else u[g]=v}return new Blob([u],{type:l()})}default:throw new Error(`Encoding "${t}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}};var Ui=(o,r)=>{let e=o.match(r);return e?e[2]:null};function Bu(o=navigator.userAgent){let r="unknown",e=null;switch(/ucbrowser/i.test(o)?r="UCBrowser":/edg/i.test(o)?r="Edge":/googlebot/i.test(o)?r="GoogleBot":/chromium/i.test(o)?r="Chromium":/firefox|fxios/i.test(o)&&!/seamonkey/i.test(o)?r="Firefox":/; msie|trident/i.test(o)&&!/ucbrowser/i.test(o)?r="IE":/chrome|crios/i.test(o)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(o)?r="Chrome":/safari/i.test(o)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(o)?r="Safari":/opr|opera/i.test(o)&&(r="Opera"),r){case"UCBrowser":e=Ui(o,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":e=Ui(o,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":e=Ui(o,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":e=Ui(o,/(chromium)\/([\d\.]+)/i);break;case"Firefox":e=Ui(o,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":e=Ui(o,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":e=Ui(o,/(safari)\/([\d\.]+)/i);break;case"Opera":e=Ui(o,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{let t=Ui(o,/(trident)\/([\d\.]+)/i);e=t?`${parseFloat(t)+4}`:"7.0";break}default:e="0.0.0.0";break}return{name:r,version:e}}var Fv=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,Wv=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,jv=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,Yv=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,Xv=/^#[a-f0-9]{6}$/,qv=/^#[a-f0-9]{3}$/;function Ip(o){return!be.isNullOrEmpty(o)&&typeof o=="object"&&"r"in o&&"g"in o&&"b"in o&&typeof o.r=="number"&&typeof o.b=="number"&&typeof o.g=="number"?(o.a??=1,o.r>=0&&o.r<=1&&o.g>=0&&o.g<=1&&o.b>=0&&o.b<=1&&o.a>=0&&o.a<=1):!1}function Fn(o){return!be.isNullOrEmpty(o)&&typeof o=="object"&&"h"in o&&"s"in o&&"l"in o&&typeof o.h=="number"&&typeof o.s=="number"&&typeof o.l=="number"?(o.a??=1,o.h>=0&&o.h<=360&&o.s>=0&&o.s<=1&&o.l>=0&&o.l<=1&&o.a>=0&&o.a<=1):!1}function fx(o){let r=o.r,e=o.g,t=o.b;return(.5*(Math.max(r,e,t)+Math.min(r,e,t))).clamp(0,1)}var yt={adjustRgbChannel:o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),adjustRgbChannelInv:o=>o<=.00304?o*12.92:1.055*(Math.pow(o,1/2.4)-.055),adjustRgb:o=>({r:yt.adjustRgbChannel(o.r),g:yt.adjustRgbChannel(o.g),b:yt.adjustRgbChannel(o.b),a:o.a}),adjustRgbInv:o=>({r:yt.adjustRgbChannelInv(o.r),g:yt.adjustRgbChannelInv(o.g),b:yt.adjustRgbChannelInv(o.b),a:o.a}),X:o=>.4125*o.r+.3576*o.g+.1804*o.b,Y:o=>.2126*o.r+.7152*o.g+.0722*o.b,Z:o=>.0193*o.r+.1191*o.g+.9503*o.b,relativeLuminance:o=>{let r=yt.adjustRgb(o);return yt.Y(r)},rgbToCieXYZ:o=>{let r=yt.adjustRgb(o);return{x:yt.X(r),y:yt.Y(r),z:yt.Z(r),a:o.a}},cieXYZToRgb:o=>{let r=3.241*o.x-1.5374*o.y-.4986*o.z,e=-.9692*o.x+1.876*o.y+.0416*o.z,t=.0556*o.x-.204*o.y+1.057*o.z;return yt.adjustRgbInv({r,g:e,b:t,a:o.a})},contrastRatio:(o,r)=>{let e=yt.relativeLuminance(o)+.05,t=yt.relativeLuminance(r)+.05;return e>t?e/t:t/e}};function gx(o,r){let e=o.r,t=o.g,n=o.b,i=Math.max(e,t,n),s=Math.min(e,t,n);return(r===0||r===1?0:(i-s)/(1-Math.abs(2*r-1))).clamp(0,1)}function vx(o){let r=o.r,e=o.g,t=o.b,n=Math.max(r,e,t),i=Math.min(r,e,t),s=0;return n!==i&&(n===r?s=(60*((e-t)/(n-i))+360)%360:n===e?s=(60*((t-r)/(n-i))+120)%360:s=(60*((r-e)/(n-i))+240)%360),s.clamp(0,360)}function zm(o){return o.toString(16).padStart(2,"0")}var Be=class o{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(r){let e=t=>Math.min(1,Math.max(0,t));return r[3]==null&&(r[3]=1),{r:e(r[0]),g:e(r[1]),b:e(r[2]),a:Math.min(1,Math.max(0,r[3]))}}static _normalize(r){return[r[0]/255,r[1]/255,r[2]/255,r[3]]}static parse(r){if(r=(r||"").toLowerCase(),jv.test(r)){let e=jv.exec(r);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(Yv.test(r)){let e=Yv.exec(r);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(Xv.test(r)){let e=Xv.exec(r)[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(qv.test(r)){let e=qv.exec(r)[0],t=e.substr(1,1),n=e.substr(2,1),i=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+t+t),parseInt("0x"+n+n),parseInt("0x"+i+i),1]))}if(Fv.test(r)){let e=Fv.exec(r),t={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01};return this.rgb(t)}if(Wv.test(r)){let e=Wv.exec(r),t={h:parseFloat(e[1]),s:parseFloat(e[2])*.01,l:parseFloat(e[3])*.01,a:parseFloat(e[4])};return this.rgb(t)}}static hsl(r){let e=fx(r),t=gx(r,e);return{h:vx(r),s:t,l:e,a:r.a}}static cieXYZ(r){return Fn(r)&&(r=this.rgb(r)),yt.rgbToCieXYZ(r)}static rgb(r){if(Fn(r)){let e=r.h,t=r.s,n=r.l,i=e/60,s=(1-Math.abs(2*n-1))*t,l=s*(1-Math.abs(i%2-1)),p=n-s/2,u=(f,g,v)=>this._clampRGB([f+p,g+p,v+p,r.a]);if(i<=1)return u(s,l,0);if(i<=2)return u(l,s,0);if(i<=3)return u(0,s,l);if(i<=4)return u(0,l,s);if(i<=5)return u(l,0,s);if(i<=6)return u(s,0,l)}else{let e=yt.cieXYZToRgb(r);return this._clampRGB([e.r,e.g,e.b,e.a])}}static stringify(r,e=1){if(Fn(r)){e??=1,r.a??=1;let t=typeof e=="number"?e:1;return`hsla(${r.h.roundoff(t)},${(r.s*100).roundoff(t)}%,${(r.l*100).roundoff(t)}%,${r.a.roundoff()})`}else if(Ip(r)){e??=!0,r.a??=1;let t=typeof e=="boolean"?e:!!e,n=Math.round(r.r*255),i=Math.round(r.g*255),s=Math.round(r.b*255),l=r.a.roundoff();return l===1?t?("#"+zm(n)+zm(i)+zm(s)).toUpperCase():`rgb(${n},${i},${s})`:`rgba(${n},${i},${s},${l})`}}static contrastRatio(r,e){return Fn(r)&&(r=this.rgb(r)),Fn(e)&&(e=this.rgb(e)),yt.contrastRatio(r,e)}static luminance(r){return Fn(r)&&(r=o.rgb(r)),yt.relativeLuminance(r)}static lighten(r,e=.1){if(e||=0,Fn(r)){let t=Math.min(1,Math.max(0,r.l+e));return Object.assign({},r,{l:t})}if(Ip(r)){let t=this.lighten(this.hsl(r),e);return this.rgb(t)}return r}static darken(r,e=.1){return this.lighten(r,-e)}static saturate(r,e=.1){if(e||=0,Fn(r)){let t=Math.min(1,Math.max(0,r.s+e));return Object.assign({},r,{s:t})}if(Ip(r)){let t=this.saturate(this.hsl(r),e);return this.rgb(t)}return r}static desaturate(r,e=.1){return this.saturate(r,-e)}static interpolate(r,e,t,n){t??=.5,n??=t;let i=(t+n).roundoff(),s=(t/i).roundoff(),l=(n/i).roundoff(),p=Ip(r),u=Fn(r),f=v=>Ip(v)||Fn(v)?o.cieXYZ(v):v;r=f(r),e=f(e);let g={x:(r.x*s+e.x*l).roundoff(),y:(r.y*s+e.y*l).roundoff(),z:(r.z*s+e.z*l).roundoff(),a:(r.a*s+e.a*l).roundoff()};return p?o.rgb(g):u?o.hsl(o.rgb(g)):g}};var bx=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function yr(o){let r=[],e=o.match(bx);return e&&e.length>0&&e.forEach(t=>r.push(parseFloat(t))),r}var Wn=class o{static isAngle(r){return typeof r=="object"&&"vertex"in r&&se.isPoint(r.vertex)&&"start"in r&&se.isPoint(r.start)&&"end"in r&&se.isPoint(r.end)}static value(r){if(be.isNullOrEmpty(r)||!o.isAngle(r))return Number.NaN;let{vertex:e,start:t,end:n}=r;return o.angleBetween(e,t,n)}static angleBetween(r,e,t){let n={x:e.x-r.x,y:e.y-r.y},i={x:t.x-r.x,y:t.y-r.y},s=n.x*i.x+n.y*i.y,l=n.x*i.y-n.y*i.x;return-Math.atan2(l,s)}},Zs=class{static parse(r){let e=yr(r);if(e&&e.length===2)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${r}" as a valid Size.`)}static isSize(r){return typeof r=="object"&&"width"in r&&typeof r.width=="number"&&"height"in r&&typeof r.height=="number"}},se=class{static parse(r){let e=yr(r);if(e&&e.length===2)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${r}" as a valid Point.`)}static isPoint(r){return typeof r=="object"&&"x"in r&&typeof r.x=="number"&&"y"in r&&typeof r.y=="number"}static distance(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}static subtract(r,e){return{x:e.x-r.x,y:e.y-r.y}}static add(...r){var e={x:0,y:0};for(var t of r)e.x+=t.x,e.y+=t.y;return e}static multiply(r,e){return{x:r.x*e,y:r.y*e}}};var ke=class o{static isIdentity(r){return r.a===1&&r.d===1&&r.b===0&&r.f===0&&r.c===0&&r.e===0}static get identity(){return{a:1,b:0,c:0,d:1,e:0,f:0}}static copy(r){return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e,f:r.f}}static scale(r,e,t=e){return{a:r.a*e,b:r.b,c:r.c,d:r.d*t,e:r.e,f:r.f}}static translate(r,e){return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e+e.x,f:r.f+e.y}}static rotate(r,e){let t=Math.cos(e),n=Math.sin(e);return o.multiply(r,{a:t,b:n,c:-n,d:t,e:0,f:0})}static multiply(r,e){return"x"in r&&"y"in r?typeof e=="number"?{x:r.x*e,y:r.y*e}:{x:r.x*e.a+r.y*e.c+e.e,y:r.x*e.b+r.y*e.d+e.f}:typeof e=="number"?{a:r.a*e,b:r.b*e,c:r.c*e,d:r.d*e,e:r.e*e,f:r.f*e}:{a:r.a*e.a+r.b*e.c,b:r.a*e.b+r.b*e.d,c:r.c*e.a+r.d*e.c,d:r.c*e.b+r.d*e.d,e:r.e*e.a+r.f*e.c+e.e,f:r.e*e.b+r.f*e.d+e.f}}static det(r){return r.a*r.d-r.c*r.b}static invert(r){let e=this.det(r);if(e===0)return null;let t=1/e;return this.multiply({a:r.d,b:-r.b,c:-r.c,d:r.a,e:-r.e*r.d+r.c*r.f,f:r.e*r.b-r.a*r.f},t)}static toComponents(r,e={x:0,y:0}){let t=Math.sqrt(r.a*r.a+r.c*r.c),n=Math.sqrt(r.b*r.b+r.d*r.d),i=t!=0?r.a/t:0,s=t!=0?r.c/t:0,l=Math.atan2(s,i),{x:p,y:u}=e,f={x:r.e-p*(t*i-1)+u*t*s,y:r.f-u*(n*i-1)-p*n*s};return{scaleX:t,scaleY:n,rotation:l,translation:f}}static fromTransform([r,e,t],[n,i,s]){let l=r.x*(e.y-t.y)-r.y*(e.x-t.x)+(e.x*t.y-t.x*e.y);if(Math.abs(l)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");let p=1/l;return{a:p*(n.x*(e.y-t.y)+i.x*(t.y-r.y)+s.x*(r.y-e.y)),b:p*(n.y*(e.y-t.y)+i.y*(t.y-r.y)+s.y*(r.y-e.y)),c:p*(n.x*(t.x-e.x)+i.x*(r.x-t.x)+s.x*(e.x-r.x)),d:p*(n.y*(t.x-e.x)+i.y*(r.x-t.x)+s.y*(e.x-r.x)),e:p*(n.x*(e.x*t.y-t.x*e.y)+i.x*(t.x*r.y-r.x*t.y)+s.x*(r.x*e.y-e.x*r.y)),f:p*(n.y*(e.x*t.y-t.x*e.y)+i.y*(t.x*r.y-r.x*t.y)+s.y*(r.x*e.y-e.x*r.y))}}static areClose(r,e,t=12){return r.a.isCloseTo(e.a,t)&&r.b.isCloseTo(e.b,t)&&r.c.isCloseTo(e.c,t)&&r.d.isCloseTo(e.d,t)&&r.e.isCloseTo(e.e,t)&&r.f.isCloseTo(e.f,t)}};var Ze=class o{static parse(r){let e=yr(r);if(e&&e.length===4)return{x:e[0],y:e[1],width:e[2],height:e[3]};throw new Error(`Cannot parse "${r}" as a valid Rect.`)}static isRect(r){return se.isPoint(r)&&Zs.isSize(r)}static _stretch(r,e){return{a:e.width/r.width,b:0,c:0,d:e.height/r.height,e:e.x-r.x,f:e.y-r.y}}static _contain(r,e,t,n){let i=1,s=r.width/r.height,l=e.width/e.height;s>=l?i=e.width/r.width:i=e.height/r.height;let p=r.width*i,u=r.height*i,f=this._align({x:r.x,y:r.y,width:p,height:u},e,t,n);return ke.translate({a:i,b:0,c:0,d:i,e:0,f:0},f)}static _cover(r,e,t,n){let i=1,s=r.width/r.height,l=e.width/e.height;s<l?i=e.width/r.width:i=e.height/r.height;let p=r.width*i,u=r.height*i,f=this._align({x:r.x,y:r.y,width:p,height:u},e,t,n);return ke.translate({a:i,b:0,c:0,d:i,e:0,f:0},f)}static _align(r,e,t,n){let i=0,s=0;switch(t){case"left":i=e.x-r.x;break;case"right":i=e.x+e.width-r.width-r.x;break;default:i=e.x+e.width*.5-r.width*.5-r.x;break}switch(n){case"top":s=e.y-r.y;break;case"bottom":s=e.y+e.height-r.height-r.y;break;default:s=e.y+e.height*.5-r.height*.5-r.y;break}return{x:i,y:s}}static findTransform(r,e,t="stretch",n="center",i="middle"){switch(t){case"contain":return this._contain(r,e,n,i);case"cover":return this._cover(r,e,n,i);default:return this._stretch(r,e)}}static intersect(...r){let e={x:0,y:0,height:0,width:0},t=Array.from(r||[]);if(t.length<=0)return e;for(var n=t[0],i=1;i<t.length;i++){let s=t[i],l=Math.max(s.x,n.x),p=Math.max(s.y,n.y),u=Math.min(s.x+s.width,n.x+n.width),f=Math.min(s.y+s.height,n.y+n.height),g=u-l,v=f-p;if(g<0||v<=0)return e;n={x:l,y:p,width:g,height:v}}return n}static expand(r,...e){let t=Array.from(e||[]),n=r.x,i=r.y,s=n,l=i;o.isRect(r)&&(s+=r.width,l+=r.height);for(let p of t)n=Math.min(p.x,n),i=Math.min(p.y,i),s=Math.max(p.x,s),l=Math.max(p.y,l);return{x:n,y:i,width:s-n,height:l-i}}};var Fl=class{constructor(r,e){this.#n=r,this.#r=e}#e=[];#t=[];#r;#n;get current(){return this.#n}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}set maxlength(r){this.#r=r}undo(){if(this.canUndo){let r=this.#e,e=this.#t,t=this.#n;e.unshift(t),this.#n=r.pop()}}redo(){if(this.canRedo){let r=this.#e,e=this.#t,t=this.#n;r.push(t),this.#n=e.shift()}}push(r){this.#t.splice(0),this.#e.push(this.#n),this.#n=r;let e=this.#r,t=this.#e;e>0&&t.length>e&&t.splice(0,t.length-e)}reset(){this.#t.splice(0),this.#e.splice(0)}};var yx={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"},fo=class o{static async loadImage(r){let e=await fetch(r);return e.ok?await e.blob():null}static async resizeImage(r,e,t,n){if(e<=0||t<=0||isNaN(e)||isNaN(t))throw new Error("Invalid target size");typeof r=="string"&&(r=await o.loadImage(r));let i=await self.createImageBitmap(r),s=i.width,l=i.height,p=new OffscreenCanvas(s,l),u=p.getContext("2d");u.imageSmoothingEnabled=u.mozImageSmoothingEnabled=u.oImageSmoothingEnabled=u.webkitImageSmoothingEnabled=!0;let{quality:f,type:g,mode:v,align:y,valign:_,background:x}=Object.assign({},yx,n??{}),w={width:s,height:l,x:0,y:0},E={x:0,y:0,width:e,height:t},k=Ze.findTransform(w,E,v,y,_);return p.width=e,p.height=t,x&&(u.fillStyle=x,u.fillRect(0,0,p.width,p.height)),u.setTransform(k),u.drawImage(i,0,0),await p.convertToBlob({quality:f,type:g})}};var Qs=class o{static#e;static uniqueId(){let r=o.#e||Date.now();return o.#e=++r}static uniqueCode(){return o.uniqueId().toBase62()}static randomString(r){let e="";do e+=(Math.random()*62).toBase62();while(e.length<r);return e}};var go=class{static round(r,e=1){return Math.round(r/e)*e}static log(r,e){return Math.log10(r)/Math.log10(e)}static rebase(r,e,t){let n=r.toString(),i=parseInt(n,e);return n.endsWith(i.toString(e))?parseInt(r.toString(),e).toString(t):Number.NaN.toString()}};function Gm(o,r){let e=o.length,t=r.length,n=Array.from({length:e+1},()=>Array(t+1).fill(0));for(let i=1;i<=e;i++)for(let s=1;s<=t;s++)o[i-1]===r[s-1]?n[i][s]=n[i-1][s-1]+1:n[i][s]=Math.max(n[i-1][s],n[i][s-1]);return n}function Fm(o,r,e,t=""){let n=o.length,i=r.length,s=[],l=n,p=i,u=null,f=()=>{u&&(s.push(u),u=null)};for(;l>0||p>0;){var g=null;let v=null;l>0&&p>0&&o[l-1]===r[p-1]?(g="=",v=o[l-1],l--,p--):p>0&&(l===0||e[l][p-1]>=e[l-1][p])?(g="+",v=r[p-1],p--):l>0&&(p===0||e[l-1][p]>e[l][p-1])&&(g="-",v=o[l-1],l--),g&&v!==null?u&&u.type===g?u.value=v+(u.value?t:"")+u.value:(f(),u={type:g,value:v}):f()}return f(),s.reverse()}function _x(o,r){let e=o.split(""),t=r.split(""),n=Gm(e,t);return Fm(e,t,n,"")}function xx(o,r){let e=/(\S+|\s+)/g,t=o.match(e)||[],n=r.match(e)||[],i=Gm(t,n);return Fm(t,n,i,"")}function Cx(o,r){let e=/\r?\n/,t=o.split(e),n=r.split(e),i=Gm(t,n);return Fm(t,n,i,`
|
|
7
|
+
`)}var gn=class{static leftPad(r,e,t){return r.toString().padStart(e,t)}static format(r,...e){let t=Array.from(e),n=r;for(let s=0;s<t.length;s++){let l=new RegExp("(^|[^\\{])\\{"+s+"\\}($|[^\\}])","g");n=n.replaceAll(l,(p,...u)=>p.replace("{"+s+"}",t[s]))}let i=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(n);if(!be.isNullOrEmpty(i))throw new Error(`Missing argument at index ${i[2]}.`);return n}static diff(r,e,t="char"){switch(t){case"line":return Cx(r,e);case"word":return xx(r,e);default:return _x(r,e)}}static async hash(r,e="SHA-256"){let t=await crypto.subtle.digest(e,new TextEncoder().encode(r));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}};var Gu={};Se(Gu,{Markdown:()=>Km,Parser:()=>$p});var Km={};Se(Km,{Parser:()=>qm});var Wm=class{tokenize(r,e){let t=[];for(;r;){let n=r.length;for(let i of e){let s=i.exec(r,this),l=s?.length;if(l>0){Array.prototype.push.apply(t,s);let p=s[l-1];r=r.substr((p.index||0)+p.raw.length);break}}if(r.length>=n)throw new Error(`Cannot parse
|
|
8
8
|
"${r}"
|
|
9
|
-
using the provided grammar.`)}return t}},$p=class{constructor(r=new Wm){this._lexer=r}parse(r,e,t){let n=this._lexer.tokenize(r,e);return t.render(n)}};function jm(o){return(o??"").replace(/</g,"<")}function
|
|
10
|
-
`).trim()}var zu=class{constructor(r=(e,t)=>e?.text||""){this._extraItemRender=r;this._renderContent=r=>{let e=r.tokens;return be.isNullOrEmpty(e)?r.text:this._render(e)}}_rendeItem(r,e){let t=this._renderContent,n=
|
|
9
|
+
using the provided grammar.`)}return t}},$p=class{constructor(r=new Wm){this._lexer=r}parse(r,e,t){let n=this._lexer.tokenize(r,e);return t.render(n)}};function jm(o){return(o??"").replace(/</g,"<")}function wx(o){if(!be.isNullOrEmpty(o)&&!(/^\(/.test(o)&&/\)$/.test(o)))return/^\[/.test(o)&&/\]$/.test(o)&&(o=o.substr(1,o.length-2)),o}function jn(o){return o?.index||void 0}function kx(o){if(!be.isNullOrEmpty(o)&&!(/^\[/.test(o)&&/\]$/.test(o)))return/^\(/.test(o)&&/\)$/.test(o)&&(o=o.substr(1,o.length-2)),o}function Vu(o){return o?.replace(/[^\w]+/g," ").trim().replace(/ +/g,"-").toLowerCase()}function jt(o,r,e){let t=r.exec(o);return t&&t.length?e(t):null}var Mx=/(<!--)([\s\S]*?)(-->|$)/,Sx=/^ {0,3}(={3,}|_{3,}|-{3,})(\r?\n|$)/,Lx=/^ {0,3}(#{1,6})\s+([^\n]+)(\r?\n|$)+/,Nx=/^ {0,3}([^\n]+)(\r?\n=+(\r?\n|$))+/,Tx=/^ {0,3}([^\n]+)(\r?\n-+(\r?\n|$))+/,Ax=/^ {4,}.+(\r?\n {4,}.+)*(\r?\n|$)+/,Dx=/^ {0,3}``` *([^\n]*)\r?\n(([\s\S](?!\r?\n {0,3}```))*.(\r?\n)+) {0,3}```(\r?\n|$)+/,Rx=/^ {0,3}> *([^\n]+)(\r?\n {0,3}> *([^\n]*))*(\r?\n|$)+/,Ox=/^( {0,3}([-+]).*\r?\n|$)((?!(?: {0,3}(?:\d+[.\)]|\r?\n\S))).*(\r?\n|$))*/,Px=/^( {0,3}(\d+[.\)]).*\r?\n|$)((?!(?: {0,3}(?:[+-]|\r?\n\S))).*(\r?\n|$))*/,Kv=/^(?:[-+*]|\d+[.\)])/m,Ix=/^(?! {4,})(.+(\n(?! {0,3}```)(?! {0,3}([-+]|\d+[.\)]))(?! {4,})(?! {0,3}>).+)*)/,$x=/^ {0,3}(!?)\[([^\]]+)\]: +(\S+)(?: +['"\(](.+)['"\)])?(\r?\n|$)+/,Hx=/!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?(\[[^\[\]]*\]|\([^\(\)]*\))?/,Bx=/(\*\*?|__?)(\[[^\]]*]\([^\)]+\))\1/,Ym=/(?:(?<!\\)`)(.+?)(?:(?<!\\)`)/,Vx=/(\*\*?|__?)((?!\1\s?)(?:(?!\1)[\S\s])*[^\s])\1/,Ux=/(~~?|__?)(?!\1\s?)([^\s][\s\S]*?(?!\1)[^\s])\1/,zx=/(:")(?!":\s?)([^\s][\s\S]*?(?!":)[^\s])":/,Gx=/^\s+/,Fx=/ {2,}\r?\n/,Wx=/^[^\r\n]+/;function Uu(o=[]){let r={0:{exec:(x,w)=>jt(x,Mx,E=>{let k=jn(E),N=[{type:"html",index:k,raw:E[0],text:E[2]}];if(k>0){let T=x.substr(0,k),O=w.tokenize(T,_);Array.prototype.unshift.apply(N,O)}return N})},1:{exec:x=>jt(x,$x,w=>{let E=jn(w),k=w[0],N=k,T=w[1]==="!",O=w[2],D=w[3],P=w[4];return[{type:"ref",index:E,raw:k,text:N,id:O,image:T,url:D,title:P}]})}},e=[],t=[],n={};for(let x of o){let w,E="inline";switch("type"in x?(E=x.type,w=x.rule):w=x,E){case"block":e.push(w);break;case"code":if("lang"in x){let N=x.lang.toLowerCase();(n[N]=n[N]||[]).push(w)}break;default:let k={exec:(N,T)=>{let O=w.exec(N,T);return l(N,O,T),O}};t.push(k);break}}let i={254:{exec:x=>jt(x,Wx,w=>{let E=w[0],k=E;return[{index:jn(w),raw:E,text:k,type:"text"}]})},255:{exec:x=>jt(x,Gx,w=>{let E=w[0];return[{type:"space",raw:E,text:E}]})}},s={13:{exec:(x,w)=>p(x,Hx,w,E=>{let k=jn(E),N=E[0],T=N.charAt(0)==="!",O=E[1],D=kx(E[2]),P=Vu(wx(E[2])??O);return T?[{index:k,type:D?"img":"imglike",raw:N,text:O,src:D,ref:P,tokens:w.tokenize(O,u)}]:[{index:k,type:D?"link":"linklike",raw:N,text:O,href:D,ref:P,tokens:w.tokenize(O,u)}]})},17:{exec:(x,w)=>p(x,Ym,w,E=>{let k=jm(E[1]);return[{type:"code",raw:E[0],text:k,index:jn(E)}]})},12:{exec:(x,w)=>p(x,Bx,w,E=>{if(E.length<3||be.isNullOrEmpty(E[2]))return null;let k=E[1].length>1?"bold":"italic",N=E[2];return[{index:jn(E),type:k,raw:E[0],text:N,tokens:w.tokenize(N,u)}]})},14:{exec:(x,w)=>p(x,Vx,w,E=>{if(E.length<3||be.isNullOrEmpty(E[2]))return null;let k=E[1].length>1?"bold":"italic",N=E[2];return[{index:jn(E),type:k,raw:E[0],text:N,tokens:w.tokenize(N,u)}]})},15:{exec:(x,w)=>p(x,Ux,w,E=>{if(E.length<3||be.isNullOrEmpty(E[2]))return null;let k="strike",N=E[2];return[{index:jn(E),type:k,raw:E[0],text:N,tokens:w.tokenize(N,u)}]})},16:{exec:(x,w)=>p(x,zx,w,E=>{if(E.length<3||be.isNullOrEmpty(E[2]))return null;let k="quote",N=E[2];return[{index:jn(E),type:k,raw:E[0],text:N,tokens:w.tokenize(N,u)}]})},18:{exec:(x,w)=>p(x,Fx,w,E=>{let k=E[0],N=k;return[{index:jn(E),raw:k,text:N,type:"br"}]})}},l=(x,w,E)=>{let k=w?.length>0&&w[0].index;if(k>0){let N=x.substr(0,k),T=E.tokenize(N,u)||[];Array.prototype.unshift.apply(w,T)}},p=(x,w,E,k)=>{let N=jt(x,w,T=>{if(w!=Ym){let O=Ym.exec(x);if(O&&O.length&&O.index<T.index)return null}return k(T)});return l(x,N,E),N},u=Object.values(s);Array.prototype.push.apply(u,t),u.push(i[254],i[255]);let f=x=>{let w=[i[254],i[255]],E=x?.toLowerCase()||"";return E&&E in n&&Array.prototype.unshift.apply(w,n[E]),w},g={11:{exec:(x,w)=>jt(x,Ix,E=>{let k=E[0],N=k;return[{type:"paragraph",raw:k,text:N,tokens:w.tokenize(N,u)}]})},255:i[255]},v=(x,w)=>{let E=/^ {0,3}(`{3,}|$|>|[+-]\s|\d+[.\)])/m.test(x)?_:u;return w.tokenize(x,E)},_=Object.values({2:{exec:(x,w)=>jt(x,Sx,E=>{let k=E[0];return[{type:"hr",raw:k,text:k}]})},3:{exec:(x,w)=>jt(x,Lx,E=>{let k=E[2];return[{type:"heading",raw:E[0],text:k,level:E[1].length,ref:Vu(k),tokens:w.tokenize(k,u)}]})},4:{exec:(x,w)=>jt(x,Nx,E=>{let k=E[1];return[{type:"heading",raw:E[0],text:k,level:1,ref:Vu(k),tokens:w.tokenize(k,u)}]})},5:{exec:(x,w)=>jt(x,Tx,E=>{let k=E[1];return[{type:"heading",raw:E[0],text:k,level:2,ref:Vu(k),tokens:w.tokenize(k,u)}]})},6:{exec:(x,w)=>jt(x,Ax,E=>{let k=E[0],N=jm(k);return[{type:"codeblock",raw:k,text:N,tokens:w.tokenize(N,[])}]})},7:{exec:(x,w)=>jt(x,Dx,E=>{let k=jm(E[2]),N=E[1]?.toLowerCase();return[{type:"codeblock",raw:E[0],text:k,lang:N,tokens:w.tokenize(k,f(N))}]})},8:{exec:(x,w)=>jt(x,Rx,E=>{let k=E[0],N=k.replace(/^ {0,3}> */gm,"");return[{type:"blockquote",raw:k,text:N,tokens:w.tokenize(N,[g[11],g[255]])}]})},9:{exec:(x,w)=>jt(x,Px,E=>{let k=E[0],N=k.replace(/^ {0,3}/gm,"").split(Kv).filter(T=>!be.isNullOrEmpty(T)).map(T=>T.trim());return[{type:"ol",start:parseInt(/\d/.exec(E[0])[0]),raw:k,text:k,tokens:N.map(T=>({type:"listitem",raw:T,text:T,tokens:v(T,w)}))}]})},10:{exec:(x,w)=>jt(x,Ox,E=>{let k=E[0],N=k.replace(/^ {0,3}/gm,"").split(Kv).filter(T=>!be.isNullOrEmpty(T)).map(T=>T.trim());return[{type:"ul",raw:k,text:k,tokens:N.map(T=>({type:"listitem",raw:T,text:T,tokens:v(T,w)}))}]})}});return Array.prototype.push.apply(_,e),_.push(g[11],g[255]),[r[0],r[1]].concat(_)}var jx="\0",Yx=/[ \r\n]*\0+[ \r\n]*/g;function Xx(o){return o?.replace(Yx,`
|
|
10
|
+
`).trim()}var zu=class{constructor(r=(e,t)=>e?.text||""){this._extraItemRender=r;this._renderContent=r=>{let e=r.tokens;return be.isNullOrEmpty(e)?r.text:this._render(e)}}_rendeItem(r,e){let t=this._renderContent,n=jx;switch(r?.type){case"ref":return"";case"html":return r.raw;case"blockquote":return`<blockquote>
|
|
11
11
|
${t(r)}</blockquote>${n}`;case"bold":return`<b>${t(r)}</b>`;case"codeblock":let i=r.lang;return`<pre>${n}<code${i?' class="'+i+'"':""}>${t(r)}</code>${n}</pre>${n}`;case"code":return`<code>${t(r)}</code>`;case"hr":return`<hr />${n}`;case"heading":let s=r.level,l=r.ref;return`<h${s} id="${l}">${t(r)}</h${s}>${n}`;case"img":case"imglike":let p=r,u=p.src,f="",g=p.text,v=p.ref;if(!u&&v){let E=e.find(k=>k.type==="ref"&&k.image===!0&&k.id?.toLowerCase()===v.toLowerCase());E&&(u=E.url,f=E.title??"")}return u?`<img src="${u}" alt="${g}"${f?' title="'+f+'"':""} />`:`![${t(r)}]`;case"italic":return`<i>${t(r)}</i>`;case"strike":return`<s>${t(r)}</s>`;case"quote":return`<q>${t(r)}</q>`;case"br":return"<br />"+n;case"ol":return`<ol start="${r.start}">
|
|
12
12
|
${t(r)}</ol>${n}`;case"ul":return`<ul>
|
|
13
|
-
${t(r)}</ul>${n}`;case"listitem":return` <li>${t(r)}</li>${n}`;case"link":case"linklike":let y=r,_=y.href,x="",w=y.ref;if(!_&&w){let E=e.find(k=>k.type==="ref"&&k.image!==!0&&k.id?.toLowerCase()===w.toLowerCase());E&&(_=E.url,x=E.title??"")}return _?`<a href="${_}"${x?' title="'+x+'"':""}>${t(r)}</a>`:`[${t(r)}]`;case"paragraph":return`<p>${t(r)}</p>${n}`;case"text":case"space":return r.text}return this._extraItemRender(r,e)}_render(r){let e="";for(let t of r||[])e+=this._rendeItem(t,r);return e}render(r){return Yx(this._render(r))}},Xm=class{_render(r){return be.isNullOrEmpty(r)?"":JSON.stringify(r)}render(r){return"["+r.filter(e=>!be.isNullOrEmpty(e)).map(this._render).join(",")+"]"}};function Xx(o){return o&&typeof o=="object"&&typeof o.render=="function"}var qm=class extends $p{toHtml(r,e,t){let n=new zu(t);return be.isNullOrEmpty(e)?this.parse(r,n):this.parse(r,Uu(e),n)}tokenize(r,e){let t=this.parse(r,Uu(e),new Xm);return JSON.parse(t)}parse(r,e=Uu(),t=new zu){return Xx(e)?super.parse(r,Uu(),e):super.parse(r,e,t)}};var Wl=class o{constructor(){}static clone(r){return new o()._clone(r)}_clone(r){let e=new WeakMap;function t(n){if(typeof n=="object"&&n!==null&&!(n instanceof Element)&&!(n instanceof FileSystemHandle)&&!(n instanceof File)){if(Array.isArray(n))return n.map(t);if(n instanceof Date)return new Date(n.valueOf());if(n instanceof RegExp)return new RegExp(n);if(e.has(n))return e.get(n);{let i=Object.assign({},n);return e.set(n,i),Object.keys(i).forEach(s=>{i[s]=t(n[s])}),i}}return n}return t(r)}};var vo="$refId",Kv=(t=>(t[t.Ignore=0]="Ignore",t.Reference="reference",t.Plain="plain",t))(Kv||{}),Fu=class{static{this._jsonFnWeakMap=new WeakMap}static{this._jsonFnMap=new Map}static store(r){let e=this._jsonFnWeakMap;if(!e.has(r)){let t=Qs.uniqueCode();e.set(r,t),this._jsonFnMap.set(t,r)}return e.get(r)}static retrieve(r){return this._jsonFnMap.get(r)}static remove(r){let e=this.retrieve(r);this._jsonFnMap.delete(r),this._jsonFnWeakMap.delete(e)}},Hp=class _Json{constructor(o){this._options=o}static serialize(o,r){return new _Json(r)._serialize(o)}static deserialize(o){return new _Json()._deserialize(o)}_serialize(o){let r=Wl.clone(o),e=[vo],t=this._flatten(r,0,null,e);return JSON.stringify(t,e.sort())}_deserialize(json){let hasRefs=!1,obj=JSON.parse(json,(key,value)=>{let elPattern=/^\$<#(.+)>$/,fnPattern=/^\$<fn:([^\x05]+)>$/,regexPattern=/^\$<regex:(.+)>$/,fnRefPattern=/^\$<fn#(.+)>$/,arr;if(key===vo)hasRefs=!0;else if(typeof value=="string")if((arr=regexPattern.exec(value))&&arr.length>1){let o=arr[1],r=o.lastIndexOf("|");return new RegExp(o.substr(0,r),o.substr(r+1))}else{if((arr=elPattern.exec(value))&&arr.length>1)return document.getElementById(arr[1]);if((arr=fnPattern.exec(value))&&arr.length>1)return eval(arr[1]);if((arr=fnRefPattern.exec(value))&&arr.length>1)return Fu.retrieve(arr[1])}return value});return hasRefs?this._revive(obj):obj}_flatten(o,r=0,e,t){if(e=e||new WeakSet,t=t||[],o instanceof Element)return o.id?`$<#${o.id}>`:void 0;if(o instanceof RegExp)return`$<regex:${o.source}|${o.flags}>`;if(typeof o=="object"&&o!=null&&!(o instanceof Date))return Array.isArray(o)?o.map(n=>this._flatten(n,r,e,t)):e.has(o)?o[vo]=o[vo]||"$#ref_"+r++:(e.add(o),Object.keys(o).forEach(n=>{t.indexOf(n)===-1&&t.push(n),o[n]=this._flatten(o[n],r,e,t)}),o);if(typeof o=="function")switch(this._options?.functions){case"reference":return"$<fn#"+Fu.store(o)+">";case"plain":return"$<fn:"+o+">";default:return}return o}_revive(o){let r={},e=/^\$#ref_(.+)$/;function t(n){if(typeof n=="object"&&n!==null){if(Array.isArray(n))return n.map(t);vo in n&&(r[n[vo]]=n,delete n[vo]),Object.keys(n).forEach(i=>{n[i]=t(n[i])})}else if(typeof n=="string"&&e.test(n)){let i=e.exec(n);return r[i[0]]}return n}return t(o)}};var _t=class o{constructor(){this.deferred=null;var r=this;r.promise=new Promise(function(e,t){r.deferred={resolve:e,reject:t,promise:r}})}then(r,e){return this.promise.then(r,e)}finally(r){return this.promise.then(r,r),this}success(r){return this.promise.then(r,null),this}error(r){return this.promise.then(null,r),this}static defer(){var r=new o;return r.deferred}};var qx="pacem",Jv="download",Re=o=>{o.stopPropagation()},jl=o=>{o.preventDefault()},Q=o=>{o.preventDefault(),o.stopPropagation()},Zv=/^\/[^\/]+/,Kx=/\/\{([a-z\$_][\w]*)\??\}/,a=class o{static get core(){let r=window.Pacem;var e=r&&r.Configuration&&r.Configuration.core||qx;return window[e]=window[e]||{}}static get customElements(){return window.customElements}static uniqueId(){return Qs.uniqueId()}static uniqueCode(){return Qs.uniqueCode()}static randomString(r){return Qs.randomString(r)}static parseDate(r){return br.parse(r)}static copyToClipboard(r){return navigator.clipboard?navigator.clipboard.writeText(r):new Promise((e,t)=>{let n=document.createElement("textarea");n.value=r,n.style.opacity="0",document.body.appendChild(n);try{n.select(),document.execCommand("copy"),n.remove(),e()}catch(i){t(i)}})}static{this.Json={stringify:Hp.serialize,parse:Hp.deserialize}}static{this.Dates={now:()=>o.parseDate(Date.now()),parse:o.parseDate,isLeapYear:br.isLeapYear,daysInMonth:br.daysInMonth,isDate:br.isDate,dateOnly:br.dateOnly,addMonths:br.addMonths,addDays:br.addDays,daysBetween:br.daysBetween}}static colorize(r,e){let t={h:38,s:.245,l:.6};var n,i,s,l;r instanceof HTMLElement?n=e:n=r,typeof n=="string"?i=Be.parse(n):i={r:n[0],g:n[1],b:n[2]};let p=Be.hsl(i);if(s=`brightness(50%) sepia(1) hue-rotate(${p.h-t.h}deg) saturate(${1+(p.s-t.s)}) brightness(${1+(p.l-t.l)})`,n===e)l.style.filter=s;else return s}static cssEscape(r){return escape(r).replace("%","\\")}static{this.Css={colorize:o.colorize,escape:o.cssEscape,getVariableValue(r){return getComputedStyle(document.documentElement).getPropertyValue(r)},setVariable(r,e){getComputedStyle(document.documentElement).setProperty(r,e)},isClassDefined(r){let e=new RegExp("."+r+"($|[s.,])");for(let t=0;t<document.styleSheets.length;t++){let n=document.styleSheets.item(t);try{let i=n.cssRules;for(let s=0;s<i.length;s++){let l=n.cssRules.item(s);if(e.test(l.selectorText))return!0}}catch(i){i instanceof DOMException&&console.warn(`Couldn't access cssRules of stylesheet "`+n.href+'".')}}return!1},deserializeTransform(r){let e=r instanceof Element?getComputedStyle(r):r,t=1,n=0,i=0,s=1,l=0,p=0,u=/^matrix\((.*)\)$/.exec(e.transform),f;return u&&u.length>1&&(f=u[1].split(",")).length==6&&(t=parseFloat(f[0]),n=parseFloat(f[1]),i=parseFloat(f[2]),s=parseFloat(f[3]),l+=parseFloat(f[4]),p+=parseFloat(f[5])),{a:t,b:n,c:i,d:s,e:l,f:p}}}}static{this.leftPad=gn.leftPad}static{this.formatString=gn.format}static{this.diff=gn.diff}static{this.Strings={leftPad:gn.leftPad,format:gn.format,diff:gn.diff,stripHTML:r=>new DOMParser().parseFromString(r,"text/html").body.textContent||""}}static{this.Blobs={toDataURL:mo.blobToDataURL,fromDataURL:mo.dataURLToBlob,toText:mo.blobToText,fromText:mo.textToBlob}}static{this.Images={load:fo.loadImage,resize:fo.resizeImage}}static loadImage(r){return new Promise((e,t)=>{let n=new Image;n.src=r,n.complete?e(n):(n.onload=i=>{e(n)},n.onerror=i=>{t()})})}static blobToDataURL(r){return o.Blobs.toDataURL(r)}static dataURLToBlob(r){return o.Blobs.fromDataURL(r)}static blobToText(r,e){return o.Blobs.toText(r,e)}static textToBlob(r,e="text/plain"){return o.Blobs.fromText(r,e)}static resizeImage(r,e,t,n){var i=_t.defer();return o.blobToDataURL(r).then(o.loadImage).then(s=>{let l=s.width,p=s.height,u=document.createElement("canvas");u.width=l,u.height=p;let f=u.getContext("2d");if(l>e||p>t){let g=l/p,v=e/t,y,_;v<g?(_=e,y=e/g):(y=t,_=t*g),u.width=_,u.height=y;let x=n>0&&n<=1;x&&(f.fillStyle="#000",f.fillRect(0,0,u.width,u.height)),o.cropImageOntoCanvas(s,f);let w;x?w=f.canvas.toDataURL("image/jpeg",n):w=f.canvas.toDataURL(),i.resolve(o.dataURLToBlob(w))}else i.resolve(r)},s=>{}),i.promise}static cropImage(r,e,t,n){var i=_t.defer();let s=new Image;return s.crossOrigin="anonymous",s.onload=function(l){let p=document.createElement("canvas"),u=p.getContext("2d");e&&(p.width=e),t&&(p.height=t);let f=n>0&&n<=1;f&&(u.fillStyle="#000",u.fillRect(0,0,p.width,p.height)),o.cropImageOntoCanvas(s,u),i.resolve(f?p.toDataURL("image/jpeg",n):p.toDataURL())},s.src=r,i.promise}static getUserMediaFunctions(){var r=[];let t=[navigator.getUserMedia,navigator.webkitGetUserMedia,navigator.msGetUserMedia,navigator.mozGetUserMedia].filter(function(n,i){return typeof n=="function"});return t.length&&(r=t),r}static cropImageOntoCanvas(r,e,t,n){e.imageSmoothingEnabled=e.mozImageSmoothingEnabled=e.oImageSmoothingEnabled=e.webkitImageSmoothingEnabled=!0;let i=e.canvas.width,s=e.canvas.height,l=i,p=s,u=t||1*r.width,f=n||1*r.height;var g=u/f,v=i/s;if(v>g){var y=i/u;s=y*f,e.drawImage(r,0,.5*(-s+p),l,s)}else{var y=s/f;i=y*u,e.drawImage(r,-Math.abs(.5*(-i+l)),0,i,p)}}static get _domURL(){return window.URL||window.webkitURL||window}static snapshotElement(r,e,t="image/png",n){function i(s){return new Promise((l,p)=>{let u=document.createElement("canvas"),f=s.width,g=s.height;if(!(f>0))p("Image has width zero.");else if(!(g>0))p("Image has height zero.");else{u.width=f,u.height=g;let v=u.getContext("2d");o.isNullOrEmpty(e)||(v.fillStyle=e,v.fillRect(0,0,f,g)),v.drawImage(s,0,0),u.toBlob(y=>{l(y)},t,n)}})}return r instanceof HTMLCanvasElement?i(r):new Promise((s,l)=>{let p=[];function u(w){let E=new Promise((k,N)=>{let T=()=>w instanceof HTMLImageElement?w.src:w.href.baseVal,O=D=>{w instanceof HTMLImageElement?w.src=D:w.setAttribute("href",D)};fetch(T()).then(D=>D.blob()).then(D=>o.blobToDataURL(D)).then(D=>{O(D),k()})});p.push(E)}function f(w,E){let k=new Promise((N,T)=>{let O=new Image;O.crossOrigin="anonymous",O.width=E.width,O.height=E.height,O.style.cssText=w.style.cssText,O.onload=()=>{w.replaceWith(O),N()},O.src=E.toDataURL()});p.push(k)}function g(w,E){let k=getComputedStyle(E);for(let N=0;N<k.length;N++){let T=k.item(N);w.style[T]=k[T]}}function v(w,E){g(w,E),w instanceof HTMLImageElement||w instanceof SVGImageElement?u(w):w instanceof HTMLCanvasElement&&f(w,E);let k=w.children.length;for(let N=0;N<k;N++){let T=w.children.item(N),O=E.children.item(N);T.tagName===O.tagName&&v(T,O)}}if(r instanceof SVGElement){let w=r.cloneNode(!0);v(w,r),Promise.all(p).then(E=>{r=w,x()})}else{var _=document.implementation.createHTMLDocument("");_.write(r.outerHTML),_.documentElement.setAttribute("xmlns",_.documentElement.namespaceURI);let E=document.evaluate(".//"+r.localName,_.body,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;E.setAttribute("xmlns",_.documentElement.namespaceURI),v(E,r),Promise.all(p).then(k=>{let N=document.createElementNS("http://www.w3.org/2000/svg","svg"),T=o.offset(r);N.setAttribute("viewBox",`0 0 ${T.width} ${T.height}`),N.setAttribute("width",T.width.toString()),N.setAttribute("height",T.height.toString()),N.innerHTML=`<foreignObject width="${T.width}" height="${T.height}">${E.outerHTML}</foreignObject>`,r=N,x()})}function x(){let w=new XMLSerializer().serializeToString(r),E=new Image;E.crossOrigin="anonymous";let k="data:image/svg+xml;charset=utf8,"+encodeURIComponent(w);E.onload=()=>{i(E).then(s)},E.src=k}})}static async download(r,e,t="application/download"){if(typeof r=="string"){let l=r,p={},u;o.isNullOrEmpty(e)||(typeof e=="object"?(p={credentials:e.credentials,headers:e.headers},u=e.filename||u,t=e.mime||t):u=e);var n=await fetch(l,p);if(n.ok){if(o.isNullOrEmpty(u)){let g="Content-Disposition";if(n.headers.has(g)){let v=n.headers.get(g),y=/^attachment; filename=\"?([^;\"]+)\"?(;|$)/.exec(v);y.length>1&&(u=y[1])}else u=Jv}var i=await n.blob();let f=u.split(/[\\\/]/g).join("_");return o.download(i,f)}{let f=await n.text();throw new Error(f)}}else{let l=r,p=typeof e=="string"&&e||Jv,u=document.createElement("a");if(u.setAttribute("href",o._domURL.createObjectURL(l)),u.setAttribute("download",p),document.createEvent){var s=document.createEvent("MouseEvents");s.initEvent("click",!0,!0),u.dispatchEvent(s)}else u.click()}}static isDOMReady(){return document.readyState==="complete"}static onDOMReady(r){window.addEventListener("load",r,!1)}static moveChildren(r,e){return o.moveItems(r.childNodes,e)}static moveItems(r,e){let t=[],n;for(let i=r.length-1;i>=0;i--){let s=r instanceof NodeList?r.item(i):r[i];e.insertBefore(s,n),t.unshift(s),n=s}return t}static is(r,e){return(r.matches||r.matchesSelector||r.msMatchesSelector||r.mozMatchesSelector||r.webkitMatchesSelector||r.oMatchesSelector).call(r,e)}static lang(r){return r.lang||document.documentElement.lang||navigator.language}static jsonSortStringify(r){return o.isNull(r)?r:o.Json.stringify(r)}static{this.Browsers={detect:Bu}}static cookies(r){let e=(r??document.cookie).split(";"),t={};for(var n of e){let i=n.split("=");if(i.length<2)continue;let s=(i[0]||"").trim(),l=(i[1]||"").trim();Object.defineProperty(t,s,{configurable:!1,enumerable:!0,writable:!1,value:decodeURIComponent(l.split("+").join(" "))})}return t}static{this.Cookies={getAll:async r=>{let e="cookieStore"in window?window.cookieStore:null,t=[];if(o.isNull(e)){let n=o.cookies();for(let i in n)!o.isNullOrEmpty(r)&&r!==i||t.push({name:i,value:n[i]});return t}else return await e.getAll(r)},stringify:r=>{let e=`${r.name}=${encodeURIComponent(r.value??"")}`;return o.isNullOrEmpty(r.domain)||(e+=`; domain=${encodeURIComponent(r.domain)}`),o.isNullOrEmpty(r.path)||(e+=`; path=${encodeURIComponent(r.path)}`),r.maxAge>0&&(e+=`; max-age=${r.maxAge.toFixed(0)}`),o.isNullOrEmpty(r.expires)||(e+=`; expires=${r.expires}`),r.partitioned&&(e+="; Partitioned"),o.isNullOrEmpty(r.sameSite)||(e+=`; SameSite=${encodeURIComponent(r.sameSite)}`),r.secure&&(e+="; Secure"),e}}}static isVisible(r){return"checkVisibility"in r?r.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):getComputedStyle(r).visibility!=="hidden"&&(r.clientWidth>0||r.clientHeight>0)}static hasClass(r,e){return r.classList?r.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(r.className)}static addClass(r,e){let t=e.trim();r.classList?DOMTokenList.prototype.add.apply(r.classList,t.split(" ")):r.setAttribute("class",r.className+" "+t)}static removeClass(r,e){let t=e.trim();r.classList?DOMTokenList.prototype.remove.apply(r.classList,t.split(" ")):r.setAttribute("class",r.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))}static toggleClass(r,e,t){t?o.addClass(r,e):o.removeClass(r,e)}static hasPart(r,e){return r.part.contains(e)}static addPart(r,e){DOMTokenList.prototype.add.apply(r.part,e.trim().split(" "))}static removePart(r,e){DOMTokenList.prototype.remove.apply(r.part,e.trim().split(" "))}static togglePart(r,e,t){t?o.addPart(r,e):o.removePart(r,e)}static offset(r){var e=r.getBoundingClientRect();return{top:Math.round(e.top)+o.scrollTop,left:Math.round(e.left)+o.scrollLeft,width:Math.round(e.width),height:Math.round(e.height)}}static offsetRect(r){var e=this.offset(r);return{y:e.top,x:e.left,width:e.width,height:e.height}}static naturalOffsetTop(r){return(r?.offsetTop??0)+(r?.offsetParent&&r.offsetParent instanceof HTMLElement?this.naturalOffsetTop(r.offsetParent):0)}static naturalOffsetLeft(r){return(r?.offsetTop??0)+(r?.offsetParent&&r.offsetParent instanceof HTMLElement?this.naturalOffsetLeft(r.offsetParent):0)}static naturalOffset(r){return{left:this.naturalOffsetLeft(r),top:this.naturalOffsetTop(r),width:r?.offsetWidth??0,height:r?.offsetHeight??0}}static naturalOffsetRect(r){var e=this.naturalOffset(r);return{y:e.top,x:e.left,width:e.width,height:e.height}}static deserializeTransform(r){return o.Css.deserializeTransform(r)}static set scrollTop(r){window.scrollTo(o.scrollLeft,r)}static set scrollLeft(r){window.scrollTo(r,o.scrollTop)}static scrollTo(r,e=!0,t=!0){let n=o.isNull(e)||typeof e=="boolean",i=n?o.scrollLeft:r,s=n?r:e,l=(n?e:t)?"smooth":"instant";window.scrollTo({behavior:l,left:i,top:s})}static get scrollTop(){return window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}static get scrollLeft(){return window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft||0}static get windowSize(){let r=window;return{width:r.innerWidth||r.document.documentElement.clientWidth||r.document.body.clientWidth||0,height:r.innerHeight||r.document.documentElement.clientHeight||r.document.body.clientHeight||0}}static addAnimationEndCallback(r,e,t=500){let n=s=>{(!s||s.target==r)&&(clearTimeout(i),r.removeEventListener("animationend",n,!1),r.removeEventListener("transitionend",n,!1),e.apply(this,[r]))};r.addEventListener("animationend",n,!1),r.addEventListener("transitionend",n,!1);let i=setTimeout(n,t)}static waitForAnimationEnd(r,e=500){return new Promise((t,n)=>{o.addAnimationEndCallback(r,()=>{t()},e)})}static idle(r){return new Promise((e,t)=>{setTimeout(()=>e(),r)})}static accelerateCallback(r,e=500,t=5,n=20){let i={cancel:!1},s=e,l=t+n,p=()=>{r(i),i.cancel||(setTimeout(p,s),s<l?s=n:s-=t)};p()}static isEmpty(r){return be.isEmpty(r)&&!(r instanceof Node)}static isNull(r){return be.isNull(r)}static isArray(r){return Array.isArray(r)}static isNullOrEmpty(r){return o.isNull(r)||o.isEmpty(r)}static areSemanticallyEqual(r,e){r??=null,e??=null;let t=r&&r.valueOf&&r.valueOf(),n=e&&e.valueOf&&e.valueOf();return t===n}static{this.extend=Object.assign}static clone(r){if(r!==void 0)return Wl.clone(r)}static fromResult(r){return Promise.resolve(r)}static fromResultAsync(r){return new Promise(e=>requestAnimationFrame(()=>e(r())))}static readonlyCopy(r){if(o.isNull(r))return null;if(o.isArray(r)){let e=r.slice(0);return Object.freeze(e),e}else{let e={};for(let t in r)e[t]=r[t];return Object.freeze(e),e}}static{this.URIs={format:function(r,e,t){for(let s in e||{}){let p=new RegExp("(^|\\/)\\{"+s+"\\??\\}(\\/|$)").exec(r);if(p&&p.length){let u=new RegExp("\\{"+s+"\\??\\}"),f=p.index;r=r.substring(0,f)+r.substring(f).replace(u,encodeURIComponent(e[s])),t&&delete e[s]}}let n=/(^|\/)\{[\w]+\?\}(\/|$)/;for(var i;(i=n.exec(r))&&i.length>0;){let s=i[0];r=r.replace(s,s.endsWith("/")?"/":"")}return r},appendQuery:function(r,e,t=!1,n=!1){let i=n?"#":"?",l=((n?/#/:/\?/).test(r)?"&":i)+Object.keys(e).filter(p=>!o.isNull(e[p])||!t).map(p=>encodeURIComponent(p)+"="+encodeURIComponent(e[p]??"")).join("&");return r+(l.length>1?l:"")},parseQuery:(r=window.location)=>{typeof r!="string"&&(r=r.search);let e={};return new URLSearchParams(r).forEach((t,n)=>{Object.defineProperty(e,n,{enumerable:!0,value:t})}),e},hasMandatoryTemplateSegments:function(r){return/(^|\/)\{\.*\}(\/|$)/.test(r)},parseRoute:function(r){let e=r,t=[];if(!o.isNullOrEmpty(e)){let n,i=0;for(;(n=Zv.exec(e))!=null;){let s=n[0],l=Kx.exec(s);if(!o.isNullOrEmpty(l)){let p=l[1];t.push({name:p,optional:s.charAt(s.length-2)==="?",index:i})}e=e.substring(n.index+s.length),i++}}return t},split:function(r){let t=/^((https?:)?\/\/[^\/]+)?([^\?#]+)(\?[^#]*)?(#[^#]*)?$/.exec(r);return t?{domain:t[2]??"",protocol:t[1]??"",path:t[3]??"",query:t[4]??"",hash:t[5]??""}:null},parseState:function(r,e,t,n,i){let s=e;if(o.isNullOrEmpty(t)){let v=o.URIs.split(e);t=v.path,o.isNullOrEmpty(n)&&(n=v.query??""),o.isNullOrEmpty(i)&&(i=v.hash??""),s=t+n+i}let l=v=>{let y=v.indexOf("#");return y!==0?null:v.substring(y+1)},p=v=>{let y=v.indexOf("?");return y===0?o.URIs.parseQuery(v.substring(y+1)):{}},u={$path:s,$pathname:t,$querystring:n.length>0?n.substring(1):n,$query:p(n),$hash:l(i)},f=0,g=r.slice();if(!o.isNullOrEmpty(g)){let v;for(;(v=Zv.exec(t))!=null;){let y=v[0],_=g.findIndex(x=>x.index===f);if(_>=0){let x=g[_],{name:w}=x;Object.defineProperty(u,w,{enumerable:!0,value:y.substring(1)}),g.splice(_,1)}f++,t=t.substring(v.index+y.length)}}for(let v=0;v<g.length;v++)if(!g[v].optional)throw`Must provide "${g[v].name}" route value.`;return u}}}static getApiResult(r){if(typeof r=="object"&&!o.isNull(r)&&r.hasOwnProperty("success"))switch(r.success){case!0:if(r.hasOwnProperty("result"))return r.result;break;case!1:if(r.hasOwnProperty("error"))return null;break}return r}};var Jk=Function,Wu="pacem:properties",Yl="pacem:custom-element:bindings",ea="pacem:custom-element:host",Bp="pacem:custom-element:scope";var Qv,d=(Qv=window.Pacem)?.Configuration?.prefix??"pacem",b=Qv?.Configuration?.css??d;var zi="__context_pacem",Jx=/'(\\'|[^'])*[^\\]?'|"(\\"|[^"])*[^\\]?"/g,Zx=/[^\w]new\s|[^\w]window\s*[\.\[]|[^\w]document\s*\.|[^\w]eval\s*\(/,eb=/(^|[\s\(\[\+\-\*\/!])(:host\.|\^+item[\s\.,;\)\]]|\^+item$|\^+index[^\w\.]|\^+index$|\$?this[\.\s$]?|#[a-zA-Z_][\w]*|::[a-zA-Z_][\w]*)/g,ta=class o{constructor(){this._pending=!1;this._independent=!1}get dependencies(){return this._dependencies}get functionBody(){return this._fnBody}get voidBody(){return this._voidBody}get pending(){return this._pending}get independent(){return this._independent}evaluate(){return this._fn||(this._fn=new Function("$pacem",zi,this._fnBody)),this._fn.apply(null,[a.core,this._args])}evaluateAsync(){let r=_t.defer();return this._fn||(this._fn=new Function("$pacem",zi,this._fnBody)),r.resolve(this._fn.apply(null,[a.core,this._args])),r.promise}evaluatePlus(r={}){if(!this._fn){let n=[zi];for(var e in r)n.push(e);n.push("$pacem"),this._fn=new Function(n.join(", "),this._voidBody)}let t=[].concat(this._args);for(var e in r)t.push(r[e]);return t.push(a.core),this._fn.apply(null,t)}static{this._pendingExpression=null}static _getPendingExpressionSingleton(){if(o._pendingExpression==null){let r=new o;r._pending=!0,r._dependencies=[],o._pendingExpression=r}return o._pendingExpression}static parse(r,e){for(var t=A.findScopeContext(e),n={$this:e},i=[],s="",l=!0,p=[],u,f=0,g=[];(u=Jx.exec(r))!=null;){g.push(r.substr(f,u.index-f));let w=u[0].length;p.push({start:u.index,length:w}),f=u.index+w}f<r.length&&g.push(r.substr(f,r.length-f));for(var v=0;v<g.length;v++){let w=g[v];if(Zx.test(w))throw`Unsafe expression detected: "${w}".`;if(t==null){if(new RegExp(eb).test(w)===!0){l=!1;break}}else{let E=w.replace(eb,(k,N,T,O,D)=>{l=!1;let P="__host_pacem",F=zi+".$this"+(T.endsWith(".")?".":""),B=e,$=D.indexOf(".",O),U=$>O?D.substr($+1).trim():"",I=/^[\w\.\$]+/.exec(U),G=I&&I.length>0&&I[0],Y,W=G&&(Y=G.split(".")).length>0&&Y[0];if(T===":host.")B=n[P]=n[P]||A.findHostContext(e),F=`${zi}.${P}.`;else if(T.endsWith("^item")||T.substr(0,T.length-1).endsWith("^item")){let V=T.endsWith("^item")?"":T.substr(T.length-1,1),X=T.length-(V.length>0?6:5),q=`__item_${X}_up_pacem`,Z=ra.findItemContext(e,X);B=n[q]=n[q]||Z&&Z.placeholder,G="item"+(G?"."+G:""),W="item",F=`${zi}.${q}.item${V}`}else if(T.endsWith("^index")||T.substr(0,T.length-1).endsWith("^index")){let V=T.endsWith("^index")?"":T.substr(T.length-1,1),X=T.length-(V.length>0?7:6),q=`__item_${X}_up_pacem`,Z=ra.findItemContext(e,X);B=n[q]=n[q]||Z&&Z.placeholder,G="index",W="index",F=`${zi}.${q}.index${V}`}else if(T.startsWith("::")){let V=T.substr(2,T.length-2),X=n[P]=n[P]||A.findHostContext(e);a.isNull(X)?B=null:B=X[V],F=`${zi}.${P}.${V}`}else if(T.startsWith("#")){let V=T.substr(1,T.length-1);B=n[V]=n[V]||t.querySelector("#"+V),F=`${zi}.${V}`}return W&&B&&W in B&&typeof B[W]!="function"&&i.find(V=>V.element===B&&V.property==W)==null&&i.push({element:B,property:W,path:G,twowayAllowed:!1}),N+F});if(s+=E,v<p.length){let k=p[v];s+=r.substr(k.start,k.length)}}}if(l){var y=new o;return y._independent=!0,y._fnBody=`return ${r};`,y._voidBody=r,y._dependencies=[],y}if(t==null)return this._getPendingExpressionSingleton();for(var _ in n)if(n[_]==null)return o._getPendingExpressionSingleton();i.length==1&&/[^\w\.\$]+/.test(s.trim())!==!0&&(i[0].twowayAllowed=!0);var x=new o;return x._args=n,x._fnBody=`try{ var ___$$$r = ${s}; return ___$$$r; }catch(e){ }`,x._voidBody=`try{ ${s} }catch(e){ }`,x._dependencies=i,x}};var Xl=class extends HTMLElement{};var ju="__pacem__",Qx=/^\{\{(.|\n)+\}\}$/,A=class o{static get polyfilling(){return customElements instanceof window.CustomElementRegistry}static camelToKebab(r){return r&&r.replace(/([A-Z])/g,"-$1").toLowerCase()}static kebabToCamel(r){return r&&r.replace(/(-[a-z])/g,e=>e[1].toUpperCase())}static waitForReady(r){return new Promise((e,t)=>{a.isNull(r)&&t("Not found."),r.isReady&&e();let n=()=>{r.removeEventListener("load",n),e()};r.addEventListener("load",n)})}static whenReady(r,e){o.waitForReady(r).then(e)}static getWatchedProperties(r,e=!0){var t=[],n=r instanceof HTMLElement?r.constructor:r;do{let s=(this.getAttachedPropertyValue(n,Wu)||[]).filter(l=>!l.name.startsWith("_"));Array.prototype.splice.apply(t,[0,0].concat(s))}while(e&&(n=Object.getPrototypeOf(n)));return t}static getWatchedProperty(r,e){return this.getWatchedProperties(r,!0).find(t=>t.name===e)}static importjs(r,e=null,t=!1){var n={type:"text/javascript",src:r};return a.isNullOrEmpty(e)||a.extend(n,{integrity:e}),t&&a.extend(n,{crossorigin:""}),o.import(r,"script",n,document.head||document.getElementsByTagName("head")[0])}static importcss(r,e=null,t=!1){var n={rel:"stylesheet",href:r};return a.isNullOrEmpty(e)||a.extend(n,{integrity:e}),t&&a.extend(n,{crossorigin:"anonymous"}),o.import(r,"link",n,document.head||document.getElementsByTagName("head")[0])}static import(r,e,t,n=document.body){let i=a.core;var s=i.imports=i.imports||{};return s[r]=s[r]||new Promise((l,p)=>{var u=e;for(let v in t||{})u+=`[${v}="${t[v]}"]`;var f=document.querySelector(u);if(!a.isNull(f))l(f);else{f=document.createElement(e),f.onerror=v=>{p(v)},f.onload=()=>{l(f)};for(var g in t||{})f.setAttribute(g,t[g]);n.appendChild(f)}})}static{this.Theme={importWebFonts(){function r(i){return/^('|").*\1$/.test(i)?i.substring(1,i.length-1):i}function e(i){return a.isNullOrEmpty(i)?Promise.resolve():document.fonts.load("1rem "+i)}let t=["icons","std","main","tech","btn"].map(i=>{let s=a.Css.getVariableValue(`--${b}-font-${i}`).split(",")[0],l=r(a.Css.getVariableValue(`--${b}-font-${i}-api-url`));return a.isNullOrEmpty(l)?e(s):o.importcss(l).then(p=>e(s))}),n=new Promise(i=>{function s(l=0){l>4||!("size"in document.fonts)||typeof document.fonts.size=="number"&&document.fonts.size>0?document.fonts.ready.then(i):setTimeout(s,250,l++)}s()});return t.push(n),Promise.all(t)}}}static setAttachedPropertyValue(r,e,t){if(a.isNull(r))return;let n=Object.getOwnPropertyDescriptor(r,ju),i=n&&n.value||Object.defineProperty(r,ju,{value:{},enumerable:!1,writable:!1,configurable:!1})[ju];a.isNull(t)?delete i[e]:i[e]=t}static deleteAttachedPropertyValue(r,e){o.setAttachedPropertyValue(r,e,void 0)}static getAttachedPropertyValue(r,e,t){let n=Object.getOwnPropertyDescriptor(r,ju),i=n&&n.value;return a.isNull(i&&i[e])&&!a.isNull(t)?(o.setAttachedPropertyValue(r,e,t),t):i&&i[e]}static resolvePath(r,e){if(!r||!e)return;if(/[\(\)\{\}]/.test(r))throw`Security alert: not allowed to process paths like ${r}.`;let t=r.split(".");var n=e,i=n,s,l=t[0];t.forEach((f,g)=>{var v=f.split("[");v.forEach((y,_)=>{s=i,/\]$/.test(y)&&(y=y.substring(0,y.length-1),/^('|").+[^\\]\1$/.test(y)&&(y=y.substr(1,y.length-2))),i=i[y]})});var p,u;return/\]$/.test(r)?(u=r.lastIndexOf("["),p=r.substring(u+1),p=p.substring(0,p.length-1)):(u=r.lastIndexOf("."),p=r.substring(u+1)),{target:{value:i,name:p},parent:{value:s||e,path:r.substring(0,u)},root:{value:n,property:l}}}static set(r,e,t){var n=o.resolvePath(e,r),i=n.target.value;if(i!==t)if(n.parent.value!=n.root.value&&!(n.parent.value instanceof HTMLElement)){n.parent.value[n.target.name]=t;let s=a.clone(n.root.value[n.root.property]);n.parent.value[n.target.name]=i;let l;n.root.property==="item"&&!a.isNull(l=Gi.getRepeaterItem(n.root.value))?l.repeater&&l.repeater.datasource&&l.repeater.datasource.splice(l.index,1,l.item=s):n.root.value[n.root.property]=s}else n.parent.value[n.target.name]=t}static get(r,e){var t=o.resolvePath(e,r);return t&&t.target&&t.target.value}static _findScopeContextLegacy(r){let e=r,t;do e=e.parentNode;while(e!=null&&(e!=(t=r.ownerDocument)||e instanceof HTMLElement&&(t=e.shadowRoot)!=null));return t}static findScopeContext(r){return(r.isConnected?r.getRootNode():o.getAttachedPropertyValue(r,Bp))??o._findScopeContextLegacy(r)}static findAncestor(r,e){let t=r,n;for(;t&&(t=t.parentNode||t.getRootNode()?.host)!=null;)if(t.host instanceof HTMLElement&&(t=t.host),e.apply(t,[t])){n=t;break}return n}static findAncestorShell(r){return o.findAncestor(r,e=>a.is(e,`.${b}-body`)||e===document.body)}static findAncestorOfType(r,e){return o.findAncestor(r,t=>t instanceof e)}static findDescendants(r,e,t=!1){let n=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(var i=[];n.nextNode();){let s=n.currentNode;if(e(s)===!0&&(i.push(s),t))return i}return i}static findFirstDescendant(r,e){let t=o.findDescendants(r,e,!0);return a.isNullOrEmpty(t)?void 0:t[0]}static findAll(r="[pacem]",e=t=>!0){let t=[];return document.querySelectorAll(r).forEach((n,i,s)=>{e(n)===!0&&t.push(n)}),t}static findPreviousSiblingOrAncestorOfType(r,e,t=0){let n=r,i=null,s=0;do if(n=n.previousSibling||n.parentNode,n instanceof e){if(s>=t){i=n;break}else n=n.parentNode;s++}while(n!=null);return i}static findPreviousSiblingOrAncestor(r,e,t=0){let n=r,i=null,s=0;do if(n=n.previousSibling||n.parentNode,n&&e.apply(n,[n])){if(s>=t){i=n;break}else n=n.parentNode;s++}while(n!=null);return i}static assignHostContext(r,e){let t=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_DOCUMENT_FRAGMENT);for(;t.nextNode();){var n=t.currentNode;a.isNull(o.getAttachedPropertyValue(n,ea))&&o.setAttachedPropertyValue(n,ea,r)}}static findHostContext(r){let e=r,t;if(!e.isConnected)return t;for(;e!=null&&(t=o.getAttachedPropertyValue(e,ea),!(t instanceof HTMLElement));)e=e.parentElement;let n;return t==null&&console&&(n=console.warn)&&n(`Element "${r.constructor.name}" isn't a descendant of a templated component.`),t}static isBindingAttribute(r){return Qx.test(r)}static extractBindingAttributeExpression(r){if(o.isBindingAttribute(r))return r.substr(2,r.length-4);throw"Invalid attribute: incorrect binding syntax."}static parseBindingAttribute(r,e){let t=o.extractBindingAttributeExpression(r),n=/,\s*(twoway|once)\s*$/.exec(t),i=n&&n.length>1&&n[1];a.isNullOrEmpty(i)||(t=t.substr(0,t.lastIndexOf(",")));var s=ta.parse(t,e);return(s&&s.dependencies).forEach(l=>{switch(i){case"twoway":l.mode=l.twowayAllowed&&s.dependencies.length==1?"twoway":void 0;break;case"once":l.mode=i;break}}),s}static ensureMember(r,e,t){let n=Object.getOwnPropertyDescriptor(r,e);return n??(Object.defineProperty(r,e,t),Object.getOwnPropertyDescriptor(r,e))}static stripObservedAttributes(r){tb(r,!1)}static freezeObservedAttributes(r){tb(r)}};function tb(o,r=!0){let e=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{var t=e.currentNode;if(t instanceof HTMLElement){let i=t.constructor.observedAttributes;if(!a.isNull(i)){A.deleteAttachedPropertyValue(t,Yl);let s=function(l){return a.isArray(l)?"["+l.map(s).join(",")+"]":l instanceof Element?`#${l.id=l.id||"_"+a.uniqueCode()}`:`${a.Json.stringify(l)}`};for(var n of i)if(n in t.attributes){let l,p;if(r&&!a.isNull(p=t[l=A.kebabToCamel(n)])){let u=s(p);t.setAttribute(n,`{{ ${u} }}`)}else t.removeAttribute(n)}}}}while(e.nextNode())}var rb=A.getAttachedPropertyValue,eC=A.setAttachedPropertyValue,Jm="pacem:repeater-item",ra=class{static findItemContext(r,e=0,t=console.warn){let n=Gi.findUpwards(r,e,t);return n==null&&t&&r instanceof HTMLElement&&r.isConnected&&t(`Couldn't find a ${Gi.name} up ${e} level${e===1?"":"s"} from element "${r.constructor.name}".`),n}},Gi=class o{constructor(r){this._placeholder=r;eC(r,Jm,this)}static findUpwards(r,e=0,t=console.warn){if(a.isNull(r)||r.localName==="template"||r instanceof Xl)return null;let n=null,i=l=>!a.isNull(n=o.getRepeaterItem(l));return A.findPreviousSiblingOrAncestor(r,i,e)==null&&t&&r instanceof HTMLElement&&r.isConnected&&t(`Couldn't find a ${o.name} up ${e} level${e===1?"":"s"} from element "${r.constructor.name}".`),n}static isRepeaterItem(r){return!a.isNull(rb(r,Jm))}static getRepeaterItem(r){return rb(r,Jm)}get placeholder(){return this._placeholder}};var nb=(n=>(n.AltKey="Alt",n.CtrlKey="Ctrl",n.ShiftKey="Shift",n.MetaKey="Cmd",n))(nb||{}),de=class{static isInstanceOf(r,e){return r instanceof e}static getEventCoordinates(r){var e;return"touches"in r?a.isNullOrEmpty(r.touches)?a.isNullOrEmpty(r.changedTouches)||(e=r.changedTouches[0]):e=r.touches[0]:e=r,{page:{x:e.pageX,y:e.pageY},screen:{x:e.screenX,y:e.screenY},client:{x:e.clientX,y:e.clientY}}}static getEventKeyModifiers(r){var e=r.which;return r instanceof MouseEvent&&(e=r.button),{which:e,shiftKey:r.shiftKey,altKey:r.altKey,ctrlKey:r.ctrlKey,metaKey:r.metaKey}}static matchModifiers(r,...e){let t=!a.isNull(e)&&(e.length===1&&a.isArray(e[0])?e[0]:Array.from(e).filter(u=>!a.isNullOrEmpty(u))),n=(t||[]).map(u=>u.toLowerCase()),i=n.indexOf("alt")>=0||n.indexOf("option")>=0,s=n.indexOf("shift")>=0,l=n.indexOf("ctrl")>=0,p=n.indexOf("win")>=0||n.indexOf("cmd")>=0;return!(i!==r.altKey||s!==r.shiftKey||p!==r.metaKey||l!==r.ctrlKey)}static fixEdgeCustomEventSubClassInstance(r,e){r instanceof e||Object.setPrototypeOf(r,e)}};var oe=class extends CustomEvent{constructor(r,e,t){super(r,a.extend({detail:e},t||{})),de.fixEdgeCustomEventSubClassInstance(this,this.constructor)}};function tC(o){if("detail"in o){for(let r in o)if(r!=="bubbles"&&r!=="cancelable"&&r!=="composed"&&r!=="detail")return!1;return!0}return!1}var ht=class extends CustomEvent{constructor(r,e,t,n){super(r,a.extend(tC(e||{})?e:{detail:e},!(t instanceof Event)&&t||{}));let i=n||t;i instanceof Event&&(this.#e=i,this.#t=de.getEventKeyModifiers(i),(i instanceof MouseEvent||i instanceof TouchEvent)&&(this.#r=de.getEventCoordinates(i))),de.fixEdgeCustomEventSubClassInstance(this,this.constructor)}#e;#t;#r;get originalEvent(){return this.#e}get which(){return this.#t?.which}get altKey(){return this.#t?.altKey}get shiftKey(){return this.#t?.shiftKey}get ctrlKey(){return this.#t?.ctrlKey}get metaKey(){return this.#t?.metaKey}get pageX(){return this.#r?.page.x}get pageY(){return this.#r?.page.y}get clientX(){return this.#r?.client.x}get clientY(){return this.#r?.client.y}get screenX(){return this.#r?.screen.x}get screenY(){return this.#r?.screen.y}},Ku="attributechange",Yu=class extends oe{constructor(r){super(Ku,r)}},ee="propertychange",ue=class extends oe{constructor(r){super(ee,r)}},rC="navigating",nC="navigate",Xu=class extends oe{constructor(r){super(nC,typeof r=="string"?{path:r}:r,{cancelable:!1,bubbles:!1})}},qu=class extends oe{constructor(r){super(rC,r,{cancelable:!0,bubbles:!1})}};var Ju=class extends oe{constructor(r){super("currentindexchange",r)}};var Yt="command",ql=class extends oe{constructor(r){super(Yt,r,{bubbles:!0,cancelable:!0})}};var bo=(o,r)=>a.areSemanticallyEqual(o,r);var iC={convert:o=>{}},sC={convert:o=>o,convertBack:o=>o},aC={convert:o=>o&&o.trim().split(/[ ,]+/),convertBack:o=>a.isArray(o)&&o.join(" ")||""},oC={convert:o=>parseFloat(o),convertBack:o=>o.toString()},lC={convert:o=>!a.isNullOrEmpty(o)&&o!=="0"&&o!=="false",convertBack:o=>(!!o).toString()},cC={convert:o=>o==="true"||o==="1",convertBack:o=>(!!o).toString()},ib={convert:o=>a.parseDate(o),convertBack:o=>a.parseDate(o).toISOString()},pC=ib,dC={convert:o=>a.Json.parse(o),convertBack:o=>a.Json.stringify(o)},uC={convert:o=>Function(`return ${o};`).apply(null),convertBack:o=>{}},hC={convert:o=>document.querySelector(o),convertBack:o=>o instanceof Element&&o.id?"#"+o.id:void 0,retryConversionWhenReady:!0},mC={convert:o=>se.parse(o),convertBack:o=>`${o.x||0} ${o.y||0}`},fC={convert:o=>Zs.parse(o),convertBack:o=>`${o.width||0} ${o.height||0}`},gC={convert:o=>Ze.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.width||0} ${o.height||0}`},m={None:iC,String:sC,StringArray:aC,Number:oC,Boolean:lC,BooleanStrict:cC,Date:pC,Datetime:ib,Json:dC,Eval:uC,Element:hC,Point:mC,Rect:gC,Size:fC};var Zu=(u=>(u.Get="GET",u.Post="POST",u.Put="PUT",u.Delete="DELETE",u.Options="OPTIONS",u.Head="HEAD",u.Patch="PATCH",u.Connect="CONNECT",u.Trace="TRACE",u))(Zu||{}),Zm="fetchresult",Qm="error",ef="success",Vp=class{static isEmpty(r){return r.status===204||r.headers.get("Content-Length")==="0"}};var vC=()=>{},Up=class extends Error{constructor(e,t){super(t);this.statusCode=e}get status(){return this.statusCode}},Qu=class{constructor(r,e){r&&(this._status=r.status,this._body=r.response,this._text=r.responseText,this._type=r.responseType,this._allHeadersRaw=r.getAllResponseHeaders(),this._processTime=e)}get processTime(){return this._processTime}get headers(){return this._headers===void 0&&this._allHeadersRaw&&this._parseHeaders(),this._headers}get size(){return+this.headers["Content-Length"]}get mime(){return this.headers["Content-Type"]}get date(){return new Date(Date.parse(this.headers.Date))}_parseHeaders(){let r={};this._allHeadersRaw.split(`\r
|
|
14
|
-
`).forEach(t=>{if(t&&t.length){let n=t.indexOf(":"),i=t.substr(0,n).trim(),s=t.substr(n+1).trim();r[i]=s}}),this._headers=r}get status(){return this._status}get text(){return this._text}get content(){return this._body}get type(){return this._type}get json(){if(this._type==="json")return this._body;try{return JSON.parse(this._text)}catch{return}}},zp=class{constructor(){}request(r,e){var t=this;let n=_t.defer();e=e||{method:"GET"};var i=e.method||"GET",s=e.data||{},l=e.progress||
|
|
13
|
+
${t(r)}</ul>${n}`;case"listitem":return` <li>${t(r)}</li>${n}`;case"link":case"linklike":let y=r,_=y.href,x="",w=y.ref;if(!_&&w){let E=e.find(k=>k.type==="ref"&&k.image!==!0&&k.id?.toLowerCase()===w.toLowerCase());E&&(_=E.url,x=E.title??"")}return _?`<a href="${_}"${x?' title="'+x+'"':""}>${t(r)}</a>`:`[${t(r)}]`;case"paragraph":return`<p>${t(r)}</p>${n}`;case"text":case"space":return r.text}return this._extraItemRender(r,e)}_render(r){let e="";for(let t of r||[])e+=this._rendeItem(t,r);return e}render(r){return Xx(this._render(r))}},Xm=class{_render(r){return be.isNullOrEmpty(r)?"":JSON.stringify(r)}render(r){return"["+r.filter(e=>!be.isNullOrEmpty(e)).map(this._render).join(",")+"]"}};function qx(o){return o&&typeof o=="object"&&typeof o.render=="function"}var qm=class extends $p{toHtml(r,e,t){let n=new zu(t);return be.isNullOrEmpty(e)?this.parse(r,n):this.parse(r,Uu(e),n)}tokenize(r,e){let t=this.parse(r,Uu(e),new Xm);return JSON.parse(t)}parse(r,e=Uu(),t=new zu){return qx(e)?super.parse(r,Uu(),e):super.parse(r,e,t)}};var Wl=class o{constructor(){}static clone(r){return new o()._clone(r)}_clone(r){let e=new WeakMap;function t(n){if(typeof n=="object"&&n!==null&&!(n instanceof Element)&&!(n instanceof FileSystemHandle)&&!(n instanceof File)){if(Array.isArray(n))return n.map(t);if(n instanceof Date)return new Date(n.valueOf());if(n instanceof RegExp)return new RegExp(n);if(e.has(n))return e.get(n);{let i=Object.assign({},n);return e.set(n,i),Object.keys(i).forEach(s=>{i[s]=t(n[s])}),i}}return n}return t(r)}};var vo="$refId",Jv=(t=>(t[t.Ignore=0]="Ignore",t.Reference="reference",t.Plain="plain",t))(Jv||{}),Fu=class{static{this._jsonFnWeakMap=new WeakMap}static{this._jsonFnMap=new Map}static store(r){let e=this._jsonFnWeakMap;if(!e.has(r)){let t=Qs.uniqueCode();e.set(r,t),this._jsonFnMap.set(t,r)}return e.get(r)}static retrieve(r){return this._jsonFnMap.get(r)}static remove(r){let e=this.retrieve(r);this._jsonFnMap.delete(r),this._jsonFnWeakMap.delete(e)}},Hp=class _Json{constructor(o){this._options=o}static serialize(o,r){return new _Json(r)._serialize(o)}static deserialize(o){return new _Json()._deserialize(o)}_serialize(o){let r=Wl.clone(o),e=[vo],t=this._flatten(r,0,null,e);return JSON.stringify(t,e.sort())}_deserialize(json){let hasRefs=!1,obj=JSON.parse(json,(key,value)=>{let elPattern=/^\$<#(.+)>$/,fnPattern=/^\$<fn:([^\x05]+)>$/,regexPattern=/^\$<regex:(.+)>$/,fnRefPattern=/^\$<fn#(.+)>$/,arr;if(key===vo)hasRefs=!0;else if(typeof value=="string")if((arr=regexPattern.exec(value))&&arr.length>1){let o=arr[1],r=o.lastIndexOf("|");return new RegExp(o.substr(0,r),o.substr(r+1))}else{if((arr=elPattern.exec(value))&&arr.length>1)return document.getElementById(arr[1]);if((arr=fnPattern.exec(value))&&arr.length>1)return eval(arr[1]);if((arr=fnRefPattern.exec(value))&&arr.length>1)return Fu.retrieve(arr[1])}return value});return hasRefs?this._revive(obj):obj}_flatten(o,r=0,e,t){if(e=e||new WeakSet,t=t||[],o instanceof Element)return o.id?`$<#${o.id}>`:void 0;if(o instanceof RegExp)return`$<regex:${o.source}|${o.flags}>`;if(typeof o=="object"&&o!=null&&!(o instanceof Date))return Array.isArray(o)?o.map(n=>this._flatten(n,r,e,t)):e.has(o)?o[vo]=o[vo]||"$#ref_"+r++:(e.add(o),Object.keys(o).forEach(n=>{t.indexOf(n)===-1&&t.push(n),o[n]=this._flatten(o[n],r,e,t)}),o);if(typeof o=="function")switch(this._options?.functions){case"reference":return"$<fn#"+Fu.store(o)+">";case"plain":return"$<fn:"+o+">";default:return}return o}_revive(o){let r={},e=/^\$#ref_(.+)$/;function t(n){if(typeof n=="object"&&n!==null){if(Array.isArray(n))return n.map(t);vo in n&&(r[n[vo]]=n,delete n[vo]),Object.keys(n).forEach(i=>{n[i]=t(n[i])})}else if(typeof n=="string"&&e.test(n)){let i=e.exec(n);return r[i[0]]}return n}return t(o)}};var _t=class o{constructor(){this.deferred=null;var r=this;r.promise=new Promise(function(e,t){r.deferred={resolve:e,reject:t,promise:r}})}then(r,e){return this.promise.then(r,e)}finally(r){return this.promise.then(r,r),this}success(r){return this.promise.then(r,null),this}error(r){return this.promise.then(null,r),this}static defer(){var r=new o;return r.deferred}};var Kx="pacem",Zv="download",Re=o=>{o.stopPropagation()},jl=o=>{o.preventDefault()},Q=o=>{o.preventDefault(),o.stopPropagation()},Qv=/^\/[^\/]+/,Jx=/\/\{([a-z\$_][\w]*)\??\}/,a=class o{static get core(){let r=window.Pacem;var e=r&&r.Configuration&&r.Configuration.core||Kx;return window[e]=window[e]||{}}static get customElements(){return window.customElements}static uniqueId(){return Qs.uniqueId()}static uniqueCode(){return Qs.uniqueCode()}static randomString(r){return Qs.randomString(r)}static parseDate(r){return br.parse(r)}static copyToClipboard(r){return navigator.clipboard?navigator.clipboard.writeText(r):new Promise((e,t)=>{let n=document.createElement("textarea");n.value=r,n.style.opacity="0",document.body.appendChild(n);try{n.select(),document.execCommand("copy"),n.remove(),e()}catch(i){t(i)}})}static{this.Json={stringify:Hp.serialize,parse:Hp.deserialize}}static{this.Dates={now:()=>o.parseDate(Date.now()),parse:o.parseDate,isLeapYear:br.isLeapYear,daysInMonth:br.daysInMonth,isDate:br.isDate,dateOnly:br.dateOnly,addMonths:br.addMonths,addDays:br.addDays,daysBetween:br.daysBetween}}static colorize(r,e){let t={h:38,s:.245,l:.6};var n,i,s,l;r instanceof HTMLElement?n=e:n=r,typeof n=="string"?i=Be.parse(n):i={r:n[0],g:n[1],b:n[2]};let p=Be.hsl(i);if(s=`brightness(50%) sepia(1) hue-rotate(${p.h-t.h}deg) saturate(${1+(p.s-t.s)}) brightness(${1+(p.l-t.l)})`,n===e)l.style.filter=s;else return s}static cssEscape(r){return escape(r).replace("%","\\")}static{this.Css={colorize:o.colorize,escape:o.cssEscape,getVariableValue(r){return getComputedStyle(document.documentElement).getPropertyValue(r)},setVariable(r,e){getComputedStyle(document.documentElement).setProperty(r,e)},isClassDefined(r){let e=new RegExp("."+r+"($|[s.,])");for(let t=0;t<document.styleSheets.length;t++){let n=document.styleSheets.item(t);try{let i=n.cssRules;for(let s=0;s<i.length;s++){let l=n.cssRules.item(s);if(e.test(l.selectorText))return!0}}catch(i){i instanceof DOMException&&console.warn(`Couldn't access cssRules of stylesheet "`+n.href+'".')}}return!1},deserializeTransform(r){let e=r instanceof Element?getComputedStyle(r):r,t=1,n=0,i=0,s=1,l=0,p=0,u=/^matrix\((.*)\)$/.exec(e.transform),f;return u&&u.length>1&&(f=u[1].split(",")).length==6&&(t=parseFloat(f[0]),n=parseFloat(f[1]),i=parseFloat(f[2]),s=parseFloat(f[3]),l+=parseFloat(f[4]),p+=parseFloat(f[5])),{a:t,b:n,c:i,d:s,e:l,f:p}}}}static{this.leftPad=gn.leftPad}static{this.formatString=gn.format}static{this.diff=gn.diff}static{this.Strings={leftPad:gn.leftPad,format:gn.format,diff:gn.diff,stripHTML:r=>new DOMParser().parseFromString(r,"text/html").body.textContent||""}}static{this.Blobs={toDataURL:mo.blobToDataURL,fromDataURL:mo.dataURLToBlob,toText:mo.blobToText,fromText:mo.textToBlob}}static{this.Images={load:fo.loadImage,resize:fo.resizeImage}}static loadImage(r){return new Promise((e,t)=>{let n=new Image;n.src=r,n.complete?e(n):(n.onload=i=>{e(n)},n.onerror=i=>{t()})})}static blobToDataURL(r){return o.Blobs.toDataURL(r)}static dataURLToBlob(r){return o.Blobs.fromDataURL(r)}static blobToText(r,e){return o.Blobs.toText(r,e)}static textToBlob(r,e="text/plain"){return o.Blobs.fromText(r,e)}static resizeImage(r,e,t,n){var i=_t.defer();return o.blobToDataURL(r).then(o.loadImage).then(s=>{let l=s.width,p=s.height,u=document.createElement("canvas");u.width=l,u.height=p;let f=u.getContext("2d");if(l>e||p>t){let g=l/p,v=e/t,y,_;v<g?(_=e,y=e/g):(y=t,_=t*g),u.width=_,u.height=y;let x=n>0&&n<=1;x&&(f.fillStyle="#000",f.fillRect(0,0,u.width,u.height)),o.cropImageOntoCanvas(s,f);let w;x?w=f.canvas.toDataURL("image/jpeg",n):w=f.canvas.toDataURL(),i.resolve(o.dataURLToBlob(w))}else i.resolve(r)},s=>{}),i.promise}static cropImage(r,e,t,n){var i=_t.defer();let s=new Image;return s.crossOrigin="anonymous",s.onload=function(l){let p=document.createElement("canvas"),u=p.getContext("2d");e&&(p.width=e),t&&(p.height=t);let f=n>0&&n<=1;f&&(u.fillStyle="#000",u.fillRect(0,0,p.width,p.height)),o.cropImageOntoCanvas(s,u),i.resolve(f?p.toDataURL("image/jpeg",n):p.toDataURL())},s.src=r,i.promise}static getUserMediaFunctions(){var r=[];let t=[navigator.getUserMedia,navigator.webkitGetUserMedia,navigator.msGetUserMedia,navigator.mozGetUserMedia].filter(function(n,i){return typeof n=="function"});return t.length&&(r=t),r}static cropImageOntoCanvas(r,e,t,n){e.imageSmoothingEnabled=e.mozImageSmoothingEnabled=e.oImageSmoothingEnabled=e.webkitImageSmoothingEnabled=!0;let i=e.canvas.width,s=e.canvas.height,l=i,p=s,u=t||1*r.width,f=n||1*r.height;var g=u/f,v=i/s;if(v>g){var y=i/u;s=y*f,e.drawImage(r,0,.5*(-s+p),l,s)}else{var y=s/f;i=y*u,e.drawImage(r,-Math.abs(.5*(-i+l)),0,i,p)}}static get _domURL(){return window.URL||window.webkitURL||window}static snapshotElement(r,e,t="image/png",n){function i(s){return new Promise((l,p)=>{let u=document.createElement("canvas"),f=s.width,g=s.height;if(!(f>0))p("Image has width zero.");else if(!(g>0))p("Image has height zero.");else{u.width=f,u.height=g;let v=u.getContext("2d");o.isNullOrEmpty(e)||(v.fillStyle=e,v.fillRect(0,0,f,g)),v.drawImage(s,0,0),u.toBlob(y=>{l(y)},t,n)}})}return r instanceof HTMLCanvasElement?i(r):new Promise((s,l)=>{let p=[];function u(w){let E=new Promise((k,N)=>{let T=()=>w instanceof HTMLImageElement?w.src:w.href.baseVal,O=D=>{w instanceof HTMLImageElement?w.src=D:w.setAttribute("href",D)};fetch(T()).then(D=>D.blob()).then(D=>o.blobToDataURL(D)).then(D=>{O(D),k()})});p.push(E)}function f(w,E){let k=new Promise((N,T)=>{let O=new Image;O.crossOrigin="anonymous",O.width=E.width,O.height=E.height,O.style.cssText=w.style.cssText,O.onload=()=>{w.replaceWith(O),N()},O.src=E.toDataURL()});p.push(k)}function g(w,E){let k=getComputedStyle(E);for(let N=0;N<k.length;N++){let T=k.item(N);w.style[T]=k[T]}}function v(w,E){g(w,E),w instanceof HTMLImageElement||w instanceof SVGImageElement?u(w):w instanceof HTMLCanvasElement&&f(w,E);let k=w.children.length;for(let N=0;N<k;N++){let T=w.children.item(N),O=E.children.item(N);T.tagName===O.tagName&&v(T,O)}}if(r instanceof SVGElement){let w=r.cloneNode(!0);v(w,r),Promise.all(p).then(E=>{r=w,x()})}else{var _=document.implementation.createHTMLDocument("");_.write(r.outerHTML),_.documentElement.setAttribute("xmlns",_.documentElement.namespaceURI);let E=document.evaluate(".//"+r.localName,_.body,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;E.setAttribute("xmlns",_.documentElement.namespaceURI),v(E,r),Promise.all(p).then(k=>{let N=document.createElementNS("http://www.w3.org/2000/svg","svg"),T=o.offset(r);N.setAttribute("viewBox",`0 0 ${T.width} ${T.height}`),N.setAttribute("width",T.width.toString()),N.setAttribute("height",T.height.toString()),N.innerHTML=`<foreignObject width="${T.width}" height="${T.height}">${E.outerHTML}</foreignObject>`,r=N,x()})}function x(){let w=new XMLSerializer().serializeToString(r),E=new Image;E.crossOrigin="anonymous";let k="data:image/svg+xml;charset=utf8,"+encodeURIComponent(w);E.onload=()=>{i(E).then(s)},E.src=k}})}static async download(r,e,t="application/download"){if(typeof r=="string"){let l=r,p={},u;o.isNullOrEmpty(e)||(typeof e=="object"?(p={credentials:e.credentials,headers:e.headers},u=e.filename||u,t=e.mime||t):u=e);var n=await fetch(l,p);if(n.ok){if(o.isNullOrEmpty(u)){let g="Content-Disposition";if(n.headers.has(g)){let v=n.headers.get(g),y=/^attachment; filename=\"?([^;\"]+)\"?(;|$)/.exec(v);y.length>1&&(u=y[1])}else u=Zv}var i=await n.blob();let f=u.split(/[\\\/]/g).join("_");return o.download(i,f)}{let f=await n.text();throw new Error(f)}}else{let l=r,p=typeof e=="string"&&e||Zv,u=document.createElement("a");if(u.setAttribute("href",o._domURL.createObjectURL(l)),u.setAttribute("download",p),document.createEvent){var s=document.createEvent("MouseEvents");s.initEvent("click",!0,!0),u.dispatchEvent(s)}else u.click()}}static isDOMReady(){return document.readyState==="complete"}static onDOMReady(r){window.addEventListener("load",r,!1)}static moveChildren(r,e){return o.moveItems(r.childNodes,e)}static moveItems(r,e){let t=[],n;for(let i=r.length-1;i>=0;i--){let s=r instanceof NodeList?r.item(i):r[i];e.insertBefore(s,n),t.unshift(s),n=s}return t}static is(r,e){return(r.matches||r.matchesSelector||r.msMatchesSelector||r.mozMatchesSelector||r.webkitMatchesSelector||r.oMatchesSelector).call(r,e)}static lang(r){return r.lang||document.documentElement.lang||navigator.language}static jsonSortStringify(r){return o.isNull(r)?r:o.Json.stringify(r)}static{this.Browsers={detect:Bu}}static cookies(r){let e=(r??document.cookie).split(";"),t={};for(var n of e){let i=n.split("=");if(i.length<2)continue;let s=(i[0]||"").trim(),l=(i[1]||"").trim();Object.defineProperty(t,s,{configurable:!1,enumerable:!0,writable:!1,value:decodeURIComponent(l.split("+").join(" "))})}return t}static{this.Cookies={getAll:async r=>{let e="cookieStore"in window?window.cookieStore:null,t=[];if(o.isNull(e)){let n=o.cookies();for(let i in n)!o.isNullOrEmpty(r)&&r!==i||t.push({name:i,value:n[i]});return t}else return await e.getAll(r)},stringify:r=>{let e=`${r.name}=${encodeURIComponent(r.value??"")}`;return o.isNullOrEmpty(r.domain)||(e+=`; domain=${encodeURIComponent(r.domain)}`),o.isNullOrEmpty(r.path)||(e+=`; path=${encodeURIComponent(r.path)}`),r.maxAge>0&&(e+=`; max-age=${r.maxAge.toFixed(0)}`),o.isNullOrEmpty(r.expires)||(e+=`; expires=${r.expires}`),r.partitioned&&(e+="; Partitioned"),o.isNullOrEmpty(r.sameSite)||(e+=`; SameSite=${encodeURIComponent(r.sameSite)}`),r.secure&&(e+="; Secure"),e}}}static isVisible(r){return"checkVisibility"in r?r.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):getComputedStyle(r).visibility!=="hidden"&&(r.clientWidth>0||r.clientHeight>0)}static hasClass(r,e){return r.classList?r.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(r.className)}static addClass(r,e){let t=e.trim();r.classList?DOMTokenList.prototype.add.apply(r.classList,t.split(" ")):r.setAttribute("class",r.className+" "+t)}static removeClass(r,e){let t=e.trim();r.classList?DOMTokenList.prototype.remove.apply(r.classList,t.split(" ")):r.setAttribute("class",r.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))}static toggleClass(r,e,t){t?o.addClass(r,e):o.removeClass(r,e)}static hasPart(r,e){return r.part.contains(e)}static addPart(r,e){DOMTokenList.prototype.add.apply(r.part,e.trim().split(" "))}static removePart(r,e){DOMTokenList.prototype.remove.apply(r.part,e.trim().split(" "))}static togglePart(r,e,t){t?o.addPart(r,e):o.removePart(r,e)}static offset(r){var e=r.getBoundingClientRect();return{top:Math.round(e.top)+o.scrollTop,left:Math.round(e.left)+o.scrollLeft,width:Math.round(e.width),height:Math.round(e.height)}}static offsetRect(r){var e=this.offset(r);return{y:e.top,x:e.left,width:e.width,height:e.height}}static naturalOffsetTop(r){return(r?.offsetTop??0)+(r?.offsetParent&&r.offsetParent instanceof HTMLElement?this.naturalOffsetTop(r.offsetParent):0)}static naturalOffsetLeft(r){return(r?.offsetTop??0)+(r?.offsetParent&&r.offsetParent instanceof HTMLElement?this.naturalOffsetLeft(r.offsetParent):0)}static naturalOffset(r){return{left:this.naturalOffsetLeft(r),top:this.naturalOffsetTop(r),width:r?.offsetWidth??0,height:r?.offsetHeight??0}}static naturalOffsetRect(r){var e=this.naturalOffset(r);return{y:e.top,x:e.left,width:e.width,height:e.height}}static deserializeTransform(r){return o.Css.deserializeTransform(r)}static set scrollTop(r){window.scrollTo(o.scrollLeft,r)}static set scrollLeft(r){window.scrollTo(r,o.scrollTop)}static scrollTo(r,e=!0,t=!0){let n=o.isNull(e)||typeof e=="boolean",i=n?o.scrollLeft:r,s=n?r:e,l=(n?e:t)?"smooth":"instant";window.scrollTo({behavior:l,left:i,top:s})}static get scrollTop(){return window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}static get scrollLeft(){return window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft||0}static get windowSize(){let r=window;return{width:r.innerWidth||r.document.documentElement.clientWidth||r.document.body.clientWidth||0,height:r.innerHeight||r.document.documentElement.clientHeight||r.document.body.clientHeight||0}}static addAnimationEndCallback(r,e,t=500){let n=s=>{(!s||s.target==r)&&(clearTimeout(i),r.removeEventListener("animationend",n,!1),r.removeEventListener("transitionend",n,!1),e.apply(this,[r]))};r.addEventListener("animationend",n,!1),r.addEventListener("transitionend",n,!1);let i=setTimeout(n,t)}static waitForAnimationEnd(r,e=500){return new Promise((t,n)=>{o.addAnimationEndCallback(r,()=>{t()},e)})}static idle(r){return new Promise((e,t)=>{setTimeout(()=>e(),r)})}static accelerateCallback(r,e=500,t=5,n=20){let i={cancel:!1},s=e,l=t+n,p=()=>{r(i),i.cancel||(setTimeout(p,s),s<l?s=n:s-=t)};p()}static isEmpty(r){return be.isEmpty(r)&&!(r instanceof Node)}static isNull(r){return be.isNull(r)}static isArray(r){return Array.isArray(r)}static isNullOrEmpty(r){return o.isNull(r)||o.isEmpty(r)}static areSemanticallyEqual(r,e){r??=null,e??=null;let t=r&&r.valueOf&&r.valueOf(),n=e&&e.valueOf&&e.valueOf();return t===n}static{this.extend=Object.assign}static clone(r){if(r!==void 0)return Wl.clone(r)}static fromResult(r){return Promise.resolve(r)}static fromResultAsync(r){return new Promise(e=>requestAnimationFrame(()=>e(r())))}static readonlyCopy(r){if(o.isNull(r))return null;if(o.isArray(r)){let e=r.slice(0);return Object.freeze(e),e}else{let e={};for(let t in r)e[t]=r[t];return Object.freeze(e),e}}static{this.URIs={format:function(r,e,t){for(let s in e||{}){let p=new RegExp("(^|\\/)\\{"+s+"\\??\\}(\\/|$)").exec(r);if(p&&p.length){let u=new RegExp("\\{"+s+"\\??\\}"),f=p.index;r=r.substring(0,f)+r.substring(f).replace(u,encodeURIComponent(e[s])),t&&delete e[s]}}let n=/(^|\/)\{[\w]+\?\}(\/|$)/;for(var i;(i=n.exec(r))&&i.length>0;){let s=i[0];r=r.replace(s,s.endsWith("/")?"/":"")}return r},appendQuery:function(r,e,t=!1,n=!1){let i=n?"#":"?",l=((n?/#/:/\?/).test(r)?"&":i)+Object.keys(e).filter(p=>!o.isNull(e[p])||!t).map(p=>encodeURIComponent(p)+"="+encodeURIComponent(e[p]??"")).join("&");return r+(l.length>1?l:"")},parseQuery:(r=window.location)=>{typeof r!="string"&&(r=r.search);let e={};return new URLSearchParams(r).forEach((t,n)=>{Object.defineProperty(e,n,{enumerable:!0,value:t})}),e},hasMandatoryTemplateSegments:function(r){return/(^|\/)\{\.*\}(\/|$)/.test(r)},parseRoute:function(r){let e=r,t=[];if(!o.isNullOrEmpty(e)){let n,i=0;for(;(n=Qv.exec(e))!=null;){let s=n[0],l=Jx.exec(s);if(!o.isNullOrEmpty(l)){let p=l[1];t.push({name:p,optional:s.charAt(s.length-2)==="?",index:i})}e=e.substring(n.index+s.length),i++}}return t},split:function(r){let t=/^((https?:)?\/\/[^\/]+)?([^\?#]+)(\?[^#]*)?(#[^#]*)?$/.exec(r);return t?{domain:t[2]??"",protocol:t[1]??"",path:t[3]??"",query:t[4]??"",hash:t[5]??""}:null},parseState:function(r,e,t,n,i){let s=e;if(o.isNullOrEmpty(t)){let v=o.URIs.split(e);t=v.path,o.isNullOrEmpty(n)&&(n=v.query??""),o.isNullOrEmpty(i)&&(i=v.hash??""),s=t+n+i}let l=v=>{let y=v.indexOf("#");return y!==0?null:v.substring(y+1)},p=v=>{let y=v.indexOf("?");return y===0?o.URIs.parseQuery(v.substring(y+1)):{}},u={$path:s,$pathname:t,$querystring:n.length>0?n.substring(1):n,$query:p(n),$hash:l(i)},f=0,g=r.slice();if(!o.isNullOrEmpty(g)){let v;for(;(v=Qv.exec(t))!=null;){let y=v[0],_=g.findIndex(x=>x.index===f);if(_>=0){let x=g[_],{name:w}=x;Object.defineProperty(u,w,{enumerable:!0,value:y.substring(1)}),g.splice(_,1)}f++,t=t.substring(v.index+y.length)}}for(let v=0;v<g.length;v++)if(!g[v].optional)throw`Must provide "${g[v].name}" route value.`;return u}}}static getApiResult(r){if(typeof r=="object"&&!o.isNull(r)&&r.hasOwnProperty("success"))switch(r.success){case!0:if(r.hasOwnProperty("result"))return r.result;break;case!1:if(r.hasOwnProperty("error"))return null;break}return r}};var Zk=Function,Wu="pacem:properties",Yl="pacem:custom-element:bindings",ea="pacem:custom-element:host",Bp="pacem:custom-element:scope";var eb,d=(eb=window.Pacem)?.Configuration?.prefix??"pacem",b=eb?.Configuration?.css??d;var zi="__context_pacem",Zx=/'(\\'|[^'])*[^\\]?'|"(\\"|[^"])*[^\\]?"/g,Qx=/[^\w]new\s|[^\w]window\s*[\.\[]|[^\w]document\s*\.|[^\w]eval\s*\(/,tb=/(^|[\s\(\[\+\-\*\/!])(:host\.|\^+item[\s\.,;\)\]]|\^+item$|\^+index[^\w\.]|\^+index$|\$?this[\.\s$]?|#[a-zA-Z_][\w]*|::[a-zA-Z_][\w]*)/g,ta=class o{constructor(){this._pending=!1;this._independent=!1}get dependencies(){return this._dependencies}get functionBody(){return this._fnBody}get voidBody(){return this._voidBody}get pending(){return this._pending}get independent(){return this._independent}evaluate(){return this._fn||(this._fn=new Function("$pacem",zi,this._fnBody)),this._fn.apply(null,[a.core,this._args])}evaluateAsync(){let r=_t.defer();return this._fn||(this._fn=new Function("$pacem",zi,this._fnBody)),r.resolve(this._fn.apply(null,[a.core,this._args])),r.promise}evaluatePlus(r={}){if(!this._fn){let n=[zi];for(var e in r)n.push(e);n.push("$pacem"),this._fn=new Function(n.join(", "),this._voidBody)}let t=[].concat(this._args);for(var e in r)t.push(r[e]);return t.push(a.core),this._fn.apply(null,t)}static{this._pendingExpression=null}static _getPendingExpressionSingleton(){if(o._pendingExpression==null){let r=new o;r._pending=!0,r._dependencies=[],o._pendingExpression=r}return o._pendingExpression}static parse(r,e){for(var t=A.findScopeContext(e),n={$this:e},i=[],s="",l=!0,p=[],u,f=0,g=[];(u=Zx.exec(r))!=null;){g.push(r.substr(f,u.index-f));let w=u[0].length;p.push({start:u.index,length:w}),f=u.index+w}f<r.length&&g.push(r.substr(f,r.length-f));for(var v=0;v<g.length;v++){let w=g[v];if(Qx.test(w))throw`Unsafe expression detected: "${w}".`;if(t==null){if(new RegExp(tb).test(w)===!0){l=!1;break}}else{let E=w.replace(tb,(k,N,T,O,D)=>{l=!1;let P="__host_pacem",F=zi+".$this"+(T.endsWith(".")?".":""),B=e,$=D.indexOf(".",O),U=$>O?D.substr($+1).trim():"",I=/^[\w\.\$]+/.exec(U),G=I&&I.length>0&&I[0],Y,W=G&&(Y=G.split(".")).length>0&&Y[0];if(T===":host.")B=n[P]=n[P]||A.findHostContext(e),F=`${zi}.${P}.`;else if(T.endsWith("^item")||T.substr(0,T.length-1).endsWith("^item")){let V=T.endsWith("^item")?"":T.substr(T.length-1,1),X=T.length-(V.length>0?6:5),q=`__item_${X}_up_pacem`,Z=ra.findItemContext(e,X);B=n[q]=n[q]||Z&&Z.placeholder,G="item"+(G?"."+G:""),W="item",F=`${zi}.${q}.item${V}`}else if(T.endsWith("^index")||T.substr(0,T.length-1).endsWith("^index")){let V=T.endsWith("^index")?"":T.substr(T.length-1,1),X=T.length-(V.length>0?7:6),q=`__item_${X}_up_pacem`,Z=ra.findItemContext(e,X);B=n[q]=n[q]||Z&&Z.placeholder,G="index",W="index",F=`${zi}.${q}.index${V}`}else if(T.startsWith("::")){let V=T.substr(2,T.length-2),X=n[P]=n[P]||A.findHostContext(e);a.isNull(X)?B=null:B=X[V],F=`${zi}.${P}.${V}`}else if(T.startsWith("#")){let V=T.substr(1,T.length-1);B=n[V]=n[V]||t.querySelector("#"+V),F=`${zi}.${V}`}return W&&B&&W in B&&typeof B[W]!="function"&&i.find(V=>V.element===B&&V.property==W)==null&&i.push({element:B,property:W,path:G,twowayAllowed:!1}),N+F});if(s+=E,v<p.length){let k=p[v];s+=r.substr(k.start,k.length)}}}if(l){var y=new o;return y._independent=!0,y._fnBody=`return ${r};`,y._voidBody=r,y._dependencies=[],y}if(t==null)return this._getPendingExpressionSingleton();for(var _ in n)if(n[_]==null)return o._getPendingExpressionSingleton();i.length==1&&/[^\w\.\$]+/.test(s.trim())!==!0&&(i[0].twowayAllowed=!0);var x=new o;return x._args=n,x._fnBody=`try{ var ___$$$r = ${s}; return ___$$$r; }catch(e){ }`,x._voidBody=`try{ ${s} }catch(e){ }`,x._dependencies=i,x}};var Xl=class extends HTMLElement{};var ju="__pacem__",eC=/^\{\{(.|\n)+\}\}$/,A=class o{static get polyfilling(){return customElements instanceof window.CustomElementRegistry}static camelToKebab(r){return r&&r.replace(/([A-Z])/g,"-$1").toLowerCase()}static kebabToCamel(r){return r&&r.replace(/(-[a-z])/g,e=>e[1].toUpperCase())}static waitForReady(r){return new Promise((e,t)=>{a.isNull(r)&&t("Not found."),r.isReady&&e();let n=()=>{r.removeEventListener("load",n),e()};r.addEventListener("load",n)})}static whenReady(r,e){o.waitForReady(r).then(e)}static getWatchedProperties(r,e=!0){var t=[],n=r instanceof HTMLElement?r.constructor:r;do{let s=(this.getAttachedPropertyValue(n,Wu)||[]).filter(l=>!l.name.startsWith("_"));Array.prototype.splice.apply(t,[0,0].concat(s))}while(e&&(n=Object.getPrototypeOf(n)));return t}static getWatchedProperty(r,e){return this.getWatchedProperties(r,!0).find(t=>t.name===e)}static importjs(r,e=null,t=!1){var n={type:"text/javascript",src:r};return a.isNullOrEmpty(e)||a.extend(n,{integrity:e}),t&&a.extend(n,{crossorigin:""}),o.import(r,"script",n,document.head||document.getElementsByTagName("head")[0])}static importcss(r,e=null,t=!1){var n={rel:"stylesheet",href:r};return a.isNullOrEmpty(e)||a.extend(n,{integrity:e}),t&&a.extend(n,{crossorigin:"anonymous"}),o.import(r,"link",n,document.head||document.getElementsByTagName("head")[0])}static import(r,e,t,n=document.body){let i=a.core;var s=i.imports=i.imports||{};return s[r]=s[r]||new Promise((l,p)=>{var u=e;for(let v in t||{})u+=`[${v}="${t[v]}"]`;var f=document.querySelector(u);if(!a.isNull(f))l(f);else{f=document.createElement(e),f.onerror=v=>{p(v)},f.onload=()=>{l(f)};for(var g in t||{})f.setAttribute(g,t[g]);n.appendChild(f)}})}static{this.Theme={importWebFonts(){function r(i){return/^('|").*\1$/.test(i)?i.substring(1,i.length-1):i}function e(i){return a.isNullOrEmpty(i)?Promise.resolve():document.fonts.load("1rem "+i)}let t=["icons","std","main","tech","btn"].map(i=>{let s=a.Css.getVariableValue(`--${b}-font-${i}`).split(",")[0],l=r(a.Css.getVariableValue(`--${b}-font-${i}-api-url`));return a.isNullOrEmpty(l)?e(s):o.importcss(l).then(p=>e(s))}),n=new Promise(i=>{function s(l=0){l>4||!("size"in document.fonts)||typeof document.fonts.size=="number"&&document.fonts.size>0?document.fonts.ready.then(i):setTimeout(s,250,l++)}s()});return t.push(n),Promise.all(t)}}}static setAttachedPropertyValue(r,e,t){if(a.isNull(r))return;let n=Object.getOwnPropertyDescriptor(r,ju),i=n&&n.value||Object.defineProperty(r,ju,{value:{},enumerable:!1,writable:!1,configurable:!1})[ju];a.isNull(t)?delete i[e]:i[e]=t}static deleteAttachedPropertyValue(r,e){o.setAttachedPropertyValue(r,e,void 0)}static getAttachedPropertyValue(r,e,t){let n=Object.getOwnPropertyDescriptor(r,ju),i=n&&n.value;return a.isNull(i&&i[e])&&!a.isNull(t)?(o.setAttachedPropertyValue(r,e,t),t):i&&i[e]}static resolvePath(r,e){if(!r||!e)return;if(/[\(\)\{\}]/.test(r))throw`Security alert: not allowed to process paths like ${r}.`;let t=r.split(".");var n=e,i=n,s,l=t[0];t.forEach((f,g)=>{var v=f.split("[");v.forEach((y,_)=>{s=i,/\]$/.test(y)&&(y=y.substring(0,y.length-1),/^('|").+[^\\]\1$/.test(y)&&(y=y.substr(1,y.length-2))),i=i[y]})});var p,u;return/\]$/.test(r)?(u=r.lastIndexOf("["),p=r.substring(u+1),p=p.substring(0,p.length-1)):(u=r.lastIndexOf("."),p=r.substring(u+1)),{target:{value:i,name:p},parent:{value:s||e,path:r.substring(0,u)},root:{value:n,property:l}}}static set(r,e,t){var n=o.resolvePath(e,r),i=n.target.value;if(i!==t)if(n.parent.value!=n.root.value&&!(n.parent.value instanceof HTMLElement)){n.parent.value[n.target.name]=t;let s=a.clone(n.root.value[n.root.property]);n.parent.value[n.target.name]=i;let l;n.root.property==="item"&&!a.isNull(l=Gi.getRepeaterItem(n.root.value))?l.repeater&&l.repeater.datasource&&l.repeater.datasource.splice(l.index,1,l.item=s):n.root.value[n.root.property]=s}else n.parent.value[n.target.name]=t}static get(r,e){var t=o.resolvePath(e,r);return t&&t.target&&t.target.value}static _findScopeContextLegacy(r){let e=r,t;do e=e.parentNode;while(e!=null&&(e!=(t=r.ownerDocument)||e instanceof HTMLElement&&(t=e.shadowRoot)!=null));return t}static findScopeContext(r){return(r.isConnected?r.getRootNode():o.getAttachedPropertyValue(r,Bp))??o._findScopeContextLegacy(r)}static findAncestor(r,e){let t=r,n;for(;t&&(t=t.parentNode||t.getRootNode()?.host)!=null;)if(t.host instanceof HTMLElement&&(t=t.host),e.apply(t,[t])){n=t;break}return n}static findAncestorShell(r){return o.findAncestor(r,e=>a.is(e,`.${b}-body`)||e===document.body)}static findAncestorOfType(r,e){return o.findAncestor(r,t=>t instanceof e)}static findDescendants(r,e,t=!1){let n=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(var i=[];n.nextNode();){let s=n.currentNode;if(e(s)===!0&&(i.push(s),t))return i}return i}static findFirstDescendant(r,e){let t=o.findDescendants(r,e,!0);return a.isNullOrEmpty(t)?void 0:t[0]}static findAll(r="[pacem]",e=t=>!0){let t=[];return document.querySelectorAll(r).forEach((n,i,s)=>{e(n)===!0&&t.push(n)}),t}static findPreviousSiblingOrAncestorOfType(r,e,t=0){let n=r,i=null,s=0;do if(n=n.previousSibling||n.parentNode,n instanceof e){if(s>=t){i=n;break}else n=n.parentNode;s++}while(n!=null);return i}static findPreviousSiblingOrAncestor(r,e,t=0){let n=r,i=null,s=0;do if(n=n.previousSibling||n.parentNode,n&&e.apply(n,[n])){if(s>=t){i=n;break}else n=n.parentNode;s++}while(n!=null);return i}static assignHostContext(r,e){let t=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_DOCUMENT_FRAGMENT);for(;t.nextNode();){var n=t.currentNode;a.isNull(o.getAttachedPropertyValue(n,ea))&&o.setAttachedPropertyValue(n,ea,r)}}static findHostContext(r){let e=r,t;if(!e.isConnected)return t;for(;e!=null&&(t=o.getAttachedPropertyValue(e,ea),!(t instanceof HTMLElement));)e=e.parentElement;let n;return t==null&&console&&(n=console.warn)&&n(`Element "${r.constructor.name}" isn't a descendant of a templated component.`),t}static isBindingAttribute(r){return eC.test(r)}static extractBindingAttributeExpression(r){if(o.isBindingAttribute(r))return r.substr(2,r.length-4);throw"Invalid attribute: incorrect binding syntax."}static parseBindingAttribute(r,e){let t=o.extractBindingAttributeExpression(r),n=/,\s*(twoway|once)\s*$/.exec(t),i=n&&n.length>1&&n[1];a.isNullOrEmpty(i)||(t=t.substr(0,t.lastIndexOf(",")));var s=ta.parse(t,e);return(s&&s.dependencies).forEach(l=>{switch(i){case"twoway":l.mode=l.twowayAllowed&&s.dependencies.length==1?"twoway":void 0;break;case"once":l.mode=i;break}}),s}static ensureMember(r,e,t){let n=Object.getOwnPropertyDescriptor(r,e);return n??(Object.defineProperty(r,e,t),Object.getOwnPropertyDescriptor(r,e))}static stripObservedAttributes(r){rb(r,!1)}static freezeObservedAttributes(r){rb(r)}};function rb(o,r=!0){let e=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{var t=e.currentNode;if(t instanceof HTMLElement){let i=t.constructor.observedAttributes;if(!a.isNull(i)){A.deleteAttachedPropertyValue(t,Yl);let s=function(l){return a.isArray(l)?"["+l.map(s).join(",")+"]":l instanceof Element?`#${l.id=l.id||"_"+a.uniqueCode()}`:`${a.Json.stringify(l)}`};for(var n of i)if(n in t.attributes){let l,p;if(r&&!a.isNull(p=t[l=A.kebabToCamel(n)])){let u=s(p);t.setAttribute(n,`{{ ${u} }}`)}else t.removeAttribute(n)}}}}while(e.nextNode())}var nb=A.getAttachedPropertyValue,tC=A.setAttachedPropertyValue,Jm="pacem:repeater-item",ra=class{static findItemContext(r,e=0,t=console.warn){let n=Gi.findUpwards(r,e,t);return n==null&&t&&r instanceof HTMLElement&&r.isConnected&&t(`Couldn't find a ${Gi.name} up ${e} level${e===1?"":"s"} from element "${r.constructor.name}".`),n}},Gi=class o{constructor(r){this._placeholder=r;tC(r,Jm,this)}static findUpwards(r,e=0,t=console.warn){if(a.isNull(r)||r.localName==="template"||r instanceof Xl)return null;let n=null,i=l=>!a.isNull(n=o.getRepeaterItem(l));return A.findPreviousSiblingOrAncestor(r,i,e)==null&&t&&r instanceof HTMLElement&&r.isConnected&&t(`Couldn't find a ${o.name} up ${e} level${e===1?"":"s"} from element "${r.constructor.name}".`),n}static isRepeaterItem(r){return!a.isNull(nb(r,Jm))}static getRepeaterItem(r){return nb(r,Jm)}get placeholder(){return this._placeholder}};var ib=(n=>(n.AltKey="Alt",n.CtrlKey="Ctrl",n.ShiftKey="Shift",n.MetaKey="Cmd",n))(ib||{}),de=class{static isInstanceOf(r,e){return r instanceof e}static getEventCoordinates(r){var e;return"touches"in r?a.isNullOrEmpty(r.touches)?a.isNullOrEmpty(r.changedTouches)||(e=r.changedTouches[0]):e=r.touches[0]:e=r,{page:{x:e.pageX,y:e.pageY},screen:{x:e.screenX,y:e.screenY},client:{x:e.clientX,y:e.clientY}}}static getEventKeyModifiers(r){var e=r.which;return r instanceof MouseEvent&&(e=r.button),{which:e,shiftKey:r.shiftKey,altKey:r.altKey,ctrlKey:r.ctrlKey,metaKey:r.metaKey}}static matchModifiers(r,...e){let t=!a.isNull(e)&&(e.length===1&&a.isArray(e[0])?e[0]:Array.from(e).filter(u=>!a.isNullOrEmpty(u))),n=(t||[]).map(u=>u.toLowerCase()),i=n.indexOf("alt")>=0||n.indexOf("option")>=0,s=n.indexOf("shift")>=0,l=n.indexOf("ctrl")>=0,p=n.indexOf("win")>=0||n.indexOf("cmd")>=0;return!(i!==r.altKey||s!==r.shiftKey||p!==r.metaKey||l!==r.ctrlKey)}static fixEdgeCustomEventSubClassInstance(r,e){r instanceof e||Object.setPrototypeOf(r,e)}};var oe=class extends CustomEvent{constructor(r,e,t){super(r,a.extend({detail:e},t||{})),de.fixEdgeCustomEventSubClassInstance(this,this.constructor)}};function rC(o){if("detail"in o){for(let r in o)if(r!=="bubbles"&&r!=="cancelable"&&r!=="composed"&&r!=="detail")return!1;return!0}return!1}var ht=class extends CustomEvent{constructor(r,e,t,n){super(r,a.extend(rC(e||{})?e:{detail:e},!(t instanceof Event)&&t||{}));let i=n||t;i instanceof Event&&(this.#e=i,this.#t=de.getEventKeyModifiers(i),(i instanceof MouseEvent||i instanceof TouchEvent)&&(this.#r=de.getEventCoordinates(i))),de.fixEdgeCustomEventSubClassInstance(this,this.constructor)}#e;#t;#r;get originalEvent(){return this.#e}get which(){return this.#t?.which}get altKey(){return this.#t?.altKey}get shiftKey(){return this.#t?.shiftKey}get ctrlKey(){return this.#t?.ctrlKey}get metaKey(){return this.#t?.metaKey}get pageX(){return this.#r?.page.x}get pageY(){return this.#r?.page.y}get clientX(){return this.#r?.client.x}get clientY(){return this.#r?.client.y}get screenX(){return this.#r?.screen.x}get screenY(){return this.#r?.screen.y}},Ku="attributechange",Yu=class extends oe{constructor(r){super(Ku,r)}},ee="propertychange",ue=class extends oe{constructor(r){super(ee,r)}},nC="navigating",iC="navigate",Xu=class extends oe{constructor(r){super(iC,typeof r=="string"?{path:r}:r,{cancelable:!1,bubbles:!1})}},qu=class extends oe{constructor(r){super(nC,r,{cancelable:!0,bubbles:!1})}};var Ju=class extends oe{constructor(r){super("currentindexchange",r)}};var Yt="command",ql=class extends oe{constructor(r){super(Yt,r,{bubbles:!0,cancelable:!0})}};var bo=(o,r)=>a.areSemanticallyEqual(o,r);var sC={convert:o=>{}},aC={convert:o=>o,convertBack:o=>o},oC={convert:o=>o&&o.trim().split(/[ ,]+/),convertBack:o=>a.isArray(o)&&o.join(" ")||""},lC={convert:o=>parseFloat(o),convertBack:o=>o.toString()},cC={convert:o=>!a.isNullOrEmpty(o)&&o!=="0"&&o!=="false",convertBack:o=>(!!o).toString()},pC={convert:o=>o==="true"||o==="1",convertBack:o=>(!!o).toString()},sb={convert:o=>a.parseDate(o),convertBack:o=>a.parseDate(o).toISOString()},dC=sb,uC={convert:o=>a.Json.parse(o),convertBack:o=>a.Json.stringify(o)},hC={convert:o=>Function(`return ${o};`).apply(null),convertBack:o=>{}},mC={convert:o=>document.querySelector(o),convertBack:o=>o instanceof Element&&o.id?"#"+o.id:void 0,retryConversionWhenReady:!0},fC={convert:o=>se.parse(o),convertBack:o=>`${o.x||0} ${o.y||0}`},gC={convert:o=>Zs.parse(o),convertBack:o=>`${o.width||0} ${o.height||0}`},vC={convert:o=>Ze.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.width||0} ${o.height||0}`},m={None:sC,String:aC,StringArray:oC,Number:lC,Boolean:cC,BooleanStrict:pC,Date:dC,Datetime:sb,Json:uC,Eval:hC,Element:mC,Point:fC,Rect:vC,Size:gC};var Zu=(u=>(u.Get="GET",u.Post="POST",u.Put="PUT",u.Delete="DELETE",u.Options="OPTIONS",u.Head="HEAD",u.Patch="PATCH",u.Connect="CONNECT",u.Trace="TRACE",u))(Zu||{}),Zm="fetchresult",Qm="error",ef="success",Vp=class{static isEmpty(r){return r.status===204||r.headers.get("Content-Length")==="0"}};var bC=()=>{},Up=class extends Error{constructor(e,t){super(t);this.statusCode=e}get status(){return this.statusCode}},Qu=class{constructor(r,e){r&&(this._status=r.status,this._body=r.response,this._text=r.responseText,this._type=r.responseType,this._allHeadersRaw=r.getAllResponseHeaders(),this._processTime=e)}get processTime(){return this._processTime}get headers(){return this._headers===void 0&&this._allHeadersRaw&&this._parseHeaders(),this._headers}get size(){return+this.headers["Content-Length"]}get mime(){return this.headers["Content-Type"]}get date(){return new Date(Date.parse(this.headers.Date))}_parseHeaders(){let r={};this._allHeadersRaw.split(`\r
|
|
14
|
+
`).forEach(t=>{if(t&&t.length){let n=t.indexOf(":"),i=t.substr(0,n).trim(),s=t.substr(n+1).trim();r[i]=s}}),this._headers=r}get status(){return this._status}get text(){return this._text}get content(){return this._body}get type(){return this._type}get json(){if(this._type==="json")return this._body;try{return JSON.parse(this._text)}catch{return}}},zp=class{constructor(){}request(r,e){var t=this;let n=_t.defer();e=e||{method:"GET"};var i=e.method||"GET",s=e.data||{},l=e.progress||bC,p=e.headers||{};t.accessToken&&(p.Authorization="Bearer "+t.accessToken);var u=new XMLHttpRequest;u.withCredentials=!1,u.addEventListener("progress",y=>{if(y.lengthComputable){var _=y.loaded/y.total;typeof l=="function"&&l.apply(t,[_])}},!1),u.addEventListener("error",y=>{n.reject(new Up(500,y.message||"Unknown error"))},!1);var f;u.addEventListener("load",()=>{if(u.status>=200&&u.status<300){var y=new Qu(u,Date.now()-f);n.resolve(y)}else n.reject(new Up(u.status,u.statusText))},!1);var g;switch(i.toUpperCase()){case"GET":r+=(/\?/.test(r)?"&":"?")+(typeof s=="string"?s:Object.keys(s).map(function(y){return encodeURIComponent(y)+"="+encodeURIComponent(s[y])}).join("&"));break;case"POST":g=JSON.stringify(s)}switch(u.open(i,r,!0),i.toUpperCase()){case"GET":u.setRequestHeader("X-Requested-With","XMLHttpRequest");break;case"POST":u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/json");break}for(var v in p)u.setRequestHeader(v,p[v]);return f=Date.now(),u.send(g),n.promise}get(r,e,t){return this.request(r,{method:"GET",data:e,headers:t||{}})}post(r,e,t){return this.request(r,{method:"POST",data:e,headers:t||{}})}};var $e=A.getAttachedPropertyValue,Xt=A.setAttachedPropertyValue,Fp=A.deleteAttachedPropertyValue,yC="pacem:property:",ab="pacem:version",Gp="pacem:binding:",cb="pacem:view-children",tf="pacem:has-binding:",pb="pacem:custom-element:has-template",ob="pacem:custom-element:has-templated",db="pacem:custom-element:promise",Jl="pacem:custom-element:ready",lb="pacem:custom-element:startup";function Kl(o,r,e){var t=o;let n=r,i=e;var s=$e(t,Gp+n);if(s&&s.forEach(l=>{l.dep.element.removeEventListener(ee,l.callback,!1)}),a.isNull(i)||$e(o,Jl)!==!0)Fp(t,Gp+n),Fp(t,tf+n);else if(i.pending)Xt(t,Gp+n,[]);else{let l="oneway";switch(i.dependencies&&i.dependencies.length&&i.dependencies[0].mode){case"twoway":i.dependencies.length==1&&(l="twoway");break;case"once":l="once"}Xt(t,tf+n,l);let p=i.dependencies.map(u=>{var f={dep:u,callback:function(g){g.detail.propertyName===u.property&&(t[n]=i.evaluate())}};return u.element.addEventListener(ee,f.callback,!1),f});Xt(t,Gp+n,p),t[n]=i.evaluate()}}function _C(o){var r=_t.defer();let e=t=>{a.isDOMReady()?r.resolve(t):a.onDOMReady(n=>{r.resolve(t)})};return o.template?e(o.template):o.templateUrl?new zp().get(o.templateUrl).success(n=>{let i=o.template=n.text;return e(i),n}).error(n=>{console.error(n.message),e(null)}):e(null),r.promise}function xC(o,r){let e=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(var t=[];e.nextNode();){var n=e.currentNode;if($e(n.constructor,pb)===!0){var i=$e(n,db,_t.defer());t.push(i.promise)}}return t}var C=o=>r=>{if(a.customElements.get(o.tagName)){console.warn(`${o.tagName} registration skipped, since already defined.`);return}var e=A.getWatchedProperties(r,!0);if(Xt(r,pb,!(a.isNullOrEmpty(o.template)&&a.isNullOrEmpty(o.templateUrl))),e&&e.length>0){let i="observedAttributes";var t=[];r.hasOwnProperty(i)&&(t=r[i].slice(),delete r[i]);let s=t;for(var n of e){let l=A.camelToKebab(n.name);s.unshift(l)}Object.defineProperty(r,i,{get:function(){return s},enumerable:!0,configurable:!1})}{let i=r.prototype,s=Object.getOwnPropertyDescriptor(i,"connectedCallback")||i.connectedCallback,l=Object.getOwnPropertyDescriptor(i,"viewActivatedCallback")||i.viewActivatedCallback;Object.defineProperty(i,"connectedCallback",{value:function(){let v=this;v.setAttribute("pacem",""),v.setAttribute("cloak",""),Fp(v,cb),s&&s.value?s.value.apply(v,[]):typeof s=="function"&&s.apply(v),_C(o).then(y=>{if(!v.isConnected)return;var _=[];if($e(v,Jl)!==!0&&!a.isNullOrEmpty(y)&&$e(v,ob)!=!0){Xt(v,ob,!0);let D=v,P=o.shadow,F=document.createElement("template").content,B=document.createElement("template");if(!P)for(var x=D.childNodes.length-1;x>=0;x--)F.insertBefore(D.childNodes.item(x),F.firstChild);B.innerHTML=y;let $=B.content.querySelectorAll(d+"-content");if(A.assignHostContext(v,B),$.length==1){let U=$.item(0);var w=U.nextSibling;let I=U.parentElement||B.content,G=F.childNodes;for(I.removeChild(U);G.length>0;)try{let Y=G.item(0);I.insertBefore(Y,w)}catch(Y){console.error(Y.toString())}}else if($.length>1)throw"There can only be at most 1 content placeholder inside a template.";var E;if(o.shadow)E=D.attachShadow({mode:"open"}),E.appendChild(B.content);else{E=D;for(var k=B.content.children;k.length>0;)E.append(k.item(0))}_=xC(v,E)}Xt(v,Jl,!0);for(let D of e){let P=D.name,F=D.config;if(!F.converter.retryConversionWhenReady||!a.isNull(v[P]))continue;let B=A.camelToKebab(P),$=v.getAttribute(B);!a.isNullOrEmpty($)&&!A.isBindingAttribute($)&&(v[P]=F.converter.convert($,v))}($e(v,lb)||[]).forEach(D=>{D.apply(v)}),(D=>{var P=$e(v,Yl)||[];P.forEach(F=>{let B=F;if(!(B in v.attributes))throw`Howcome? ${B} not in ${v.constructor.name} attributes!?...`;let $=v.attributes[B].value;if(A.isBindingAttribute($)){var U=A.parseBindingAttribute($,v);Kl(v,A.kebabToCamel(F),U)}})})();let O=D=>{l&&l.value?l.value.apply(v,[]):typeof l=="function"&&l.apply(v);var P=$e(v,db);a.isNull(P)||P.resolve()};v.removeAttribute("cloak"),Promise.all(_).then(D=>O())})},configurable:!0,enumerable:!0});let p=Object.getOwnPropertyDescriptor(i,"disconnectedCallback")||i.disconnectedCallback;Object.defineProperty(i,"disconnectedCallback",{value:function(){let v=this;p&&p.value?p.value.apply(v,[]):typeof p=="function"&&p.apply(v,[]),Xt(v,Jl,!1),($e(v,Yl)||[]).forEach(_=>{Kl(v,A.kebabToCamel(_))})},configurable:!0,enumerable:!0});let u=Object.getOwnPropertyDescriptor(i,"attributeChangedCallback")||i.attributeChangedCallback;Object.defineProperty(i,"attributeChangedCallback",{value:function(v,y,_){let x=this,w=$e(x,Jl)===!0;u&&u.value?u.value.apply(x,[v,y,_]):typeof u=="function"&&u.apply(x,[v,y,_]);let E=new Yu({attributeName:v,oldValue:y,currentValue:_,firstChange:!w});x.dispatchEvent(E);let k=A.isBindingAttribute(_),N=v,T=A.kebabToCamel(N),O=!1;if(k){let P=A.parseBindingAttribute(_,x);if(P instanceof ta){let F=()=>{x[T]=P.evaluate(),Kl(x,T)},B=()=>{var $=$e(x,Yl,[]);$.push(N),P.pending||Kl(x,T,P)};if(P.independent&&!O)try{F()}catch($){console.warn(`Error occurred in early binding evaluation:
|
|
15
15
|
${_}
|
|
16
|
-
${$.message??$}`),B()}else B()}else throw`Howcome? ${_} misinterpreted as ${N} binding...`}else{var D=e.find(P=>P.name===T);a.isNull(D)||(Kl(x,T),x[T]=D.config.converter.convert(_,x))}},configurable:!0,enumerable:!0});let f=Object.getOwnPropertyDescriptor(i,"propertyChangedCallback")||i.propertyChangedCallback;Object.defineProperty(i,"propertyChangedCallback",{value:function(v,y,_,x,w){let E=this,k=$e(E,Jl)===!0,N=()=>{let O=$e(E,tf+v);if(f&&f.value?f.value.apply(E,[v,y,_,!k]):typeof f=="function"&&f.apply(E,[v,y,_,!k]),!w||w.emit!==!1){let $=new ue({propertyName:v,oldValue:y,currentValue:_,firstChange:!k});E.dispatchEvent($)}if(a.isNullOrEmpty(O)){var D=e.find($=>$.name===v);if(w&&w.reflectBack===!0&&!A.polyfilling){var P=A.camelToKebab(v),F=E.attributes.getNamedItem(P);if(k||a.isNullOrEmpty(F)){var B;if(_==null)E.removeAttribute(P);else if(D&&(B=D.config)&&typeof B.converter.convertBack=="function"){let $=B.converter.convertBack(_,E);(F==null||$!==F.value)&&E.setAttribute(P,$)}}}}else if(O==="twoway"){let $=$e(E,Gp+v)[0].dep;A.set($.element,$.path,_)}else O==="once"&&Kl(E,v)};if(k)N.apply(E);else{var T=$e(E,
|
|
17
|
-
`)}}return v},"")}static padleft(r,e,t){return a.leftPad(""+r,e,t)}static size(r){return r>0?r<1024?r+" B":r<1048576?(r/1024).toFixed(2)+" kB":r<1073741824?(r/1048576).toFixed(2)+" MB":(r/1073741824).toFixed(2)+" GB":"-"}static decToDeg(r,e="\xB0 ",t="' ",n='"'){let i=Math.sign(r);r=Math.abs(r);let s=Math.floor(r),l=(r-s)*60,p=Math.floor(l),u=(l-p)*60,f=Math.floor(u);return(i<0?"-":"")+s+e+p+t+f+n}static date(r,e,t){var n=a.parseDate(r),i=t||navigator.language;if(a.isNull(e)||typeof e=="string")switch(e){case"iso":return n.toISOString();case"isodate":return n.toISOString().substring(0,10);case"localdate":return`${n.getFullYear()}-${a.leftPad(n.getMonth()+1,2,"0")}-${a.leftPad(n.getDate(),2,"0")}`;case"time":case"localtime":return n.toLocaleTimeString(i,{hour:"numeric",minute:"numeric",second:"numeric",hour12:!1});case"full":let l=-(n.getTimezoneOffset()/60);var s="";return l!=0&&(s=" (UTC"+((l>0?"+":"-")+Math.abs(l).toLocaleString())+")"),n.toLocaleString(i)+s;default:return n.toLocaleDateString(i)}else return n.toLocaleString(t,e)}static timespan(r,e,t,n){let i=a.parseDate(r),s=a.parseDate(e),l=s.valueOf()-i.valueOf(),p=l<0?"-":"",u=Math.abs(l);if(typeof t=="object"){let k={timeZone:"UTC",hour12:!1},N=a.extend(k,t);return(p||(t.sign?"+":""))+Intl.DateTimeFormat(n??navigator.language,N).format(u)}let f=864e5,g=36e5,v=6e4,y=Math.floor(u/f),_=Math.floor(u%f/g),x=Math.floor(u%g/v),w=Math.floor(u%v/1e3),E=Math.floor(u%1e3);return`${p}${y}d ${_}h ${x}m ${w}s ${E}ms`}static currency(r,e,t){return new Intl.NumberFormat(t??navigator.language,{style:"currency",currency:e}).format(r)}static number(r,e,t){return typeof e=="string"?new Intl.NumberFormat(e||navigator.language).format(r):new Intl.NumberFormat(t??navigator.language,e).format(r)}static filter(r,e){return r.filter(e)}static orderby(r,e){return r.sort((t,n)=>(a.isNullOrEmpty(e)||(t=t[e],n=n[e]),t>n?1:t<n?-1:0))}static isMatch(r,e,t){return new RegExp(e,t).test(r)}static isEmpty(r){return a.isEmpty(r)}static isNull(r){return a.isNull(r)}static isNullOrEmpty(r){return a.isNullOrEmpty(r)}static getCssVariable(r){return a.Css.getVariableValue(r)}static getQuerystring(r){return a.URIs.parseQuery()[r]}static importThemeWebFonts(){return A.Theme.importWebFonts()}static findHostContext(r){return A.findHostContext(r)}};c([Te()],ct,"highlight",1),c([Te()],ct,"diff",1),c([Te()],ct,"padleft",1),c([Te()],ct,"size",1),c([Te()],ct,"decToDeg",1),c([Te()],ct,"date",1),c([Te()],ct,"timespan",1),c([Te()],ct,"currency",1),c([Te()],ct,"number",1),c([Te()],ct,"filter",1),c([Te()],ct,"orderby",1),c([Te("regex.")],ct,"isMatch",1),c([Te()],ct,"isEmpty",1),c([Te()],ct,"isNull",1),c([Te()],ct,"isNullOrEmpty",1),c([Te("cssvar")],ct,"getCssVariable",1),c([Te("querystring")],ct,"getQuerystring",1),c([Te()],ct,"importThemeWebFonts",1),c([Te("host")],ct,"findHostContext",1);var Bt={};Le(Bt,{AnimationEndEvent:()=>Yp,AnimationEvent:()=>jp,AnimationStartEvent:()=>Xp,Easings:()=>Ur,Timer:()=>sf,TweenService:()=>Fi});var th=Math.PI*.5,yo={linear:o=>o,sineIn:o=>Math.sin(o*th-th)+1,sineOut:o=>Math.sin(o*th),sineInOut:o=>.5*Math.sin(o*Math.PI-th)+.5,expoIn:o=>(Math.pow(Math.E,o)-1)/(Math.E-1),expoOut:o=>Math.log(o*(Math.E-1)+1),expoInOut:o=>o<.5?.5*Ur.expoIn(o*2):.5*(1+Ur.expoOut(o*2-1))};function _o(o,r){let e=t=>o(t);return e.css=r,e}var Ur={linear:_o(yo.linear,"linear"),sineIn:_o(yo.sineIn,"cubic-bezier(0.12, 0, 0.39, 0)"),sineOut:_o(yo.sineOut,"cubic-bezier(0.61, 1, 0.88, 1)"),sineInOut:_o(yo.sineInOut,"cubic-bezier(0.37, 0, 0.63, 1)"),expoIn:_o(yo.expoIn,"cubic-bezier(0.7, 0, 0.84, 0)"),expoOut:_o(yo.expoOut,"cubic-bezier(0.16, 1, 0.3, 1)"),expoInOut:_o(yo.expoInOut,"cubic-bezier(0.87, 0, 0.13, 1)")};var jp=class extends oe{constructor(r){super("step",r)}},Yp=class extends CustomEvent{constructor(){super("end")}},Xp=class extends CustomEvent{constructor(){super("start")}};var Fi=class{run(r,e,t,n=0,i=Ur.linear,s=null){return new Promise((l,p)=>{let f=(performance&&performance.now()||Date.now())+Math.abs(n||0),g=f+Math.abs(t||0),v=()=>{let y=performance&&performance.now()||Date.now();if(y>=f&&y<g){let _=(y-f)/t,x=r+(i||Ur.linear)(_)*(e-r);s&&s(_,x)}y<g?requestAnimationFrame(v):(s&&s(1,e),l())};v()})}};var sf=class o{constructor(r,e){this.#n=0;this._run=r=>{this.#r=requestAnimationFrame(this._run);let e=performance.now(),t=this.#e,n=e-this.#n;n>=t&&(this.#n=e-n%t,this.#t(r))};this.#e=1e3/e,this.#t=r,this.#r=requestAnimationFrame(this._run)}#e;#t;#r;#n;static run(r,e=60){return new o(r,e)}stop(){cancelAnimationFrame(this.#r)}};var pt={};Le(pt,{FetchErrorEventName:()=>Qm,FetchResultEventName:()=>Zm,FetchSuccessEventName:()=>ef,Fetcher:()=>Vp,Http:()=>zp,HttpMethod:()=>Zu,Response:()=>Qu,StatusCodeError:()=>Up});var J={};Le(J,{DragDataMode:()=>af,DragDropEvent:()=>vn,DragDropEventArgsClass:()=>Yn,DragDropEventType:()=>cf,DragDropInitEventArgsClass:()=>qp,DropBehavior:()=>of,DropTargetMissedBehavior:()=>lf,RescaleEvent:()=>Co,RescaleEventArgsClass:()=>xo,RescaleEventType:()=>df,RescaleHandle:()=>pf,RotateEvent:()=>wo,RotateEventArgsClass:()=>Eo,RotateEventType:()=>uf,SwipeEvent:()=>Wi,SwipeEventArgsClass:()=>Kp,SwipeEventType:()=>hf});var af=(t=>(t.Self="self",t.Alias="alias",t.Copy="copy",t))(af||{}),of=(e=>(e.InsertChild="insert",e.None="none",e))(of||{}),lf=(t=>(t.Revert="revert",t.Remove="remove",t.None="none",t))(lf||{}),cf=(l=>(l.Init="draginit",l.Start="dragstart",l.Drag="drag",l.Drop="drop",l.Over="dragover",l.Out="dragout",l.End="dragend",l))(cf||{}),rh=class{constructor(r){this._builder=r;this.currentPosition=r.currentPosition,this.target=r.target}get element(){return this._builder.element}get origin(){return this._builder.origin}get initialDelta(){return this._builder.initialDelta}get startTime(){return this._builder.startTime}get floater(){return this._builder.floater}get delta(){var r=this;return se.add(r.initialDelta,se.subtract(r.origin,r.currentPosition))}},qp=class o extends rh{constructor(r){super(r),this.placeholder=r.placeholder,this.data=r.data}static fromArgs(r){return new o(a.extend({},r))}},Yn=class o extends rh{constructor(e,t=e.placeholder,n=e.data){super(e);this._placeholder=t;this._data=n}get placeholder(){return this._placeholder}get data(){return this._data}static fromArgs(e){return new o(a.extend({},e))}},vn=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var pf=(i=>(i.All="all",i.Top="top",i.Left="left",i.Right="right",i.Bottom="bottom",i))(pf||{}),df=(t=>(t.Start="rescalestart",t.Rescale="rescale",t.End="rescaleend",t))(df||{}),xo=class o{constructor(r){this._builder=r}get currentPosition(){return this._builder.currentPosition}get targetRect(){return this._builder.targetRect}get element(){return this._builder.element}get handle(){return this._builder.handle}static fromArgs(r){return new o(a.extend({},r))}},Co=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var uf=(t=>(t.Start="rotatestart",t.Rotate="rotate",t.End="rotateend",t))(uf||{}),Eo=class o{constructor(r){this._builder=r}get currentPosition(){return this._builder.currentPosition}get rotation(){return this._builder.rotation}get element(){return this._builder.element}get center(){return this._builder.center}static fromArgs(r){return new o(a.extend({},r))}},wo=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var hf=(g=>(g.Swipe="swipe",g.Pan="pan",g.SwipeLeft="swipeleft",g.SwipeRight="swiperight",g.SwipeUp="swipeup",g.SwipeDown="swipedown",g.SwipeAnimationEnd="swipeanimationend",g.SwipeLeftAnimationEnd="swipeleftanimationend",g.SwipeRightAnimationEnd="swiperightanimationend",g.SwipeUpAnimationEnd="swipeupanimationend",g.SwipeDownAnimationEnd="swipedownanimationend",g))(hf||{}),Kp=class o{constructor(r){this._builder=r}get#e(){let{verticalspeed:r,horizontalspeed:e,vertical:t}=this._builder;return t??Math.abs(e)<Math.abs(r)}get direction(){return this.#e?this._builder.verticalspeed>0?"down":"up":this._builder.horizontalspeed>0?"right":"left"}get speed(){let{verticalspeed:r,horizontalspeed:e}=this._builder;return this.#e?r:e}get delta(){let{position:{x:r,y:e},t0:{position:{x:t,y:n}}}=this._builder;return this.#e?e-n:r-t}get flinging(){let{fling:r}=this._builder;return r>0&&Math.abs(this.speed)>r}get predictedDelta(){let r=this._builder.inertia??8;return this.delta+this.speed/r}get predictedDuration(){let r=this._builder.inertia??8;return-Math.log(.01)/r}get element(){return this._builder.element}static fromArgs(r){return new o(a.extend({},r))}},Wi=class extends oe{constructor(r,e,t){super(r,e,t)}};var nh={};Le(nh,{PacemBehavior:()=>bn});var bn=class extends K{#e=new WeakSet;register(r){var e=this.#e;e.has(r)||(e.add(r),this.decorate(r))}unregister(r){var e=this.#e;e.has(r)&&(this.undecorate(r),e.delete(r))}has(r){return this.#e.has(r)}};var ce={};Le(ce,{LogLevel:()=>qt});var Ab={};Le(Ab,{DragEvent:()=>pc,DrawableEvent:()=>Cn,PresentationState:()=>hd,Shape:()=>Ki,StageEvent:()=>md,UI2DEvent:()=>cc,isDrawable:()=>dc,isGroup:()=>Bo,isImage:()=>fc,isLinearGradient:()=>fd,isPresentationObject:()=>gd,isRadialGradient:()=>uc,isShape:()=>hc,isText:()=>mc,isUiObject:()=>Cr});var R={};Le(R,{AnimationElement:()=>lr,CustomItemCommandEvent:()=>sd,DockMode:()=>yf,ItemCommandEvent:()=>id,ItemRegisterEvent:()=>td,ItemRegisterEventName:()=>xf,ItemUnregisterEvent:()=>rd,ItemUnregisterEventName:()=>Cf,KeyboardShortcutExecuteEventName:()=>Mf,PacemAdapter:()=>sh,PacemAnnihilatorElement:()=>tc,PacemBeforeunloadElement:()=>ia,PacemBodyProxyElement:()=>nc,PacemBroadcastChannelProxyElement:()=>Xn,PacemBrowserDetectElement:()=>Mo,PacemColorAnimationElement:()=>da,PacemContentElement:()=>ko,PacemCrossItemsContainerElement:()=>ac,PacemDataElement:()=>qn,PacemDockElement:()=>yn,PacemDragDropElement:()=>xr,PacemElement:()=>mt,PacemElementProxyElement:()=>So,PacemEventProxyElement:()=>ji,PacemFetchElement:()=>dt,PacemHistoryElement:()=>Kn,PacemHtmlProxyElement:()=>aa,PacemIfElement:()=>No,PacemItemElement:()=>Yi,PacemItemsContainerElement:()=>_n,PacemIterableElement:()=>oh,PacemIterativeElement:()=>To,PacemLayoutProxyElement:()=>oa,PacemMetaProxyElement:()=>Zn,PacemNumberAnimationElement:()=>ua,PacemOnlineStatusElement:()=>Ao,PacemPanelElement:()=>oc,PacemPointAnimationElement:()=>ha,PacemRepeaterElement:()=>zr,PacemRescaleElement:()=>Gr,PacemResizeElement:()=>la,PacemRotateElement:()=>ri,PacemRouterElement:()=>Qn,PacemSafeContentElement:()=>na,PacemScrollAwareElement:()=>ca,PacemServiceWorkerProxyElement:()=>ei,PacemShellProxyElement:()=>ic,PacemShortcutElement:()=>pa,PacemSpanElement:()=>Po,PacemStoryboardElement:()=>si,PacemStyleProxyElement:()=>Xi,PacemSwipeElement:()=>ni,PacemTemplateProxyElement:()=>xn,PacemTextElement:()=>Io,PacemTimerElement:()=>$o,PacemTitleProxyElement:()=>Ho,PacemTransferProxyElement:()=>Lo,PacemTweenElement:()=>_r,PacemUnsafeContentElement:()=>ih,PacemViewportAwareElement:()=>qi,PacemWebWorkerProxyElement:()=>ti,RepeaterItem:()=>Do,RepeaterItemCreateEvent:()=>Ql,RepeaterItemCreateEventName:()=>vf,RepeaterItemEvent:()=>Zl,RepeaterItemRemoveEvent:()=>ec,RepeaterItemRemoveEventName:()=>bf,ResizeEvent:()=>ad,ResizeEventName:()=>Ef,ScrollEvent:()=>od,ScrollEventName:()=>kf,StateEvent:()=>ed,TweenAnimationElement:()=>ii,isItemsContainer:()=>mb});var vf="repeateritemcreate",bf="repeateritemremove",Zl=class extends oe{constructor(r,e){super(r,e)}},Ql=class extends Zl{constructor(r){super(vf,r)}},ec=class extends Zl{constructor(r){super(bf,r)}},mf=["keydown","keyup","click","focus","blur","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","pointerdown","mouseup","pointerup","mousemove","contextmenu","wheel"],ff=class{constructor(r,e){this._element=r;this._aria=a.extend({},e||{})}toObject(){return a.extend({},this._aria)}set(r,e){this._aria[r]=e;let t=this._element;t.isConnected&&t.setAttribute("aria-"+r,e)}remove(r){delete this._aria[r];let e=this._element;e.isConnected&&e.removeAttribute("aria-"+r)}},gf=class{constructor(r,e,t){this._element=r;this._aria={role:e,attrs:new ff(r,t)}}get role(){return this._aria.role}set role(r){this._aria.role=r;let e=this._element;e.isConnected&&(a.isNullOrEmpty(r)?e.removeAttribute("role"):e.setAttribute("role",r))}get attributes(){return this._aria.attrs}},mt=class extends K{constructor(e,t){super();this.#t=[];this.#r=[];this._tabIndex=-1;this.behaviors=[];this._aria=new gf(this,e,t)}get aria(){return this._aria}static#e=null;static get emittedEventTypes(){return this.#e??=a.readonlyCopy(mf)}#t;#r;connectedCallback(){super.connectedCallback(),a.isNullOrEmpty(this._aria.role)||this.setAttribute("role",this._aria.role);let e=this._aria.attributes.toObject();if(!a.isNullOrEmpty(e))for(let t in e)this.setAttribute("aria-"+t,e[t])}viewActivatedCallback(){super.viewActivatedCallback(),mf.forEach(t=>{this.addEventListener(t,this.emitHandler,!1)});for(var e of this.behaviors||[])e.register(this)}disconnectedCallback(){for(var e of this.behaviors||[])e.unregister(this);mf.forEach(t=>{this.removeEventListener(t,this.emitHandler,!1)}),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"css":for(var s in this.css)this.style.setProperty(s,this.css[s]);break;case"cssClass":if(a.isArray(this.cssClass)){let g=this.cssClass;for(let v of this.#t.splice(0))a.removeClass(this,v);for(let v of g)this.#t.push(v),a.addClass(this,v)}else for(let g in this.cssClass)a.toggleClass(this,g,this.cssClass[g]);break;case"cssPart":let l=this.cssPart,p=this.#r;if(a.isArray(l)){let g=l;for(let v of p.splice(0))a.removePart(this,v);for(let v of g)p.push(v),a.addPart(this,v)}else for(let g in l)a.togglePart(this,g,l[g]);break;case"hide":let u=b+"-hiding";if(n){let g=this,v=b+"-anim",y=()=>{g.setAttribute("hidden",""),g.aria.attributes.set("hidden","true")};a.hasClass(g,v)&&!a.isNull(t)?(a.removeClass(g,v),requestAnimationFrame(()=>{a.addClass(g,u),a.addClass(g,v),a.waitForAnimationEnd(g,250).then(_=>{g.hide&&y(),a.removeClass(g,u)})})):y()}else a.removeClass(this,u),this.removeAttribute("hidden"),this.aria.attributes.remove("hidden");break;case"tooltip":this.title=n,a.isNullOrEmpty(n)?this.aria.attributes.remove("label"):this.aria.attributes.set("label",n);break;case"tabOrder":this._tabIndex=n,this.disabled||(this.tabIndex=n);break;case"behaviors":if(!a.isNullOrEmpty(t))for(let g of t)g.unregister(this);if(!a.isNullOrEmpty(n)&&!i)for(let g of n)g.register(this);break;case"disabled":let f=b+"-"+e;n?(this._tabIndex=this.tabIndex,this.tabIndex=-1,a.addClass(this,f)):(this.tabIndex=this._tabIndex,a.removeClass(this,f));break;case"culture":a.isNullOrEmpty(n)?this.removeAttribute("lang"):this.setAttribute("lang",n),i||this.refreshBindings();break}}};c([h({emit:!1,converter:m.Json})],mt.prototype,"cssClass",2),c([h({emit:!1,converter:m.Json})],mt.prototype,"cssPart",2),c([h({emit:!1,converter:m.Json})],mt.prototype,"css",2),c([h({emit:!1,converter:m.Boolean})],mt.prototype,"hide",2),c([h({emit:!1,converter:m.String})],mt.prototype,"tooltip",2),c([h({emit:!1,converter:m.Number})],mt.prototype,"tabOrder",2),c([h({converter:m.String})],mt.prototype,"culture",2),c([h({emit:!1})],mt.prototype,"behaviors",2);var ko=class extends mt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="content"&&!n&&this._fillContent(t)}_isContentNullOrEmpty(r=this.content){return a.isNullOrEmpty(r)||r instanceof DocumentFragment&&r.childElementCount===0}viewActivatedCallback(){super.viewActivatedCallback(),this._original=Array.from(this.children),this._isContentNullOrEmpty()||this._fillContent()}disconnectedCallback(){a.isNullOrEmpty(this._original)||(this.innerHTML="",Element.prototype.append.apply(this,this._original)),super.disconnectedCallback()}_fillContent(r=this.content){let e=this.sanitize(r);a.isNullOrEmpty(e)?this.innerHTML="":e instanceof Node?(this.innerHTML="",this.append(e)):this.innerHTML=e}};c([h({emit:!1,converter:m.String})],ko.prototype,"content",2);var ih=class extends ko{sanitize(r){return r}},na=class extends ko{_sanitizeLegacy(r){if(a.isNullOrEmpty(r))return r;if(r instanceof Node){for(let e=r.childNodes.length-1;e>=0;e--){let t=r.childNodes.item(e);t instanceof HTMLScriptElement?t.remove():this.sanitize(t)}return r}else{let e=/<script.+<\/script>/g;return(r||"").toString().replace(e,"")}}sanitize(r){return this._sanitizeLegacy(r)}};var sh=class extends mt{constructor(){super(...arguments);this._propertyChangeHandler=e=>{this.masterPropertyChangedCallback(e.detail.propertyName,e.detail.oldValue,e.detail.currentValue,e.detail.firstChange)}}get master(){return this._element}get initialized(){return!a.isNull(this._element)}masterPropertyChangedCallback(e,t,n,i){switch(e){case"items":this._adjustFocusIndex();break;case"index":this._element.dispatchEvent(new Ju({currentIndex:n,previousIndex:t}));break}}itemPropertyChangedCallback(e,t,n,i,s){}initializeCallback(){}destroyCallback(){}initialize(e){this._element!=null&&this.destroy(),e!=null&&(this._element=e,this._element.addEventListener(ee,this._propertyChangeHandler,!1)),this.initializeCallback()}destroy(){this._element!=null&&this._element.removeEventListener(ee,this._propertyChangeHandler,!1),this.destroyCallback()}disconnectedCallback(){this.destroy(),super.disconnectedCallback()}_adjustFocusIndex(){let e=this._element.items,t=this._element.index,n=e&&e.length,i=n?Math.max(0,Math.min(n-1,t)):-1,s=this._getAvailable(i);this._element.index=s}_getNextAvailable(e){return this._getAvailable(e,1)}_getPreviousAvailable(e){return this._getAvailable(Math.max(0,e),-1)}_getAvailable(e=this._element&&this._element.index,t=0){let n=this._element.items,i;if(!(n&&(i=n.length)>0))return-1;e=e%i;let s=(e+t+i)%i,l;for(t=t||-1;(l=n[s])instanceof K&&l.disabled===!0||l instanceof mt&&l.hide===!0;)if(s=(s+t+i)%i,s==e)return-1;return s}isClose(e){let t=this._getAvailable();return e===t||e===this._getPreviousAvailable(t)||e===this._getNextAvailable(t)}isPrevious(e){let t=this._getAvailable();return e===this._getPreviousAvailable(t)}isNext(e){let t=this._getAvailable();return e===this._getNextAvailable(t)}select(e){this._element.index=this._getAvailable(e)}previous(e=!0){var t=this._getPreviousAvailable(this._element.index);t>=0&&(e||this._element.index>t)&&(this._element.index=t)}next(e=!0){var t=this._getNextAvailable(this._element.index);t>=0&&(e||this._element.index<t)&&(this._element.index=t)}};var tc=class extends HTMLElement{constructor(){super()}connectedCallback(){this.remove()}};tc=c([C({tagName:d+"-annihilator"})],tc);var ia=class extends K{constructor(){super(...arguments);this._unloadingHandler=e=>{let t=this.message;!this.active||this.disabled||(e.type==="beforeunload"?(e.preventDefault(),e.returnValue=t||""):confirm(t||"Leave page?")||e.preventDefault())}}viewActivatedCallback(){super.viewActivatedCallback(),window.addEventListener("navigating",this._unloadingHandler,!1),window.addEventListener("beforeunload",this._unloadingHandler,!1)}disconnectedCallback(){window.removeEventListener("navigating",this._unloadingHandler,!1),window.removeEventListener("beforeunload",this._unloadingHandler,!1),super.disconnectedCallback()}};c([h({emit:!1,converter:m.String})],ia.prototype,"message",2),c([h({emit:!1,converter:m.Boolean})],ia.prototype,"active",2),ia=c([C({tagName:d+"-beforeunload"})],ia);var rc,Xn=class extends K{constructor(){super(...arguments);this.autosend=!0;this._messageHandler=e=>{this.result=e.data,this.dispatchEvent(new CustomEvent("receive",{detail:e.data,bubbles:!1,cancelable:!1}))};this._errorHandler=e=>{this.dispatchEvent(new CustomEvent("error",{detail:e.data,bubbles:!1,cancelable:!1}))};z(this,rc)}viewActivatedCallback(){super.viewActivatedCallback(),this._initializeChannel()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":this._disposeChannel(),this._initializeChannel(n);break;case"autosend":case"disabled":case"message":this.autosend&&this.send(this.message);break}}disconnectedCallback(){this._disposeChannel(),super.disconnectedCallback()}send(e=this.message){if(this.disabled)return;let t=M(this,rc);a.isNull(t)||t.postMessage(e)}_initializeChannel(e=this.channelName){if(!a.isNullOrEmpty(e)){let t=H(this,rc,new BroadcastChannel(e));t.addEventListener("message",this._messageHandler,!1),t.addEventListener("messageerror",this._errorHandler,!1),this.autosend&&!a.isNull(this.message)&&this.send()}}_disposeChannel(e=M(this,rc)){a.isNull(e)||(e.removeEventListener("messageerror",this._errorHandler,!1),e.removeEventListener("message",this._messageHandler,!1),e.close())}};rc=new WeakMap,c([h({emit:!1,converter:m.String})],Xn.prototype,"message",2),c([h({converter:m.String})],Xn.prototype,"result",2),c([h({emit:!1,converter:m.String})],Xn.prototype,"channelName",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Xn.prototype,"autosend",2),Xn=c([C({tagName:d+"-broadcastchannel-proxy"})],Xn);var Jp,Zp,Mo=class extends K{constructor(){super(...arguments);z(this,Jp);z(this,Zp)}viewActivatedCallback(){super.viewActivatedCallback(),this._detect()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="userAgent"&&this._detect(n)}get browser(){return M(this,Jp)}get version(){return M(this,Zp)}_detect(e=this.userAgent){let{version:t,name:n}=Bu(e),{browser:i,version:s}=this;n!=i&&(H(this,Jp,n),this.dispatchEvent(new ue({propertyName:"browser",currentValue:n,oldValue:i}))),t!=s&&(H(this,Zp,t),this.dispatchEvent(new ue({propertyName:"version",currentValue:t,oldValue:s})))}};Jp=new WeakMap,Zp=new WeakMap,c([h({emit:!1,converter:m.String})],Mo.prototype,"userAgent",2),Mo=c([C({tagName:d+"-browser-detect"})],Mo);var qn=class extends K{constructor(e=new eh){super();this.storage=e;this._handle=0;this._flag=!1}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"persistAs":a.isNullOrEmpty(t)||this.storage.removeProperty(t),i===!0&&!a.isNullOrEmpty(n)&&(this.model=this.storage.getPropertyValue(n)??this.model);break;case"model":let s=this.debounce,l=this.throttle,p=()=>{this.dispatchEvent(new ue({propertyName:e,oldValue:t,currentValue:n,firstChange:i}))};if(s>0&&!i)if(l){if(this._flag)return;this._flag=!0,p(),this._handle=window.setTimeout(()=>{this._flag=!1},s)}else clearTimeout(this._handle),this._handle=window.setTimeout(p,s);else p();!i&&!a.isNullOrEmpty(this.persistAs)&&(a.isNull(n)?this.storage.removeProperty(this.persistAs):this.storage.setPropertyValue(this.persistAs,n,!0));break}}};c([h({emit:!1,converter:m.Eval})],qn.prototype,"model",2),c([h({emit:!1,converter:m.String})],qn.prototype,"persistAs",2),c([h({emit:!1,converter:m.Number})],qn.prototype,"debounce",2),c([h({emit:!1,converter:m.BooleanStrict})],qn.prototype,"throttle",2),qn=c([C({tagName:d+"-data"})],qn);var yf=(e=>(e.Top="top",e.Bottom="bottom",e))(yf||{}),yn=class extends K{constructor(e=new Fi){super();this._tweener=e;this.mode="top";this.transitionDuration=300}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="dock"&&(!a.isNull(t)||n!=!1)?this._doDock():e==="mode"&&this.dock===!0&&this._doDock()}_animate(e,t){var n=this.transitionDuration;return n>0||(n=300),this._tweener.run(e,t,n,this.delay,Ur.sineInOut,(i,s)=>{this._setOffset(s)}).then(()=>{this._resetOffset()})}_setOffset(e){this.style.transform="translateY("+e+"px)"}_resetOffset(){this.style.transform=""}_compute(){let e=a.offset(this),t=getComputedStyle(this),n=a.scrollTop;switch(this.mode){case"bottom":let i=parseInt(t.marginBottom),s=e.top;return{delta:a.windowSize.height-(s-n+this.offsetHeight)+i};case"top":let p=parseInt(t.marginTop);return{delta:-(e.top-n+p)}}}_doDock(){if(this.dock){let t=this._compute();if(a.isNull(t))return;switch(a.addClass(this,b+"-dock"),this.mode){case"bottom":a.removeClass(this,b+"-dock-top"),a.addClass(this,b+"-dock-bottom");break;case"top":a.removeClass(this,b+"-dock-bottom"),a.addClass(this,b+"-dock-top");break}let n=-t.delta,i=0,s=A.getAttachedPropertyValue(this,"pacem-dock:state")||0;A.setAttachedPropertyValue(this,"pacem-dock:state",-n+s),this.log("info",`animating from ${n}px to ${i}px`),this._animate(n,i)}else{let t=A.getAttachedPropertyValue(this,"pacem-dock:state");A.deleteAttachedPropertyValue(this,"pacem-dock:state");let n=0;this.log("info",`animating back from ${t}px to ${n}px`),a.removeClass(this,`${b}-dock ${b}-dock-top ${b}-dock-bottom`),this._animate(t,n)}}};c([h({emit:!1,converter:m.String})],yn.prototype,"mode",2),c([h({converter:m.Boolean})],yn.prototype,"dock",2),c([h({emit:!1,converter:m.Element})],yn.prototype,"target",2),c([h({emit:!1,converter:m.Number})],yn.prototype,"delay",2),c([h({emit:!1,converter:m.Number})],yn.prototype,"transitionDuration",2),yn=c([C({tagName:d+"-dock"})],yn);var Lo=class extends K{constructor(){super(...arguments);this._dom=[];this._children=[]}get dom(){return this._children}viewActivatedCallback(){super.viewActivatedCallback(),this.moveContent(this.proxy)}moveContent(e){a.isNull(e)||(a.isNullOrEmpty(this._dom)?(this._dom=a.moveItems(this.childNodes,e),this._children=this._dom.filter(t=>t instanceof Element)):a.moveItems(this._children,e))}disconnectedCallback(){for(let e of(this._dom||[]).splice(0))e.remove();super.disconnectedCallback()}},nc=class extends Lo{get proxy(){return document.body}};nc=c([C({tagName:d+"-body-proxy"})],nc);var ic=class extends Lo{get proxy(){return A.findAncestorShell(this)}};ic=c([C({tagName:d+"-shell-proxy"})],ic);var So=class extends Lo{get proxy(){return this.target}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="target"&&!n&&this.moveContent(this.proxy)}};c([h({converter:m.Element})],So.prototype,"target",2),So=c([C({tagName:d+"-element-proxy"})],So);var _f=class extends Event{constructor(e){super("emit");this._originalEvent=e}get originalEvent(){return this._originalEvent}},wC={convert:function(o,r){return o==="$window"?window:m.Element.convert(o,r)},convertBack:(o,r)=>o===window?"$window":m.Element.convertBack(o,r)},ji=class extends K{constructor(){super(...arguments);this._emitHandler=e=>{var t=new _f(e);this.dispatchEvent(t)}}viewActivatedCallback(){super.viewActivatedCallback(),this._observe()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"target":this._unobserve(t,this.event,this.capture),this._observe();break;case"event":this._unobserve(this.target,t,this.capture),this._observe();break;case"capture":this._unobserve(this.target,this.event,t),this._observe();break}}disconnectedCallback(){this._unobserve(),super.disconnectedCallback()}_unobserve(e=this.target,t=this.event,n=this.capture){a.isNull(e)||a.isNullOrEmpty(t)||e.removeEventListener(t,this._emitHandler,{capture:n})}_observe(e=this.target,t=this.event,n=this.capture){a.isNull(e)||a.isNullOrEmpty(t)||e.addEventListener(t,this._emitHandler,{capture:n})}};c([h({emit:!1,converter:wC})],ji.prototype,"target",2),c([h({emit:!1,converter:m.String})],ji.prototype,"event",2),c([h({emit:!1,converter:m.Boolean})],ji.prototype,"capture",2),ji=c([C({tagName:d+"-event-proxy"})],ji);var hb="New incoming request overrides the ongoing one. Aborting.",sa,Qp,dt=class extends K{constructor(){super(...arguments);this.autofetch=!0;this.debounce=100;z(this,sa);z(this,Qp)}viewActivatedCallback(){super.viewActivatedCallback(),this._delayAndConditionallyFetch()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"url":case"method":case"type":case"as":case"mode":case"credentials":case"disabled":case"autofetch":this._delayAndConditionallyFetch();break;case"parameters":case"headers":(!this.diffByValues||a.jsonSortStringify(t)!=a.jsonSortStringify(n))&&this._delayAndConditionallyFetch();break}}_delayAndConditionallyFetch(){clearTimeout(this._handle),this.disabled?this._abortPending():this.autofetch&&(this._handle=setTimeout(()=>{this.fetch()},this.debounce||0))}_abortPending(){M(this,sa)&&(M(this,sa).abort(hb),H(this,sa,null))}fetch(){return this.throttle&&this.fetching?M(this,Qp):H(this,Qp,new Promise((e,t)=>{var n=this.url;if(!this.isReady||a.isNullOrEmpty(n)||this.disabled){e(null);return}let i=this;i.fetching=!0;let s=i.type||"json",l="application/json";s==="raw"&&(l="application/x-www-form-urlencoded");let p=(i.method||"GET").toUpperCase(),u={headers:a.extend({"Content-Type":l},i.headers),method:p,mode:i.mode||"cors",credentials:i.credentials||"same-origin",cache:i.cache||"default"},f=a.clone(i.parameters??{});if(n=a.URIs.format(n,f,p=="GET"),!a.isNullOrEmpty(f))switch(p){case"GET":n=a.URIs.appendQuery(n,f);break;case"PUT":case"POST":case"PATCH":switch(i.type){case"raw":let v=new URLSearchParams;for(let y in f)v.set(y,f[y]);u.body=v;break;default:u.body=a.Json.stringify(f);break}break}if(a.URIs.hasMandatoryTemplateSegments(n)){e(null);return}this._abortPending();let{signal:g}=H(this,sa,new AbortController);u.signal=g,fetch(n,u).then(v=>{if(H(this,sa,null),i.fetching=!1,v.ok)if(this.dispatchEvent(new CustomEvent(ef,{detail:v})),Vp.isEmpty(v)){switch(i.as){case"blob":case"image":i.result=null;break;case"text":i.result=null;break;default:i.result=null;break}e(v)}else switch(i.as){case"blob":case"image":v.blob().then(_=>{i.as==="image"?a.blobToDataURL(_).then(x=>{i._acceptFetchResult(x)}):i._acceptFetchResult(_),e(v)},_=>{this.log("warn",`Couldn't parse a ${i.as}. ${_}`),e(null)});break;case"text":v.text().then(_=>{i._acceptFetchResult(_),e(v)});break;default:v.json().then(_=>{i._acceptFetchResult(_),e(v)},_=>{this.log("warn",`Couldn't parse a ${i.as}. ${_}`),e(null)});break}else this.dispatchEvent(new CustomEvent(Qm,{detail:v})),t(v)},v=>{typeof v=="string"&&v===hb?(this.log("info",v),e(null)):t(v)})}))}_acceptFetchResult(e){this.dispatchEvent(new CustomEvent(Zm,{detail:e})),this.result=e}};sa=new WeakMap,Qp=new WeakMap,c([h({emit:!1,reflectBack:!0,converter:m.String})],dt.prototype,"url",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],dt.prototype,"method",2),c([h({emit:!1,converter:m.Json})],dt.prototype,"parameters",2),c([h({emit:!1,converter:m.Json})],dt.prototype,"headers",2),c([h({emit:!1,converter:m.String})],dt.prototype,"credentials",2),c([h({emit:!1,converter:m.String})],dt.prototype,"mode",2),c([h({emit:!1,converter:m.String})],dt.prototype,"cache",2),c([h({converter:m.BooleanStrict})],dt.prototype,"fetching",2),c([h({reflectBack:!0,converter:m.Boolean})],dt.prototype,"autofetch",2),c([h({emit:!1,converter:m.String})],dt.prototype,"as",2),c([h({emit:!1,converter:m.String})],dt.prototype,"type",2),c([h({reflectBack:!0,converter:m.Number})],dt.prototype,"debounce",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],dt.prototype,"throttle",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],dt.prototype,"diffByValues",2),c([h()],dt.prototype,"result",2),dt=c([C({tagName:d+"-fetch"})],dt);var ed=class extends CustomEvent{constructor(r,e){super(r,{detail:e})}},Jn,Kn=class extends K{constructor(){super(...arguments);z(this,Jn)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"state":this._handleStateChange(n);break;case"maxlength":let s=M(this,Jn);a.isNull(s)||(s.maxlength=n);break}}viewActivatedCallback(){super.viewActivatedCallback(),this._handleStateChange()}_handleStateChange(e=this.state){let t=M(this,Jn);a.isNull(t)?H(this,Jn,new Fl(e,this.maxlength)):bo(t.current,e)!==!0&&(t.push(e),this.log("log","Pushed state."),this._synchronize("push"))}redo(){let e=M(this,Jn);a.isNull(e)||(e.redo(),this.log("log","Redone state."),this._synchronize("redo"))}reset(){let e=M(this,Jn);a.isNull(e)||(e.reset(),this.log("log","Reset state."),this._synchronize("reset"))}undo(){let e=M(this,Jn);a.isNull(e)||(e.undo(),this.log("log","Undone state."),this._synchronize("undo"))}_synchronize(e){let t=M(this,Jn);this.canUndo=t.canUndo,this.canRedo=t.canRedo,this.state=t.current;let{canRedo:n,canUndo:i,current:s}=t;this.dispatchEvent(new ed(e,{canRedo:n,canUndo:i,state:s}))}};Jn=new WeakMap,c([h({emit:!0,converter:m.Json})],Kn.prototype,"state",2),c([h({emit:!1,converter:m.Number})],Kn.prototype,"maxlength",2),c([h({emit:!0,converter:m.Boolean})],Kn.prototype,"canUndo",2),c([h({emit:!0,converter:m.Boolean})],Kn.prototype,"canRedo",2),Kn=c([C({tagName:d+"-history"})],Kn);var aa=class extends K{constructor(){super(...arguments);this._html=document.documentElement}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="attr"&&t&&this._html.removeAttribute(t),this._update()}_update(){let e=this.attr;if(a.isNullOrEmpty(e)||this.disabled)return;let t=this.value,n=this._html;a.isNullOrEmpty(t)?n.removeAttribute(e):n.setAttribute(e,t)}};c([h({emit:!1,converter:m.String})],aa.prototype,"attr",2),c([h({emit:!1,converter:m.String})],aa.prototype,"value",2),aa=c([C({tagName:d+"-html-proxy"})],aa);var sc,No=class extends HTMLElement{constructor(){super(...arguments);z(this,sc)}propertyChangedCallback(e,t,n,i){a.isNullOrEmpty(M(this,sc))&&H(this,sc,this.innerHTML),n?this.innerHTML=M(this,sc):this.innerHTML=""}};sc=new WeakMap,c([h({emit:!1,converter:m.Boolean})],No.prototype,"match",2),No=c([C({tagName:d+"-if"})],No);var Yi=class extends mt{get container(){return this._container}findContainer(){return A.findAncestor(this,r=>r instanceof _n)}viewActivatedCallback(){super.viewActivatedCallback();let r=this._container=this.findContainer();a.isNull(r)||r.register(this)}disconnectedCallback(){a.isNull(this._container)||this._container.unregister(this),super.disconnectedCallback()}};function mb(o){return"items"in o&&(a.isNull(o.items)||a.isArray(o.items))&&typeof o.register=="function"&&typeof o.unregister=="function"}var xf="itemregister",Cf="itemunregister",td=class extends oe{constructor(r,e){super(xf,r,e)}},rd=class extends oe{constructor(r,e){super(Cf,r,e)}},ah=class{constructor(r){this._container=r;if(r==null||!(r instanceof _n||r instanceof ac))throw"Must provide a valid itemscontainer."}register(r){let e=this._container;var t=!1;return e.validate(r)?a.isNull(e.items)?(e.items=[r],t=!0):e.items.indexOf(r)===-1&&(e.items.push(r),t=!0):e.logger&&e.logger.log("debug",`${r&&r.localName} element couldn't be registered in a ${e.localName} element.`),t&&e.dispatchEvent(new td(r)),t}unregister(r){let e=this._container;if(!a.isNull(e.items)){let t=e.items.indexOf(r);if(t>=0){let n=e.items.splice(t,1);return e.dispatchEvent(new rd(n[0])),!0}}return!1}},ac=class extends Yi{constructor(r,e){super(r,e),this._registrar=new ah(this)}register(r){return this._registrar.register(r)}unregister(r){return this._registrar.unregister(r)}};c([h()],ac.prototype,"items",2);var _n=class extends mt{constructor(r,e){super(r,e),this._registrar=new ah(this)}register(r){return this._registrar.register(r)}unregister(r){return this._registrar.unregister(r)}};c([h()],_n.prototype,"items",2);var oh=class extends Yi{findContainer(){return A.findAncestor(this,r=>r instanceof To)}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.container,s=(i&&i.items||[]).indexOf(this);s>=0&&i&&i.adapter&&i.adapter.itemPropertyChangedCallback(s,r,e,t,n)}},To=class extends _n{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),this.adapter&&this.adapter.masterPropertyChangedCallback(r,e,t,n),r){case"adapter":a.isNull(e)||e.destroy(),a.isNull(t)||this.adapter.initialize(this);break;case"items":this.isReady&&this._checkIndex();break}}viewActivatedCallback(){super.viewActivatedCallback(),this._checkIndex()}_checkIndex(){let r=0;a.isNullOrEmpty(this.items)||this.index<this.items.length&&(r=this.index),this.index=r}disconnectedCallback(){a.isNull(this.adapter)||this.adapter.destroy(),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Element})],To.prototype,"adapter",2),c([h({converter:m.Number})],To.prototype,"index",2);var fb="false",kC="true",nd,oa=class extends K{constructor(){super(...arguments);z(this,nd)}connectedCallback(){super.connectedCallback(),H(this,nd,A.findAncestorShell(this))}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),this._update()}disconnectedCallback(){let e=this.attr;a.isNullOrEmpty(e)||this._update(e,fb,!1),super.disconnectedCallback()}_update(e=this.attr,t=this.value?.toString(),n=this.disabled){if(a.isNullOrEmpty(e)||n)return;let i=M(this,nd);a.isNull(i)||(a.isNullOrEmpty(t)||t===fb?i.removeAttribute(e):i.setAttribute(e,t===kC?"":t))}};nd=new WeakMap,c([h({emit:!1,converter:m.String})],oa.prototype,"attr",2),c([h({emit:!1,converter:m.String})],oa.prototype,"value",2),oa=c([C({tagName:d+"-layout-proxy"})],oa);var Zn=class extends K{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),this._update()}viewActivatedCallback(){super.viewActivatedCallback(),this._update()}_update(){let r=this.content,e=!a.isNullOrEmpty(this.name),t=e?this.name:this.itemprop;if(a.isNullOrEmpty(t)||this.disabled)return;let n=a.cssEscape(t),i=e?`meta[name='${n}']`:`meta[itemprop='${n}']`;var s=document.head.querySelector(i);if(a.isNull(s))s=document.createElement("meta"),document.head.appendChild(s);else if(a.isNullOrEmpty(r)){s.remove();return}s.setAttribute("content",r),s.setAttribute(e?"name":"itemprop",t),s.removeAttribute(e?"itemprop":"name")}};c([h({emit:!1,converter:m.String})],Zn.prototype,"name",2),c([h({emit:!1,converter:m.String})],Zn.prototype,"itemprop",2),c([h({emit:!1,converter:m.String})],Zn.prototype,"content",2),c([me(!0)],Zn.prototype,"_update",1),Zn=c([C({tagName:d+"-meta-proxy"})],Zn);var Ao=class extends K{constructor(){super(...arguments);this._onlineHandler=e=>{a.isNull(e)?this.online=navigator.onLine||!1:this.online=e.type==="online"}}connectedCallback(){super.connectedCallback(),window.addEventListener("online",this._onlineHandler,!1),window.addEventListener("offline",this._onlineHandler,!1)}viewActivatedCallback(){super.viewActivatedCallback(),this._onlineHandler()}disconnectedCallback(){window.removeEventListener("online",this._onlineHandler,!1),window.removeEventListener("offline",this._onlineHandler,!1),super.disconnectedCallback()}};c([h({converter:m.Boolean})],Ao.prototype,"online",2),Ao=c([C({tagName:d+"-online-status"})],Ao);var oc=class extends na{};oc=c([C({tagName:d+"-panel"})],oc);var xn=class extends Xl{propertyChangedCallback(r,e,t,n){r==="target"&&this.dispatchEvent(new Event("templatechange"))}addEventListener(r,e,t){super.addEventListener(r,e,t)}removeEventListener(r,e,t){super.removeEventListener(r,e,t)}};c([h({emit:!1,converter:m.Element})],xn.prototype,"target",2),xn=c([C({tagName:d+"-template-proxy"})],xn);var MC=A.getAttachedPropertyValue,zT=A.setAttachedPropertyValue,lh=class extends oe{constructor(e,t,n){super(e,t,{bubbles:!1,cancelable:!0});this._originalEvent=n}get srcEvent(){return this._originalEvent}},id=class extends lh{constructor(r){super("item"+Yt,r.detail,r)}},sd=class extends lh{constructor(r){super("item"+r.detail.commandName.toLowerCase(),r.detail.commandArgument,r)}},zr=class extends K{constructor(){super(...arguments);this._childItems=[];this._fragment=document.createDocumentFragment();this._setupItem=(e,t,n)=>{e.index=t,e.item=n};this._refreshItemTemplateHandler=e=>{let t=e.target;this._itemTemplate=t.target,this._databind()}}removeItem(e){this._removeItems(e,e)}_setItem(e,t,n){let i=this._childItems,s;t>=i.length?(s=new Do(this,this._itemTemplate,n,this._childTemplatePlaceholder),this._setupItem(s,t,e),i.push(s),s.append()):(s=i[t],this._setupItem(s,t,e),s.redrawEventually(this._itemTemplate,n)),this.dispatchEvent(new Ql(s))}_removeItems(e,t){let i=this._childItems.splice(e,t+1-e);for(var s=i.length-1;s>=0;s--){let l=i[s];this.dispatchEvent(new ec(l)),l.remove()}}databind(){this._databind()}_databind(e=this.datasource){if(!this.isConnected)return;let t=this._itemTemplate,n=this._childTemplatePlaceholder;if(t==null)throw`Missing template element in ${zr.name}.`;let i=this._childItems,s=0;try{for(var l of e||[])this._setItem(l,s,this._fragment),s++}catch(p){this.log("error",p)}s<i.length?this._removeItems(s,i.length-1):a.isNull(n&&n.parentNode)||n.parentNode.insertBefore(this._fragment,n)}_onCommand(e){this.dispatchEvent(new id(e)),this.dispatchEvent(new sd(e))}_buildupItemTemplate(){let e=A.findFirstDescendant(this,t=>t instanceof HTMLTemplateElement||t instanceof xn);return e instanceof xn?(e.addEventListener("templatechange",this._refreshItemTemplateHandler,!1),this._childTemplatePlaceholder=e,this._itemTemplate=e.target):this._itemTemplate=this._childTemplatePlaceholder=e}viewActivatedCallback(){super.viewActivatedCallback(),this.addEventListener(Yt,this._onCommand,!1),this._buildupItemTemplate()&&this._databind()}disconnectedCallback(){let e=this._childTemplatePlaceholder;!a.isNull(e)&&e instanceof xn&&e.removeEventListener("templatechange",this._refreshItemTemplateHandler,!1),this.removeEventListener(Yt,this._onCommand,!1),this.datasource=[],super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="datasource"&&(a.isNull(this._itemTemplate)||this._databind(n))}};c([h({emit:!1,converter:m.Eval})],zr.prototype,"datasource",2),zr=c([C({tagName:d+"-repeater"})],zr);var Do=class extends Gi{constructor(e,t,n,i){super(document.createComment("pacem-repeater-item"));this._repeater=e;this._template=t;this._fragment=n;this._holder=i;this._alterEgos=[];let s="_";function l(u,f){var g=this,v=s+u;if(f!==g[v]){var y=g[v];g[v]=f;var _=new ue({propertyName:u,oldValue:y,currentValue:f});g.dispatchEvent(_)}}let p=this.placeholder;Object.defineProperties(p,{item:{get:function(){return this[s+"item"]},set:function(u){l.apply(p,["item",u])},configurable:!0},index:{get:function(){let u=this[s+"index"];return a.isNull(u)?-1:u},set:function(u){l.apply(p,["index",u])},configurable:!0}})}append(){let e=this._template,t=this._fragment;this._alterEgos.push(t.appendChild(this.placeholder));let n=e.cloneNode(!0);var i;a.isNull(i=MC(this._repeater,ea))||A.assignHostContext(i,n);var s=n.content.childNodes;Array.prototype.push.apply(this._alterEgos,s),t.appendChild(n.content)}redrawEventually(e,t){if(e===this._template)return;this._fragment=t,this._template=e;let n=this._holder.parentElement,i=this._alterEgos;for(;i.length>0;)n.removeChild(i.pop());this.append()}get dom(){return this._alterEgos.filter(e=>!(e instanceof Comment||e instanceof Text))}get repeater(){return this._repeater}remove(){let e=this._holder.parentElement;for(var t of this._alterEgos)t.parentElement===e&&!a.isNull(e)&&e.removeChild(t)}get index(){return this.placeholder.index}set index(e){this.placeholder.index=e}get item(){return this.placeholder.item}set item(e){this.placeholder.item=e}};var Ef="resize",ad=class extends oe{constructor(r){super(Ef,r)}},gb={box:"border-box"},la=class extends K{constructor(){super(...arguments);this._checkSizeHandler=()=>{this._assignSizeDebounced()}}get _target(){return this.target||this}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":this._start();break;case"target":if(!a.isNull(this._observer)){var s=t||this;this._observer.unobserve(s)}case"watchPosition":var l=this.target||this;a.isNull(this._observer)||this._observer.observe(l,gb);break}}_start(){if(this.disabled){this._stop();return}this.watchPosition?this._startWatchIntensively():(this._observer=new ResizeObserver(e=>{var t=!1;for(let n of e)if(n.target===this._target&&n.contentRect){t=!0;break}t&&this._assignSizeDebounced()}),this._observer.observe(this._target,gb)),window.addEventListener("resize",this._checkSizeHandler,!1)}_stop(){window.cancelAnimationFrame(this._handle),window.removeEventListener("resize",this._checkSizeHandler,!1),a.isNull(this._observer)||(this._observer.disconnect(),this._observer=null)}_startWatchIntensively(){this._checkSize(),this._handle=window.requestAnimationFrame(()=>{this._startWatchIntensively()})}_assignSizeDebounced(){this._checkSize()}_checkSize(){this.log("log","Resize flow triggered.");let e=this._target,t=a.offset(e),n=t.height,i=t.width;(n!=this._previousHeight||i!=this._previousWidth||this.watchPosition&&(t.left!=this._previousLeft||t.top!=this._previousTop))&&(this._previousHeight=n,this._previousWidth=i,this._previousLeft=t.left,this._previousTop=t.top,this._dispatchResize())}get currentSize(){var e={height:this._previousHeight,width:this._previousWidth};return this.watchPosition&&(e.left=this._previousLeft,e.top=this._previousTop),e}_dispatchResize(){this.dispatchEvent(new ad(this.currentSize))}connectedCallback(){super.connectedCallback(),this._start()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Element})],la.prototype,"target",2),c([h({emit:!1,converter:m.Boolean})],la.prototype,"watchPosition",2),la=c([C({tagName:d+"-resize"})],la);var SC=/^([\w\.]:)?\/\/[^\/]+/,Ro,Oo,Qn=class extends K{constructor(){super(...arguments);z(this,Ro);z(this,Oo);this._onScroll=e=>{if(!(this.scrollRestoration??!0))return;let n=Math.floor(a.scrollTop);window.history.replaceState(a.extend({},window.history.state,{$scrollY:n}),document.title)};this._onPopState=e=>{if(!a.isNull(e.state)&&!M(this,Ro)){let t=e.state;this.path=t.$path}}}parseState(e={}){let t=this._stringifyMergedState(e),n=this._segmentateUrl(t);return this._parseState(n.path+n.query+n.hash,n.path,n.query,n.hash)}navigate(e,t){if(this.disabled||a.isNullOrEmpty(e))return;if(typeof e=="object"?e=this._stringifyMergedState(e):e=a.URIs.format(e,this.state),e!=this.path){this.path=e;return}let n=document.location;if(SC.test(e)&&!e.startsWith(n.protocol+"//"+n.host))throw`Only same-origin navigation is currently supported. "${e}" is not a valid path.`;if(!M(this,Ro)){let i=this.state&&this.state.$path||void 0,s=this._segmentateUrl(e),l=this._parseState(s.path+s.query+s.hash,s.path,s.query,s.hash),p=n.pathname+n.search+n.hash===s.path+s.query+s.hash,u=new qu(e);if(window.dispatchEvent(u),H(this,Ro,u.defaultPrevented)){p&&window.history.pushState(this.state,t,i),this.path=i;return}let f=p?a.extend({$scrollY:0},window.history.state,l):a.extend({$scrollY:0},l);this.state=f,window.history.scrollRestoration=this.scrollRestoration??!0?"manual":"auto",p?window.history.replaceState(f,document.title):window.history.pushState(f,t,e),a.isNullOrEmpty(t)||(document.title=t),window.dispatchEvent(new Xu({path:e,referrer:i,title:t}))}H(this,Ro,!1)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"template":H(this,Oo,null);break;case"path":this.navigate(n);break}}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState,!1),document.addEventListener("scroll",this._onScroll,!1)}viewActivatedCallback(){super.viewActivatedCallback();let e=this.path;a.isNullOrEmpty(e)||this.navigate(e)}disconnectedCallback(){document.removeEventListener("scroll",this._onScroll,!1),window.removeEventListener("popstate",this._onPopState,!1),super.disconnectedCallback()}_stringifyMergedState(e){let t=a.extend({},e),n=a.extend({},this.state,t),i=this.template,s=""+i;for(let u of this._parseTemplate(i)){let f=u.name,g=new RegExp("/{"+f+"\\??}"),v=n[f];delete t[f],s=s.replace(g,a.isNullOrEmpty(v)?"":"/"+v)}let l=a.extend({},this.state.$query);for(let u in t)l[u]=t[u];let{hash:p}=this._segmentateUrl(this.path);return a.URIs.appendQuery(s,l,!0)+p}_parseTemplate(e=this.template){return a.isNullOrEmpty(M(this,Oo))?H(this,Oo,a.URIs.parseRoute(e)):M(this,Oo)}_segmentateUrl(e){let t=a.URIs.split(e);return a.isNullOrEmpty(t.path)?null:t}_parseState(e,t,n,i){let s=this._parseTemplate();return a.URIs.parseState(s,e,t,n,i)}};Ro=new WeakMap,Oo=new WeakMap,c([h({emit:!1,converter:m.String})],Qn.prototype,"template",2),c([h({converter:m.Eval})],Qn.prototype,"state",2),c([h({emit:!1,converter:m.String})],Qn.prototype,"path",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Qn.prototype,"scrollRestoration",2),Qn=c([C({tagName:d+"-router"})],Qn);var kf="scroll",od=class extends oe{constructor(r){super(kf,r)}},wf=class{constructor(r){this.global=r;this.scrollers=[];this.scrollHandler=r=>{this._scroll(r)}}register(r){let e=this.scrollers;e.indexOf(r)===-1&&(e.push(r),e.length===1&&this.global.addEventListener("scroll",this.scrollHandler,!1),this._scroll())}unregister(r){var e;let t=this.scrollers;(e=t.indexOf(r))!==-1&&(t.splice(e,1),t.length===0&&this.global.removeEventListener("scroll",this.scrollHandler,!1))}_scroll(r){for(var e of this.scrollers){if(a.isNull(e.target)){let t=a.scrollTop,n=a.scrollLeft;e.offset={top:t,left:n}}else{let t=e.target.scrollTop,n=e.target.scrollLeft;e.offset={top:t,left:n}}e.dispatchEvent(new od(e.offset))}}},vb=new wf(window),ca=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),vb.register(this)}disconnectedCallback(){vb.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Element})],ca.prototype,"target",2),c([h({converter:m.Json})],ca.prototype,"offset",2),ca=c([C({tagName:d+"-scroll-aware"})],ca);function LC(o){let r="=".repeat((4-o.length%4)%4);o=(o+r).replace(/\-/g,"+").replace(/_/g,"/");let e=window.atob(o),t=new Uint8Array(e.length);for(var n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}var ei=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),this._tryRegister()}disconnectedCallback(){this._tryUnregister(),super.disconnectedCallback()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"pushSubscription":a.isNull(e)||this.dispatchEvent(new CustomEvent("unsubscribe",{detail:e})),a.isNull(t)||this.dispatchEvent(new CustomEvent("subscribe",{detail:t}));break;case"registration":a.isNull(e)||this.dispatchEvent(new CustomEvent("unregister",{detail:e})),a.isNull(t)||this.dispatchEvent(new CustomEvent("register",{detail:t}));break}}_tryUnregister(r=this.registration){return a.isNull(r)?Promise.resolve(!0):r.unregister()}_tryRegister(r=this.src){this._tryUnregister().then(e=>{!a.isNullOrEmpty(r)&&"serviceWorker"in navigator&&navigator.serviceWorker.register(r).then(t=>{this.registration=t,"PushManager"in window&&t.pushManager.getSubscription().then(n=>{this.pushSubscription=n})})})}unsubscribe(r=this.pushSubscription){return new Promise((e,t)=>{if(a.isNull(r))e(!1);else{let n=r===this.pushSubscription;r.unsubscribe().then(i=>{n&&(this.pushSubscription=null),e(i)})}})}subscribe(r=this.publicKey){return new Promise((e,t)=>{typeof r=="string"&&(r=LC(r));let n=this.registration?.pushManager;a.isNull(n)?e(null):n.subscribe({userVisibleOnly:!0,applicationServerKey:r}).then(i=>{Notification.permission==="denied"?e(this.pushSubscription=null):e(this.pushSubscription=i)})})}};c([h()],ei.prototype,"registration",2),c([h()],ei.prototype,"pushSubscription",2),c([h({emit:!1,converter:m.String})],ei.prototype,"src",2),c([h({emit:!1,converter:m.String})],ei.prototype,"publicKey",2),ei=c([C({tagName:d+"-serviceworker-proxy"})],ei);var bb="keydown";function NC(o,r,e=[]){if(a.isNullOrEmpty(r))return!1;let t=/(\w+)\s*\+/,n=[],i;for(;!a.isNullOrEmpty(i=t.exec(r));)r=r.substr(i.index+i[0].length),n.push(i[1]);if(!de.matchModifiers(o,n))return!1;let s=r.split(",").map(p=>p.trim().toLowerCase());if(a.isNullOrEmpty(s))return!1;var l=o.key.toLowerCase();return TC(l,s[e.length])?(e.push(l),e.length==s.length?!0:"ongoing"):!1}function TC(o,r){return o===r||o==="escape"&&r==="esc"||o==="backspace"&&r==="back"||o==="control"&&r==="ctrl"||o==="delete"&&(r==="del"||r==="canc")||/^arrow/.test(o)&&r===o.substr(5)}var Mf="execute",pa=class extends K{constructor(){super(...arguments);this._accumulator=[];this._shortcutHandler=e=>{switch(NC(e,this.combination,this._accumulator)){case!0:Q(e),this.dispatchEvent(new Event(Mf,{bubbles:!1,cancelable:!1}));case!1:this._accumulator.splice(0);break}}}viewActivatedCallback(){super.viewActivatedCallback(),this._addHandler()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&!i&&(this._removeHandler(t),this._addHandler(n))}disconnectedCallback(){this._removeHandler(),super.disconnectedCallback()}_removeHandler(e=this.target){(e||window).removeEventListener(bb,this._shortcutHandler,!1)}_addHandler(e=this.target){(e||window).addEventListener(bb,this._shortcutHandler,!1)}};c([h({emit:!1,converter:m.String})],pa.prototype,"combination",2),c([h({emit:!1,converter:m.Element})],pa.prototype,"target",2),pa=c([C({tagName:d+"-shortcut"})],pa);var Po=class extends na{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="text"&&!n&&(this.textContent=t)}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.text)||(this.textContent=this.text)}};c([h({converter:m.String})],Po.prototype,"text",2),Po=c([C({tagName:d+"-span"})],Po);var Xi=class extends K{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"cssText":a.isNull(this._style)||(this.cssReady=!1,this._style.textContent=t,a.isNullOrEmpty(t)?this.cssReady=!0:this._idleWhileReady());break;case"disabled":case"src":this._fetch();break}}viewActivatedCallback(){super.viewActivatedCallback();let r=this._style=document.createElement("style");r.setAttribute("type","text/css"),document.head.appendChild(r),this._fetch()}disconnectedCallback(){a.isNull(this._style)||this._style.remove(),super.disconnectedCallback()}_idleWhileReady(){let r=this._style.sheet,t=setInterval(()=>{try{r.cssRules.length>0&&(clearInterval(t),A.Theme.importWebFonts().then(n=>{this.cssReady=!0,this.dispatchEvent(new Event("cssready"))}))}catch{}},100)}_fetch(){let r=this.src,e=this._style;this.disabled||a.isNull(e)||(a.isNullOrEmpty(r)?e.textContent=this.cssText||"":(this.cssReady=!1,fetch(r).then(t=>{t.text().then(n=>{e.textContent=n,this._idleWhileReady()},n=>{this.cssReady=!0})},t=>{this.cssReady=!0})))}};c([h({emit:!1,converter:m.String})],Xi.prototype,"src",2),c([h({emit:!1,converter:m.String})],Xi.prototype,"cssText",2),c([h({converter:m.Boolean})],Xi.prototype,"cssReady",2),Xi=c([C({tagName:d+"-style-proxy"})],Xi);var Io=class extends HTMLElement{constructor(){super()}connectedCallback(){this.childNodes.length==0&&(this.innerHTML=" "),this._text=this.childNodes.item(0)}propertyChangedCallback(r,e,t,n){a.isNull(t)&&n===!0||(this._text.nodeValue=t)}};c([h({emit:!1,converter:m.String})],Io.prototype,"text",2),Io=c([C({tagName:d+"-text"})],Io);var $o=class extends K{constructor(){super();this._handle=0}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"interval":case"disabled":this._restart();break}}viewActivatedCallback(){super.viewActivatedCallback(),this._restart()}disconnectedCallback(){window.clearInterval(this._handle),super.disconnectedCallback()}_restart(){clearInterval(this._handle),!this.disabled&&this.interval>0&&(this._handle=window.setInterval(()=>{this.dispatchEvent(new Event("tick",{bubbles:!1,cancelable:!1}))},this.interval))}};c([h({emit:!1,converter:m.Number})],$o.prototype,"interval",2),$o=c([C({tagName:d+"-timer"})],$o);var Ho=class extends K{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),this._update()}viewActivatedCallback(){super.viewActivatedCallback(),this._update()}_update(){let r=this.value;a.isNullOrEmpty(r)||this.disabled||(document.title=r)}};c([h({emit:!1,converter:m.String})],Ho.prototype,"value",2),Ho=c([C({tagName:d+"-title-proxy"})],Ho);var _r=class extends K{constructor(e=new Fi){super();this._tweener=e;this.duration=1e3}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="start"&&n===!0&&this.disabled!=!0&&this._animate()}run(){return this._animate()}_animate(){var e=!1;return this._tweener.run(this.from,this.to,this.duration,this.delay,this.easing,(t,n)=>{e=e==!1&&this.dispatchEvent(new Xp),this.dispatchEvent(new jp({time:t,value:this.value=n})),this.log("info","value: "+this.value),t==1&&(this.dispatchEvent(new Yp),this.start=!1)})}};c([h({emit:!1})],_r.prototype,"easing",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],_r.prototype,"from",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],_r.prototype,"to",2),c([h({emit:!1,converter:m.Number})],_r.prototype,"duration",2),c([h({emit:!1,converter:m.Number})],_r.prototype,"delay",2),c([h({emit:!1,converter:m.Boolean})],_r.prototype,"start",2),c([h({converter:m.Number})],_r.prototype,"value",2),_r=c([C({tagName:d+"-tween"})],_r);var ch=class{constructor(r){this._global=r;this.viewports=[];this._checkHandler=r=>{this._oncheck(r)}}register(r){let e=this.viewports,t=this._global;e.indexOf(r)===-1&&(e.push(r),e.length===1&&(t.addEventListener("resize",this._checkHandler,!1),t.addEventListener("scroll",this._checkHandler,!1),t.addEventListener("transitionend",this._checkHandler,!1),t.addEventListener("animationend",this._checkHandler,!1)),this._oncheck())}unregister(r){var e;let t=this.viewports,n=this._global;(e=t.indexOf(r))!==-1&&(t.splice(e,1),t.length===0&&(n.removeEventListener("resize",this._checkHandler,!1),n.removeEventListener("scroll",this._checkHandler,!1),n.removeEventListener("transitionend",this._checkHandler,!1),n.removeEventListener("animationend",this._checkHandler,!1)),this._oncheck())}isElementVisible(r,e){let t=a.windowSize;var n=this._global.document,i=r.getBoundingClientRect(),s=t.width,l=t.height,p=function(u,f){return document.elementFromPoint(u,f)};return i.bottom>0&&i.top<0+l&&(e||i.left<s+0&&i.right>0)}_oncheck(r){for(var e of this.viewports){let n=e.target||e,i=this.isElementVisible(n,e.ignoreHorizontal);if(i!==e.visible){var t=e.visible=i;t?a.addClass(n,b+"-in-viewport"):a.removeClass(n,b+"-in-viewport")}}}};c([me(100)],ch.prototype,"_oncheck",1);var yb=new ch(window),qi=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),yb.register(this)}disconnectedCallback(){yb.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Boolean})],qi.prototype,"visible",2),c([h({emit:!1,converter:m.Element})],qi.prototype,"target",2),c([h({emit:!1,converter:m.Boolean})],qi.prototype,"ignoreHorizontal",2),qi=c([C({tagName:d+"-viewport-aware"})],qi);var ti=class extends K{constructor(){super(...arguments);this.autosend=!0;this._messageHandler=e=>{this.result=e.data,this.dispatchEvent(new CustomEvent("receive",{detail:e.data,bubbles:!1,cancelable:!1}))};this._errorHandler=e=>{this.dispatchEvent(new CustomEvent("error",{detail:e.error,bubbles:!1,cancelable:!1}))}}viewActivatedCallback(){super.viewActivatedCallback(),this._initializeWorker()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":this._disposeWorker(),this._initializeWorker(n);break;case"autosend":case"disabled":case"message":this.autosend&&this.send(this.message);break}}disconnectedCallback(){this._disposeWorker(),super.disconnectedCallback()}send(e=this.message){if(this.disabled)return;let t=this._worker;a.isNull(t)||t.postMessage(e)}_initializeWorker(e=this.src){if(!a.isNullOrEmpty(e)){let t=this._worker=new Worker(e);t.addEventListener("message",this._messageHandler,!1),t.addEventListener("error",this._errorHandler,!1),this.autosend&&!a.isNull(this.message)&&this.send()}}_disposeWorker(e=this._worker){a.isNull(e)||(e.removeEventListener("error",this._errorHandler,!1),e.removeEventListener("message",this._messageHandler,!1),e.terminate())}};c([h({emit:!1,converter:m.String})],ti.prototype,"message",2),c([h({converter:m.String})],ti.prototype,"result",2),c([h({emit:!1,converter:m.String})],ti.prototype,"src",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],ti.prototype,"autosend",2),ti=c([C({tagName:d+"-webworker-proxy"})],ti);var Sf=A.getAttachedPropertyValue,Lf=A.setAttachedPropertyValue,cd=A.deleteAttachedPropertyValue,ph="pacem:dragdrop:mousedown",ld="pacem:dragdrop:info",_b="pacem:dragdrop:delegate",Nf=class{constructor(r,e){this._logFn=e;this._started=!1;this._enterHandler=r=>{this._currentTarget=r.target};this._leaveHandler=r=>{this._currentTarget=null};this._revertTrackedTarget=null;this._moveHandler=r=>{r.type!=="wheel"&&Q(r);var e=this._element,t=this._dragDropper,n,i=Sf(e,ld);function s(){return n=n||(r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY})}if(!this._started){if(this._logFn("info","Dragging act started"),this._started=!0,t.dropBehavior==="insert"){var l=e;do l=l.parentElement;while(l&&t.dropTargets.indexOf(l)==-1);this._currentTarget=l}t.dispatchEvent(new vn("dragstart",Yn.fromArgs(i),{},r))}if(!a.isNull(i)){this._logFn("debug","Dragging act ongoing");let f=r instanceof MouseEvent;a.addClass(A.findAncestorShell(e),b+"-dragging");let g=i.currentPosition=s(),v=i.floater,y=new vn("drag",Yn.fromArgs(i),{cancelable:!0},r);if(t.dispatchEvent(y),!y.defaultPrevented&&(v instanceof HTMLElement||v instanceof SVGElement)){let _={x:y.detail.delta.x,y:y.detail.delta.y};v.style.transform=`translate3d(${_.x}px, ${_.y}px, 0)`}var p=this._currentTarget;!f&&t.dropTargets.length>0&&(p=document.elementsFromPoint(i.currentPosition.x-a.scrollLeft,i.currentPosition.y-a.scrollTop).find(_=>t.dropTargets.indexOf(_)>=0));var u=i.target;if(p!==u)if(a.isNull(u)||(a.removeClass(u,b+"-dropping"),t.dispatchEvent(new vn("dragout",Yn.fromArgs(i),{},r)),this._logFn("info",`Drop area left (${u.id||u.constructor.name})`)),t.dropTargets.indexOf(p)!=-1){i.target=p,this._logFn("info",`Drop area entering (${i.target.id||i.target.constructor.name})`);let _=new vn("dragover",Yn.fromArgs(i),{cancelable:!0},r);t.dispatchEvent(_),_.defaultPrevented?delete i.target:(a.addClass(i.target,b+"-dropping"),this._logFn("info",`Drop area entered (${i.target.id||i.target.constructor.name})`))}else delete i.target;if(this._revertTrackedTarget=i.target||u,!a.isNull(i.target)&&t.dropBehavior==="insert")this._insertChild(p,i);else if(a.isNull(i.target)&&t.mode==="copy"){let _=i.placeholder;_ instanceof Element&&_.remove()}}};this._endHandler=r=>{var e=this._element,t=A.findAncestorShell(e),n=this._dragDropper,i;if(!a.isNull(i=Sf(e,ld))){r instanceof MouseEvent&&Q(r);let l=()=>{let u=i.floater;(u instanceof HTMLElement||u instanceof SVGElement)&&(u.style.pointerEvents=""),n.mode!=="self"&&i.floater.remove(),a.removeClass(e,b+"-dragging"),a.removeClass(e,b+"-drag-lock"),cd(e,ld),a.isNull(i.placeholder)||(a.removeClass(i.placeholder,b+"-dragging"),a.removeClass(i.placeholder,"drag-placeholder"),a.removeClass(i.placeholder,b+"-drag-lock"),cd(i.placeholder,ld));let f=!a.isNull(i.target);f&&(n.dispatchEvent(new vn("drop",Yn.fromArgs(i),{},r)),a.removeClass(i.target,b+"-dropping"));let g=i.data,v=n.dropTargets,y=i.placeholder,_=this._repeaterItem,x=this._sourceRepeater,w=!a.isNull(_),E=y&&this._findTargetRepeaterItem(i.placeholder.parentElement,i.placeholder.nextElementSibling),k=E&&E.repeater,N=n.mode==="copy",T=f&&!a.isNull(k)&&!(a.isNull(_)&&x===k);if(w&&!N&&f&&x.removeItem(_.index),T)if(i.placeholder.remove(),k===x&&!N){let O=_.index,D=E.index;D>O&&D--,x.datasource.moveWithin(O,D)}else N||x&&x.datasource.splice(_.index,1),k&&(k.datasource=k.datasource||[]).splice(E.index,0,g);!f&&!a.isNullOrEmpty(n.dropTargets)&&n.spillBehavior==="remove"&&!N&&(w?x.datasource.splice(_.index,1):e.remove()),n.dispatchEvent(new vn("dragend",Yn.fromArgs(i),{},r)),a.removeClass(t,b+"-dragging")},p=i.placeholder||i.element;if(i.floater!=p){let u=i.floater;var s=a.deserializeTransform(getComputedStyle(u));if(!a.isNull(i.target)||n.spillBehavior==="revert"||n.dropBehavior==="insert"&&n.spillBehavior!=="remove"){let f=a.offset(p),g=a.offset(u);u.style.transition="transform .2s ease-in-out",s=ke.translate(s,{x:f.left-g.left,y:f.top-g.top})}else u.style.transition="transform .2s ease-in, opacity .2s linear",s=ke.scale(s,.1),u.style.opacity="0";a.addAnimationEndCallback(u,l,300),u.style.transform=`matrix(${s.a},${s.b},${s.c},${s.d},${s.e},${s.f})`}else l()}a.removeClass(e,b+"-drag-lock"),this.dispose(),this._logFn("info","Dragging act disposed")};this._dragDropper=r.dragDrop,a.addClass(this._element=r.element,b+"-drag-lock"),window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),document.addEventListener("wheel",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,{capture:!0,passive:!1}),this._dragDropper.dropTargets.forEach(n=>{n.addEventListener("mouseenter",this._enterHandler,!1),n.addEventListener("mouseleave",this._leaveHandler,!1)});var t=ra.findItemContext(this._element,0,null);t&&(t.dom&&t.dom.length===1&&t.dom[0]===this._element&&(this._repeaterItem=t),this._sourceRepeater=t.repeater),this._bootstrap(r.placeholder,r.data)}_getLogicalData(r){return r instanceof Gi?r.item:r instanceof HTMLElement?r.dataset:r}_getPhysicalData(r){return r instanceof Do?r.dom:[r]}_createFloater(r,e){let t=this._dragDropper,n=r;if(t.mode!="self"&&(n=n.cloneNode(!0),A.stripObservedAttributes(n),n instanceof HTMLElement||n instanceof SVGElement)){a.addClass(n,b+"-drag-floater"),A.findAncestorShell(this._element).appendChild(n),n.style.position="absolute";let i={left:e.x+n.clientWidth/2,top:e.y-n.clientHeight/2};if(r===this._element||r.classList.contains("drag-floater-resize")){let s=a.offset(this._element);n.style.boxSizing="border-box",n.style.width=s.width+"px",n.style.height=s.height+"px",i={left:s.left,top:s.top}}n.style.left=`${i.left}px`,n.style.top=`${i.top}px`}return(n instanceof HTMLElement||n instanceof SVGElement)&&(n.style.pointerEvents="none"),n}_findTargetRepeaterItem(r,e){var t=ra.findItemContext(e,0,null);if(a.isNull(t)){var n=null,i=-1;if(r instanceof zr?n=r:n=A.findAncestorOfType(r,zr),!a.isNull(n))return{repeater:n,index:n.datasource&&n.datasource.length||0}}else return{repeater:t.repeater,index:t.index};return null}_findNextSibling(r,e){var t=0,n=0;let i=Array.from(r.children),s=i.length,l=document.elementFromPoint(e.currentPosition.x-a.scrollLeft,e.currentPosition.y-a.scrollTop),p;if(l===r)return this._currentHover=p=e.placeholder,p.parentElement===r?p.nextElementSibling:null;for(var u=l;u.parentElement!=r&&u.parentElement!=null;)u=u.parentElement;if(u.parentElement!=r||u===e.placeholder)return this._currentHover=p=e.placeholder,p.nextElementSibling;if(u!=this._currentHover){p=this._currentHover;let f=i.indexOf(p),g=i.indexOf(u);return this._currentHover=u,f>g?u:u.nextElementSibling}return u}_insertChild(r,e){let t=e.placeholder||e.element,n=e.target,i=this._findNextSibling(n,e);(t.nextSibling!=i||t.parentElement!=n)&&(a.isNull(i)||i.parentElement==r)&&(r.insertBefore(t,i),this._logFn("info",`Positioned before ${i&&(i.id||i.constructor.name)||"null"} for drop`))}_bootstrap(r,e){var t=this._element,n=this._dragDropper,i,s;if(!a.isNull(i=Sf(t,ph))){this._started=!1,cd(t,ph),a.addClass(t,b+"-dragging");let l=getComputedStyle(t),p={x:0,y:0},u=a.deserializeTransform(l);p.x+=u.e,p.y+=u.f;let f=this._createFloater(n.floater||t,i);if(a.isNull(r))switch(n.mode){case"alias":r=t;break;case"copy":r=t.cloneNode(!0);break}a.isNull(r)||a.addClass(r,"drag-placeholder"),!a.isNull(this._repeaterItem)&&!a.isNull(r)&&A.freezeObservedAttributes(r);let g=e||this._getLogicalData(this._repeaterItem||t);s={element:t,placeholder:r||t,data:g,startTime:Date.now(),origin:i,initialDelta:p,currentPosition:i,floater:f},Lf(t,ld,s)}}dispose(){this._dragDropper.dropTargets.forEach(r=>{r.removeEventListener("mouseenter",this._enterHandler,!1),r.removeEventListener("mouseleave",this._leaveHandler,!1)}),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),document.removeEventListener("wheel",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,{capture:!0})}},xr=class extends bn{constructor(){super(...arguments);this._startHandler=e=>{if(this.disabled||!e.isTrusted||!a.isNullOrEmpty(this.handleSelector)&&e.currentTarget.querySelector(this.handleSelector)!==e.target)return;let t=e.currentTarget,n=de.getEventCoordinates(e),i=n.page,s=t,l=qp.fromArgs({element:s,placeholder:null,currentPosition:i,origin:i,initialDelta:{x:0,y:0},startTime:null,floater:null,data:null}),p=new vn("draginit",l,{cancelable:!0},e);if(this.dispatchEvent(p),p.defaultPrevented)return;Q(e);let u=()=>{t.removeEventListener("mouseup",f,!1),t.removeEventListener("touchend",f,!1),this.log("info","Drag locked!"),Lf(t,ph,i),Lf(t,_b,new Nf({element:s,dragDrop:this,placeholder:l.placeholder,data:l.data},(v,y,_)=>this.log.apply(this,[v,y,_])))},f=v=>{this.log("info","Drag avoided!"),clearTimeout(g)},g=setTimeout(u,this.lockTimeout);t.addEventListener("mouseup",f,!1),t.addEventListener("touchend",f,!1)};this.lockTimeout=100;this.dropTargets=[];this.mode="self"}decorate(e){let t={capture:!1,passive:!1};e.addEventListener("mousedown",this._startHandler,!1),e.addEventListener("touchstart",this._startHandler,t)}undecorate(e){let t={capture:!1,passive:!1};e.removeEventListener("mousedown",this._startHandler,!1),e.removeEventListener("touchstart",this._startHandler,t)}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}dispatchEvent(e){return e.type==="dragend"&&(cd(e.detail.element,ph),cd(e.detail.element,_b)),super.dispatchEvent(e)}};c([h({emit:!1,converter:m.Number})],xr.prototype,"lockTimeout",2),c([h({emit:!1})],xr.prototype,"dropTargets",2),c([h({emit:!1,converter:m.String})],xr.prototype,"mode",2),c([h({emit:!1,converter:m.Element})],xr.prototype,"floater",2),c([h({emit:!1,converter:m.String})],xr.prototype,"dropBehavior",2),c([h({emit:!1,converter:m.String})],xr.prototype,"spillBehavior",2),c([h({emit:!1,converter:m.String})],xr.prototype,"handleSelector",2),xr=c([C({tagName:d+"-drag-drop"})],xr);var Af=class{constructor(r,e,t,n){this._element=r;this._type=e;this._rescaler=t;this._logFn=n;this._startTime=Date.now();this._moveHandler=r=>{r.stopPropagation();let e=this._element,t=this._origin,n=this._rescaler,i=this._type,s=n.keepProportions,l=n.minWidth||0,p=n.minHeight||0,u=n.maxWidth||Number.MAX_SAFE_INTEGER,f=n.maxHeight||Number.MAX_SAFE_INTEGER,g=r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY},v={x:g.x,y:g.y},y=this._rect;switch(i){case"top":case"bottom":v.x=t.x;break;case"left":case"right":v.y=t.y;break}this._position=v;let _={x:v.x-t.x,y:v.y-t.y};var x;if(s){let k={x:y.x,y:y.y},N={x:y.x+y.width,y:y.y},T={x:y.x+y.width,y:y.y+y.height},O={x:y.x,y:y.y+y.height},D=se.distance(T,O)/se.distance(T,k),P=se.distance(k,O)/se.distance(T,k),F=se.distance(k,T),B=($,U)=>($.x*U.x+$.y*U.y)/F;switch(i){case"topleft":let $=se.subtract(T,k),U=B(se.subtract(T,v),$),I={x:T.x-U*D,y:T.y-U*P};x={x:I.x,y:I.y,width:T.x-I.x,height:T.y-I.y};break;case"topright":let G=se.subtract(O,N),Y=B(se.subtract(O,v),G),W={x:O.x+Y*D,y:O.y-Y*P};x={x:O.x,y:W.y,width:W.x-O.x,height:O.y-W.y};break;case"bottomleft":let V=se.subtract(N,O),X=B(se.subtract(N,v),V),q={x:N.x-X*D,y:N.y+X*P};x={x:q.x,y:N.y,width:N.x-q.x,height:q.y-N.y};break;default:let Z=se.subtract(k,T),ne=B(se.subtract(k,v),Z),te={x:k.x+ne*D,y:k.y+ne*P};x={x:k.x,y:k.y,width:te.x-k.x,height:te.y-k.y};break}}else x={x:this._rect.x,y:this._rect.y,width:this._rect.width+_.x,height:this._rect.height+_.y},i.startsWith("top")&&(x.y=this._rect.y+_.y,x.height=this._rect.height-_.y),i.endsWith("left")&&(x.x=this._rect.x+_.x,x.width=this._rect.width-_.x);this._logFn("log",`handle: ${i}, origin: ${JSON.stringify(t)}, currentPosition: ${JSON.stringify(g)}`,"Rescaling"),this._logFn("log",`delta: ${JSON.stringify(_)}, position: ${JSON.stringify(v)}`,"Rescaling"),this._logFn("log",`from: ${JSON.stringify(this._rect)}, to: ${JSON.stringify(x)}`,"Rescaling");let w=x.width>=l&&x.width<=u,E=x.height>=p&&x.height<=f;if(s&&(!w||!E)&&(w=E=!1),w||(x.x=this._targetRect.x,x.width=this._targetRect.width),E||(x.y=this._targetRect.y,x.height=this._targetRect.height),w||E){let k={currentPosition:v,element:e,handle:i,origin:t,targetRect:x,startTime:this._startTime},N=new Co("rescale",xo.fromArgs(k),{cancelable:!0},r);if(n.dispatchEvent(N),!N.defaultPrevented){let T=this._originalTransform;e.style.transform=`matrix(${T.a},${T.b},${T.c},${T.d},${T.e+x.x-this._rect.x},${T.f+x.y-this._rect.y})`,e.style.width=x.width+"px",e.style.height=x.height+"px"}this._targetRect=x}};this._endHandler=r=>{r.stopPropagation();let e=this._type,t=new Co("rescaleend",xo.fromArgs({element:this._element,origin:this._origin,handle:e,startTime:this._startTime,currentPosition:this._position,targetRect:this._targetRect}),{},r);a.removeClass(document.body,b+"-rescaling rescale-"+e),this._rescaler.dispatchEvent(t),xb(this._element,Eb),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,!1)};window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,!1),this._origin=this._position=Df(r,Cb),this._rect=this._targetRect=a.offsetRect(r),this._originalTransform=a.deserializeTransform(getComputedStyle(r)),a.addClass(document.body,b+"-rescaling rescale-"+e)}},Df=A.getAttachedPropertyValue,Tf=A.setAttachedPropertyValue,xb=A.deleteAttachedPropertyValue,AC="top right bottom left topleft topright bottomright bottomleft".split(" "),dh="pacem:rescale:frame",Cb="pacem:rescale:origin",Eb="pacem:rescale:delegate",Gr=class extends bn{constructor(){super(...arguments);this._bag=[];this._startHandler=e=>{e.stopPropagation();let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.page,s=/rescale-(.+)/.exec(n.className)[1],l=n.parentElement,p=new Co("rescalestart",xo.fromArgs({currentPosition:i,origin:i,element:l,handle:s,startTime:Date.now()}),{cancelable:!0},e);this.dispatchEvent(p),!p.defaultPrevented&&(Q(e),Tf(l,Cb,i),Tf(l,Eb,new Af(l,s,this,(u,f,g)=>this.log.apply(this,[u,f,g]))))}}decorate(e){let t=e,n=getComputedStyle(t);a.addClass(t,b+"-rescalable"),this._setFrame(t)}undecorate(e){let t=e;a.removeClass(t,b+"-rescalable"),this._removeFrame(t)}viewActivatedCallback(){super.viewActivatedCallback(),this._syncHandles()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":case"handles":case"keepProportions":this._syncHandles();break}}_syncHandles(){let e=this.handles||["all"],t=e.find(s=>s==="all")!=null,n=this.disabled,i=this.keepProportions;for(let s of this._bag){let l=Df(s,dh);l.top.hidden=n||!t&&e.find(p=>p==="top")==null,l.bottom.hidden=n||!t&&e.find(p=>p==="bottom")==null,l.left.hidden=n||!t&&e.find(p=>p==="left")==null,l.right.hidden=n||!t&&e.find(p=>p==="right")==null,l.topleft.hidden=l.top.hidden||l.left.hidden,l.topright.hidden=l.top.hidden||l.right.hidden,l.bottomleft.hidden=l.bottom.hidden||l.left.hidden,l.bottomright.hidden=l.bottom.hidden||l.right.hidden,i&&(l.top.hidden=l.bottom.hidden=l.left.hidden=l.right.hidden=!0)}}_setFrame(e){let t={};for(let n of AC){let i=t[n]=document.createElement("div");a.addClass(i,b+"-rescale rescale-"+n),e.setAttribute("pacem",""),e.appendChild(i),i.addEventListener("mousedown",this._startHandler,!1),i.addEventListener("touchstart",this._startHandler,{capture:!1,passive:!0})}Tf(e,dh,t),this._bag.push(e),this._syncHandles()}_removeFrame(e){let t=Df(e,dh);for(var n in t){let i=t[n];i.removeEventListener("mousedown",this._startHandler,!1),i.removeEventListener("touchstart",this._startHandler,{capture:!1}),i.remove()}xb(e,dh),this._bag.splice(this._bag.indexOf(e),1)}};c([h({emit:!1,converter:m.StringArray})],Gr.prototype,"handles",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"minWidth",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"maxWidth",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"minHeight",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"maxHeight",2),c([h({emit:!1,converter:m.Boolean})],Gr.prototype,"keepProportions",2),Gr=c([C({tagName:d+"-rescale"})],Gr);var uh=A.getAttachedPropertyValue,hh=A.setAttachedPropertyValue,DC=A.deleteAttachedPropertyValue,wb="pacem:rotate:origin",kb="pacem:rotate:delegate",Rf="pacem:rotate:offset",Mb="pacem:rotate:center",vR=2*Math.PI,Of=class{constructor(r,e,t){this._element=r;this._rotator=e;this._logFn=t;this._startTime=Date.now();this._moveHandler=r=>{r.stopPropagation();let e=this._element,t=this._previousPosition,n=this._rotator,i=n.minRotation,s=n.maxRotation,l=r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY},p=this._pivot;var u=this._computeAngle(p,l,t)+this._previousAngle,f=this._constraintAngle(u,n.step);for(this._logFn("log",`previousPosition: ${JSON.stringify(t)}, currentPosition: ${JSON.stringify(l)}`,"Rotating"),u>s&&(u=s);f>s&&n.step>0;)this._logFn("log",`angle: ${f} constrained to max: ${s}`,"Rotating"),f-=n.step;for(u<i&&(u=i);f<i&&n.step>0;)this._logFn("log",`angle: ${f} constrained to min: ${i}`,"Rotating"),f+=n.step;if(this._logFn("log",`angle: ${f}, origin: ${JSON.stringify(this._originalPosition)}, current: ${JSON.stringify(l)}`,"Rotating"),f!=this._previousRenderedAngle){let g=new wo("rotate",Eo.fromArgs({element:this._element,origin:this._originalPosition,startTime:this._startTime,currentPosition:l,rotation:f,center:this._pivot}),{cancelable:!0},r);if(this._rotator.dispatchEvent(g),!g.defaultPrevented){let v=this._originalTransform,y=ke.rotate(v,f-this._originalAngle);e.style.transform=`matrix(${y.a}, ${y.b}, ${y.c}, ${y.d}, ${y.e}, ${y.f})`,hh(this._element,Rf,f)}this._previousRenderedAngle=f}this._previousPosition=l,this._previousAngle=u};this._endHandler=r=>{r.stopPropagation();let e=new wo("rotateend",Eo.fromArgs({element:this._element,origin:this._originalPosition,startTime:this._startTime,currentPosition:this._previousPosition,rotation:this._previousAngle,center:this._pivot}),{},r);this._rotator.dispatchEvent(e),DC(this._element,kb),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,!1)};window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,!1),this._originalPosition=this._previousPosition=uh(r,wb),this._originalAngle=this._previousAngle=this._previousRenderedAngle=uh(r,Rf,0),this._pivot=uh(r,Mb),this._originalTransform=a.Css.deserializeTransform(r)}_computeAngle(r,e,t){return Wn.angleBetween(r,e,t)}_constraintAngle(r,e){return e>0?go.round(r,e):r}},ri=class extends bn{constructor(){super(...arguments);this._startHandler=e=>{if(this.disabled)return;let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.page,s=a.offsetRect(n),l=s.width/2,p=s.height/2;var u=this.center;if(a.isNull(u))u={x:s.x+l,y:s.y+p},n.style.transformOrigin="50% 50%";else{let g=s.x+l-u.x,v=s.y+p-u.y;n.style.transformOrigin=`${-g}px ${-v}px`}let f=new wo("rotatestart",Eo.fromArgs({currentPosition:i,rotation:uh(n,Rf,0),center:u,origin:i,element:n,startTime:Date.now()}),{cancelable:!0},e);this.dispatchEvent(f),!f.defaultPrevented&&(Q(e),hh(n,wb,i),hh(n,Mb,u),hh(n,kb,new Of(n,this,(g,v,y)=>this.log.apply(this,[g,v,y]))))}}decorate(e){let t=e;a.addClass(t,b+"-rotatable");let n={capture:!1,passive:!1};e.addEventListener("mousedown",this._startHandler,!1),e.addEventListener("touchstart",this._startHandler,n)}undecorate(e){let t=e;a.removeClass(t,b+"-rotatable");let n={capture:!1,passive:!1};e.removeEventListener("mousedown",this._startHandler,!1),e.removeEventListener("touchstart",this._startHandler,n)}};c([h({emit:!1,converter:m.Number})],ri.prototype,"step",2),c([h({emit:!1,converter:m.Number})],ri.prototype,"minRotation",2),c([h({emit:!1,converter:m.Number})],ri.prototype,"maxRotation",2),c([h({emit:!1,converter:m.Point})],ri.prototype,"center",2),ri=c([C({tagName:d+"-rotate"})],ri);var Sb=A.getAttachedPropertyValue,Pf=A.setAttachedPropertyValue,If=A.deleteAttachedPropertyValue,lc="pacem:swipe:preparing",Lb="pacem:swipe:delegate",Nb={fling:400,inertia:8,start:32,autoresetSpans:!1,bouncy:!0},$f=class{constructor(r,e,t,n){this._element=r;this._swiper=e;this._init=t;this._logFn=n;this._moveHandler=r=>{let e=this.#t,t=this._buildStateFromUiEvent(r);for(e.push(this.#n=t);e.length>0&&t.timestamp-e[0].timestamp>100;)e.shift();let n=this._buildSwipeArgsFromState(t),i=new Wi("pan",n,{cancelable:!0,bubbles:!1}),s=this._swiper;if(s.dispatchEvent(i),!i.defaultPrevented){let{delta:l}=this._delta(this._init,t);if(!s.options.bouncy){let p=s.snaps.slice().sort(),u=p[0],f=p[p.length-1],g=this._swiper.direction,{x:v,y}=l,_=v.clamp(u,f),x=y.clamp(u,f);l=g==="vertical"?{x:0,y:x}:{x:_,y:0}}this._animateOffsetBy(l,0)}};this._endHandler=r=>{if(window.removeEventListener("pointermove",this._moveHandler),a.isNull(this.#n))console.log("How come?!");else{let e=this._buildSwipeArgsFromState(),t=new Wi("swipe",e,{cancelable:!0,bubbles:!1}),n=this._swiper;if(n.dispatchEvent(t),!t.defaultPrevented){let i=new Wi("swipe"+e.direction,e,{cancelable:!0,bubbles:!1});if(n.dispatchEvent(i),!i.defaultPrevented){let s=n.snaps??[0];s.sort();let l=n.options.bouncy?e.predictedDelta:e.predictedDelta.clamp(s[0],s[s.length-1]),p=s.reduce((y,_)=>{let x=Math.abs(_-l),w=Math.abs(y-l);return x<w?_:y},0),u=n.direction==="vertical",f=e.predictedDuration,g=u?{x:0,y:l}:{x:l,y:0},v=()=>{let y=new Wi("swipeanimationend",e,{cancelable:!1,bubbles:!1});return n.dispatchEvent(y)?y:null};if(p.isCloseTo(0))this._animateOffsetBy(g,f).then(()=>{this._animateOffsetBy({x:0,y:0},.3,"cubic-bezier(.37,-0.01,.34,1.43)").then(()=>v())});else{let y=(p-l)*(p-e.delta)>=0,_=u?{x:0,y:p}:{x:p,y:0},x=()=>this._animateOffsetBy(_,y?f:.2,"cubic-bezier(0,0,0,1)");(y?Promise.resolve():this._animateOffsetBy(g,f)).then(()=>x().then(()=>{v();let E=new Wi("swipe"+e.direction+"animationend",e,{cancelable:!1,bubbles:!1});n.dispatchEvent(E)}))}this.#e.autoresetSpans&&(this._swiper.snaps=s.map(y=>y-p))}}}this.dispose()};this.#t=[];let i=r;this.#e=a.extend({},Nb,e.options??{}),this.#r=a.deserializeTransform(getComputedStyle(i)),window.addEventListener("pointermove",this._moveHandler,!1),window.addEventListener("pointerup",this._endHandler,!1),window.addEventListener("pointercancel",this._endHandler,!1)}_serializeTransformMatrix(r){return`matrix3d(${r.a},${r.b},0,0,${r.c},${r.d},0,0,0,0,1,0,${r.e},${r.f},0,1)`}_animateOffsetBy(r,e,t=a.Css.getVariableValue(`--${b}-easing-out-sine`)){let n=ke.translate(this.#r,r),i=Math.min(.3,e)*1e3,s=this._element,l=this._serializeTransformMatrix(n);return new Promise((p,u)=>{let f=s.animate([{transform:l}],{fill:"forwards",duration:i,easing:t}),g=v=>{f.removeEventListener("finish",g),f.commitStyles(),f.cancel(),p()};f.addEventListener("finish",g,!1)})}_buildStateFromUiEvent(r){let e=de.getEventCoordinates(r),t=performance.now();return{position:e.client,timestamp:t}}_buildSwipeArgsFromState(r=this.#n){let e=this.#e,t=this.speed,i=this._swiper.direction==="vertical",s=i?0:t,l=i?t:0;return Kp.fromArgs({position:r.position,element:this._element,t0:this._init,timestamp:r.timestamp,inertia:e.inertia,fling:e.fling,horizontalspeed:s,verticalspeed:l,vertical:i})}_delta(r,e){let{position:{x:t,y:n},timestamp:i}=r,{position:{x:s,y:l},timestamp:p}=e;return{delta:this._swiper.direction==="vertical"?{x:0,y:l-n}:{x:s-t,y:0},time:p-i}}get speed(){let r=this.#t;if(r.length<2)return 0;let e=r[0],t=r[r.length-1],{delta:n,time:i}=this._delta(e,t),s=i/1e3,l=n.x+n.y;return s>0?l/s:0}#e;#t;#r;#n;dispose(){let r=this._element;If(r,Lb),window.removeEventListener("pointercancel",this._endHandler),window.removeEventListener("pointerup",this._endHandler)}},pd,ni=class extends bn{constructor(){super(...arguments);z(this,pd);this._prepareHandler=e=>{if(this.disabled)return;let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.client,s=this.handleSelector;!a.isNullOrEmpty(s)&&n.querySelector(s)!==e.target||(e.stopPropagation(),Pf(n,lc,{position:i,timestamp:performance.now()}),Pf(window,lc,n),window.addEventListener("pointermove",this._startHandler,!1),window.addEventListener("pointerup",this._undoHandler,!1))};this._startHandler=e=>{let t=Sb(window,lc),n=Sb(t,lc);if(a.isNull(n)){this._undo(t);return}let i=de.getEventCoordinates(e),{x:s,y:l}=i.client,{position:{x:p,y:u}}=n,v=(this.direction||"horizontal")==="vertical"?l-u:s-p,y=M(this,pd),{start:_}=y;if(Math.abs(v)>_){this._undo(t);let x=this,w=new $f(t,x,n,(E,k,N)=>{x.log(E,k,N)});Pf(t,Lb,w)}};this._undoHandler=e=>{let t=e.currentTarget;this._undo(t)}}decorate(e){(e instanceof HTMLElement||e instanceof SVGElement)&&a.addClass(e,b+"-swipe"),e.addEventListener("pointerdown",this._prepareHandler,!1)}undecorate(e){(e instanceof HTMLElement||e instanceof SVGElement)&&a.removeClass(e,b+"-swipe"),e.removeEventListener("pointerdown",this._prepareHandler,!1)}viewActivatedCallback(){super.viewActivatedCallback(),this._setOptions()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&e==="options"&&this._setOptions(n)}_setOptions(e=this.options){H(this,pd,a.extend({},Nb,e??{}))}_undo(e){window.removeEventListener("pointermove",this._startHandler),window.removeEventListener("pointerup",this._undoHandler),If(e,lc),If(window,lc)}};pd=new WeakMap,c([h({emit:!1,reflectBack:!0,converter:{convert:(e,t)=>e.match(/[-+]?[\d\.]+/g).map(n=>parseFloat(n)),convertBack:(e,t)=>e?.join(" ")}})],ni.prototype,"snaps",2),c([h({emit:!1,converter:m.String,reflectBack:!0})],ni.prototype,"direction",2),c([h({emit:!1,converter:m.Json})],ni.prototype,"options",2),c([h({emit:!1,converter:m.String,reflectBack:!0})],ni.prototype,"handleSelector",2),ni=c([C({tagName:d+"-swipe"})],ni);var RC={convert:o=>Ur[o]??Ur.linear},lr=class extends Yi{};c([h({emit:!1,converter:m.Element})],lr.prototype,"target",2),c([h({emit:!1,converter:m.String})],lr.prototype,"property",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"delay",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"duration",2),c([h({emit:!1,converter:RC})],lr.prototype,"easing",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"iterations",2),c([h({emit:!1,converter:m.String})],lr.prototype,"direction",2);var ii=class extends lr{constructor(e=new Fi){super();this._tweener=e}get tweener(){return this._tweener}#e=!1;startAnimation(){return this.#e=!1,new Promise((e,t)=>{this._tweener.run(0,1,this.duration??0,this.delay??0,this.easing??Ur.linear,(n,i)=>{this.#e||(this.target[this.property]=this.tweenInterpolationCallback(n,i))}).then(e)})}cancelAnimation(){this.#e=!0}};var Hf={h:0,l:0,s:.5,a:1},OC={h:0,l:1,s:.5,a:1},dd,ud,da=class extends ii{constructor(){super(...arguments);z(this,dd,Hf);z(this,ud,OC)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"from":this._precomputeFrom(n);break;case"to":this._precomputeTo(n);break}}viewActivatedCallback(){super.viewActivatedCallback(),this._precomputeColors()}_precomputeColors(){this._precomputeFrom(),this._precomputeTo()}_precomputeFrom(e=this.from){H(this,dd,this._precomputeColor(e)??Hf)}_precomputeTo(e=this.to){H(this,ud,this._precomputeColor(e)??Hf)}_precomputeColor(e){if(!a.isNullOrEmpty(e))try{return this._parseColor(e)}catch{return null}}_parseColor(e){return Be.hsl(Be.parse(e))}tweenInterpolationCallback(e,t){let n=M(this,dd),i=M(this,ud),s={h:(i.h-n.h)*t+n.h,s:(i.s-n.s)*t+n.s,l:(i.l-n.l)*t+n.l,a:(i.a-n.a)*t+n.a};return Be.stringify(s)}};dd=new WeakMap,ud=new WeakMap,c([h({emit:!1,converter:m.String})],da.prototype,"from",2),c([h({emit:!1,converter:m.String})],da.prototype,"to",2),da=c([C({tagName:d+"-color-animation"})],da);var PC=0,IC=1,ua=class extends ii{tweenInterpolationCallback(r,e){let t=this.to??IC,n=this.from??PC;return(t-n)*e+n}};c([h({emit:!1,converter:m.Number})],ua.prototype,"from",2),c([h({emit:!1,converter:m.Number})],ua.prototype,"to",2),ua=c([C({tagName:d+"-number-animation"})],ua);var $C={x:0,y:0},HC={x:1,y:1},ha=class extends ii{tweenInterpolationCallback(r,e){let t=this.to??HC,n=this.from??$C;return{x:(t.x-n.x)*e+n.x,y:(t.y-n.y)*e+n.y}}};c([h({emit:!1,converter:m.Point})],ha.prototype,"from",2),c([h({emit:!1,converter:m.Point})],ha.prototype,"to",2),ha=c([C({tagName:d+"-point-animation"})],ha);var si=class extends _n{validate(r){return r instanceof lr}viewActivatedCallback(){super.viewActivatedCallback(),this._animate()}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"datasource":this._buildDatasourceFromDatasource(t);break;case"items":this._buildDatasourceFromItems(t);break;case"_adaptedDatasource":case"autostart":this._animate();break}}_buildDatasourceFromItems(r=this.items){this._adaptedDatasource=r||[]}_buildDatasourceFromDatasource(r=this.datasource){this._adaptedDatasource=r||[]}_animate(r=this.autostart){let e=this._adaptedDatasource,t=[];if(r&&!a.isNullOrEmpty(e))for(let n of e)t.push(n.startAnimation());return Promise.all(t)}cancelAnimation(){let r=this._adaptedDatasource||[];for(let e of r)e.cancelAnimation()}startAnimation(){return this._animate(!0)}};c([h({emit:!1,converter:m.Boolean})],si.prototype,"autostart",2),c([h({emit:!1,converter:m.Number})],si.prototype,"duration",2),c([h({emit:!1})],si.prototype,"datasource",2),c([h({emit:!1})],si.prototype,"_adaptedDatasource",2),si=c([C({tagName:d+"-storyboard"})],si);function dc(o){return!a.isNull(o)&&"stage"in o}function Cr(o){return dc(o)}function Tb(o){return"stops"in o&&a.isArray(o.stops)}function fd(o){return Tb(o)&&"start"in o&&se.isPoint(o.start)&&"end"in o&&se.isPoint(o.end)}function uc(o){return Tb(o)&&"center"in o&&se.isPoint(o.center)&&"radius"in o&&typeof o.radius=="number"}var hd=class{static combine(r,e,t=null){return{opacity:(r.opacity??1)*(e.opacity??1),transformMatrix:t??ke.multiply(e.transformMatrix,r.transformMatrix),dashArray:r.dashArray??e.dashArray,fill:r.fill??e.fill,lineCap:r.lineCap??e.lineCap,lineJoin:r.lineJoin??e.lineJoin,lineWidth:r.lineWidth??e.lineWidth,stroke:r.stroke??e.stroke}}};function gd(o){return Cr(o)&&("fill"in o||"transformMatrix"in o||"stroke"in o||"lineJoin"in o||"dashArray"in o||"lineWidth"in o||"opacity"in o||"lineCap"in o)}function hc(o){return Cr(o)&&"pathData"in o}function Bo(o){return Cr(o)&&"childDrawables"in o&&!a.isNullOrEmpty(o.childDrawables)}function mc(o){return Cr(o)&&"text"in o&&typeof o.text=="string"}function fc(o){return Cr(o)&&"src"in o&&typeof o.src=="string"}var cc=class extends ht{constructor(r,e,t,n){super(r,e,t),this.#e=n}#e;get transformMatrix(){return this.#e}project(r={x:this.screenX,y:this.screenY}){return ke.multiply(r,this.#e)}},Ki=class{static empty(){return{pathData:"",vertices:[],boundingRect:{x:0,y:0,width:0,height:0}}}},pc=class extends cc{},Cn=class extends cc{constructor(r,e,t,n){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}},md=class extends cc{constructor(r,e,t,n=e.transformMatrix){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}};var we={};Le(we,{LinearAlgebra:()=>Gf,Polygon:()=>Bf,Utils:()=>ai,Utils3D:()=>zf});var Fr=class o{static unit(r){let e={x:r.x,y:r.y};return this.normalize(e),e}static magSqr(r){return r.x*r.x+r.y*r.y}static mag(r){return Math.sqrt(o.magSqr(r))}static normalize(r){let e=o.mag(r);if(e<=0)throw"Cannot normalize a vector of length 0.";let t=1/e;r.x*=t,r.y*=t}static from(r,e){return se.subtract(r,e)}static dot(r,e){return r.x*e.x+r.y*e.y}static cross(r,e){return r.x*e.y-r.y*e.x}static areClose(r,e){return(e.x-r.x).isCloseTo(0)&&(e.y-r.y).isCloseTo(0)}};var gc=class{constructor(r,e,t=-1){this.x=r;this.y=e;this.index=t}equals(r){return this.x===r.x&&this.y===r.y}};function VC(o,r,e){let t=o.x,n=o.y,i=r.x,s=r.y,l=e.x,p=e.y,u=2*(t*(s-p)+i*(p-n)+l*(n-s));if(Math.abs(u)<1e-12)return{c:{x:0,y:0},r:1/0};let f=((t*t+n*n)*(s-p)+(i*i+s*s)*(p-n)+(l*l+p*p)*(n-s))/u,g=((t*t+n*n)*(l-i)+(i*i+s*s)*(t-l)+(l*l+p*p)*(i-t))/u,v=Math.hypot(f-t,g-n);return{c:{x:f,y:g},r:v}}var mh=class{constructor(r,e,t){this.v0=r;this.v1=e;this.v2=t;this.circumCirc=VC(r,e,t)}inCircumcircle(r){let e=this.circumCirc.c.x-r.x,t=this.circumCirc.c.y-r.y;return Math.hypot(e,t)<=this.circumCirc.r+1e-9}};function UC(o){let r=1/0,e=1/0,t=-1/0,n=-1/0;for(let f of o)r=Math.min(r,f.x),e=Math.min(e,f.y),t=Math.max(t,f.x),n=Math.max(n,f.y);let i=(t-r)*10,s=(n-e)*10,l=new gc(r-i,e-s*3),p=new gc(r-i,n+s),u=new gc(t+i*3,n+s);return new mh(l,p,u)}function zC(o){let r=[];for(let e=0;e<o.length;++e){let t=!0;for(let n=0;n<o.length;++n)if(e!==n){let i=o[e],s=o[n];if(i.v0.equals(s.v0)&&i.v1.equals(s.v1)||i.v0.equals(s.v1)&&i.v1.equals(s.v0)){t=!1;break}}t&&r.push(o[e])}return r}function GC(o,r){let e=[];r=r.filter(n=>n.inCircumcircle(o)?(e.push({v0:n.v0,v1:n.v1}),e.push({v0:n.v1,v1:n.v2}),e.push({v0:n.v2,v1:n.v0}),!1):!0);let t=zC(e);for(let n of t)r.push(new mh(n.v0,n.v1,o));return r}function FC(o){if(o.length<3)return[];let r=UC(o),e=[r];for(let t of o)e=GC(t,e);return e=e.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)),e}function WC(o){if(o.length<3)return[];let r=o.map((n,i)=>new gc(n.x,n.y,i)),e=FC(r),t=[];for(let n of e)t.push(n.v0.index,n.v1.index,n.v2.index);return t}var fh=class{static triangulate(r){return WC(r)}};var jC=180/Math.PI,Db=2*Math.PI,Vo=12;function gh(o){return se.isPoint(o)}function YC(o){return o!=null&&Array.isArray(o)&&o.length===2&&gh(o[0])&&gh(o[1])}var ai=class o{static slopeRad(r,e){return Math.atan2(e.y-r.y,e.x-r.x)}static slopeRad2(r,e){return(Db+o.slopeRad(r,e))%Db}static slopeDeg(r,e){return o.slopeRad(r,e)*jC}static slopeDeg2(r,e){return(360+o.slopeDeg(r,e))%360}static intersect(r,e,...t){return Array.isArray(r)&&Array.isArray(e)?o._intersectSegments(r,e,!0):Ze.isRect(r)?o._intersectRects(...arguments):"vertices"in r?o._mergePolygons(r,e,"intersect")?.polygons??null:null}static boundingBox(r){let e=Number.MAX_VALUE,t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=-Number.MAX_VALUE,s=r.length;for(let l of r)e=Math.min(e,l.x),t=Math.min(t,l.y),n=Math.max(n,l.x),i=Math.max(i,l.y);return{x:e,y:t,width:n-e,height:i-t}}static combinePolygons(r,e,t){return o._mergePolygons(r,e,t)}static _mergePolygons(r,e,t){if(be.isNullOrEmpty(r?.vertices)||be.isNullOrEmpty(e?.vertices))return null;let n=r.vertices.filter(V=>o.inPolygon(V,e.vertices));if(r.vertices.length==n.length)return{polygons:t==="intersect"?[r]:[e]};let i=e.vertices.filter(V=>o.inPolygon(V,r.vertices));if(e.vertices.length===i.length)return{polygons:t==="intersect"?[e]:[r]};let s=o.boundingBox(r.vertices),l=o.boundingBox(e.vertices),p=o.intersect(s,l);if(t!=="union"&&(!Ze.isRect(p)||!(p.width>0)||!(p.height>0)))return null;let{vertices:u}=r,{vertices:f}=e;if(u.length<3||f.length<3)return null;let g=(V,X,q)=>[V,q[(X+1)%q.length]],v=(V,X)=>V.x===X.x?V.y-X.y:V.x-X.x,y=u.map(g),_=f.map(g),x=u.concat(f),w=new Map,E=V=>{if(!w.has(V)){let X=[];w.set(V,X)}return w.get(V)},k=!1;for(let V of y){let X=E(V);for(let q of _){let Z=E(q),ne=o.intersect(V,q);be.isNull(ne)||(k=!0,x.push(ne),X.push(ne),Z.push(ne))}}if(n.length===0&&i.length===0&&!k)return t==="union"?{polygons:[r,e]}:null;let N=[];for(let V of y.concat(_)){let X=E(V);if(be.isNullOrEmpty(X))N.push(V);else{let q=V.concat(X).sort(v);for(let Z=0;Z<q.length-1;Z++)N.push([q[Z],q[Z+1]])}}var T=!1,O;do{x.sort(v),x.filter((q,Z,ne)=>Z===0||!o.areClose(q,ne[Z-1])),O=o.mesh(x);let{vertices:V,triangleIndices:X}=O;T=!1;for(let q=0;q<X.length;q+=3){let Z=X[q],ne=X[q+1],te=X[q+2],ae=V[Z],Se=V[ne],he=V[te],fe=[[ae,Se],[Se,he],[he,ae]];for(let le of N)for(let re of fe){let ge=o.areClose(re[0],le[0])||o.areClose(re[1],le[1])||o.areClose(re[0],le[1])||o.areClose(re[1],le[0])?null:o.intersect(re,le);!be.isNull(ge)&&x.findIndex(Ne=>o.areClose(Ne,ge,4))===-1&&(T=!0,x.push(ge))}}}while(T);let{vertices:D,triangleIndices:P}=O,F=[];for(let V=0;V<P.length;V+=3){let X=V,q=V+1,Z=V+2,ne=D[P[X]],te=D[P[q]],ae=D[P[Z]],Se={x:(ne.x+te.x+ae.x)/3,y:(ne.y+te.y+ae.y)/3},he=o.inPolygon(Se,u),fe=o.inPolygon(Se,f);(he&&fe&&t==="intersect"||(he||fe)&&t==="union"||(he&&!fe||!he&&fe)&&t==="difference")&&F.push([ne,te,ae])}let B=F.flatMap(([V,X,q])=>[[V,X],[X,q],[q,V]]),$=[];for(let V=0;V<B.length;V++){let X=B[V];if(V==0){$.push(X);continue}let q=$.findIndex(Z=>o.areClose(Z[0],X[0])&&o.areClose(Z[1],X[1])||o.areClose(Z[0],X[1])&&o.areClose(Z[1],X[0]));q===-1?$.push(X):$.splice(q,1)}if($.length<3)return null;let U=[],I=V=>{let{length:X}=V,q=o.areClose(V[0],V[X-1]),Z=V.slice(0,q?X-1:X);return Z.length>3&&o.inSegment(Z[0],[Z[1],Z[Z.length-1]])&&Z.shift(),Z},[G,Y]=$.shift(),W=[G,Y];for(;$.length>1;){let V=W[W.length-1],X=$.findIndex(q=>o.areClose(q[0],V)||o.areClose(q[1],V));if(X===-1){U.push({vertices:I(W.splice(0))});let[q,Z]=$.shift();W.push(q,Z)}else{let[q]=$.splice(X,1),Z=o.areClose(q[0],V)?q[1]:o.areClose(q[1],V)?q[0]:null;W.length>1&&o.inSegment(W[W.length-1],[W[W.length-2],Z])?W.splice(W.length-1,1,Z):W.push(Z)}}return U.push({vertices:I(W)}),{polygons:U,mesh:O,triangles:F.map(V=>({vertices:V}))}}static mesh(r,...e){let t=[].concat(r).concat(e),n=fh.triangulate(t);return{vertices:t,triangleIndices:n}}static intersectLines(r,e,t,n){let i,s;if(Array.isArray(r)&&Array.isArray(e)&&r.length===2&&e.length===2&&typeof r[0]=="number"&&typeof e[0]=="number"&&typeof r[1]=="number"&&typeof e[1]=="number"&&(t=e[0],n=e[1],e=r[1],r=r[0]),typeof r=="number"&&typeof e=="number"){let l=r,p=e;i=[{x:0,y:p},{x:1,y:l+p}],s=[{x:0,y:n},{x:1,y:t+n}]}else i=r,s=e;return o._intersectSegments(i,s,!1)}static cramer(r,e){Array.isArray(r)&&(r={a:r[0],b:r[1],c:r[2]}),Array.isArray(e)&&(e={a:e[0],b:e[1],c:e[2]});let t=(r.b*e.c-r.c*e.b)/(r.b*e.a-r.a*e.b),n=(r.c*e.a-r.a*e.c)/(r.b*e.a-r.a*e.b);return{x:-t.roundoff(),y:-n.roundoff()}}static mq(r,e){let t;if(gh(r)?t=r:(t=r[0],e=r[1]),t.x===e.x)return[Number.NaN,Number.NaN];let n=(e.y-t.y)/(e.x-t.x),i=t.y-n*t.x;return[n,i]}static _intersectSegments(r,e,t){let n=r[0],i=r[1],s=e[0],l=e[1],p=Math.min(n.x,i.x),u=Math.min(n.y,i.y),f=Math.max(n.x,i.x),g=f-p,v=Math.max(n.y,i.y),y=v-u,_=Math.min(s.x,l.x),x=Math.min(s.y,l.y),w=Math.max(s.x,l.x),E=w-_,k=Math.max(s.y,l.y),N=k-x;if(g===0&&E===0||y===0&&N===0)return null;let T=P=>P.x<_||P.x>w||P.x<p||P.x>f,O=P=>P.y<x||P.y>k||P.y<u||P.y>v;var D=null;if(g===0){if(t&&(_>p||w<f))return null;let P=o.mq(s,l);D=o.cramer([1,0,-p],[P[0],-1,P[1]]),t&&O(D)&&(D=null)}else if(E===0){if(t&&(p>_||f<w))return null;let P=o.mq(n,i);D=o.cramer([P[0],-1,P[1]],[1,0,-_]),t&&O(D)&&(D=null)}else if(y===0){if(t&&(x>u||k<v))return null;let P=o.mq(s,l);D=o.cramer([0,1,-u],[P[0],-1,P[1]]),t&&T(D)&&(D=null)}else if(N===0){if(t&&(u>x||v<k))return null;let P=o.mq(n,i);D=o.cramer([P[0],-1,P[1]],[0,1,-x]),t&&T(D)&&(D=null)}else{let P;if(!t||(P=o._intersectRects({x:p,y:u,width:g,height:y},{x:_,y:x,width:E,height:N}))&&P.width>0&&P.height>0){let F=o.mq(n,i),B=o.mq(s,l),$=F[0],U=B[0],I=F[1],G=B[1];if($!==U){D=o.cramer([$,-1,I],[U,-1,G]);let Y=D.x,W=D.y;t&&(Y<P.x||Y>P.x+P.width||W<P.y||W>P.y+P.height)&&(D=null)}}}return D===null?null:{x:D.x,y:D.y}}static _intersectRects(...r){return Ze.intersect(...r)}static _areClose(r,e,t=Vo){return Math.abs(r.x-e.x).isCloseTo(0,t)&&Math.abs(r.y-e.y).isCloseTo(0,t)}static areClose(r,e,t=Vo){return o._areClose(r,e,t)}static dot(r,e){return Fr.dot(r,e)}static cross(r,e){return Fr.cross(r,e)}static distance(r,e){if(YC(r))return se.distance(r[0],r[1]);if(gh(e))return se.distance(r,e);{let t=e[0],n=e[1];return Math.abs(t*r.x-r.y+n)/Math.sqrt(Math.pow(t,2)+1)}}static _pointSegmentDistance(r,e){let t=Fr.from(e[0],e[1]),n=Fr.from(e[0],r);return o.cross(t,n)}static isWithin(r,e,t,n=Vo){let i=o._pointSegmentDistance(r,e);return i.isCloseTo(0,n)?!1:t?i<0:i>0}static isBeyond(r,e,t,n=Vo){return o.isWithin(r,e,!t,n)}static inLine(r,e,t=Vo){return o._pointSegmentDistance(r,e).isCloseTo(0,t)}static inSegment(r,e,t=Vo){let n=Math.min(e[0].x,e[1].x),i=Math.max(e[0].x,e[1].x),s=Math.min(e[0].y,e[1].y),l=Math.max(e[0].y,e[1].y);return r.x>=n&&r.x<=i&&r.y>=s&&r.y<=l&&o.inLine(r,e,t)}static inTriangle(r,e){let t;for(let n=0;n<3;n++){let i=e[n],s=e[(n+1)%3],l=se.subtract(s,r),p=se.subtract(i,r),u=o.cross(l,p);if(n>0&&u*t<=0)return!1;t=u}return!0}static inPolygon(r,e,t=Vo){if(!(e?.length>=3))throw"Not enough vertices";let n=e.length;if(n===3)return o.inTriangle(r,[e[0],e[1],e[2]]);t>0&&(e=e.map(v=>({x:v.x.roundoff(t),y:v.y.roundoff(t)})),r={x:r.x.roundoff(t),y:r.y.roundoff(t)});let i=Number.MAX_VALUE,s=Number.MAX_VALUE,l=Number.MIN_VALUE,p=Number.MIN_VALUE;for(let v=0;v<n;v++){let y=e[v];i=Math.min(i,y.x),s=Math.min(s,y.y),l=Math.max(l,y.x),p=Math.max(p,y.y)}if(r.x<i||r.x>l||r.y<s||r.y>p)return!1;let u={x:i-1,y:r.y},f=[u,r],g=0;for(let v=0;v<n;v++){let y=e[v],_=e[(v+1)%n],x=[y,_];if(y.y===r.y){let w=e[(v-1+n)%n];r.x>y.x&&(w.y-r.y)*(_.y-r.y)<0&&g++}else{if(_.y===r.y)continue;o.intersect(x,f)!=null&&g++}}return g%2===1}static area(r,...e){let t=[].concat(r).concat(e),n=0,i=t.length;if(i>=3){for(let s=0;s<t.length;s++){let{x:l,y:p}=t[s],u=s===i-1?0:s+1,{x:f,y:g}=t[u];n+=l*g-p*f}n*=.5}return Math.abs(n.roundoff())}static convexHull(r,...e){let t=[].concat(r).concat(e);if(!(t?.length>1))return t?.slice()??[];let n=t.map(u=>({x:u.x,y:u.y})).sort((u,f)=>u.x===f.x?u.y-f.y:u.x-f.x),i=[];for(let u of n){let f=i[i.length-1];(!f||f.x!==u.x||f.y!==u.y)&&i.push(u)}if(i.length<=2)return i;let s=(u,f,g)=>(f.x-u.x)*(g.y-u.y)-(f.y-u.y)*(g.x-u.x),l=[];for(let u of i){for(;l.length>=2&&s(l[l.length-2],l[l.length-1],u)<=0;)l.pop();l.push(u)}let p=[];for(let u=i.length-1;u>=0;u--){let f=i[u];for(;p.length>=2&&s(p[p.length-2],p[p.length-1],f)<=0;)p.pop();p.push(f)}return l.pop(),p.pop(),l.concat(p)}};function XC(o){let r;return"vertices"in o&&Array.isArray(o.vertices)&&(r=o.vertices).length>=3&&r.every(e=>se.isPoint(e))}var Bf=class o{static{this._eps=1e-12}static isPolygon(r){return XC(r)}static from(...r){return{vertices:Array.from(r)}}static contains(r,e){return ai.inPolygon(e,r.vertices,12)}static centroid(r){let e=o.boundingBox(r);return{x:e.x+e.width/2,y:e.y+e.height/2}}static boundingBox(r){return ai.boundingBox(r.vertices)}static sides(r){let{vertices:e}=r,t=[];for(let n=1;n<=e.length;n++){let i=e[n%e.length],s=e[n-1];t.push([s,i])}return t}static isConvex(r){let{vertices:e}=r,t=e.length;if(t<=3)return!0;let n=0;for(let i=0;i<e.length;i++){let s=e[(i-1+t)%t],l=e[i],p=e[(i+1)%t],u=Wn.angleBetween(l,s,p);if(n===0){n=Math.sign(u);continue}if(n!=Math.sign(u))return!1}return!0}static isSelfIntersecting(r){let{vertices:e}=r;if(e.length<=3)return!1;let t=o.sides(r);for(let n of t)for(let i of t){if(i===n||i[0]===n[1]||n[0]===i[1])continue;let s=ai.intersect(i,n);if(!be.isNull(s))return!0}return!1}static isCounterClockwise(r){let{vertices:[e,t,n]}=r;return Wn.angleBetween(t,e,n)>0}static expand(r,e){let{vertices:t}=r,n=t.length,i=[];for(let s=0;s<t.length;s++){let l=t[(s-1+n)%n],p=t[s],u=t[(s+1)%n],f=Wn.angleBetween(p,l,u),g=-e/Math.sin(Math.abs(f)/2),v=ke.scale(ke.identity,g),y=se.subtract(p,l);Fr.normalize(y);let _=se.subtract(p,u);Fr.normalize(_);let x=se.add(y,_);Fr.normalize(x);let w=ke.multiply(x,v);i.push(se.add(p,{x:w.x.roundoff(),y:w.y.roundoff()}))}return{vertices:i}}static area(r){return ai.area(r.vertices)}static intersect(r,e){return ai.intersect(r,e)}static convexHull(r){return{vertices:ai.convexHull(r.vertices)}}};var vh=180/Math.PI,vd=1/vh,We=class o{static from(...r){if(r.length!==3)throw new RangeError("Must provide exactly 3 numbers");return{x:r[0],y:r[1],z:r[2]}}static parse(r){let e=yr(r);if(e&&e.length===3)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" 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(r,e){return{x:e.x-r.x,y:e.y-r.y,z:e.z-r.z}}static add(...r){var e={x:0,y:0,z:0};for(var t of r)e.x+=t.x,e.y+=t.y,e.z+=t.z;return e}static dot(r,e){return r.x*e.x+r.y*e.y+r.z*e.z}static cross(r,e){return{x:r.y*e.z-r.z*e.y,y:r.z*e.x-r.x*e.z,z:r.x*e.y-r.y*e.x}}static scale(r,e,t=e,n=e){return{x:r.x*e,y:r.y*t,z:r.z*n}}static magSqr(r){return r.x*r.x+r.y*r.y+r.z*r.z}static areClose(r,e){return(e.x-r.x).isCloseTo(0)&&(e.y-r.y).isCloseTo(0)&&(e.z-r.z).isCloseTo(0)}static mag(r){return Math.sqrt(o.magSqr(r))}static negate(r){return{x:-r.x,y:-r.y,z:-r.z}}static unit(r){let e={x:r.x,y:r.y,z:r.z};return this.normalize(e),e}static normalize(r){let e=o.mag(r);if(e<=0)throw"Cannot normalize a vector of length 0.";let t=1/e;r.x*=t,r.y*=t,r.z*=t}static angleBetween(r,e){let t,n=o.unit(r),i=o.unit(e);if(o.dot(n,i)<0){let l={x:-n.x-i.x,y:-n.y-i.y,z:-n.z-i.z},p=o.mag(l);t=Math.PI-2*Math.asin(p/2)}else{let l={x:n.x-i.x,y:n.y-i.y,z:n.z-i.z},p=o.mag(l);t=2*Math.asin(p/2)}return vh*t}},Vf=class o{static from(r,e,t){return{rho:r.clamp(0,1/0),theta:e.clamp(-180,180),phi:t.clamp(0,360)}}static fromVector(r,e,t){typeof r=="number"&&(r=We.from(r,e,t));let n=We.mag(r);if(n.isCloseTo(0))return o.from(0,0,0);let i=Math.atan2(r.x,r.z),s=Math.acos((r.y/n).clamp(-1,1));return o.from(n,i*vh,s*vh)}static toVector(r){let{rho:e,theta:t,phi:n}=r,i=n*vd,s=t*vd,l=Math.sin(i)*e;return{x:l*Math.sin(s),y:Math.cos(i)*e,z:l*Math.cos(s)}}static toRotationMatrix(r){let{theta:e,phi:t}=r,n=vd*e,i=Math.sin(n),s=Math.cos(n),l=vd*t,p=Math.sin(l),u=Math.cos(l);return ma.from(i*u,i*p,s,0,s*u,s*p,-i,0,-p,u,0,0,0,0,0,1)}},Uo=class o{static modify(r,e){let{m11:t,m12:n,m13:i,m14:s,m21:l,m22:p,m23:u,m24:f,m31:g,m32:v,m33:y,m34:_,offsetX:x,offsetY:w,offsetZ:E,m44:k}=r,N={m11:t,m12:n,m13:i,m14:s,m21:l,m22:p,m23:u,m24:f,m31:g,m32:v,m33:y,m34:_,offsetX:x,offsetY:w,offsetZ:E,m44:k};return e(N),N}static clone(r){return o.modify(r,e=>{})}static multiply(r,e){return ma.isIdentity(r)?e:ma.isIdentity(e)?r:ma.from(r.m11*e.m11+r.m12*e.m21+r.m13*e.m31+r.m14*e.offsetX,r.m11*e.m12+r.m12*e.m22+r.m13*e.m32+r.m14*e.offsetY,r.m11*e.m13+r.m12*e.m23+r.m13*e.m33+r.m14*e.offsetZ,r.m11*e.m14+r.m12*e.m24+r.m13*e.m34+r.m14*e.m44,r.m21*e.m11+r.m22*e.m21+r.m23*e.m31+r.m24*e.offsetX,r.m21*e.m12+r.m22*e.m22+r.m23*e.m32+r.m24*e.offsetY,r.m21*e.m13+r.m22*e.m23+r.m23*e.m33+r.m24*e.offsetZ,r.m21*e.m14+r.m22*e.m24+r.m23*e.m34+r.m24*e.m44,r.m31*e.m11+r.m32*e.m21+r.m33*e.m31+r.m34*e.offsetX,r.m31*e.m12+r.m32*e.m22+r.m33*e.m32+r.m34*e.offsetY,r.m31*e.m13+r.m32*e.m23+r.m33*e.m33+r.m34*e.offsetZ,r.m31*e.m14+r.m32*e.m24+r.m33*e.m34+r.m34*e.m44,r.offsetX*e.m11+r.offsetY*e.m21+r.offsetZ*e.m31+r.m44*e.offsetX,r.offsetX*e.m12+r.offsetY*e.m22+r.offsetZ*e.m32+r.m44*e.offsetY,r.offsetX*e.m13+r.offsetY*e.m23+r.offsetZ*e.m33+r.m44*e.offsetZ,r.offsetX*e.m14+r.offsetY*e.m24+r.offsetZ*e.m34+r.m44*e.m44)}},ma=class o{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(...r){if(r.length!==16)throw new RangeError("Must provide exactly 16 numbers");return{m11:r[0],m12:r[1],m13:r[2],m14:r[3],m21:r[4],m22:r[5],m23:r[6],m24:r[7],m31:r[8],m32:r[9],m33:r[10],m34:r[11],offsetX:r[12],offsetY:r[13],offsetZ:r[14],m44:r[15]}}static transpose(r){return o.from(r.m11,r.m21,r.m31,r.offsetX,r.m12,r.m22,r.m32,r.offsetY,r.m13,r.m23,r.m33,r.offsetZ,r.m14,r.m24,r.m34,r.m44)}static toArray(r){return[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.offsetX,r.offsetY,r.offsetZ,r.m44]}static clone(r,e){return typeof e=="function"?Uo.modify(r,e):Uo.clone(r)}static scale(r,e,t,n){return typeof e=="number"?(t??=e,n??=e):(n=e.z,t=e.y,e=e.x),Uo.modify(r,i=>{i.m11*=e,i.m22*=t,i.m33*=n})}static translate(r,e){return Uo.modify(r,t=>{t.offsetX+=e.x,t.offsetY+=e.y,t.offsetZ+=e.z})}static parse(r){let e=yr(r);if(e&&e.length===16)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" as a valid Matrix3D.`)}static isIdentity(r){return r.m11==1&&r.m12==0&&r.m13==0&&r.m14==0&&r.m21==0&&r.m22==1&&r.m23==0&&r.m24==0&&r.m31==0&&r.m32==0&&r.m33==1&&r.m34==0&&r.offsetX==0&&r.offsetY==0&&r.offsetZ==0&&r.m44==1}static isAffine(r){return r.m14==0&&r.m24==0&&r.m34==0&&r.m44==1}static determinant(r){if(o.isIdentity(r))return 1;if(o.isAffine(r))return r.m11*(r.m22*r.m33-r.m32*r.m23)-r.m12*(r.m21*r.m33-r.m31*r.m23)+r.m13*(r.m21*r.m32-r.m31*r.m22);{let e=r.m13*r.m24-r.m23*r.m14,t=r.m13*r.m34-r.m33*r.m14,n=r.m13*r.m44-r.offsetZ*r.m14,i=r.m23*r.m34-r.m33*r.m24,s=r.m23*r.m44-r.offsetZ*r.m24,l=r.m33*r.m44-r.offsetZ*r.m34,p=r.m22*t-r.m32*e-r.m12*i,u=r.m12*s-r.m22*n+r.offsetY*e,f=r.m32*n-r.offsetY*t-r.m12*l,g=r.m22*l-r.m32*s+r.offsetY*i;return r.offsetX*p+r.m31*u+r.m21*f+r.m11*g}}static multiply(...r){if(r.length===0)throw new ReferenceError("Matrix not provided.");let e=Array.from(r),t=e[0];for(let n=1;n<e.length;n++)t=Uo.multiply(t,e[n]);return t}static invert(r){if(o.isAffine(r)){let e=o.determinant(r);if(e==0)return null;let t=r.m12*r.m23-r.m22*r.m13,n=r.m32*r.m13-r.m12*r.m33,i=r.m22*r.m33-r.m32*r.m23,s=r.m21*r.m13-r.m11*r.m23,l=r.m11*r.m33-r.m31*r.m13,p=r.m31*r.m23-r.m21*r.m33,u=r.m11*r.m22-r.m21*r.m12,f=r.m11*r.m32-r.m31*r.m12,g=r.m11*r.offsetY-r.offsetX*r.m12,v=r.m21*r.m32-r.m31*r.m22,y=r.m21*r.offsetY-r.offsetX*r.m22,_=r.m31*r.offsetY-r.offsetX*r.m32,x=r.m23*g-r.offsetZ*u-r.m13*y,w=r.m13*_-r.m33*g+r.offsetZ*f,E=r.m33*y-r.offsetZ*v-r.m23*_,k=u,N=-f,T=v,O=1/e;return o.from(i*O,n*O,t*O,0,p*O,l*O,s*O,0,T*O,N*O,k*O,0,E*O,w*O,x*O,1)}else{let e=o.determinant(r);if(e==0)return null;let t=r.m33*r.m44-r.m34*r.offsetZ,n=r.m32*r.m44-r.m34*r.offsetY,i=r.m31*r.m44-r.m34*r.offsetX,s=r.m32*r.offsetZ-r.m33*r.offsetY,l=r.m31*r.offsetZ-r.m33*r.offsetX,p=r.m31*r.offsetY-r.m32*r.offsetX,u=r.m33*r.m44-r.m34*r.offsetZ,f=r.m32*r.m44-r.m34*r.offsetY,g=r.m31*r.m44-r.m34*r.offsetX,v=r.m32*r.offsetZ-r.m33*r.offsetY,y=r.m31*r.offsetZ-r.m33*r.offsetX,_=r.m31*r.offsetY-r.m32*r.offsetX,x=r.m23*r.m44-r.m24*r.offsetZ,w=r.m22*r.m44-r.m24*r.offsetY,E=r.m21*r.m44-r.m24*r.offsetX,k=r.m22*r.offsetZ-r.m23*r.offsetY,N=r.m21*r.offsetZ-r.m23*r.offsetX,T=r.m21*r.offsetY-r.m22*r.offsetX,O=r.m23*r.m34-r.m24*r.m33,D=r.m22*r.m34-r.m24*r.m32,P=r.m21*r.m34-r.m24*r.m31,F=r.m22*r.m33-r.m23*r.m32,B=r.m21*r.m33-r.m23*r.m31,$=r.m21*r.m32-r.m22*r.m31,U=r.m22*t-r.m23*n+r.m24*s,I=-(r.m21*t-r.m23*i+r.m24*l),G=r.m21*n-r.m22*i+r.m24*p,Y=-(r.m21*s-r.m22*l+r.m23*p),W=-(r.m12*u-r.m13*f+r.m14*v),V=r.m11*u-r.m13*g+r.m14*y,X=-(r.m11*f-r.m12*g+r.m14*_),q=r.m11*v-r.m12*y+r.m13*_,Z=r.m12*x-r.m13*w+r.m14*k,ne=-(r.m11*x-r.m13*E+r.m14*N),te=r.m11*w-r.m12*E+r.m14*T,ae=-(r.m11*k-r.m12*N+r.m13*T),Se=-(r.m12*O-r.m13*D+r.m14*F),he=r.m11*O-r.m13*P+r.m14*B,fe=-(r.m11*D-r.m12*P+r.m14*$),le=r.m11*F-r.m12*B+r.m13*$,re=1/e;return o.from(U*re,W*re,Z*re,Se*re,I*re,V*re,ne*re,he*re,G*re,X*re,te*re,fe*re,Y*re,q*re,ae*re,le*re)}}static transform(r,e){var t={x:r.x,y:r.y,z:r.z};if(!o.isIdentity(e)){var n=t.x,i=t.y,s=t.z;if(t.x=n*e.m11+i*e.m21+s*e.m31+e.offsetX,t.y=n*e.m12+i*e.m22+s*e.m32+e.offsetY,t.z=n*e.m13+i*e.m23+s*e.m33+e.offsetZ,!o.isAffine(e)){var l=n*e.m14+i*e.m24+s*e.m34+e.m44;l!=0&&(t.x/=l,t.y/=l,t.z/=l)}}return t}},Uf=class o{static identity(){return o.from(0,0,0,1)}static from(...r){if(r.length!==4)throw new RangeError("Must provide exactly 4 numbers");return{x:r[0],y:r[1],z:r[2],w:r[3]}}static parse(r){let e=yr(r);if(e&&e.length===4)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" as a valid Quaternion.`)}static fromVectors(r,e){We.normalize(r),We.normalize(e);let t=(i,s,l,p)=>{let u=o.from(i,s,l,p);return o.normalize(u),u},n=We.dot(r,e)+1;return n.isCloseTo(0)?Math.abs(r.x)>Math.abs(r.z)?t(-r.y,r.x,0,0):t(0,-r.z,r.y,0):t(r.y*e.z-r.z*e.y,r.z*e.x-r.x*e.z,r.x*e.y-r.y*e.x,n)}static normalize(r){let e=o.mag(r);if(e.isCloseTo(0))r.x=r.y=r.z=0,r.w=1;else{let t=1/e;r.x*=t,r.y*=t,r.z*=t,r.w*=t}}static unit(r){let e=o.from(r.x,r.y,r.z,r.w);return o.normalize(e),e}static fromAxisAngle(r,e){e%=360;var t=vd*e,n=We.mag(r);if(n==0)throw new RangeError("Invalid argument");var i=Math.sin(.5*t)/n,s=r.x*i,l=r.y*i,p=r.z*i;return o.from(s,l,p,Math.cos(.5*t))}static fromRotationMatrix(r){let e=r.m11+r.m22+r.m33+r.m44;if(e>0){let t=.5/Math.sqrt(e),n=.25/t,i=(r.m23-r.m32)*t,s=(r.m31-r.m13)*t,l=(r.m12-r.m21)*t;return o.from(i,s,l,n)}else if(r.m11>r.m22&&r.m11>r.m22){let t=.5/Math.sqrt(r.m44+r.m11-r.m22-r.m33),n=(r.m23-r.m32)*t,i=.25/t,s=(r.m12+r.m21)*t,l=(r.m31+r.m13)*t;return o.from(i,s,l,n)}else if(r.m22>r.m33){let t=.5/Math.sqrt(r.m44+r.m22-r.m11-r.m33),n=(r.m23+r.m32)*t,i=.25/t,s=(r.m12+r.m21)*t,l=(r.m31-r.m13)*t;return o.from(s,i,n,l)}else{let t=.5/Math.sqrt(r.m44+r.m33-r.m11-r.m22),n=(r.m23+r.m32)*t,i=.25/t,s=(r.m12-r.m21)*t,l=(r.m31-r.m13)*t;return o.from(l,n,i,s)}}static conjugate(r){return o.from(-r.x,-r.y,-r.z,r.w)}static mag(r){return Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z+r.w*r.w)}static norm(r){return r.x*r.x+r.y*r.y+r.z*r.z}static axis(r){return r.x==0&&r.y==0&&r.z==0?We.j():We.unit(r)}static transform(r,e){o.normalize(e);let t=We.cross(e,r),n=We.scale(t,2),i=We.cross(e,n);return{x:r.x+e.w*n.x+i.x,y:r.y+e.w*n.y+i.y,z:r.z+e.w*n.z+i.z}}static angle(r){let e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z),t=r.w;if(e>Number.MAX_VALUE){let n=Math.max(Math.abs(r.x),Math.max(Math.abs(r.y),Math.abs(r.z))),i=r.x/n,s=r.y/n,l=r.z/n;e=Math.sqrt(i*i+s*s+l*l),t/=n}return Math.atan2(e,t)*114.59155902616465}static toRotationMatrix(r){var e=ma.identity(),t=r.x,n=r.y,i=r.z,s=r.w;return e.m11=1-2*n*n-2*i*i,e.m12=2*t*n+2*s*i,e.m13=2*t*i-2*s*n,e.m21=2*t*n-2*s*i,e.m22=1-2*t*t-2*i*i,e.m23=2*n*i+2*s*t,e.m31=2*s*n+2*t*i,e.m32=2*n*i-2*s*t,e.m33=1-2*t*t-2*n*n,e}static invert(r){let e=o.unit(r);return o.conjugate(e)}static multiply(r,e){return o.from(r.w*e.x+r.x+e.w+r.y*e.z-r.z*e.y,r.w*e.y-r.x*e.z+r.y*e.w+r.z*e.x,r.w*e.z+r.x*e.y-r.y*e.x+r.z*e.w,r.w*e.w-r.x*e.x-r.y*e.y-r.z*e.z)}static dot(r,e){var t=o.multiply(r,o.conjugate(e));return t.w}};var zf=class{static intersect(r,e){let[t,n]=r,i=We.subtract(t,n),[s,l,p]=e,u=We.subtract(s,l),f=We.subtract(s,p),g=We.cross(i,f),v=We.dot(u,g);if(v.isCloseTo(0))return null;let y=1/v,_=We.subtract(t,s),x=y*We.dot(_,g);if(x<0||x>1)return null;let w=We.cross(_,u),E=y*We.dot(i,w);if(E<0||x+E>1)return null;let k=y*We.dot(f,w);return k<0||k.isCloseTo(0)?null:We.add(t,We.scale(i,k))}};var Gf={};Le(Gf,{Matrix3D:()=>ma,Quaternion:()=>Uf,Spherical:()=>Vf,Vector:()=>Fr,Vector3D:()=>We});var Hb={};Le(Hb,{Complex:()=>Kt,DataAnalysis:()=>Qf,NumberTheory:()=>rg});function oi(o){return typeof o=="number"&&(o={real:o,img:0}),o}var Rb;function zo(o,r){let e={};return Object.defineProperty(e,"real",{value:o,writable:!1}),Object.defineProperty(e,"img",{value:r,writable:!1}),e}function Ff(){return Rb||(Rb=zo(Number.NaN,Number.NaN))}var Kt=class{static build(r,e){return this.isComplex(r)?r:(e??=0,typeof r!="number"||typeof e!="number"?Ff():zo(r,e||0))}static add(r,e){let t=oi(r),n=oi(e);return zo(t.real+n.real,t.img+n.img)}static subtract(r,e){let t=oi(r),n=oi(e);return zo(t.real-n.real,t.img-n.img)}static multiply(r,e){let t=oi(r),n=oi(e);return zo(t.real*n.real-t.img*n.img,t.real*n.img+t.img*n.real)}static divide(r,e){let t=oi(r),n=oi(e),i=this.absSquare(n).roundoff();if(i===0)return Ff();let s=1/i;return zo(s*(t.real*n.real+t.img*n.img),s*(t.img*n.real-t.real*n.img))}static absSquare(r){let e=oi(r);return Math.pow(e.real,2)+Math.pow(e.img,2)}static modulus(r){return Math.sqrt(this.absSquare(r))}static isComplex(r){return r!=null&&typeof r=="object"&&"real"in r&&"img"in r&&typeof r.real=="number"&&typeof r.img=="number"}static conjugate(r){return r=oi(r),zo(r.real,Math.abs(r.img)==0?0:-r.img)}static equals(r,e){let t=this.build(r),n=this.build(e);return!this.isComplex(r)||!this.isComplex(e)?!1:t.real===n.real&&t.img===n.img}static get NaC(){return Ff()}};var Qf={};Le(Qf,{Fourier:()=>jf,Gaussian:()=>vc,Lagrange:()=>bh,Lagrangian:()=>eE,Newton:()=>Xf,Pchip:()=>Yf,SearchFunctions:()=>lE,Utils:()=>Kf});function qC(o,r){let e=2*Math.PI*o/r;return Kt.build(Math.cos(e),Math.sin(e))}var Ob={};function Pb(o,r){let e=Ob[r]=Ob[r]||{};return e[o]=e[o]||qC(o,r)}function KC(o){return o>0&&(o&o-1)===0}function Wf(o){let r=[],e=o.length;if(e===1)return[Kt.build(o[0])];let t=Wf(o.filter((s,l)=>l%2===0)),n=Wf(o.filter((s,l)=>l%2===1));for(var i=0;i<e/2;i++){let s=t[i],l=Kt.multiply(Pb(i,e),n[i]);r[i]=Kt.add(s,l),r[i+e/2]=Kt.subtract(s,l)}return r}var jf=class{static transform(r,e=!0){return r=r||[],KC(r.length)?this.fft(r,e):this.dft(r,e)}static invert(r,e=!0){return this.idft(r||[],e)}static dft(r,e=!0){let t=(r||[])?.length,n=e?1/Math.sqrt(t):1,i=[];for(let s=0;s<t;s++){i.push({real:0,img:0});for(let l=0;l<t;l++){let p=Pb(s*l,t),u=Kt.multiply(r[l],p),f=Kt.multiply(u,n);i[s]=Kt.add(i[s],f)}}return i}static idft(r,e=!0){let t=r.map(i=>Kt.build(i.img,i.real));return this.transform(t,e).map(i=>Kt.build(i.img,i.real))}static fft(r,e=!0){let t=Wf(r);if(!e)return t;let n=1/Math.sqrt(r.length);return t.map(i=>Kt.multiply(i,n))}};var JC=Math.sqrt(Math.PI);function ZC(o){let r=Math.abs(o),e=1/(1+.5*r),t=e*Math.exp(-r*r-1.26551223+e*(1.00002368+e*(.37409196+e*(.09678418+e*(-.18628806+e*(.27886807+e*(-1.13520398+e*(1.48851587+e*(-.82215223+e*.17087277)))))))));return o>=0?t:2-t}var vc=class{constructor(r,e){this.mean=r,this.stdev=Math.abs(e),this.variance=Math.pow(e,2)}static get normal(){return QC}weight(r){return Math.exp(-.5*Math.pow(this._z(r),2))}probabilityDensity(r){let e=this.stdev*Math.SQRT2*JC;return this.weight(r)/e}_z(r){return(r-this.mean)/this.stdev}probability(r){return .5*ZC(-this._z(r)/Math.SQRT2)}},QC=new vc(0,1);var bh=class o{constructor(r){this.#e=r}#e;#t=null;_prepareBarycentric(){if(this.#t)return;let r=this.#e||[],e=r.length;if(e===0){this.#t=[];return}let t=new Array(e),n=new Array(e);for(let l=0;l<e;l++){let p=0,u=1,f=r[l].x;for(let g=0;g<e;g++){if(g===l)continue;let v=f-r[g].x;if(v===0)throw new Error("Invalid function provided.");v<0&&(u=-u),p+=Math.log(Math.abs(v))}t[l]=-p,n[l]=u}let i=t[0];for(let l=1;l<e;l++)t[l]>i&&(i=t[l]);let s=new Array(e);for(let l=0;l<e;l++){let p=Math.exp(t[l]-i);s[l]=n[l]*p}this.#t=s}_computeBarycentric(r){let e=this.#e||[];this.#t||this._prepareBarycentric();let t=this.#t||[],n=0,i=0;for(let s=0;s<e.length;s++){let l=e[s].x;if(r===l)return e[s].y;let p=t[s]/(r-l);n+=p*e[s].y,i+=p}return n/i}interpolate(r){return this._computeBarycentric(r)}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}},eE={create:bh.create},Yf=class o{constructor(r){if(!r||r.length<2)throw new Error("Need at least 2 points");let e=r.slice().sort((t,n)=>t.x-n.x);this.xs=e.map(t=>t.x),this.ys=e.map(t=>t.y),this.ms=this.computeDerivatives()}computeDerivatives(){let r=this.xs.length,e=new Array(r-1),t=new Array(r-1);for(let i=0;i<r-1;i++)e[i]=this.xs[i+1]-this.xs[i],t[i]=(this.ys[i+1]-this.ys[i])/e[i];let n=new Array(r).fill(0);n[0]=t[0],n[r-1]=t[r-2];for(let i=1;i<r-1;i++){let s=t[i-1],l=t[i];if(s===0||l===0||s*l<=0)n[i]=0;else{let p=2*e[i]+e[i-1],u=e[i]+2*e[i-1];n[i]=(p+u)/(p/s+u/l)}}for(let i=0;i<r-1;i++)if(t[i]===0)n[i]=0,n[i+1]=0;else{let s=n[i]/t[i],l=n[i+1]/t[i],p=s*s+l*l;if(p>9){let u=3/Math.sqrt(p);n[i]=u*s*t[i],n[i+1]=u*l*t[i]}}return n}interpolate(r){let e=this.xs,t=this.ys,n=this.ms,i=e.length;if(r<=e[0]){let w=n[0];return t[0]+w*(r-e[0])}if(r>=e[i-1]){let w=n[i-1];return t[i-1]+w*(r-e[i-1])}let s=0,l=i-1;for(;l-s>1;){let w=s+l>>1;e[w]<=r?s=w:l=w}let p=e[s+1]-e[s],u=(r-e[s])/p,f=u*u,g=f*u,v=2*g-3*f+1,y=g-2*f+u,_=-2*g+3*f,x=g-f;return v*t[s]+y*(n[s]*p)+_*t[s+1]+x*(n[s+1]*p)}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}},Xf=class o{constructor(r){if(!r||r.length===0)throw new Error("Need at least 1 point");let e=r.slice().sort((i,s)=>i.x-s.x);this.xs=e.map(i=>i.x);let t=e.length,n=e.map(i=>i.y);for(let i=1;i<t;i++)for(let s=t-1;s>=i;s--){let l=this.xs[s]-this.xs[s-i];if(l===0)throw new Error("Invalid function provided.");n[s]=(n[s]-n[s-1])/l}this.coeffs=n}interpolate(r){let e=this.xs,t=this.coeffs,n=t.length;if(n===0)return NaN;let i=t[n-1];for(let s=n-2;s>=0;s--)i=i*(r-e[s])+t[s];return i}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}};var li=(o,r)=>o;function tE(o,r=li){let e=Object.groupBy(o,r),t,n=0;for(let i in e){let s=e[i].length;s>n&&(t=parseInt(i),n=s)}return t}function rE(o,r=li){let e=o.slice(0),t=e.length;e.sort((i,s)=>{let l=r(i),p=r(s);return l-p});let n=Math.ceil(e.length/2)-1;return t%2==1?e[n]:.5*(e[n+1]+e[n])}function $b(o,r=li){return o.reduce((e,t,n)=>e+r(t,n),0)}function yh(o,r=li){return $b(o,r)/o.length}function qf(o,r=li,e=!1){let t=yh(o,r);return o.reduce((n,i)=>Math.pow(i-t,2)+n,0)/(o.length-(e?1:0))}function Ib(o,r=li,e=!1){let t=qf(o,r,e);return Math.sqrt(t)}function nE(o,r,e=li,t=li){let n=Array.isArray(r);if(n&&r.length!==o.length)throw new Error("Sets must be of the same length.");let i=o.length,s=o,l=n?r:o,p=n?e:r,u=n?t:e,f=yh(s,p),g=yh(l,u),v=0,y=0,_=0;for(let x=0;x<i;x++){let w=s[x],E=l[x],k=p(w,x)-f,N=u(E,x)-g;v+=k*N,y+=k*k,_+=N*N}return v/Math.sqrt(y*_)}function iE(o,r,e=li,t=li){let n=Array.isArray(r);if(n&&r.length!==o.length)throw new Error("Sets must be of the same length.");let i=o,s=n?r:o,l=n?e:r,p=n?t:l,u=l??(N=>N.x),f=p??(N=>N.y),g=o.length,v=0,y=0,_=0,x=0,w=0;for(let N=0;N<g;N++){let T=i[N],O=s[N],D=u(T,N),P=f(O,N);v+=D*P,y+=D,_+=P,x+=D*D,w+=P*P}let E=(g*v-y*_)/(g*x-Math.pow(y,2)),k=(_-E*y)/g;return[E,k]}var Kf=class{static sum(r,e){return $b(r,e)}static mean(r,e){return yh(r,e)}static median(r,e){return rE(r,e)}static mode(r,e){return tE(r,e)}static var(r,e){return qf(r,e,!0)}static varp(r,e){return qf(r,e,!1)}static stdevp(r,e){return Ib(r,e,!1)}static stdev(r,e){return Ib(r,e,!0)}static correlation(r,e,t,n){return nE(r,e,t,n)}static linearRegression(r,e,t,n){return iE(r,e,t,n)}static gaussian(r,e){return new vc(r,e)}};function Jf(o,r){return(t,n,i,s)=>{let l=t,p=n,u=o(l,p),f=r(l,p),g=i(u),v=i(f);for(;p-l>s;)g<v?(p=f,f=u,v=g,u=o(l,p),g=i(u)):(l=u,u=f,g=v,f=r(l,p),v=i(f));return .5*(u+f)}}var Zf=.001,sE=(o,r,e,t=Zf)=>Jf((p,u)=>u-(u-p)/1.618,(p,u)=>p+(u-p)/1.618)(o,r,e,t);function aE(o){if(o<=1)throw new RangeError("segments must be a number grater than 1.");return(r,e,t,n=Zf)=>Jf((p,u)=>p+(u-p)/o,(p,u)=>u-(u-p)/o)(r,e,t,n)}var oE=(o,r,e,t=Zf)=>{var n=null,i=null;let s=(f,g)=>(i??=g-f,n??=i/Math.sqrt(12),n*(g-f)/i);return Jf((f,g)=>Math.max(f,(g+f)/2-s(f,g)),(f,g)=>Math.min(g,(g+f)/2+s(f,g)))(o,r,e,t)},lE={linear:(o=2)=>aE(o),goldenRatio:sE,gaussian:oE};var rg={};Le(rg,{Utils:()=>tg});var _h="0123456789abcdefghijklmnopqrstuvwxyz",eg=`Radix out of range: possible values go between positive 1 exclusive and ${_h.length} inclusive`,tg=class o{static lcd(...r){if(be.isNullOrEmpty(r)||r.length<=1)throw"Insufficient set of numbers.";function e(i,s){return s?e(s,i%s):s===0?i:NaN}function t(i,s){return i*s/e(i,s)}let n=Math.round(r[0]);for(let i=1;i<r.length;i++)n=t(n,Math.round(r[i]));return n}static gcd(r,e){return r=Math.round(r),e=Math.round(e),r===0?e:o.gcd(e%r,r)}static rebaseInt(r,e,t){return go.rebase(r,e,t)}static rebaseFloat(r,e,t,n=12){let i=o.rebaseFloat10ToN,s=o.rebaseFloatNTo10;if(e===10){let p=parseFloat(r.toString());return t%1===0?o.rebaseFloat10ToNIntBase(p,t,n):i(p,t,n)}if(t===10)return s(r.toString(),e,n);let l=s(r.toString(),e,n+1);return i(l,t,n)}static rebaseFloatNTo10(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=(r??"0").toString().toLowerCase(),s=Number.NaN;if(i==="0")return 0;let l=/^([-+]?) *([\da-z]+)?(.[\da-z]+)?$/.exec(i);if(l.length<2)return s;let p=l[1]==="-"?-1:1,u=l[2]||"0",f=l[3]||".0",g=0,v=0;for(let y of u+f.substr(1)){let _=n.indexOf(y);if(_===-1||_>=e)return s;g+=_*Math.pow(e,u.length-v-1),v++}return p*g}static rebaseFloat10ToNIntBase(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=e,s=Math.abs(r??0);if(s===0||Number.isNaN(s))return r.toString();let l=(s%1).roundoff(),p="";do{let f=s/i,g=Math.floor(f),v=(s-g*i).roundoff(),y=Math.floor(v);if(y>=n.length?p=`[${y}]`+p:p=n[y]+p,g<=0)break;s=g}while(!0);if(p=p.replace(/^0+/,""),p||="0",l===0)return p;let u="";do{s=(l*i).roundoff();let f=Math.floor(s),g=(s-f).roundoff();f>=n.length?u=`[${f}]`:u+=n[f],l=g}while(!l.isCloseTo(0)&&u.length<t);return/^0*$/.test(u)?p:(Math.sign(r)<0?"-":"")+p+"."+u.replace(/0+$/,"")}static rebaseFloat10ToN(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=e,s=Math.abs(r??0);if(s===0||Number.isNaN(s))return r.toString();let l=Math.sign(r)<0?"-":"",p=[],u=[];for(let y=0;y<20;y++)p.push("0"),u.push("0");let f=i%1===0?i:Math.ceil(i);function g(y,_,x){let w=y?p:u,E=w[_]=w[_]||"0",k=n.indexOf(E)+x,N=k%f,T=Math.floor(k/f);return w[_]=n[N],T>0&&(y?g(y,_+1,T):_===0?g(!0,0,T):g(!1,_-1,T)),T}let v=0;do{let y=Math.floor(go.log(s,i)),_=y>=0,x=_?y:Math.abs(1+y);if(g(_,x,1),s=(s-Math.pow(i,y).roundoff()).roundoff(),_||v++,s===0||v>=100){let w=l+(p.reverse().map(k=>k||"0").join("").replace(/^0+/,"")||"0"),E=u.map(k=>k||"0").join("").substr(0,t).replace(/0+$/,"");return/^0*$/.test(E)?w:w+"."+E}}while(!0)}};var Vb={};Le(Vb,{BooleanOrNumberConverter:()=>ig,DragEvent:()=>Go,KnownShader:()=>kn,LineGeometry:()=>ga,MaterialElement:()=>ft,MeshGeometry:()=>ze,NodeGeometry:()=>Yo,NotifyChange:()=>jo,Pacem3DAdapterElement:()=>fa,Pacem3DCameraElement:()=>jr,Pacem3DGroupElement:()=>di,Pacem3DLightElement:()=>Er,Pacem3DMeshElement:()=>En,Pacem3DObjectElement:()=>wn,Pacem3DOrthographicCameraElement:()=>Wr,Pacem3DPerspectiveCameraElement:()=>pi,Point3DConverter:()=>Ji,Point3DOrNumberConverter:()=>xh,QuaternionConverter:()=>ng,RenderableElement:()=>ci,RenderableEvent:()=>Fo,StalePropertyFlag:()=>hi,UI3DEvent:()=>xc,Ui3DElement:()=>At,computePlaneNormal:()=>ag,computeSharpVertexNormals:()=>Dt,isBasicMaterial:()=>kh,isCamera:()=>Vt,isGeometry:()=>_d,isGroup:()=>Wo,isInteraction:()=>wh,isLambertMaterial:()=>Mh,isLight:()=>ui,isLineMaterial:()=>va,isMaterial:()=>Yr,isMesh:()=>wr,isMeshGeometry:()=>Ec,isOrthographicCamera:()=>Eh,isPerspectiveCamera:()=>Ch,isPhongMaterial:()=>Sh,isRenderable:()=>yd,isShaderMaterial:()=>Bb,isStage:()=>sg,isStandardMaterial:()=>Lh,isUi3DObject:()=>Cc});var Ji={convert:o=>we.LinearAlgebra.Vector3D.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0}`},xh={convert:o=>{let r=yr(o),e=()=>{throw new Error(`Cannot parse "${o}" as a valid Vector3D.`)};if(a.isNullOrEmpty(r)&&e(),r.length===3)return we.LinearAlgebra.Vector3D.from(...r);if(r.length===1){let t=r[0];return we.LinearAlgebra.Vector3D.from(t,t,t)}e()},convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0}`},ng={convert:o=>we.LinearAlgebra.Quaternion.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0} ${o.w||0}`},ig={convert:o=>o==="true"?!0:o==="false"?!1:yr(o)[0],convertBack:o=>o.toString()};var Zi=Math.PI/180;var bc,yc,Jt=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._itemPropertyChangeHandler=e=>{let t=e.target;this.adapter&&this.adapter.updateItem(this,t),t.flags.splice(0)};this._clickHandler=e=>{let t=this;if(!t.interactive||a.isNull(t._lastHitResult))return;let n=e.type.replace(/^mouse/,""),i=t._lastHitResult,s=i.object,l=i.point;this._itemDispatch(s,l,n,e)};this._hitTestCallback=(e,t)=>{let n=this;if(e!=n._lastHitResult){if(e?.object!=n._lastHitResult?.object){let i=e?.object,s=n._lastHitResult?.object,l=e?.point;a.isNull(s)||this._itemDispatch(s,l,"out",t),a.isNull(i)||this._itemDispatch(i,l,"over",t)}n._lastHitResult=e}};this._moveHandler=e=>{let t=this;if(!t.adapter||!t.interactive)return;let n=t._resizer.currentSize,i=l=>t._hitTestCallback(l,e),s=e.type==="mousemove"?{x:e.pageX-n.left,y:e.pageY-n.top}:{x:-1,y:-1};t.adapter.raycast(this,s,n,i)};z(this,bc);this._resizeHandler=e=>{let t=M(this,bc),n=e.detail;if(!a.isNull(t)&&t.height===n.height&&t.width===n.width)return;H(this,bc,n);let i=this.adapter;a.isNull(i)||(this.adapter.invalidateSize(this,n),this.dispatchEvent(new R.ResizeEvent(n)))};z(this,yc)}validate(e){return e instanceof ci}get stage(){return this._container}get scene(){return this.adapter&&this.adapter.getScene(this)}register(e){let t=super.register(e);return t&&(this._add(e),e.addEventListener(ee,this._itemPropertyChangeHandler,!1)),t}unregister(e){let t=super.unregister(e);return t&&(e.removeEventListener(ee,this._itemPropertyChangeHandler,!1),this._erase(e)),t}_refreshDatasource(e=this.datasource){this.adapter?.updateItem(this,void 0)}_buildUpDatasourceFromDOM(e=this.items){a.isNullOrEmpty(e)||(this.datasource=e.slice())}_add(e){this.adapter&&this.adapter.addItem(this,e)}_erase(e){this.adapter&&this.adapter.removeItem(this,e)}_initializeAdapter(e,t){return new Promise((n,i)=>{let s=this.datasource||[];a.isNull(e)||s.forEach(l=>e.removeItem(this,l)),!a.isNull(this._container)&&!a.isNull(t)?t.initialize(this).then(l=>{(s||[]).forEach(p=>this._add(p)),n()},l=>{this.log(ce.LogLevel.Error,l?.toString()),i(l)}):n()})}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"adapter":this._initializeAdapter(t,n);break;case"items":this._buildUpDatasourceFromDOM(n);break;case"transparent":this.adapter?.invalidateSize(this,this.size);break;case"datasource":this._refreshDatasource(n);case"disabled":case"background":this.render();break}}viewActivatedCallback(){super.viewActivatedCallback();let e=this._container,t=this._resizer;t.addEventListener("resize",this._resizeHandler,!1),t.target=e,this._initializeAdapter(null,this.adapter).then(n=>{e.addEventListener("mousemove",this._moveHandler,!1),e.addEventListener("click",this._clickHandler,!1),e.addEventListener("mouseup",this._clickHandler,!1),e.addEventListener("mousedown",this._clickHandler,!1),e.addEventListener("mouseout",this._moveHandler,!1),this._buildUpDatasourceFromDOM(),this.render()})}_itemDispatch(e,t,n,i){if(!a.isNull(e)){var s,l,p;i instanceof Event?l=i:s={item:e,offset:i},typeof n=="string"?p=n:(p=n.type,l=n.originalEvent);let f=t,g=()=>i instanceof Event?new Fo(p,e,l,f):new Go(p,{detail:s,cancelable:p===J.DragDropEventType.Init||p===J.DragDropEventType.Drag},l,f),v=i instanceof Event?new Fo("item"+p,e,l,f):new Go("item"+p,{detail:s,cancelable:p===J.DragDropEventType.Init||p===J.DragDropEventType.Drag},l,f);var u=!1;if(e instanceof EventTarget){let y=g();e.dispatchEvent(y),u=y.defaultPrevented}return e.stage.dispatchEvent(v),u||v.defaultPrevented}return!1}disconnectedCallback(){M(this,yc)?.stop();let e=this._resizer,t=this._container;a.isNull(t)||(t.removeEventListener("click",this._clickHandler,!1),t.removeEventListener("mouseup",this._clickHandler,!1),t.removeEventListener("mousedown",this._clickHandler,!1),t.removeEventListener("mousemove",this._moveHandler,!1),t.removeEventListener("mouseout",this._moveHandler,!1)),a.isNull(e)||e.removeEventListener("resize",this._resizeHandler,!1),super.disconnectedCallback()}get size(){return M(this,bc)}render(e,t,n=performance.now()){if(a.isNull(e))M(this,yc)?.stop(),H(this,yc,Bt.Timer.run(i=>this._doRender()));else{let i=this.adapter;a.isNull(i)||i.updateItem(this,e)}}_doRender(){if(!this.disabled&&!a.isNull(this.adapter)){let e=this.adapter.getScene(this),t=new CustomEvent("prerender",{detail:{scene:e},cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(this.adapter.render(this),this.dispatchEvent(new CustomEvent("render",{detail:{scene:e}})))}}};bc=new WeakMap,yc=new WeakMap,c([S(`.${b}-3d`)],Jt.prototype,"_container",2),c([S(d+"-resize")],Jt.prototype,"_resizer",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"interactive",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"transparent",2),c([h({emit:!1,converter:m.String})],Jt.prototype,"background",2),c([h({emit:!1,converter:m.Element})],Jt.prototype,"adapter",2),c([h({emit:!1,converter:m.Json})],Jt.prototype,"datasource",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"orbit",2),Jt=c([C({tagName:d+"-"+"3d",shadow:j.USE_SHADOW_ROOT,template:`<${d}-resize watch-position="true"></${d}-resize><div class="${b}-3d"></div><${d}-content></${d}-content>`})],Jt);function sg(o){return!a.isNull(o)&&"render"in o&&typeof o.render=="function"}function yd(o){return sg(o?.stage)}function Cc(o){return"transformMatrix"in o&&yd(o)}function Vt(o){return"type"in o&&"up"in o&&"lookAt"in o&&yd(o)}function Ch(o){return Vt(o)&&"type"in o&&o.type==="perspective"}function Eh(o){return Vt(o)&&"type"in o&&o.type==="orthographic"}function ui(o){return"type"in o&&(o.type==="ambient"||o.type==="omni"||o.type==="direction"||o.type=="spot")&&yd(o)}function wr(o){return"geometry"in o&&Cc(o)}function _d(o){return"positions"in o&&a.isArray(o.positions)}function Ec(o){return("triangleIndices"in o&&a.isArray(o.triangleIndices)||"normals"in o&&a.isArray(o.normals)||"textureCoordinates"in o&&a.isArray(o.textureCoordinates))&&_d(o)}function Wo(o){return"childRenderables"in o&&a.isArray(o.childRenderables)&&Cc(o)}function Dt(o){let r=[];if(!a.isNullOrEmpty(o)){let e=o.triangleIndices;if(e.length%3!==0)throw new RangeError(`Invalid mesh geometry: ${e.length} is not multiple of 3.`);for(let t=2;t<e.length;t+=3){let n=e[t-2],i=e[t-1],s=e[t],l=o.positions[n],p=o.positions[i],u=o.positions[s],f=ag(l,p,u);r.push(f,f,f)}}o.normals=r}function ag(o,r,e){let t=we.LinearAlgebra.Vector3D.subtract(o,r),n=we.LinearAlgebra.Vector3D.subtract(o,e),i=we.LinearAlgebra.Vector3D.cross(t,n);return we.LinearAlgebra.Vector3D.unit(i)}var xc=class extends ht{constructor(r,e,t,n){super(r,e,t),this.#e=n}#e;get point(){return this.#e}},Go=class extends xc{},Fo=class extends xc{constructor(r,e,t,n){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}},hi=(p=>(p.Position="position",p.Transform="transform",p.Geometry="geometry",p.Children="children",p.Material="material",p.Light="light",p.Camera="camera",p.Visibility="visibility",p))(hi||{});function wh(o){return typeof o=="object"&&"time"in o&&typeof o.time=="number"}var Qi={OBJECT_SELECTOR:d+"-"+"3d"+"-object",LIGHT_SELECTOR:d+"-"+"3d"+"-light",PERSPECTIVE_CAMERA_SELECTOR:d+"-"+"3d"+"-perspective-camera",ORTHO_CAMERA_SELECTOR:d+"-"+"3d"+"-orthographic-camera",LINE_SELECTOR:d+"-"+"3d"+"-line",MESH_SELECTOR:d+"-"+"3d"+"-mesh",GROUP_SELECTOR:d+"-"+"3d"+"-group",DEFAULT_COORDS:{x:0,y:0,z:0}},_c=class _c extends R.PacemCrossItemsContainerElement{constructor(){super(...arguments);this.position=Qi.DEFAULT_COORDS;this.#e=[]}validate(e){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||A.findAncestorOfType(this,Jt)}get parent(){return this._drawableParent=this._drawableParent||A.findAncestor(this,e=>e instanceof _c)}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"hide":this.setAsDirty("visibility");break;case"items":this.setAsDirty("children");break;case"position":this.setAsDirty("position");break}}#e;get flags(){return this.#e}setAsDirty(...e){for(let t of e)this.flags.includes(t)||this.flags.push(t);this.stage?.render(this)}};c([h({emit:!1,converter:Ji})],_c.prototype,"position",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],_c.prototype,"tag",2),c([h({emit:!1,converter:m.Boolean})],_c.prototype,"inert",2);var ci=_c,At=class extends ci{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"transformMatrix":this.setAsDirty("transform");break;case"translateZ":case"translateX":case"translateY":this.offset={x:this.translateX,y:this.translateY,z:this.translateZ};break;case"scaleX":case"scaleY":case"scaleZ":this.scale={x:this.scaleX,y:this.scaleY,z:this.scaleZ};break;case"scale":case"offset":case"rotate":this._computeTransformMatrix();break}}_computeTransformMatrix(){let r=we.LinearAlgebra.Matrix3D,e=we.LinearAlgebra.Vector3D,t=we.LinearAlgebra.Quaternion,n=this.scale??e.from(1,1,1),i=r.scale(r.identity(),n);if(!a.isNull(this.rotate)){let l=t.toRotationMatrix(this.rotate);i=r.multiply(i,l)}let s=this.offset??e.from(0,0,0);i=r.translate(i,s),this.transformMatrix=i}};c([h({emit:!1,converter:ng})],At.prototype,"rotate",2),c([h({emit:!1,converter:xh})],At.prototype,"scale",2),c([h({emit:!1,converter:xh})],At.prototype,"offset",2),c([h({emit:!1})],At.prototype,"transformMatrix",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleX",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleY",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleZ",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateX",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateY",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateZ",2);var bd,di=class extends At{constructor(){super(...arguments);z(this,bd,[])}validate(e){return e instanceof ci}get childRenderables(){return M(this,bd)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"items":case"datasource":H(this,bd,n||[]),this.setAsDirty("children");break}}};bd=new WeakMap,c([h({emit:!1})],di.prototype,"datasource",2),di=c([C({tagName:Qi.GROUP_SELECTOR})],di);var En=class extends At{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"geometry":this.setAsDirty("geometry");break;case"material":case"backMaterial":this.setAsDirty("material");break}}};c([h({emit:!1,converter:m.Json})],En.prototype,"geometry",2),c([h({emit:!1,converter:m.Json})],En.prototype,"material",2),c([h({emit:!1,converter:m.Json})],En.prototype,"backMaterial",2),En=c([C({tagName:Qi.MESH_SELECTOR})],En);var wn=class extends At{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),(r==="content"||r==="type")&&this.setAsDirty("geometry","material")}};c([h({emit:!1})],wn.prototype,"content",2),c([h({emit:!1,converter:m.String})],wn.prototype,"type",2),wn=c([C({tagName:Qi.OBJECT_SELECTOR})],wn);var Er=class extends ci{constructor(){super(...arguments);this.intensity=.85;this.target=Qi.DEFAULT_COORDS;this.color="#fff";this.type="omni"}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"type":case"color":case"intensity":case"target":this.setAsDirty("light");break}}};c([h({emit:!1,converter:m.Number})],Er.prototype,"intensity",2),c([h({emit:!1,converter:Ji})],Er.prototype,"target",2),c([h({emit:!1,converter:m.String})],Er.prototype,"color",2),c([h({emit:!1,converter:m.String})],Er.prototype,"type",2),Er=c([C({tagName:Qi.LIGHT_SELECTOR})],Er);var jr=class extends ci{constructor(){super(...arguments);this.near=.1;this.far=1e3;this.up=we.LinearAlgebra.Vector3D.j();this.lookAt=Qi.DEFAULT_COORDS}#e;_resetBoundingSphere(){let e=this.#e,t=this.position,n=this.lookAt,i=a.isNullOrEmpty(t)||a.isNullOrEmpty(n)?0:we.LinearAlgebra.Vector3D.mag(we.LinearAlgebra.Vector3D.subtract(t,n)),s=this.#e={center:n,radius:i};this.dispatchEvent(new ue({currentValue:s,propertyName:"boundingSphere",oldValue:e}))}get boundingSphere(){return this.#e}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"lookAt":case"position":this._resetBoundingSphere();case"near":case"far":case"up":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],jr.prototype,"near",2),c([h({emit:!1,converter:m.Number})],jr.prototype,"far",2),c([h({emit:!1,converter:Ji})],jr.prototype,"up",2),c([h({emit:!1,converter:Ji})],jr.prototype,"lookAt",2);var pi=class extends jr{constructor(){super(...arguments);this.fov=45;this.aspect=1}get type(){return"perspective"}get aspectRatio(){return this.aspect}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"fov":case"aspect":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],pi.prototype,"fov",2),c([h({emit:!1,converter:m.Number})],pi.prototype,"aspect",2),pi=c([C({tagName:Qi.PERSPECTIVE_CAMERA_SELECTOR})],pi);var Wr=class extends jr{constructor(){super(...arguments);this.top=1;this.left=-1;this.bottom=-1;this.right=1}get type(){return"orthographic"}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"top":case"left":case"bottom":case"right":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],Wr.prototype,"top",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"left",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"bottom",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"right",2),Wr=c([C({tagName:Qi.ORTHO_CAMERA_SELECTOR})],Wr);var fa=class extends K{};function jo(o){return(r,e,t)=>{let n=`_${e}_${a.uniqueCode()}_backingField`;function i(){return this[n]}function s(l){if(l!==this[n]){let p=this[n];this[n]=l,o.call(this,e,p,l)}}Object.defineProperty(r,e,{get:function(){return i.call(this)},set:function(l){s.call(this,l)},enumerable:!0,configurable:!1})}}var Yo=class{constructor(r=[]){this.positions=r}static barycenter(r){var e={x:0,y:0,z:0};if(!a.isNullOrEmpty(r)){for(var t=r.length,n=0;n<r.length;n++){var i=r[n];e.x+=i.x,e.y+=i.y,e.z+=i.z}var s=1*t;e.x/=s,e.y/=s,e.z/=s}return e}static boundingBox(r){let e={minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0};if(!a.isNullOrEmpty(r))for(var t=0;t<r.length;t++){var n=r[t];e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.minZ=Math.min(e.minZ,n.z),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y),e.maxZ=Math.max(e.maxZ,n.z)}return e}setAsDirty(){wc.call(this)}};function wc(){let o=this;o.flags=["geometry"]}var ga=class extends Yo{};c([jo(wc)],ga.prototype,"positions",2);var ze=class extends Yo{#e;#t;#r;get barycenter(){return this.#r??=Yo.barycenter(this.positions)}set barycenter(r){this.#r=r}get boundingBox(){return this.#e??=Yo.boundingBox(this.positions)}set boundingBox(r){this.#e=r}get boundingSphere(){return this.#t}set boundingSphere(r){this.#t=r}constructor(r,e,t=[],n=[]){super(r),this.triangleIndices=e,this.textureCoordinates=t,this.normals=n}};c([jo(wc)],ze.prototype,"positions",2),c([jo(wc)],ze.prototype,"triangleIndices",2),c([jo(wc)],ze.prototype,"textureCoordinates",2),c([jo(wc)],ze.prototype,"normals",2);var kn=(s=>(s.Basic="basic",s.Lambert="lambert",s.Phong="phong",s.Standard="standard",s.Line="line",s.Custom="custom",s))(kn||{});function Yr(o){return"shader"in o}function kh(o){return Yr(o)&&o.shader==="basic"}function va(o){return Yr(o)&&o.shader==="line"}function Mh(o){return Yr(o)&&o.shader==="lambert"}function Sh(o){return Yr(o)&&o.shader==="phong"}function Lh(o){return Yr(o)&&o.shader==="standard"}function Bb(o){return Yr(o)&&o.shader==="custom"}var ft=class extends K{constructor(r){super(),this.#e=r}#e;get shader(){return this.#e}async _loadMap(r,e=this.material?.texture){if(a.isNull(e)||e.close(),a.isNullOrEmpty(r))return null;let t=await fo.loadImage(r);return a.isNull(t)?null:await createImageBitmap(t)}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"map":case"opacity":case"wireframe":case"color":case"hide":this.updateMaterial();break}}viewActivatedCallback(){super.viewActivatedCallback(),this.updateMaterial()}updateMaterial(){this.createMaterial().then(r=>{this.material=a.extend(r,{flags:["material"]})})}async createMaterial(){return{opacity:this.opacity??1,wireframe:this.wireframe??!1,color:this.color||a.Css.getVariableValue(`--${b}-color-primary`),visible:!(this.hide??!1),map:this.map,texture:await this._loadMap(this.map),shader:this.shader,flags:[]}}};c([h()],ft.prototype,"material",2),c([h({emit:!1,converter:m.Number})],ft.prototype,"opacity",2),c([h({emit:!1,converter:m.Boolean})],ft.prototype,"wireframe",2),c([h({emit:!1,converter:m.String})],ft.prototype,"color",2),c([h({emit:!1,converter:m.Boolean})],ft.prototype,"hide",2),c([h({emit:!1,converter:m.String})],ft.prototype,"map",2);var lg=class{static parse(r){let e=[],t=/^v((\s+-?[\d\.]+){3})/gm,n=t.exec(r);for(;n&&n.length;)e.push(Ji.convert(n[1])),n=t.exec(r);let i=[],s=/^vt((\s+-?[\d\.]+){2})/gm;for(n=s.exec(r);n&&n.length;)i.push(se.parse(n[1])),n=s.exec(r);let l=[],p=/^vn((\s+-?[\d\.]+){3})/gm;for(n=p.exec(r);n&&n.length;)l.push(Ji.convert(n[1])),n=p.exec(r);let u=[],f=[],g=[],v=/^f((\s+([\d]+\/[\d]+\/[\d]+)){3,})/gm;for(n=v.exec(r);n&&n.length;){let N=/([\d]+)\/([\d]+)\/([\d]+)/g,T=n[1],O=N.exec(T),D=0;for(var y,_,x,w,E,k;O&&O.length;)D>2&&(g.push(y),f.push(i[_]),u.push(l[x]),g.push(w),f.push(i[E]),u.push(l[k])),w=parseInt(O[1])-1,E=parseInt(O[2])-1,k=parseInt(O[3])-1,g.push(w),f.push(i[E]),u.push(l[k]),D===0&&(y=w,_=E,x=k),D++,O=N.exec(T);n=v.exec(r)}return new ze(e,g,f,u)}},og=class{static parseGeometry(r,e){if(e.toLowerCase()==="obj")return lg.parse(r);throw new Error(`Type '${e}' is not supported.`)}};c([Te("parse3D")],og,"parseGeometry",1);var es={};Le(es,{LatLng:()=>it,LatLngBounds:()=>st,MapProjection:()=>cg});var Ub={lat:Number.NaN,lng:Number.NaN},it=class{static get Empty(){return Ub}static isEmpty(r){return r===Ub||isNaN(r.lat)&&isNaN(r.lng)}static isLatLng(r){return"lat"in r&&typeof r.lat=="number"&&"lng"in r&&typeof r.lng=="number"}static translate(r,e){return{lat:r.lat+e.lat,lng:r.lng+e.lng}}static equals(r,e){return r===e||r.lat===e.lat&&r.lng===e.lng}},zb={ne:it.Empty,sw:it.Empty},st=class o{static get Empty(){return zb}static isEmpty(r){return r===zb||it.isEmpty(r.ne)&&it.isEmpty(r.sw)}static isPoint(r){return!this.isEmpty(r)&&(r.ne===r.sw||r.ne.lat===r.sw.lat&&r.ne.lng===r.sw.lng)}static isLatLngBounds(r){return typeof r=="object"&&"ne"in r&&it.isLatLng(r.ne)&&"sw"in r&&it.isLatLng(r.sw)}static union(r,e){if(o.isEmpty(r))return o.isLatLngBounds(e)?e:{ne:e,sw:e};if(o.isLatLngBounds(e)){if(o.isEmpty(e))return r;let t=Math.max(r.ne.lat,e.ne.lat),n=Math.max(r.ne.lng,e.ne.lng),i=Math.min(r.sw.lat,e.sw.lat),s=Math.min(r.sw.lng,e.sw.lng);return{ne:{lat:t,lng:n},sw:{lat:i,lng:s}}}if(it.isLatLng(e)){if(it.isEmpty(e))return r;let t=Math.max(r.ne.lat,e.lat),n=Math.max(r.ne.lng,e.lng),i=Math.min(r.sw.lat,e.lat),s=Math.min(r.sw.lng,e.lng);return{ne:{lat:t,lng:n},sw:{lat:i,lng:s}}}return r}static equals(r,e){return r===e||it.equals(r.ne,e.ne)&&it.equals(r.sw,e.sw)}},ba={SIZE:256,RAD:Math.PI/180,DEG:180/Math.PI,EPSILON:1e-15,SIN_LIMIT:1-1e-15,EARTH_RADIUS:6378137},Nh={TRANSFORMERS_NS:"maps"},mi=class mi{constructor(r,e,t=ba.SIZE){this._pixelSize=r;this._bounds=e;this._normalizedSize=t;let n=t/2;this.#e={x:n,y:n},this.#n=t/360,this.#i=n/Math.PI,this.#t=this._latLngToWorldNormalizedPoint(e.sw),this.#r=this._latLngToWorldNormalizedPoint(e.ne)}#e;#t;#r;#n;#i;_latLngToWorldNormalizedPoint(r){let e=this.#e.x+r.lng*this.#i,t=r.lat*ba.RAD,n=ba.SIN_LIMIT,i=Math.sin(t).clamp(-n,n),s=this.#e.y+.5*Math.log((1+i)/(1-i))*-this.#n;return{x:e,y:s}}_worldNormalizedPointToLatLng(r){let e=ba.DEG*(2*Math.atan(Math.exp((r.y-this.#e.y)/-this.#n))-Math.PI/2),t=(r.x-this.#e.x)/this.#i;return{lat:e,lng:t}}_latLngToPoint(r){let e=this.#r,t=this.#t,n=-e.y+t.y,i=e.x-t.x,s=this._latLngToWorldNormalizedPoint(r),{width:l,height:p}=this._pixelSize,u=(s.x-t.x)*(l/i),f=(s.y-e.y)*(p/n);return{x:u,y:f}}_pointToLatLng(r){let e=this.#r,t=this.#t,n=-e.y+t.y,i=e.x-t.x,{width:s,height:l}=this._pixelSize,p=r.x/(s/i)+this.#t.x,u=r.y/(l/n)+this.#r.y;return this._worldNormalizedPointToLatLng({x:p,y:u})}static _haversine(r,e){let t=ba.RAD,n=r.lng*t,i=e.lng*t,s=r.lat*t,l=e.lat*t;return 2*Math.asin(Math.sqrt(Math.pow(Math.sin((s-l)/2),2)+Math.cos(s)*Math.cos(l)*Math.pow(Math.sin((n-i)/2),2)))}static _offsetByMeters(r,e,t,n){let{RAD:i,DEG:s}=ba,l=r.lat*i,p=r.lng*i,u=e/n,f=t/(n*Math.cos(l)),g=l+u,v=p+f;return{lat:g*s,lng:v*s}}static offsetBy(r,e,t,n=ba.EARTH_RADIUS){return mi._offsetByMeters(r,e,t,n)}static distanceBetween(r,e,t=ba.EARTH_RADIUS){return mi._haversine(r,e)*t}static latLngToPoint(r,e,t){return new mi(t,e)._latLngToPoint(r)}static pointToLatLng(r,e,t){return new mi(e,t)._pointToLatLng(r)}};c([Te(Nh.TRANSFORMERS_NS+".")],mi,"offsetBy",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"distanceBetween",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"latLngToPoint",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"pointToLatLng",1);var cg=mi;var Gb={};Le(Gb,{FieldChangeEvent:()=>xd,FieldChangeEventName:()=>kc,L10n:()=>hg,OpenApi:()=>dg});var kc="change",xd=class extends oe{constructor(r){super(kc,r,{bubbles:!0,cancelable:!1})}};var dg={};Le(dg,{ApiParameterType:()=>Th,ApiParserBase:()=>ts,OpenApi3Parser:()=>Ed,OpenApiParser:()=>pg,SwaggerParser:()=>Cd,getOpenApiDefinition:()=>pE});var Th=(s=>(s.String="string",s.Number="number",s.Datetime="datetime",s.Boolean="boolean",s.Binary="binary",s.Object="object",s))(Th||{}),ts=class{async load(r,e){let t=await fetch(r,{mode:"cors",credentials:"omit",headers:e});try{let n=await t.json();return this.parse(n,r)}catch{return null}}},cE=/^#\/(definitions|components\/schemas)\/(.+)$/;function pE(o,r){var e=cE.exec(r);return e&&e.length>2?{name:e[2],schema:o.definitions[e[2]]}:null}var Ah=pt.HttpMethod,Cd=class extends ts{_findDefinitionName(r){var e=/#\/definitions\/(.+)/,t=e.exec(r);return t==null||t.length<2?r:t[1]}parse(r,e){let t=r;typeof t=="string"&&(t=JSON.parse(t));let n=t,i={};for(let p in n.definitions){let u=this._findDefinitionName(p);i[u]=n.definitions[p]}let s="";if(n.host&&n.schemes.length>0)s=n.schemes[0]+"://"+n.host+n.basePath;else if(e){let p=/^(https?):\/\/([^\/]+)/.exec(e);p&&p.length&&(!n.schemes&&p.length>1&&(n.schemes=[p[1]]),!n.host&&p.length>2&&(n.host=p[2],n.basePath=""),s=p[0])}else console.warn("Not able to find a base url from the OpenApi specs.");let l={endpoints:[],definitions:i,baseUrl:s};for(let p in n.paths){let u=n.paths[p];for(let f of[Ah.Get,Ah.Delete,Ah.Post,Ah.Put]){let g=u[f.toLowerCase()];if(g){let v=this._tryGetEndpoint(n,g,p,f);l.endpoints.push(v)}}}return l}_tryGetEndpoint(r,e,t,n){return{response:this._tryGetResponse(r,e),path:t,method:n,parameters:this._tryGetParameters(r,e)}}_translateType(r,e){switch(r){case"number":case"integer":return"number";case"boolean":return"boolean";case"string":switch(e){case"date":case"date-time":return"datetime";case"byte":return"binary";case"binary":throw"Binary octets not supported."}return"string"}return"string"}_tryGetParameters(r,e){return(e.parameters||[]).map(t=>{let n=t,i={name:n.name,required:n.required||!1},s=t.type;if(t.schema){let l=t;i.type="object";let p=i.fullType=this._findDefinitionName(l.schema.$ref);i.meta=r.definitions[p]}else s&&(i.type=this._translateType(s,t.format));return i})}_tryGetResponse(r,e){let t=e.responses[200];if(!t||!t.schema)return null;let n=t.schema.type||"object",i,s;return t.schema.$ref?(s=this._findDefinitionName(t.schema.$ref),i=r.definitions[s]):(i=t.schema,t.schema.items&&(t.schema.items.hasOwnProperty("$ref")?(s=this._findDefinitionName(t.schema.items.$ref),i=r.definitions[s]):i=t.schema.items)),{type:n,fullType:s,meta:i}}};var Ed=class extends ts{parse(r,e){let t=r;typeof t=="string"&&(t=JSON.parse(t));let n=t,i=[],s=this._gatherDefinitions(new Map,n.components.schemas);for(let l in n.paths)for(let p in n.paths[l]){let u=n.paths[l][p];i.push({path:l,method:p.toUpperCase(),parameters:this._convertToApiParameters(u.parameters),response:this._tryGetResponse(s,u.responses)})}return{endpoints:i,definitions:s,baseUrl:e}}_convertToApiParameters(r=[]){let e=[];for(let t of r){let n=t.schema;"type"in n&&e.push({name:t.name,required:t.required,type:this._translateType(n.type,n.format)})}return e}_translateType(r,e){switch(r){case"number":case"integer":return"number";case"boolean":return"boolean";case"string":switch(e){case"date":case"date-time":return"datetime";case"byte":return"binary";case"binary":throw"Binary octets not supported."}return"string"}return"string"}_gatherDefinitions(r,e){let t={};for(let n in e)t[n]=this._findDefinition(r,e,n);return t}_findDefinition(r,e,t){if(r.has(t))return r.get(t);if(t in e){let n=e[t];return r.set(t,n),n}return null}_findDefinitionName(r){var e=/#\/components\/schemas\/(.+)/,t=e.exec(r);return t==null||t.length<2?r:t[1]}_tryGetResponse(r,e){let n={responses:e}.responses[200];if(a.isNullOrEmpty(n&&n.content))return null;let i;for(let u in n.content){i=n.content[u].schema;break}let s="object",l,p;return"$ref"in i?(p=this._findDefinitionName(i.$ref),l=r[p]):(s=i.type,l=i,i.type==="array"&&("$ref"in i.items?(p=this._findDefinitionName(i.items.$ref),l=r[p]):l=i.items)),{type:s,fullType:p,meta:l}}};var pg=class extends ts{constructor(e=new Ed,t=new Cd){super();this._openApi3=e;this._swagger=t}parse(e,t){let n=e;typeof n=="string"&&(n=JSON.parse(n));let i=n;return"openapi"in i?this._openApi3.parse(i,t):this._swagger.parse(i,t)}};var hg={};Le(hg,{Forms:()=>ug});var dE={display:(o,r,e)=>e[`${o}_${r}`],validator:(o,r,e,t)=>t["validator_"+o+"_"+e]??t["validator_"+o+r+"_"+e],commandTooltip:(o,r)=>r["command_tooltip_"+o]},wd=class wd{static localizeMetadata(r,e,t){return wd._localizeMetadata(r,e,t)}static _localizeMetadata(r,e,t,n=""){t=a.extend({},dE,t);for(let i of r.props){if("props"in i&&typeof i.props=="object"&&!a.isArray(i.props)){let p=n+i.prop+".";i.props=wd._localizeMetadata(i.props,e,t,p)}let s=i.display=i.display??{},l=n+i.prop;if(s.name=t.display("name",l,e)??s.name,s.watermark=t.display("watermark",l,e)??s.watermark,s.description=t.display("description",l,e)??s.description,!a.isNullOrEmpty(i.commands))for(let p of i.commands){let u=t.commandTooltip(p.name,e);a.isNullOrEmpty(u)||(p.tooltip=u)}if(!a.isNullOrEmpty(i.validators)){let p={};for(let u of i.validators){let f=u.type;if(typeof f=="string"){let g=p[f]=(p[f]??-1)+1,v=t.validator(f,g,l,e);a.isNullOrEmpty(v)||(u.errorMessage=v)}}}}return r}};c([Te("forms.localizeMetadata")],wd,"localizeMetadata",1);var ug=wd;var Fb={};Le(Fb,{L10n:()=>mg,PacemBaseCellElement:()=>Mn});var Mn=class extends R.PacemSafeContentElement{viewActivatedCallback(){super.viewActivatedCallback(),this.updateColumnPosition(),this.updateLayout(this.metadata)}updateColumnPosition(r=this.metadata,e=this.gridState){this.style.gridColumn=(e.orderedColumns.indexOf(r.prop)+1).toString()}updateVisibility(r=this.state){this.hide=!!r.hidden}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"metadata":this.updateLayout(t);break;case"gridState":this.updateColumnPosition();break;case"state":this.updateVisibility();break}}};c([h({converter:m.Json})],Mn.prototype,"metadata",2),c([h({converter:m.Json})],Mn.prototype,"state",2),c([h({converter:m.Json})],Mn.prototype,"gridState",2);var mg={};Le(mg,{DataGrids:()=>Dh});var uE={headCell:(o,r,e)=>{switch(o){case"name":return e["column_name_"+r]??e["name_"+r];case"description":return e["column_description_"+r]??e["description_"+r]}return null}},Dh=class{static localizeMetadata(r,e,t){t=a.extend({},uE,t??{});for(let n of r){let i=n.headCell=n.headCell??{};i.name=t.headCell("name",n.prop,e)??i.name,i.description=t.headCell("description",n.prop,e)??i.description}return r}};c([Te("datagrids.localizeMetadata")],Dh,"localizeMetadata",1);var cx={};Le(cx,{AnimationElement:()=>lr,Charts:()=>jg,CustomItemCommandEvent:()=>sd,DataCellUIEvent:()=>Pu,DataColumnRescaleEvent:()=>Op,DataColumnRescaleEventName:()=>Vm,DataColumnSortEvent:()=>Rp,DataColumnSortEventName:()=>Bm,DataGridBindEvent:()=>Um,DataRowSelectChangeEvent:()=>Ru,DataRowSelectChangeEventName:()=>lx,DockMode:()=>yf,Drawing:()=>vg,Drawing3D:()=>Gg,EditMode:()=>rx,Fx:()=>Yg,ItemCommandEvent:()=>id,ItemRegisterEvent:()=>td,ItemRegisterEventName:()=>xf,ItemUnregisterEvent:()=>rd,ItemUnregisterEventName:()=>Cf,KeyboardShortcutExecuteEventName:()=>Mf,Logging:()=>Xg,Maps:()=>dm,Media:()=>pv,Networking:()=>dv,PacemAdapter:()=>sh,PacemAnnihilatorElement:()=>tc,PacemBaseCellElement:()=>Mn,PacemBeforeunloadElement:()=>ia,PacemBodyProxyElement:()=>nc,PacemBroadcastChannelProxyElement:()=>Xn,PacemBrowserDetectElement:()=>Mo,PacemCarouselElement:()=>Fs,PacemColorAnimationElement:()=>da,PacemContentElement:()=>ko,PacemContextMenuElement:()=>Bi,PacemContextMenuItemCommandElement:()=>Hr,PacemContextMenuItemElement:()=>Dp,PacemContextMenuItemSeparatorElement:()=>Tu,PacemCrossItemsContainerElement:()=>ac,PacemDataCellElement:()=>Xs,PacemDataColumnElement:()=>$t,PacemDataElement:()=>qn,PacemDataGridElement:()=>gr,PacemDockElement:()=>yn,PacemDragDropElement:()=>xr,PacemEditElement:()=>Br,PacemElement:()=>mt,PacemElementProxyElement:()=>So,PacemEventProxyElement:()=>ji,PacemFetchElement:()=>dt,PacemGalleryElement:()=>ar,PacemHeadCellElement:()=>Ou,PacemHistoryElement:()=>Kn,PacemHtmlProxyElement:()=>aa,PacemIfElement:()=>No,PacemItemElement:()=>Yi,PacemItemsContainerElement:()=>_n,PacemIterableElement:()=>oh,PacemIterativeElement:()=>To,PacemLayoutProxyElement:()=>oa,PacemMetaProxyElement:()=>Zn,PacemModalFormElement:()=>lt,PacemNumberAnimationElement:()=>ua,PacemOnlineStatusElement:()=>Ao,PacemPanelElement:()=>oc,PacemPointAnimationElement:()=>ha,PacemRepeaterElement:()=>zr,PacemRescaleElement:()=>Gr,PacemResizeElement:()=>la,PacemRotateElement:()=>ri,PacemRouterElement:()=>Qn,PacemRouterHashStateElement:()=>js,PacemRouterViewScrollElement:()=>ho,PacemSafeContentElement:()=>na,PacemScrollAwareElement:()=>ca,PacemSearchElement:()=>zn,PacemServiceWorkerProxyElement:()=>ei,PacemShellProxyElement:()=>ic,PacemShortcutElement:()=>pa,PacemSpanElement:()=>Po,PacemStoryboardElement:()=>si,PacemStyleProxyElement:()=>Xi,PacemSwipeElement:()=>ni,PacemTemplateProxyElement:()=>xn,PacemTextElement:()=>Io,PacemTimerElement:()=>$o,PacemTitleProxyElement:()=>Ho,PacemTransferProxyElement:()=>Lo,PacemTweenElement:()=>_r,PacemUnsafeContentElement:()=>ih,PacemViewportAwareElement:()=>qi,PacemWebWorkerProxyElement:()=>ti,RepeaterItem:()=>Do,RepeaterItemCreateEvent:()=>Ql,RepeaterItemCreateEventName:()=>vf,RepeaterItemEvent:()=>Zl,RepeaterItemRemoveEvent:()=>ec,RepeaterItemRemoveEventName:()=>bf,ResizeEvent:()=>ad,ResizeEventName:()=>Ef,Scaffolding:()=>$m,ScrollEvent:()=>od,ScrollEventName:()=>kf,StateEvent:()=>ed,TweenAnimationElement:()=>ii,UI:()=>Tm,isItemsContainer:()=>mb});var vg={};Le(vg,{AdapterUtils:()=>at,CornerType:()=>Yb,DrawableElement:()=>rs,Pacem2DElement:()=>Rt,PacemCanvasAdapterElement:()=>Td,PacemCircleElement:()=>Sn,PacemEllipseElement:()=>kr,PacemGroupElement:()=>ya,PacemImageElement:()=>cr,PacemLineElement:()=>ns,PacemPathElement:()=>Nc,PacemPolygonElement:()=>Sr,PacemPolylineElement:()=>gi,PacemRectElement:()=>Mr,PacemSvgAdapterElement:()=>Rd,PacemTextElement:()=>Ot,PresentationElement:()=>Xr,ShapeElement:()=>ut,UiElement:()=>St,getStageOptions:()=>Lc});var o1=2*Math.PI;var hE=/^\s*[xX]\s*([Mm](in|ax|id))\s*[yY]\s*([Mm](in|ax|id))(\s+(none|slice|meet))?\s*$/,mE={convert:o=>{let r=hE.exec(o);return r&&r.length>=4?{x:r[1].toLowerCase(),y:r[3].toLowerCase(),slice:r[6]==="slice"}:"none"},convertBack:o=>a.isNull(o)||typeof o=="string"?"none":`xM${o.x.substring(1)}YM${o.y.substring(1)} ${o.slice?"slice":"meet"}`},Wb={panControl:!0,zoomControl:!0,panModifiers:["Alt"],zoomModifiers:["Alt"],clickModifiers:[]};function Lc(o){let r=o instanceof Rt?o.options:{};return a.extend({},Wb,r)}var Mc,Xo,qo,fi,Sc,Rt=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);z(this,Mc);z(this,Xo,ke.identity);z(this,qo,Wb);z(this,fi);this._resizeHandler=e=>{H(this,fi,{x:e.detail.left,y:e.detail.top,width:e.detail.width,height:e.detail.height});let t=this.adapter;a.isNull(t)||this._invalidateSize()};this._zoomHandler=e=>{if(!e.isTrusted)return;let t=M(this,qo);if(t.zoomControl&&de.matchModifiers(e,t.zoomModifiers)){Q(e);let n=e.deltaY<0,i=.1,s=n?-1:1,l=i*s,p=1+l,u=a.offsetRect(e.currentTarget),f={x:e.clientX,y:e.clientY};this._zoom(p,u,f)}};this._panHandler=e=>{let t=M(this,Sc),n=this._getPanPoint(e);if(!a.isNullOrEmpty(t&&t.point)&&!a.isNull(n)){Q(e);let i=t.factor,s=t.box,l=t.point;this.viewbox={x:s.x-i*(n.x-l.x),y:s.y-i*(n.y-l.y),width:s.width,height:s.height}}};z(this,Sc);this._panStartHandler=e=>{if(!M(this,qo).panControl||!e.isTrusted)return;let n=M(this,fi),i=this.viewbox||{x:0,y:0,width:n.width,height:n.height},s=this._getPanPoint(e);if(s){Q(e),this._stage.style.pointerEvents="none";let l=this._getActualAspectRatio(),p=i.width/n.width,u=i.height/n.height,f=l.slice?Math.min(p,u):Math.max(p,u);H(this,Sc,{point:s,box:i,factor:f})}};this._panEndHandler=e=>{this._stage.style.pointerEvents="",H(this,Sc,null)}}get stage(){return this._stage}snapshot(e,t,n){let i=this.adapter;return a.isNull(i)?Promise.resolve(null):i.snapshot(this,e,t,n)}get transformMatrix(){return M(this,Xo)}_transformMatrixScale(){let e=M(this,fi)||a.offsetRect(this._stage);var t=M(this,Mc)||e;let n=this.viewbox||t,i=this.aspectRatio||"none",s=i==="none"?"stretch":i.slice?"cover":"contain";return Ze.findTransform(n,t,s).a}validate(e){return e instanceof rs&&a.isNull(e.parent)}draw(e,t=!1){let n=this.adapter;if(!this.disabled&&!a.isNull(n)){let i=new CustomEvent("predraw",{cancelable:!0});this.dispatchEvent(i),i.defaultPrevented||(n.draw(this,e,t),this.dispatchEvent(new CustomEvent("draw")))}}_drawDebounced(e,t=!1){!a.isNull(e)&&Bo(e)?this.draw(e,t):this.draw(e)}requestDraw(e,t=!1){this._drawDebounced(e,t)}_buildUpDatasourceFromDOM(){this.datasource=(this.items||[]).slice()}_getActualAspectRatio(){let e=this.aspectRatio||"none",t=e==="none"?"mid":e.x,n=e==="none"?"mid":e.y,i=e==="none"?!1:e.slice;return{x:t,y:n,slice:i}}_zoomFromValue(e){let t=M(this,fi);if(a.isNull(t))return;let n=t,i=M(this,Mc)||n,s=this.viewbox||i,l=this.aspectRatio||"none",p=l==="none"?"stretch":l.slice?"cover":"contain",u=Ze.findTransform(s,n,p),f=Ze.findTransform(i,n,p),g=u.a,y=f.a*e,_=g/y;this._zoom(_)}_zoom(e,t,n){a.isNull(t)&&(t=a.offsetRect(this._stage)),a.isNull(n)&&(n={x:t.x+t.width*.5,y:t.y+t.height*.5});let i=M(this,fi),s=this.viewbox||i,l=Math.min(s.width,s.height),p=l*e,u=l*e;if(p>0&&u>0){let f=this._getActualAspectRatio(),g=f.x,v=f.y,y=f.slice,_=s.width/s.height,x=y?Math.max(t.width,t.height):Math.min(t.width,t.height),w,E;switch(g){case"mid":w=(p-s.width)*(n.x-t.x-.5*(t.width-x))/(x*_);break;case"max":w=(p-s.width)*(n.x-t.x-(t.width-x))/(x*_);break;default:w=(p-s.width)*(n.x-t.x)/(x*_);break}switch(v){case"mid":E=(u-s.height)*(n.y-t.y-.5*(t.height-x))/(x*_);break;case"max":E=(u-s.height)*(n.y-t.y-(t.height-x))/(x*_);break;default:E=(u-s.height)*(n.y-t.y)/(x*_);break}let k=s.x-w,N=s.y-E;this.viewbox={x:k,y:N,width:p,height:u}}}_getPanPoint(e){let t=M(this,qo);return e instanceof MouseEvent&&de.matchModifiers(e,t.panModifiers)?de.getEventCoordinates(e).page:null}_invalidateSize(){this.adapter.invalidateSize(this,M(this,fi));let e=M(this,Xo);H(this,Xo,this.adapter.getTransformMatrix(this)),this.dispatchEvent(new ue({propertyName:"transformMatrix",currentValue:M(this,Xo),oldValue:e})),this.zoom=this._transformMatrixScale(),this.dispatchEvent(new R.ResizeEvent(M(this,fi)))}viewActivatedCallback(){super.viewActivatedCallback();let e=this.adapter;a.isNull(e)||(e.initialize(this),this._invalidateSize(),this._drawDebounced());let t=this._resize;t.addEventListener(R.ResizeEventName,this._resizeHandler,!1);let n=this._stage;t.target=n;let i={capture:!1,passive:!0};n.addEventListener("wheel",this._zoomHandler,!1),n.addEventListener("mousedown",this._panStartHandler,!1),n.addEventListener("touchstart",this._panStartHandler,i),window.addEventListener("mousemove",this._panHandler,!1),window.addEventListener("mouseup",this._panEndHandler,!1),window.addEventListener("touchmove",this._panHandler,i),window.addEventListener("touchend",this._panEndHandler,i)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"adapter":a.isNull(t)||t.dispose(this),a.isNull(n)||(n.initialize(this),this._invalidateSize(),this._drawDebounced());break;case"aspectRatio":a.isNull(this.adapter)||this._invalidateSize();break;case"viewbox":a.isNull(this.adapter)||this._invalidateSize(),M(this,Mc)??H(this,Mc,this.viewbox||null);break;case"items":this._buildUpDatasourceFromDOM();break;case"zoom":n!==this._transformMatrixScale()&&this._zoomFromValue(n);break;case"options":H(this,qo,Lc(this));break;case"disabled":case"datasource":this._drawDebounced();break}}disconnectedCallback(){let e=this._resize,t=this._stage;a.isNull(e)||e.removeEventListener(R.ResizeEventName,this._resizeHandler,!1),a.isNull(t)||(t.removeEventListener("wheel",this._zoomHandler,!1),t.removeEventListener("mousedown",this._panStartHandler,!1),t.removeEventListener("touchstart",this._panStartHandler),window.removeEventListener("mousemove",this._panHandler,!1),window.removeEventListener("mouseup",this._panEndHandler,!1),window.removeEventListener("touchmove",this._panHandler),window.removeEventListener("touchend",this._panEndHandler)),a.isNull(this.adapter)||this.adapter.dispose(this),super.disconnectedCallback()}};Mc=new WeakMap,Xo=new WeakMap,qo=new WeakMap,fi=new WeakMap,Sc=new WeakMap,c([h({converter:m.Element})],Rt.prototype,"adapter",2),c([h({reflectBack:!0,converter:m.Rect})],Rt.prototype,"viewbox",2),c([h({emit:!1,reflectBack:!0,converter:mE})],Rt.prototype,"aspectRatio",2),c([h({emit:!1,converter:m.Json})],Rt.prototype,"datasource",2),c([h({emit:!1,converter:m.Json})],Rt.prototype,"options",2),c([h({converter:m.Number})],Rt.prototype,"zoom",2),c([S("."+b+"-2d")],Rt.prototype,"_stage",2),c([S(d+"-resize")],Rt.prototype,"_resize",2),c([me(!0)],Rt.prototype,"_drawDebounced",1),Rt=c([C({tagName:d+"-"+"2d",shadow:!0,template:`<${d}-resize watch-position="true"></${d}-resize><div class="${b}-2d" part="container"></div><slot></slot>`})],Rt);var kd=class kd extends R.PacemCrossItemsContainerElement{validate(r){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||A.findAncestorOfType(this,Rt)}get parent(){return this._drawableParent=this._drawableParent||A.findAncestor(this,r=>r instanceof kd)}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),n||r==="hide"&&this.stage?.draw(this)}};c([h({emit:!1,reflectBack:!0,converter:m.String})],kd.prototype,"tag",2),c([h({emit:!1,converter:m.Boolean})],kd.prototype,"inert",2);var rs=kd;var fE=Math.PI/180,St=class extends rs{#e=ke.identity;viewActivatedCallback(){super.viewActivatedCallback(),this._updateTransformMatrix()}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"rotate":case"scaleX":case"scaleY":case"translateX":case"translateY":this._updateTransformMatrix();case"opacity":this.stage?.draw(this);break}}_updateTransformMatrix(){let r=fE*(this.rotate??0),e=Math.cos(r),t=Math.sin(r),n=(this.scaleX??1)*e,i=-t,s=t,l=(this.scaleY??1)*e,p=this.translateX??0,u=this.translateY??0;this.#e={a:n,b:i,c:s,d:l,e:p,f:u}}get transformMatrix(){let r=this.#e;return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e,f:r.f}}};c([h({emit:!1,converter:m.Number})],St.prototype,"rotate",2),c([h({emit:!1,converter:m.Number})],St.prototype,"scaleX",2),c([h({emit:!1,converter:m.Number})],St.prototype,"scaleY",2),c([h({emit:!1,converter:m.Number})],St.prototype,"translateX",2),c([h({emit:!1,converter:m.Number})],St.prototype,"translateY",2),c([h({emit:!1,converter:m.Number})],St.prototype,"opacity",2);var Xr=class extends St{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"stroke":case"lineWidth":case"lineJoin":case"lineCap":case"dashArray":case"fill":a.isNull(this.stage)||this.stage.draw(this);break}}};c([h({emit:!1,converter:m.String})],Xr.prototype,"stroke",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"fill",2),c([h({emit:!1,converter:{convert:r=>r?.split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),convertBack:r=>r?.join(",")}})],Xr.prototype,"dashArray",2),c([h({emit:!1,converter:m.Number})],Xr.prototype,"lineWidth",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"lineJoin",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"lineCap",2);var ut=class extends Xr{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),n||r==="data"&&this.stage?.draw(this)}viewActivatedCallback(){super.viewActivatedCallback(),this.recomputeShape()}recomputeShape(){let{pathData:r,vertices:e,boundingRect:t}=this.getShapeGeometry();this.#t=e,this.#e=t,this.data=r}get pathData(){return this.data}#e;get boundingRect(){return this.#e}#t;get vertices(){return this.#t}};c([h({emit:!1,converter:m.String})],ut.prototype,"data",2);var Md,ya=class extends Xr{constructor(){super(...arguments);z(this,Md,[])}validate(e){return e instanceof rs&&e.parent===this}get childDrawables(){return M(this,Md)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"items":case"datasource":H(this,Md,n||[]);let s=this.stage;a.isNull(s)||s.draw(this,!0);break}}};Md=new WeakMap,c([h({emit:!1})],ya.prototype,"datasource",2),ya=c([C({tagName:d+"-"+"2d"+"-group"})],ya);function gE(o,r,e){let t=2*r,n=o.x,i=o.y;return{pathData:`M ${n} ${i} m ${-r},0 a ${r},${e} 0 1,1 ${t},0 a ${r},${e} 0 1,1 ${-t},0`,vertices:[],boundingRect:{x:n-r,y:i-e,width:2*r,height:2*e}}}function vE(o,r,e,t,n){let i=Math.PI/180,s=i*t,l=i*n,p=k=>r*e/Math.sqrt(Math.pow(Math.cos(k)*e,2)+Math.pow(Math.sin(k)*r,2)),u=p(s),f=p(l),g=(k,N)=>({x:k*Math.cos(N),y:k*Math.sin(N)}),v=g(u,s),y=g(f,l),_={x:o.x+v.x,y:o.y+v.y},x={x:o.x+y.x,y:o.y+y.y},w=Ze.expand(o,_,x);n<t&&(n+=360),(t<=0&&n>0||n>=360)&&(w=Ze.expand(w,{x:o.x+r,y:o.y})),(t<=90&&n>90||n>=450)&&(w=Ze.expand(w,{x:o.x,y:o.y+e})),(t<=180&&n>180||n>=540)&&(w=Ze.expand(w,{x:o.x-r,y:o.y})),(t<=270&&n>270||n>=630)&&(w=Ze.expand(w,{x:o.x,y:o.y-e}));let E=l-s>Math.PI?"1":"0";return{pathData:`M ${_.x} ${_.y} A ${r},${e} 0 ${E},1 ${x.x},${x.y} L ${o.x},${o.y} Z`,vertices:[_,x],boundingRect:w}}function fg(o,r,e,t,n){for(t??=0,n??=0,t%=360,n%=360;t<0;)t+=360;for(;n<t;)n+=360;return(t-n).isCloseTo(0)?gE(o,r,e):vE(o,r,e,t,n)}var kr=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"center":case"rx":case"ry":case"start":case"end":this.recomputeShape();break}}getPathData(){let r=this.rx,e=this.ry,t=this.center,n=this.start??0,i=this.end??0;return!a.isNull(t)&&!a.isNull(r)&&!a.isNull(e)?kr.getPathData(t,r,e,n,i):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.rx??0,t=this.ry??0;return fg(r,e,t,this.start,this.end)}static getPathData(r={x:NaN,y:NaN},e=NaN,t=NaN,n,i){let{pathData:s}=fg(r,e,t,n,i);return s}};c([h({emit:!1,converter:m.Point})],kr.prototype,"center",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"rx",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"ry",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"start",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"end",2),kr=c([C({tagName:d+"-"+"2d"+"-ellipse"})],kr);var Sn=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"center":case"radius":case"start":case"end":this.recomputeShape();break}}getPathData(){let r=this.radius,e=this.center;return!a.isNull(e)&&!a.isNull(r)?Sn.getPathData(e,r,this.start,this.end):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.radius??0;return fg(r,e,e,this.start,this.end)}static getPathData(r={x:NaN,y:NaN},e=NaN,t,n){return kr.getPathData(r,e,e,t,n)}};c([h({emit:!1,converter:m.Point})],Sn.prototype,"center",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"start",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"end",2),Sn=c([C({tagName:d+"-"+"2d"+"-circle"})],Sn);function Sd(o){let r=o[2],e=o[4]??r,t=o[6]==="cut"?"cut":"rounded";return{rx:jb(r),ry:jb(e),type:t}}function jb(o){return{value:parseFloat(o),unit:o.endsWith("%")?"pct":"u"}}function _a(o){return`${o.value}${o.unit==="pct"?"%":""}`}var bE=/(([\d\.]+%?)(\s*,?\s*([\d\.]+%?))?(\s+(cut|round))?)/g;function yE(o){let r,e=[];for(;r=bE.exec(o);)e.push(r);switch(e.length){case 1:let t=Sd(e[0]);return[t,t,t,t];case 4:let n=Sd(e[0]),i=Sd(e[1]),s=Sd(e[2]),l=Sd(e[3]);return[n,i,s,l];default:return null}}function _E(o){let r=o[0],e=o[1],t=o[2],n=o[3],i=_a(r.rx),s=_a(r.ry),l=_a(e.rx),p=_a(e.ry),u=_a(t.rx),f=_a(t.ry),g=_a(n.rx),v=_a(n.ry);return`${i},${s} ${l},${p} ${u},${f} ${g},${v}`}var Yb=(e=>(e.Rounded="rounded",e.Cut="cut",e))(Yb||{}),Mr=class extends ut{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="x"||r==="y"||r==="w"||r==="h"||r==="r"||r==="cornerType")&&this.recomputeShape()}getPathData(){let r=this.x,e=this.y,t=this.w,n=this.h,i=this.r??{rx:{value:0},ry:{value:0},type:"rounded"};return a.isArray(i)||(i=[i,i,i,i]),i=i.map(s=>typeof s=="number"?{rx:{value:s},ry:{value:s},type:this.cornerType}:s),!a.isNull(r)&&!a.isNull(e)&&!a.isNull(t)&&!a.isNull(n)?Mr.getPathData(r,e,t,n,i):null}getShapeGeometry(){let r=this.x,e=this.y,t=r+this.w,n=e+this.h;return{pathData:this.getPathData(),vertices:[{x:r,y:e},{x:t,y:e},{x:t,y:n},{x:r,y:n}],boundingRect:{x:r,y:e,width:this.w,height:this.h}}}static getPathData(r=NaN,e=NaN,t=NaN,n=NaN,i=null){if(!i)return`M ${r} ${e} h ${t} v ${n} h ${-t} z`;a.isArray(i)||(i=[i,i,i,i]);let s=i[0],l=i[1],p=i[2],u=i[3],f=O=>O.unit==="pct"?O.value*.01*t:O.value,g=O=>O.unit==="pct"?O.value*.01*n:O.value,v=f(s.rx),y=g(s.ry),_=f(l.rx),x=g(l.ry),w=f(p.rx),E=g(p.ry),k=f(u.rx),N=g(u.ry),T=`M ${r},${e+y}`;return s.type==="cut"?T+=` l ${v},${-y}`:T+=` a ${v} ${y} 0 0 1 ${v} ${-y}`,T+=` h ${t-v-_}`,l.type==="cut"?T+=` l ${_},${x}`:T+=` a ${_} ${x} 0 0 1 ${_} ${x}`,T+=` v ${n-x-E}`,p.type==="cut"?T+=` l ${-w},${E}`:T+=` a ${w} ${E} 0 0 1 ${-w} ${E}`,T+=` h ${-(t-w-k)}`,u.type==="cut"?T+=` l ${-k},${-N}`:T+=` a ${k} ${N} 0 0 1 ${-k} ${-N}`,T+" z"}};c([h({emit:!1,converter:m.Number})],Mr.prototype,"x",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"y",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"w",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"h",2),c([h({emit:!1,converter:{convert:r=>yE(r),convertBack:r=>_E(r)}})],Mr.prototype,"r",2),c([h({emit:!1,converter:m.String})],Mr.prototype,"cornerType",2),Mr=c([C({tagName:d+"-"+"2d"+"-rect"})],Mr);var ns=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"from":case"to":this.recomputeShape();break}}getShapeGeometry(){let r=this.from,e=this.to;if(a.isNull(r)||a.isNull(e))return Ki.empty();let t=r.x,n=r.y,i=e.x,s=e.y,l={x:Math.min(t,i),y:Math.min(n,s),width:Math.abs(t-i),height:Math.abs(n-s)};return{pathData:this.getPathData(),vertices:[r,e],boundingRect:l}}getPathData(){let r=this.from,e=this.to;return!a.isNull(r)&&!a.isNull(e)?ns.getPathData(r,e):null}static getPathData(r={x:NaN,y:NaN},e={x:NaN,y:NaN}){let t=r.x,n=r.y,i=e.x,s=e.y;return`M ${t} ${n} L ${i} ${s}`}};c([h({emit:!1,converter:m.Point})],ns.prototype,"from",2),c([h({emit:!1,converter:m.Point})],ns.prototype,"to",2),ns=c([C({tagName:d+"-"+"2d"+"-line"})],ns);var Nc=class extends ut{constructor(){super(...arguments);this.getPathData=()=>this.d}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="d"&&!i&&this.recomputeShape()}getShapeGeometry(){return{pathData:this.getPathData(),boundingRect:null,vertices:[]}}};c([h({emit:!1,converter:m.String})],Nc.prototype,"d",2),Nc=c([C({tagName:d+"-"+"2d"+"-path"})],Nc);var Sr=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"radius":case"starIndent":case"sides":this.recomputeShape();break}}getPathData(){let r=this.sides,e=this.radius,t=this.center;return!a.isNull(r)&&!a.isNull(e)?Sr.getPathData(t,e,r,this.starIndent):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.radius??0,t=this.sides??3,n=this.starIndent;return t<3?Ki.empty():Sr.getShapeGeometry(r,e,t,n)}static getShapeGeometry(r,e,t,n=0){let i={x:r.x,y:r.y-e},s=`M ${i.x} ${i.y}`,l=[i],p=2*Math.PI/t,u=.5*p,f=n>0,g=e*Math.cos(u);for(let y=1;y<t;y++){let _=y*p,x=r.x+Math.sin(_)*e,w=r.y-Math.cos(_)*e;if(f){let E=g*(1-n),k=_-u,N=r.x+Math.sin(k)*E,T=r.y-Math.cos(k)*E;s+=` L ${N} ${T} L ${x} ${w}`,l.push({x:N,y:T})}else s+=` L ${x} ${w}`;l.push({x,y:w})}if(f){let y=g*(1-n),_=2*Math.PI-u,x=r.x+Math.sin(_)*y,w=r.y-Math.cos(_)*y;s+=` L ${x} ${w}`,l.push({x,y:w})}l.push(i);let v=e*2;return{pathData:s+" Z",vertices:l,boundingRect:{x:i.x-e,y:i.y,width:v,height:v}}}static getPathData(r,e,t,n=0){let{pathData:i}=Sr.getShapeGeometry(r,e,t,n);return i}};c([h({emit:!1,converter:m.Number})],Sr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Sr.prototype,"radius",2),c([h({emit:!1,converter:m.Point})],Sr.prototype,"center",2),c([h({emit:!1,converter:m.Number})],Sr.prototype,"starIndent",2),Sr=c([C({tagName:d+"-"+"2d"+"-polygon"})],Sr);var xE={convert:o=>{let r=yr(o);if(r.length%2===0){let e=[];for(let t=0;t<r.length;t+=2)e.push({x:r[t],y:r[t+1]});return e}return JSON.parse(o)},convertBack:o=>JSON.stringify(o)},gi=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"points":case"closed":this.recomputeShape();break}}static getShapeGeometry(r,e){if(a.isNullOrEmpty(r))return Ki.empty();let t="",n=Number.MAX_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE,l=Number.MIN_VALUE;for(let u=0;u<r.length;u++){let{x:f,y:g}=r[u];t+=`${u===0?"M":"L"} ${f} ${g} `,n=Math.min(n,f),s=Math.max(s,f),i=Math.min(i,g),l=Math.max(l,g)}let p={x:n,y:i,width:s-n,height:l-i};return e&&(t+="Z"),{pathData:t,vertices:r,boundingRect:p}}getShapeGeometry(){return gi.getShapeGeometry(this.points,this.closed)}getPathData(){let{pathData:r}=this.getShapeGeometry();return r}static getPathData(r,e){let{pathData:t}=gi.getShapeGeometry(r,e);return t}};c([h({emit:!1,converter:xE})],gi.prototype,"points",2),c([h({emit:!1,converter:m.Boolean})],gi.prototype,"closed",2),gi=c([C({tagName:d+"-"+"2d"+"-polyline"})],gi);var cr=class extends St{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"src":case"x":case"y":case"width":case"height":this.stage?.draw(this);break}}};c([h({emit:!1,converter:m.String})],cr.prototype,"src",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"x",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"y",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"width",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"height",2),cr=c([C({tagName:d+"-"+"2d"+"-image"})],cr);var Ot=class extends St{propertyChangedCallback(r,e,t,n){if(!n)switch(r){case"text":case"color":case"fontFamily":case"fontSize":case"fontWeight":case"fontStyle":case"anchor":a.isNull(this.stage)||this.stage.draw(this);break}}};c([h({emit:!1,converter:m.String})],Ot.prototype,"text",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"color",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontFamily",2),c([h({emit:!1,converter:m.Number})],Ot.prototype,"fontSize",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontWeight",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontStyle",2),c([h({emit:!1,converter:m.Point})],Ot.prototype,"anchor",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"textAnchor",2),Ot=c([C({tagName:d+"-"+"2d"+"-text"})],Ot);var at=class{static stageDispatch(r,e,t){r instanceof EventTarget&&r.dispatchEvent(new md("stage"+e,r,t,r.transformMatrix))}static isValidViewbox(r){return!a.isNullOrEmpty(r)&&Ze.isRect(r)&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.width)&&Number.isFinite(r.height)}static itemDispatch(r,e,t){if(a.isNull(r?.stage))return!1;var n,i,s;t instanceof Event?i=t:n={item:r,offset:t},typeof e=="string"?s=e:(s=e.type,i=e.originalEvent);let l=r.stage.transformMatrix,p=()=>t instanceof Event?new Cn(s,r,i,l):new pc(s,{detail:n,cancelable:s===J.DragDropEventType.Init||s===J.DragDropEventType.Drag},i,l),u=t instanceof Event?new Cn("item"+s,r,i,l):new pc("item"+s,{detail:n,cancelable:s===J.DragDropEventType.Init||s===J.DragDropEventType.Drag},i,l);var f=!1;if(r instanceof EventTarget){let g=p();r.dispatchEvent(g),f=g.defaultPrevented}return r.stage.dispatchEvent(u),f||u.defaultPrevented}};var CE=.9,Tc=class extends K{constructor(){super(...arguments);this.DefaultShapeValues={stroke:"#000",lineWidth:1,fill:"#fff"}}snapshotElement(e,t,n,i){let s=!a.isNullOrEmpty(t),l=n??(s?"image/jpeg":null),p=i??(s?CE:null);return a.snapshotElement(e,t,l,p)}};var Rh="pacem:2d-canvas-scene",Xb="pacem:2d-parent-matrix",EE="pacem:2d-world-matrix",Oh=A.setAttachedPropertyValue,Ld=A.getAttachedPropertyValue;function Ko(o){return o==="none"||a.isNullOrEmpty(o)}function Nd(o,r){return a.isNull(o)?r:o}var Jo,xa,Td=class extends Tc{constructor(){super(...arguments);z(this,Jo);z(this,xa);this._pointer={page:{x:Number.NaN,y:Number.NaN},screen:{x:Number.NaN,y:Number.NaN},client:{x:Number.NaN,y:Number.NaN}};this._dragInitHandler=e=>{let t=this._hitTarget;if(a.isNull(t)||!Cr(t)||!t.draggable){e.preventDefault();return}let n=e.detail,i=t,s=t.transformMatrix??ke.identity,l=Ld(t,Xb,ke.identity);n.data={item:i,initialTransformMatrix:s,parentMatrix:l},at.itemDispatch(i,e,{x:0,y:0})&&e.preventDefault()};this._draggingHandler=e=>{Q(e),this._dragging=!0;let t=e.detail,n=t.data,i={x:t.currentPosition.x-t.origin.x,y:t.currentPosition.y-t.origin.y},s={x:i.x*n.parentMatrix.a+n.initialTransformMatrix.e,y:i.y*n.parentMatrix.d+n.initialTransformMatrix.f},l=n.item.stage.transformMatrix;if(!at.itemDispatch(n.item,e,{x:i.x*l.a+l.e,y:i.y*l.d+l.f}))if(n.item instanceof St)n.item.translateX=s.x,n.item.translateY=s.y;else{let u=n.initialTransformMatrix,f={a:u.a,b:u.b,c:u.c,d:u.d,e:s.x,f:s.y};a.extend(n.item,{transformMatrix:f})}};this._dragEndHandler=e=>{this._dragging=!1;let t=e.detail,n=t.data,i=n.item.transformMatrix;at.itemDispatch(n.item,e,{x:i.e,y:i.f})};this._mouseleaveHandler=e=>{if(this._dragging)return;let t=this._hitTarget;if(a.isNull(t))return;this._scopeEvent=e;let n={x:Number.NaN,y:Number.NaN};this._pointer={page:n,screen:n,client:n};let i=e.srcElement,s=Ld(i,Rh);this._requestDraw(s)};this._mousemoveHandler=e=>{this._scopeEvent=e,this._pointer=de.getEventCoordinates(e);let t=e.srcElement,n=Ld(t,Rh);this._requestDraw(n),this._dragging||a.isNull(this._hitTarget)||at.stageDispatch(n,"move",e)};this._mouseDownUpHandler=e=>{this._scopeEvent=e,this._pointer=de.getEventCoordinates(e);let t=e.target;if(t instanceof HTMLCanvasElement){let n=Ld(t,Rh),i=this._hitTarget,s=e.type.replace(/^(mouse|touch)/,""),l=s==="end"?"click":s,p=Lc(n);de.matchModifiers(e,p.clickModifiers)&&(!a.isNull(i)&&i.stage===n?at.itemDispatch(i,l,e):at.stageDispatch(n,l,e))}};this._scenes=new WeakMap;this._handles=new WeakMap}snapshot(e,t,n,i){let s=this._scenes;if(s.has(e)){let l=s.get(e).context,p=l.canvas;return this.snapshotElement(p,t,n,i)}else return Promise.resolve(null)}getCanvas(e){let t=this._scenes;return t.has(e)?t.get(e).context.canvas:null}_getScreenInverseMatrix(e,t){return ke.invert({a:e.a,b:e.b,c:e.c,d:e.d,e:e.e+t.x,f:e.f+t.y})}getTransformMatrix(e){let t=this._scenes;return t.has(e)?t.get(e).screenInverseMatrix:ke.identity}viewActivatedCallback(){super.viewActivatedCallback();let e=H(this,Jo,document.createElement(d+"-drag-drop"));e.mode=J.DragDataMode.Copy,e.dropBehavior=J.DropBehavior.None,e.spillBehavior=J.DropTargetMissedBehavior.None;let t=document.createElement("div");t.hidden=!0,e.floater=t,A.findAncestorShell(this).appendChild(e),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){let e=M(this,Jo);a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,t){let n=this._scenes;if(!a.isNull(e)&&!a.isNullOrEmpty(t)&&n.has(e)){let i=n.get(e),s=i.context;s.canvas.width=t.width,s.canvas.height=t.height;let l=i.offset=a.offsetRect(s.canvas),p={x:0,y:0,width:t.width,height:t.height},u=e.aspectRatio,f=e.viewbox;if(at.isValidViewbox(f)){let g="contain",v="center",y="middle";if(typeof u=="object"){switch(g=u.slice?"cover":"contain",u.x){case"min":v="left";break;case"max":v="right";break}switch(u.y){case"min":y="top";break;case"max":y="bottom";break}}let _=Ze.findTransform({x:0,y:0,width:f.width,height:f.height},p,g,v,y),x=ke.translate(_,{x:-_.a*f.x,y:-_.a*f.y});i.transformMatrix=x,i.screenInverseMatrix=this._getScreenInverseMatrix(x,l)}else i.transformMatrix=ke.identity}this._requestDraw(e)}getHitTarget(e){let t=this._hitTarget;return!a.isNull(t)&&t.stage===e?t:null}initialize(e){if(a.isNull(e))throw"Provided scene is null or undefined.";let t=this._scenes,n=M(this,Jo);if(t.has(e)){let p=t.get(e).context.canvas;return a.isNull(n)||n.register(p),p}let i=e.stage;i.innerHTML="";let s=document.createElement("canvas");s.setAttribute("part","stage"),Oh(s,Rh,e);let l=s.getContext("2d");return s.addEventListener("mousemove",this._mousemoveHandler,!1),s.addEventListener("mouseleave",this._mouseleaveHandler,!1),s.addEventListener("touchstart",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("touchmove",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("touchend",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("click",this._mouseDownUpHandler,!1),s.addEventListener("mousedown",this._mouseDownUpHandler,!1),s.addEventListener("mouseup",this._mouseDownUpHandler,!1),i.appendChild(s),t.set(e,{context:l,transformMatrix:ke.identity,offset:a.offsetRect(s),screenInverseMatrix:ke.identity}),a.isNull(n)||n.register(s),s}dispose(e){let t=this._scenes;if(t.has(e)){var n=t.get(e),i=n.context,s=i.canvas;let l=M(this,Jo);a.isNull(l)||l.unregister(s),s.removeEventListener("click",this._mouseDownUpHandler,!1),s.removeEventListener("touchend",this._mouseDownUpHandler,!1),s.removeEventListener("mousedown",this._mouseDownUpHandler,!1),s.removeEventListener("mouseup",this._mouseDownUpHandler,!1),s.removeEventListener("touchstart",this._mouseDownUpHandler),s.removeEventListener("mouseleave",this._mouseleaveHandler,!1),s.removeEventListener("mousemove",this._mousemoveHandler,!1),s.remove(),t.delete(e)}}_requestDraw(e){let t=this._handles;t.has(e)&&cancelAnimationFrame(t.get(e));let n=()=>(this.draw(e),requestAnimationFrame(()=>{}));t.set(e,n())}draw(e){let t=this._scenes,n=this._handles;if(!a.isNull(e)){if(e.adapter!==this){t.has(e)&&(t.delete(e),n.get(e));return}if(!t.has(e)){this.initialize(e);return}n.has(e)&&cancelAnimationFrame(n.get(e));let i=this._hitTarget,s=e.datasource||[];this._hitTarget=null;let l=t.get(e),p=l.context,u=p.canvas;H(this,xa,getComputedStyle(u)),p.resetTransform(),p.clearRect(0,0,u.width,u.height);let f=l.transformMatrix;p.setTransform(f);let g=this._pointer,v=l.offset,y=Number.isNaN(g.page.x)||Number.isNaN(g.page.y)?null:{x:g.page.x-v.x,y:g.page.y-v.y};for(let x of s)this._draw(e,p,x,{transformMatrix:f},y);let _=this._hitTarget;_!=i&&(a.isNull(i)||(i instanceof Element&&i.dispatchEvent(new Cn("out",i,this._scopeEvent,f)),e.dispatchEvent(new Cn("itemout",i,this._scopeEvent,f))),a.isNull(_)||(_ instanceof Element&&_.dispatchEvent(new Cn("over",_,this._scopeEvent,f)),e.dispatchEvent(new Cn("itemover",_,this._scopeEvent,f))))}}_draw(e,t,n,i,s){if(n.stage??=e,dc(n)&&n.hide)return;Cr(n)&&n.draggable&&!n.hide&&!n.inert&&Oh(n,Xb,t.getTransform().inverse());let l;Cr(n)&&(l=n.transformMatrix,!a.isNull(l)&&!ke.isIdentity(l)&&t.transform(l.a,l.b,l.c,l.d,l.e,l.f));let p=i;if(gd(n)&&(p=hd.combine(n,i,t.getTransform()),this._setPresentationState(t,p)),hc(n)||n instanceof ut)this._drawShape(t,n,s);else if(mc(n)||n instanceof Ot)this._drawText(t,n,s);else if(fc(n)||n instanceof cr)this._drawImage(t,n,s);else if(Bo(n)||n instanceof ya)for(let u of n.childDrawables||[])this._draw(e,t,u,p,s);Cr(n)&&n.draggable&&!n.hide&&!n.inert&&Oh(n,EE,t.getTransform().inverse()),this._setPresentationState(t,i)}_setPresentationState(e,t){if(e.setTransform(t.transformMatrix),!a.isNullOrEmpty(t.stroke)&&!Ko(t.stroke)?e.strokeStyle=t.stroke:e.strokeStyle="transparent",a.isNullOrEmpty(t.lineWidth)?e.lineWidth=0:e.lineWidth=t.lineWidth,a.isNullOrEmpty(t.dashArray)?e.setLineDash([]):e.setLineDash(t.dashArray),a.isNullOrEmpty(t.lineCap)?e.lineCap="butt":e.lineCap=t.lineCap,a.isNullOrEmpty(t.lineJoin)?e.lineJoin="miter":e.lineJoin=t.lineJoin,typeof t.fill=="object"&&!a.isNullOrEmpty(t.fill)){let{stops:n}=t.fill,i;if(fd(t.fill)){let{start:s,end:l}=t.fill;i=e.createLinearGradient(s.x,s.y,l.x,l.y)}else if(uc(t.fill)){let{center:s,radius:l}=t.fill;i=e.createRadialGradient(s.x,s.y,l,s.x,s.y,l)}else throw new Error("Unmanaged gradient type.");for(let s of n)i.addColorStop(s.offset,s.color);e.fillStyle=i}else!a.isNullOrEmpty(t.fill)&&typeof t.fill=="string"&&!Ko(t.fill)?e.fillStyle=t.fill:e.fillStyle="transparent";a.isNullOrEmpty(t.opacity)?e.globalAlpha=1:e.globalAlpha=t.opacity}_drawImage(e,t,n){let i="pacem:2d-canvas-imagesrc",s=Ld(t,i),l=()=>{let p=s.naturalWidth,u=s.naturalHeight,f=t.width,g=t.height;if(f>0&&g>0||(f>0?g=u*f/p:g>0?f=p*g/u:(f=p,g=u)),!this._dragging&&!t.inert&&!a.isNull(n)){let v=new Path2D(`M ${t.x} ${t.y} h ${f} v ${g} H ${t.x} Z`);e.isPointInPath(v,n.x,n.y)&&(this._hitTarget=t)}e.globalAlpha=Nd(t.opacity,1),e.drawImage(s,t.x,t.y,f,g)};a.isNull(s)?(s=new Image,s.src=t.src,s.onload=()=>{Oh(t,i,s),l()}):l()}_drawText(e,t,n){let i=this.DefaultShapeValues,s=e.fillStyle=Nd(t.color,i.stroke),l=e.getTransform(),p=t.fontSize>0?`${t.fontSize}px`:M(this,xa).fontSize,u=t.fontStyle||M(this,xa).fontStyle,f=t.fontWeight||M(this,xa).fontWeight;e.font=`${u} ${f} ${p} ${t.fontFamily??M(this,xa).fontFamily}`,e.textAlign=t.textAnchor==="middle"?"center":t.textAnchor,e.fillText(t.text,t.anchor.x,t.anchor.y),e.globalAlpha=Nd(t.opacity,1);let g=!Ko(s);if(!this._dragging&&!t.inert&&!a.isNull(n)){let v=e.measureText(t.text),y=v.width,_=v.actualBoundingBoxAscent+v.actualBoundingBoxDescent,x=t.anchor.x-v.actualBoundingBoxLeft,w=t.anchor.y-v.actualBoundingBoxAscent,E=new Path2D(`M ${x} ${w} h ${y} v ${_} H ${x} z`);g&&e.isPointInPath(E,n.x,n.y)&&(this._hitTarget=t)}}_drawShape(e,t,n){if(a.isNullOrEmpty(t?.pathData))return;e.beginPath();let i=typeof e.fillStyle!="string"||!Ko(e.fillStyle),s=typeof e.strokeStyle!="string"||!Ko(e.strokeStyle);var l=new Path2D(t.pathData);!this._dragging&&!t.inert&&!a.isNull(n)&&(i&&e.isPointInPath(l,n.x,n.y)||s&&e.isPointInStroke(l,n.x,n.y))&&(this._hitTarget=t),s&&e.stroke(l),i&&e.fill(l);let p=!a.isNullOrEmpty(t.vertices)&&t.vertices.length>1,u=!a.isNull(t.markerEnd),f=!a.isNull(t.markerStart),g=!a.isNull(t.markerMid);if((u||g||f)&&(p||this.log(ce.LogLevel.Warn,"Not enough vertices were explicited in order to make markers renderable.")),p){let v=e.getTransform();if(f){let y=t.markerEnd,_=t.vertices[1],x=t.vertices[0],w=Math.atan2(x.y-_.y,x.x-_.x);this._drawMarker(e,y,x,w)}if(g){let y=t.markerEnd;for(let _=1;_<t.vertices.length-1;_++){e.setTransform(v);let x=t.vertices[_],w=t.vertices[_+1],E=Math.atan2(w.y-x.y,w.x-x.x);this._drawMarker(e,y,w,E)}}if(u){e.setTransform(v);let y=t.markerEnd,_=t.vertices[t.vertices.length-2],x=t.vertices[t.vertices.length-1],w=Math.atan2(x.y-_.y,x.x-_.x);this._drawMarker(e,y,x,w)}}}_drawMarker(e,t,n,i){let s=this.DefaultShapeValues,l=t.ref?.x||0,p=t.ref?.y||0,u=(t.width||1)*e.lineWidth,f=(t.width||1)*e.lineWidth,g=t.viewbox,v={x:0,y:0,width:u,height:f};a.isNull(g)&&(g=v);let y={a:v.width/g.width,d:v.height/g.height};e.translate(n.x,n.y),e.rotate(i),e.scale(y.a,y.d),e.translate(-l,-p),e.fillStyle=Nd(t.fill,s.fill),e.strokeStyle=Nd(t.stroke,s.stroke);let _=!Ko(t.fill),x=!Ko(t.stroke);var w=new Path2D(t.pathData);_&&e.fill(w),x&&e.stroke(w)}};Jo=new WeakMap,xa=new WeakMap,Td=c([C({tagName:d+"-"+"2d"+"-canvas-adapter"})],Td);var vi="http://www.w3.org/2000/svg",Ad="pacem:2-svg-drawable",Ph="pacem:2d-svg-stage",Dd=A.getAttachedPropertyValue,qb=A.setAttachedPropertyValue,Kb=A.deleteAttachedPropertyValue;function gg(o,r){return a.isNull(o)?r:o}function Jb(o,r,e){return e>=o.children.length?(o.appendChild(r),null):o.replaceChild(r,o.children.item(e))}var Ca,Zo,Rd=class extends Tc{constructor(){super(...arguments);z(this,Ca);this._hitTarget=null;z(this,Zo);this._dragInitHandler=e=>{let t=e.detail,n=t.element,i=Dd(n,Ad),s=i.stage.transformMatrix,l=i.transformMatrix??ke.identity;t.data={stageTransformMatrix:s,item:i,initialTransformMatrix:l},at.itemDispatch(i,e,{x:0,y:0})&&e.preventDefault()};this._draggingHandler=e=>{Q(e),H(this,Zo,!0);let t=e.detail.element,n=e.detail.data,i=e.detail,s={x:(i.currentPosition.x-i.origin.x)*n.stageTransformMatrix.a,y:(i.currentPosition.y-i.origin.y)*n.stageTransformMatrix.d},l={x:s.x+n.initialTransformMatrix.e,y:s.y+n.initialTransformMatrix.f},p={x:s.x+n.stageTransformMatrix.e,y:s.y+n.stageTransformMatrix.f};if(!at.itemDispatch(n.item,e,p)){let f=n.initialTransformMatrix;t.style.transform=`matrix(${f.a},${f.b},${f.c},${f.d},${l.x},${l.y})`}};this._dragEndHandler=e=>{H(this,Zo,!1);let t=e.detail,n=t.element,i=t.data,s=a.deserializeTransform(n.style),l={x:s.e,y:s.f};if(i.item instanceof St)i.item.translateX=l.x,i.item.translateY=l.y;else{let p=i.initialTransformMatrix,u={a:p.a,b:p.b,c:p.c,d:p.d,e:l.x,f:l.y};a.extend(i.item,{transformMatrix:u})}n.style.transform="",at.itemDispatch(i.item,e,l)};this._mouseleaveHandler=e=>{if(M(this,Zo))return;let t=this._hitTarget;a.isNull(t)||(this._hitTarget=null,a.isNull(t)||(M(this,Ca).unregister(this._items.get(t)),at.itemDispatch(t,"out",e)))};this._mousemoveHandler=e=>{var t=de.getEventCoordinates(e).client;if(!M(this,Zo)){var n=null;e.target.getRootNode().elementsFromPoint(t.x,t.y).find(u=>(n=Dd(u,Ad),n&&!n.inert));var i=this._hitTarget,s=n;(a.isNull(n&&n.stage)||!this._scenes.has(n.stage)||n.inert)&&(s=null);let p=this._hitTarget=s;if(s!==i&&(a.isNull(i)||(M(this,Ca).unregister(this._items.get(i)),at.itemDispatch(i,"out",e)),a.isNull(s)||(s.draggable&&M(this,Ca).register(this._items.get(s)),at.itemDispatch(s,"over",e))),a.isNull(p)){let u=e.currentTarget,f=Dd(u,Ph);a.isNull(f)||at.stageDispatch(f,"move",e)}}};this._mouseDownUpHandler=e=>{let t=e.currentTarget;if(t instanceof SVGSVGElement){let n=Dd(t,Ph),i=this._hitTarget,s=e.type.replace(/^mouse/,""),l=Lc(n);de.matchModifiers(e,l.clickModifiers)&&(!a.isNull(i)&&i.stage===n?at.itemDispatch(i,s,e):at.stageDispatch(n,s,e))}};this._scenes=new WeakMap;this._markers=new WeakMap;this._gradients=new WeakMap;this._items=new WeakMap}snapshot(e,t,n,i){if(this._scenes.has(e)){let s=this._scenes.get(e);return this.snapshotElement(s,t,n,i)}else return Promise.resolve(null)}getTransformMatrix(e){let t=this._scenes;return t.has(e)?t.get(e).getScreenCTM().inverse():ke.identity}viewActivatedCallback(){super.viewActivatedCallback();let e=H(this,Ca,document.createElement(d+"-drag-drop"));e.mode=J.DragDataMode.Self,A.findAncestorShell(this).appendChild(e),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){let e=M(this,Ca);a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,t){let n=this._scenes;if(!a.isNull(e)&&!a.isNullOrEmpty(t)&&n.has(e)){var i=n.get(e);i.setAttribute("width",t.width+""),i.setAttribute("height",t.height+"");let s=e.viewbox,l=e.aspectRatio;at.isValidViewbox(s)?i.setAttribute("viewBox",`${s.x} ${s.y} ${s.width} ${s.height}`):i.removeAttribute("viewBox"),a.isNullOrEmpty(l)||typeof l=="string"?i.removeAttribute("preserveAspectRatio"):i.setAttribute("preserveAspectRatio",`xM${l.x.substring(1)}YM${l.y.substring(1)} ${l.slice?"slice":"meet"}`)}}initialize(e){if(a.isNull(e))throw"Provided scene is null or undefined.";let t=this._scenes;if(t.has(e))return t.get(e);let n=e.stage;n.innerHTML="",this._items=new WeakMap;var i=document.createElementNS(vi,"svg");i.setAttribute("part","stage"),qb(i,Ph,e),n.appendChild(i),t.set(e,i);let s={passive:!1,capture:!0};return i.addEventListener("mousemove",this._mousemoveHandler,!1),i.addEventListener("click",this._mouseDownUpHandler,!1),i.addEventListener("mousedown",this._mouseDownUpHandler,!1),i.addEventListener("mouseup",this._mouseDownUpHandler,!1),i.addEventListener("mouseleave",this._mouseleaveHandler,!1),i}dispose(e){let t=this._scenes;if(t.has(e)){var n=t.get(e);n.removeEventListener("mousemove",this._mousemoveHandler),n.removeEventListener("click",this._mouseDownUpHandler),n.removeEventListener("mousedown",this._mouseDownUpHandler),n.removeEventListener("mouseup",this._mouseDownUpHandler),n.removeEventListener("mouseleave",this._mouseleaveHandler),Kb(n,Ph),n.remove(),t.delete(e)}}getHitTarget(e){return this._hitTarget}draw(e,t,n=!1){let i=this._scenes,s=this._items;if(!a.isNull(e)){if(e.adapter===this)i.has(e)||this.initialize(e);else{i.has(e)&&i.delete(e);return}var l=e.datasource,p=!0,u=i.get(e);!a.isNull(t)&&s.has(t)&&(l=[t],u=s.get(t).parentNode,p=!1),p&&(u.innerHTML="<defs></defs>",this._markers=new WeakMap),this._draw(e,u,l||[],p,n)}}_hasItems(e){return Bo(e)}_disposeSvg(e){if(!a.isNull(e)){var t=Dd(e,Ad);Kb(e,Ad),this._items.delete(t)}}_draw(e,t,n,i,s){let l=this._items,p=0;if(t.firstElementChild instanceof SVGDefsElement&&p++,!a.isNullOrEmpty(n))for(let u of n){u.stage??=e;let f;if(l.has(u)?(f=l.get(u),f.parentNode!==t&&this._disposeSvg(Jb(t,f,p))):(f=this._buildSVGElement(u),qb(f,Ad,u),this._disposeSvg(Jb(t,f,p)),l.set(u,f)),dc(u)&&(u.hide?f.setAttribute("display","none"):f.removeAttribute("display"),f.style.transform=""),hc(u)){let g=f;g.setAttribute("d",gg(u.pathData,"M0,0"));for(let{marker:v,suffix:y}of[{marker:u.markerStart,suffix:"start"},{marker:u.markerEnd,suffix:"end"},{marker:u.markerMid,suffix:"mid"}])if(v){let _=this._ensureMarker(t,v);g.setAttribute("marker-"+y,`url(#${_.id})`)}else g.removeAttribute("marker-"+y)}else if(mc(u)){let g=f;g.textContent=u.text,g.style.fill=a.isNullOrEmpty(u.color)?"":u.color,g.style.fontFamily=a.isNullOrEmpty(u.fontFamily)?"":u.fontFamily,g.style.fontSize=a.isNull(u.fontSize)?"":u.fontSize+"px",a.isNullOrEmpty(u.fontWeight)||(g.style.fontWeight=u.fontWeight),a.isNullOrEmpty(u.fontStyle)||(g.style.fontStyle=u.fontStyle),g.setAttribute("text-anchor",gg(u.textAnchor,"start")),a.isNull(u.anchor)?(g.removeAttribute("x"),g.removeAttribute("y")):(g.setAttribute("x",u.anchor.x.toString()),g.setAttribute("y",u.anchor.y.toString()))}else if(fc(u)){let g=f;g.setAttribute("href",u.src),g.setAttribute("preserveAspectRatio","none"),u.width>0?g.setAttribute("width",""+u.width):g.removeAttribute("width"),u.height>0?g.setAttribute("height",""+u.height):g.removeAttribute("height"),a.isNull(u.x)?g.removeAttribute("x"):g.setAttribute("x",""+u.x),a.isNull(u.y)?g.removeAttribute("y"):g.setAttribute("y",""+u.y)}if(Cr(u)){let g=u.transformMatrix;a.isNull(g)||ke.isIdentity(g)?f.removeAttribute("transform"):f.setAttribute("transform",`matrix(${g.a} ${g.b} ${g.c} ${g.d} ${g.e} ${g.f})`);let v=gg(u.opacity,1);v===1?f.removeAttribute("opacity"):f.setAttribute("opacity",""+v)}if(gd(u)){if(a.isNullOrEmpty(u.fill))f.removeAttribute("fill");else if(typeof u.fill=="string")f.setAttribute("fill",u.fill);else{let g=this._ensureGradient(t,u.fill);f.setAttribute("fill",`url(#${g.id})`)}a.isNullOrEmpty(u.stroke)?f.removeAttribute("stroke"):f.setAttribute("stroke",u.stroke),a.isNullOrEmpty(u.dashArray)?f.removeAttribute("stroke-dasharray"):f.setAttribute("stroke-dasharray",u.dashArray.join(" ")),a.isNullOrEmpty(u.lineCap)?f.removeAttribute("stroke-linecap"):f.setAttribute("stroke-linecap",u.lineCap),a.isNullOrEmpty(u.lineJoin)?f.removeAttribute("stroke-linejoin"):f.setAttribute("stroke-linejoin",u.lineJoin),a.isNullOrEmpty(u.lineWidth)?f.removeAttribute("stroke-width"):f.setAttribute("stroke-width",""+u.lineWidth)}u.inert?f.style.pointerEvents="none":f.style.pointerEvents="",(i||s)&&this._hasItems(u)&&this._draw(e,f,u.childDrawables,!0,s),p++}if(i)for(let u=t.children.length-1;u>=p;u--){let f=t.children.item(u);this._disposeSvg(f),f.remove()}}_buildSVGElement(e){return hc(e)||e instanceof ut?document.createElementNS(vi,"path"):mc(e)||e instanceof Ot?document.createElementNS(vi,"text"):fc(e)||e instanceof cr?document.createElementNS(vi,"image"):document.createElementNS(vi,"g")}_ensureGradient(e,t){let n=this._gradients;n.has(e)||n.set(e,new WeakMap);let i=n.get(e),s=fd(t),l=uc(t);if(i.has(t)){let g=i.get(t);(s&&g instanceof SVGLinearGradientElement||l&&g instanceof SVGRadialGradientElement)&&(g.remove(),i.delete(t))}if(!i.has(t)){let g=e,v;for(;a.isNull(v=g.querySelector(":scope > defs"));){let y=g.parentElement;if(y instanceof SVGElement)g=y;else break}if(a.isNull(v))throw new Error("Must provide a <defs> element.");var p=null;if(s)p=document.createElementNS(vi,"linearGradient");else if(uc(t))p=document.createElementNS(vi,"radialGradient");else throw new Error("Unmanaged gradient type.");p.setAttribute("gradientUnits","userSpaceOnUse"),p.setAttribute("id",`grad-${a.uniqueCode()}`),v.appendChild(p),i.set(t,p)}let u=i.get(t);s?(u.setAttribute("x1",t.start.x.toString()),u.setAttribute("y1",t.start.y.toString()),u.setAttribute("x2",t.end.x.toString()),u.setAttribute("y2",t.end.y.toString())):l&&(u.setAttribute("cx",t.center.x.toString()),u.setAttribute("cy",t.center.y.toString()),u.setAttribute("r",t.radius.toString()));let f=0;for(let g of t.stops){for(;u.children.length<=f;){let y=document.createElementNS(vi,"stop");u.appendChild(y)}let v=u.children.item(f);v.setAttribute("offset",g.offset*100+"%"),v.setAttribute("stop-color",g.color),a.isNull(g.opacity)||v.setAttribute("stop-opacity",g.opacity.toString()),f++}for(;u.children.length>t.stops.length;){let g=u.children.item(u.children.length-1);u.removeChild(g)}return u}_ensureMarker(e,t){let n=this._markers;n.has(e)||n.set(e,new WeakMap);let i=n.get(e);if(!i.has(t)){let p=document.createElementNS(vi,"marker");i.set(t,p);let u=document.createElementNS(vi,"path");p.appendChild(u),p.setAttribute("id","mark"+a.uniqueCode());let f=e,g;for(;a.isNull(g=f.querySelector(":scope > defs"));){let v=f.parentElement;if(v instanceof SVGElement)f=v;else break}if(a.isNull(g))throw new Error("Must provide a <defs> element.");g.appendChild(p)}let s=i.get(t),l=s.firstElementChild;return s.setAttribute("orient","auto-start-reverse"),a.isNullOrEmpty(t.viewbox)?s.removeAttribute("viewBox"):s.setAttribute("viewBox",`${t.viewbox.x} ${t.viewbox.y} ${t.viewbox.width} ${t.viewbox.height}`),a.isNullOrEmpty(t.ref)?(s.removeAttribute("refX"),s.removeAttribute("refY")):(s.setAttribute("refX",t.ref.x.toString()),s.setAttribute("refY",t.ref.y.toString())),t.height>0?s.setAttribute("markerHeight",t.height.toString()):s.removeAttribute("markerHeight"),t.width>0?s.setAttribute("markerWidth",t.width.toString()):s.removeAttribute("markerWidth"),l.setAttribute("d",t.pathData),a.isNullOrEmpty(t.fill)?l.removeAttribute("fill"):l.setAttribute("fill",t.fill),a.isNullOrEmpty(t.stroke)?l.removeAttribute("stroke"):l.setAttribute("stroke",t.stroke),s}};Ca=new WeakMap,Zo=new WeakMap,Rd=c([C({tagName:d+"-"+"2d"+"-svg-adapter"})],Rd);var Gg={};Le(Gg,{AdapterUtils:()=>os,BasicMaterialElement:()=>Od,DragEvent:()=>Go,KnownShader:()=>kn,LambertMaterialElement:()=>Ea,LineMaterialElement:()=>is,MaterialElement:()=>ft,OrbitCameraBehavior:()=>em,Pacem3DAdapterElement:()=>fa,Pacem3DCameraElement:()=>jr,Pacem3DDetector:()=>bg,Pacem3DElement:()=>Jt,Pacem3DGroupElement:()=>di,Pacem3DLightElement:()=>Er,Pacem3DMeshElement:()=>En,Pacem3DObjectElement:()=>wn,Pacem3DOrthographicCameraElement:()=>Wr,Pacem3DPerspectiveCameraElement:()=>pi,Pacem3DPrimitiveElement:()=>gt,Pacem3DThreeAdapterElement:()=>Ac,Pacem3DWebgpuAdapterElement:()=>ls,Pacem3DWgslScriptElement:()=>Da,PacemBoxElement:()=>Ut,PacemConeElement:()=>Lr,PacemCylinderElement:()=>Nr,PacemDodecahedronElement:()=>nl,PacemHexahedronElement:()=>tl,PacemIcosahedronElement:()=>rl,PacemLineElement:()=>ss,PacemOctahedronElement:()=>el,PacemOrbitCameraBehaviorElement:()=>Ar,PacemPlaneElement:()=>qr,PacemSphereElement:()=>yi,PacemTetrahedronElement:()=>Qo,PacemTorusElement:()=>Kr,PhongMaterialElement:()=>Ln,PolyhedronElement:()=>as,RenderableElement:()=>ci,RenderableEvent:()=>Fo,StalePropertyFlag:()=>hi,StandardMaterialElement:()=>bi,UI3DEvent:()=>xc,Ui3DElement:()=>At,computePlaneNormal:()=>ag,computeSharpVertexNormals:()=>Dt,isBasicMaterial:()=>kh,isCamera:()=>Vt,isGeometry:()=>_d,isGroup:()=>Wo,isInteraction:()=>wh,isLambertMaterial:()=>Mh,isLight:()=>ui,isLineMaterial:()=>va,isMaterial:()=>Yr,isMesh:()=>wr,isMeshGeometry:()=>Ec,isOrthographicCamera:()=>Eh,isPerspectiveCamera:()=>Ch,isPhongMaterial:()=>Sh,isRenderable:()=>yd,isShaderMaterial:()=>Bb,isStage:()=>sg,isStandardMaterial:()=>Lh,isUi3DObject:()=>Cc});var bg=class{constructor(){this._detected={supported:!1,info:{}};let r=document.createElement("canvas"),e=["webgl","experimental-webgl","moz-webgl","webkit-3d"],t,n=function(l){if(l)return t.getParameter(l)},i=(l,p,u)=>{let f=this._detected;var g=f.info[l]=f.info[l]||{};p=p.replace(/[^\w]+/g,""),p=p.substring(0,1).toLowerCase()+p.substring(1),g[p]=u};if(navigator.userAgent.indexOf("MSIE")>=0)try{t=window.WebGLHelper.CreateGLContext(r,"canvas")}catch{}else for(var s=0;s<e.length;s++)try{if(t=r.getContext(e[s]),t){i("main","Context Name",e[s]);break}}catch{}this._detected.supported=!!t,i("main","Platform",navigator.platform),i("main","Agent",navigator.userAgent),t&&(i("main","Vendor",n(t.VENDOR)),i("main","Version",n(t.VERSION)),i("main","Renderer",n(t.RENDERER)),i("main","Shading Language Version",n(t.SHADING_LANGUAGE_VERSION)),i("bits","Rgba Bits",n(t.RED_BITS)+", "+n(t.GREEN_BITS)+", "+n(t.BLUE_BITS)+", "+n(t.ALPHA_BITS)),i("bits","Depth Bits",n(t.DEPTH_BITS)),i("shader","Max Vertex Attribs",n(t.MAX_VERTEX_ATTRIBS)),i("shader","Max Vertex Texture Image Units",n(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),i("shader","Max Varying Vectors",n(t.MAX_VARYING_VECTORS)),i("shader","Max Uniform Vectors",n(t.MAX_VERTEX_UNIFORM_VECTORS)),i("tex","Max Combined Texture Image Units",n(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),i("tex","Max Texture Size",n(t.MAX_TEXTURE_SIZE)),i("tex","Max Cube Map Texture Size",n(t.MAX_CUBE_MAP_TEXTURE_SIZE)),i("tex","Num. Compressed Texture Formats",n(t.COMPRESSED_TEXTURE_FORMATS)),i("misc","Max Render Buffer Size",n(t.MAX_RENDERBUFFER_SIZE)),i("misc","Max Viewport Dimensions",n(t.MAX_VIEWPORT_DIMS)),i("misc","Aliased Line Width Range",n(t.ALIASED_LINE_WIDTH_RANGE)),i("misc","Aliased Point Size Range",n(t.ALIASED_POINT_SIZE_RANGE)),i("misc","Supported Extensions",t.getSupportedExtensions()||[]))}get info(){return this._detected.info}get supported(){return this._detected.supported}};var Od=class extends ft{constructor(){super("basic")}};Od=c([C({tagName:`${d}-${"3d"}-material-basic`})],Od);var Ea=class extends ft{constructor(){super("lambert")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:this.reflectivity??0,refractionRatio:this.refractionRatio??0},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"reflectivity":case"refractionRatio":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],Ea.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],Ea.prototype,"reflectivity",2),c([h({emit:!1,converter:m.Number})],Ea.prototype,"refractionRatio",2),Ea=c([C({tagName:`${d}-${"3d"}-material-lambert`})],Ea);var is=class extends ft{constructor(){super("line")}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"lineWidth":case"lineJoin":case"lineCap":case"dashArray":this.updateMaterial();break}}async createMaterial(){return a.extend({lineWidth:this.lineWidth??1,lineJoin:this.lineJoin??"round",lineCap:this.lineCap??"round",dashArray:this.dashArray},await super.createMaterial())}};c([h({emit:!1,converter:m.Number})],is.prototype,"lineWidth",2),c([h({emit:!1,converter:m.String})],is.prototype,"lineJoin",2),c([h({emit:!1,converter:m.String})],is.prototype,"lineCap",2),c([h({emit:!1,converter:{convert:r=>r?.split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),convertBack:r=>r?.join(",")}})],is.prototype,"dashArray",2),is=c([C({tagName:`${d}-${"3d"}-material-line`})],is);var Ln=class extends ft{constructor(){super("phong")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:this.reflectivity??0,refractionRatio:this.refractionRatio??0,specularColor:this.specularColor||"#000",shininess:this.shininess??0,flatShading:this.flatShading??!0},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"reflectivity":case"refractionRatio":case"specularColor":case"shininess":case"flatShading":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],Ln.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"reflectivity",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"refractionRatio",2),c([h({emit:!1,converter:m.String})],Ln.prototype,"specularColor",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"shininess",2),c([h({emit:!1,converter:m.Boolean})],Ln.prototype,"flatShading",2),Ln=c([C({tagName:`${d}-${"3d"}-material-phong`})],Ln);var bi=class extends ft{constructor(){super("standard")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",refractionRatio:this.refractionRatio??0,metalness:this.metalness??0,roughness:this.roughness??0,flatShading:this.flatShading??!1},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"roughness":case"metalness":case"refractionRatio":case"flatShading":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],bi.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"refractionRatio",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"roughness",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"metalness",2),c([h({emit:!1,converter:m.Boolean})],bi.prototype,"flatShading",2),bi=c([C({tagName:`${d}-${"3d"}-material-standard`})],bi);var gt=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.geometry)&&(this.geometry=this.createDefaultGeometry())}};c([h({converter:m.Json})],gt.prototype,"geometry",2);var Ut=class extends gt{static createMeshGeometry(r,e,t,n,i,s){let l=r||1,p=e||1,u=t||1,f=n||1,g=i||1,v=s||1,y=[],_=[],x=[];for(var w=0;w<=g;w++)for(var E=p/2-p*(1*w)/(1*g),k=0;k<=v;k++)for(var N=-u/2+u*(1*k)/(1*v),T=0;T<=f;T++){var O=-l/2+l*(1*T)/(1*f);(T==0||T==f||k==0||k==v||w==0||w==g)&&y.push({x:O,y:E,z:N})}for(var D=function(he,fe,le){for(var re=1e-5,Oe=0;Oe<y.length;Oe++){var ge=y[Oe];if(Math.abs(ge.x-he)<re&&Math.abs(ge.y-fe)<re&&Math.abs(ge.z-le)<re)return Oe}return-1},P=function(he,fe,le,re,Oe,ge,Ne,Pe){x.push(he),x.push(fe),x.push(le),x.push(he),x.push(le),x.push(re),_.push({x:Oe,y:Pe}),_.push({x:Ne,y:Pe}),_.push({x:Ne,y:ge}),_.push({x:Oe,y:Pe}),_.push({x:Ne,y:ge}),_.push({x:Oe,y:ge})},k=0;k<v;k++)for(var E=p/2,N=-u/2+u*(1*k)/(1*v),F=-u/2+u*(1*(k+1))/(1*v),T=0;T<f;T++){var O=-l/2+1*T*l/(1*f),B=-l/2+1*(T+1)*l/(1*f),$=D(O,E,F),U=D(B,E,F),I=D(B,E,N),G=D(O,E,N),Y=1*(T+1)/(1*f),W=1*T/(1*f),V=1-1*(k+1)/(1*v),X=1-1*k/(1*v);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-1*w*p/(1*g),q=p/2-(w+1)*p/(1*g),N=-u/2,T=0;T<f;T++){var O=l/2-1*T*l/(1*f),B=l/2-(T+1)*l/(1*f),$=D(O,q,N),U=D(B,q,N),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-1*w*p/(1*g),q=p/2-(w+1)*p/(1*g),O=-l/2,k=0;k<v;k++){var N=-u/2+k*u/(1*v),F=-u/2+(k+1)*u/(1*v),$=D(O,q,N),U=D(O,q,F),I=D(O,E,F),G=D(O,E,N),Y=(k+1)/(1*v),W=1*k/(1*v),V=1-(w+1)/(1*g),X=1-w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-w*p/(1*g),q=p/2-(w+1)*p/(1*g),N=u/2,T=0;T<f;T++){var O=-l/2+T*l/(1*f),B=-l/2+(T+1)*l/(1*f),$=D(O,q,N),U=D(B,q,N),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-w*p/(1*g),q=p/2-(w+1)*p/(1*g),O=l/2,k=0;k<v;k++){var N=u/2-k*u/(1*v),F=u/2-(k+1)*u/(1*v),$=D(O,q,N),U=D(O,q,F),I=D(O,E,F),G=D(O,E,N),Y=(k+1)/(1*v),W=1*k/(1*v),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var k=0;k<v;k++)for(var E=-p/2,N=u/2-u*k/(1*v),F=u/2-u*(k+1)/(1*v),T=0;T<f;T++){var O=-l/2+T*l/(1*f),B=-l/2+(T+1)*l/(1*f),$=D(O,E,F),U=D(B,E,F),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(k+1)/(1*v),X=1-1*k/(1*v);P($,U,I,G,W,X,Y,V)}let Z=new ze(y,x,_);Z.key=`box_${r}x${e}x${t}_w${n}_h${i}_d${s}`,Dt(Z);let ne={x:0,y:0,z:0},te=r/2,ae=e/2,Se=t/2;return Z.barycenter=ne,Z.boundingBox={maxX:te,maxY:ae,maxZ:Se,minX:-te,minY:-ae,minZ:-Se},Z.boundingSphere={center:ne,radius:Math.sqrt(Math.pow(te,2)+Math.pow(ae,2)+Math.pow(Se,2))},Z}createDefaultGeometry(){return Ut.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"width":case"height":case"depth":case"widthSegments":case"heightSegments":case"depthSegments":this.geometry=Ut.createMeshGeometry(this.width,this.height,this.depth,this.widthSegments,this.heightSegments,this.depthSegments);break}}};c([h({emit:!1,converter:m.Number})],Ut.prototype,"width",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"depth",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"widthSegments",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"depthSegments",2),Ut=c([C({tagName:d+"-"+"3d"+"-primitive-box"})],Ut);var Lr=class extends gt{static createMeshGeometry(r=1,e=1,t=18,n=5,i=1){let s=r,l=[],p=[],u=[],f=Zi*(360/t),g=s/e,v=e/n,y=1/t;l.push({x:0,y:e,z:0});for(let E=1;E<=n;E++){let k=e-v*E,N=k/e,T=(e-k)*g,D=(k+v)/e;for(let P=0;P<t;P++){let F=f*P,B=Math.cos(F)*T,$=-Math.sin(F)*T;l.push({x:B,y:k,z:$});let U=1+t*(E-1)+P,I=P==0?U+t-1:U-1,G=P*y,Y=P==0?1-y:y*(P-1);if(E==1){u.push(0,I,U),p.push({x:G,y:1},{x:Y,y:N},{x:G,y:N});continue}let W=1+t*(E-2)+P,X=P==0?W+t-1:W-1,q=I,Z=U,ne=W;u.push(Z,X,q),u.push(Z,ne,X);let te={x:Y,y:D},ae={x:Y,y:N},Se={x:G,y:N},he={x:G,y:D};p.push(Se,te,ae),p.push(Se,he,te)}}let _=1+(n-1)*t;l.push({x:0,y:0,z:0});let x=_+t;for(let E=1;E<=i;E++){let k=E/i,N=r*k,T=(E-1)/i;for(let O=0;O<t;O++){let D=f*O,P=Math.cos(D),F=Math.sin(D),B=D-f,$=Math.cos(B),U=Math.sin(B),I=.5*(1+P*k),G=.5*(1+F*k),Y=.5*(1+$*k),W=.5*(1+U*k),V,X;if(E!=i){let He=Math.cos(D)*N,Wt=-Math.sin(D)*N;l.push({x:He,y:0,z:Wt}),V=x+1+(E-1)*t+O,X=O==0?V+t-1:V-1}else V=_+O,X=O==0?_+t-1:V-1;if(E==1){u.push(x,V,X),p.push({x:.5,y:.5},{x:I,y:G},{x:Y,y:W});continue}let q=.5*(1+P*T),Z=.5*(1+F*T),ne=.5*(1+$*T),te=.5*(1+U*T),ae=x+1+(E-2)*t+O,he=O==0?ae+t-1:ae-1,fe=X,le=V,re=ae;u.push(he,re,fe),u.push(fe,re,le);let Oe={x:ne,y:te},ge={x:Y,y:W},Ne={x:I,y:G},Pe={x:q,y:Z};p.push(Oe,Pe,ge),p.push(ge,Pe,Ne)}}let w=new ze(l,u,p);return w.key=`cone_${r}x${e}_s${t}_h${n}_c${i}`,Dt(w),w}createDefaultGeometry(){return Lr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"height":case"sides":case"heightSegments":case"capSegments":this.geometry=Lr.createMeshGeometry(this.radius,this.height,this.sides,this.heightSegments,this.capSegments);break}}};c([h({emit:!1,converter:m.Number})],Lr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"capSegments",2),Lr=c([C({tagName:d+"-"+"3d"+"-primitive-cone"})],Lr);var Nr=class extends gt{static createMeshGeometry(r=1,e=1,t=18,n=5,i=1){let s=r,l=[],p=[],u=[],f=Zi*(360/t);l.push({x:0,y:e,z:0}),l.push({x:0,y:0,z:0});let g=s/i;for(let D=1;D<=i;D++)for(var v=g*D,y=0;y<t;y++){let P=2+2*t*(D-1),F=y==0?P+2*(t-1):P+2*(y-1),B=P+2*y,$=Math.cos(f*y),U=-Math.sin(f*y),I=Math.cos(f*(y-1)),G=-Math.sin(f*(y-1)),Y=v*$,W=v*U,V={x:Y,y:e,z:W},X={x:Y,y:0,z:W};l.push(V),l.push(X);let q=.5*v/s,Z=$*q,ne=U*q,te=I*q,ae=G*q;if(D==1){let Se=[0,F,B],he=[1,B+1,F+1],fe=[{x:.5,y:.5},{x:.5+te,y:.5-ae},{x:.5+Z,y:.5-ne}],le=[{x:.5,y:.5},{x:.5+Z,y:.5+ne},{x:.5+te,y:.5+ae}];u.push(...Se),u.push(...he);for(let re=0;re<fe.length;re++)p.push(fe[re]);for(let re=0;re<le.length;re++)p.push(le[re])}else{let Se=2+2*t*(D-2),he=y==0?Se+2*(t-1):Se+2*(y-1),fe=Se+2*y,le=.5*((D-1)/i),re=$*le,Oe=U*le,ge=I*le,Ne=G*le,Pe={x:.5+te,y:.5-ae},He={x:.5+Z,y:.5-ne},Wt={x:.5+re,y:.5-Oe},Gn={x:.5+ge,y:.5-Ne},vr={x:.5+te,y:.5+ae},qs={x:.5+Z,y:.5+ne},Vi={x:.5+re,y:.5+Oe},Ks={x:.5+ge,y:.5+Ne};u.push(F),u.push(B),u.push(he),u.push(he),u.push(B),u.push(fe),u.push(fe+1),u.push(B+1),u.push(F+1),u.push(fe+1),u.push(F+1),u.push(he+1),p.push(Pe),p.push(He),p.push(Gn),p.push(Gn),p.push(He),p.push(Wt),p.push(Vi),p.push(qs),p.push(vr),p.push(Vi),p.push(vr),p.push(Ks)}}let _=2+2*t*i,x=2+2*t*(i-1),w=1/t,E=1/n;for(let D=1;D<=n;D++)for(let P=0;P<t;P++){if(D!=n){var k=s*Math.cos(f*P),N=-s*Math.sin(f*P),T=e*D/n;l.push({x:k,y:T,z:N})}let F=P==0?t-1:P-1,B=D==1?x+2*F+1:_+t*(D-2)+F,$=D==1?x+2*P+1:_+t*(D-2)+P,U=D==n?x+2*P:_+t*(D-1)+P,I=D==n?x+2*F:_+t*(D-1)+F,G=F*w,Y=(D-1)*E,W=P==0?1:P*w,V=D*E,X={x:G,y:Y},q={x:W,y:Y},Z={x:W,y:V},ne={x:G,y:V};u.push(B),u.push($),u.push(U),u.push(B),u.push(U),u.push(I),p.push(X),p.push(q),p.push(Z),p.push(X),p.push(Z),p.push(ne)}let O=new ze(l,u,p);return O.key=`cylinder_${r}x${e}_s${t}_h${n}_c${i}`,Dt(O),O}createDefaultGeometry(){return Nr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"height":case"sides":case"heightSegments":case"capSegments":this.geometry=Nr.createMeshGeometry(this.radius,this.height,this.sides,this.heightSegments,this.capSegments);break}}};c([h({emit:!1,converter:m.Number})],Nr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"capSegments",2),Nr=c([C({tagName:d+"-"+"3d"+"-primitive-cylinder"})],Nr);var wE=[{x:0,y:0,z:0},{x:0,y:1,z:0}],ss=class extends gt{static createLineGeometry(r){return new ga(r||wE)}createDefaultGeometry(){return ss.createLineGeometry()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="positions"&&(this.geometry=ss.createLineGeometry(t))}};c([h({emit:!1,converter:m.Json})],ss.prototype,"positions",2),ss=c([C({tagName:d+"-"+"3d"+"-primitive-line"})],ss);var qr=class extends gt{static createMeshGeometry(r,e,t,n){r||=1,e||=1,t||=4,n||=4;let i=r*.5,s=e*.5,l=[],p=[],u=[],f=[],g=we.LinearAlgebra.Vector3D.from(0,0,1);for(let y=0;y<=n;y++)for(let _=0;_<=t;_++){let x=-i+_*r/(1*t),w=0,E=-s+y*e/(1*n);if(l.push({x,y:w,z:E}),y<n&&_<t){let k=t+1,N=(_+1)/(1*t),T=1*_/(1*t),O=1-(y+1)/(1*n),D=1-1*y/(1*n);u.push((y+1)*k+_),u.push((y+1)*k+_+1),u.push(y*k+_+1),u.push((y+1)*k+_),u.push(y*k+_+1),u.push(y*k+_),p.push({x:T,y:O}),p.push({x:N,y:O}),p.push({x:N,y:D}),p.push({x:T,y:O}),p.push({x:N,y:D}),p.push({x:T,y:D}),f.push(g,g,g,g,g,g)}}let v=new ze(l,u,p,f);return v.key=`plane_${r}x${e}_w${t}_l${n}`,v}createDefaultGeometry(){return qr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"width":case"length":case"widthSegments":case"lengthSegments":this.geometry=qr.createMeshGeometry(this.width,this.length,this.widthSegments,this.lengthSegments);break}}};c([h({emit:!1,converter:m.Number})],qr.prototype,"width",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"length",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"widthSegments",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"lengthSegments",2),qr=c([C({tagName:d+"-"+"3d"+"-primitive-plane"})],qr);var il={parseFloats:function(o){let r=/([\d.-]+)/i;var e=r.exec(o);let t=[];for(;e!=null;){let n=e[0],i=parseFloat(n);t.push(i),o=o.replace(n,""),e=r.exec(o)}return t}},et=we.LinearAlgebra.Vector3D,as=class extends gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="radius"&&this._assignMeshGeometry(t)}_assignMeshGeometry(r){this.geometry=this.createMeshGeometry(r>0?r:1)}createDefaultGeometry(){return this.createMeshGeometry(1)}};c([h({emit:!1,converter:m.Number})],as.prototype,"radius",2);var Qo=class extends as{static createMeshGeometry(r){r||=1;let t="0 0.5774 -0.8165, 0 0.5774 0.8165, 0.8165 -0.5774 0, -0.8165 -0.5774 0".split(","),n=[];for(let g=0;g<t.length;g++){let v=t[g],y=il.parseFloats(v);n.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let i=[1,2,0,2,3,0,3,1,0,3,2,1],l="0.5 0.9995, 0.5 0.0004995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995".split(","),p=[4,5,6,7,8,9,10,11,0,3,2,1],u=[];for(let g=0;g<p.length;g++){let v=p[g],y=il.parseFloats(l[v]);u.push({x:y[0],y:y[1]})}let f=new ze(n,i,u);return f.key=`tetrahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return Qo.createMeshGeometry(r)}};Qo=c([C({tagName:d+"-"+"3d"+"-primitive-tetrahedron"})],Qo);var el=class extends as{static createMeshGeometry(r){r||=1;let e="0 0.7071 -0.7071, 0 0.7071 0.7071, 1 0 0, 0 -0.7071 -0.7071, -1 0 0, 0 -0.7071 0.7071",t=[1,2,0,2,3,0,3,4,0,4,1,0,4,5,1,5,2,1,2,5,3,4,3,5],n="0.5 0.9995, 0.5 0.9995, 0.0004995 0.5, 0.5 0.9995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.9995",i=[6,7,8,9,10,11,12,13,14,15,16,0,17,18,19,20,21,1,2,22,23,4,3,5],s=e.split(","),l=[];for(let g=0;g<s.length;g++){let v=s[g],y=il.parseFloats(v);l.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let p=n.split(","),u=[];for(let g=0;g<i.length;g++){let v=i[g],y=il.parseFloats(p[v]);u.push({x:y[0],y:y[1]})}let f=new ze(l,t,u);return f.key=`octahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return el.createMeshGeometry(r)}};el=c([C({tagName:d+"-"+"3d"+"-primitive-octahedron"})],el);var tl=class extends as{static createMeshGeometry(r){r||=1;let e=1/Math.sqrt(3),t=2*r*e,n=Ut.createMeshGeometry(t,t,t);return n.key=`hexahedron_${r}`,n}createMeshGeometry(r=this.radius){return tl.createMeshGeometry(r)}};tl=c([C({tagName:d+"-"+"3d"+"-primitive-hexahedron"})],tl);var rl=class extends as{static createMeshGeometry(r){r||=1;let e="0 0.850651 -0.525731, 0 0.850651 0.525731, 0.850651 0.525731 0, 0.525731 0 -0.850651, -0.525731 0 -0.850651, -0.850651 0.525731 0, -0.525731 0 0.850651, 0.525731 0 0.850651, 0.850651 -0.525731 0, 0 -0.850651 0.525731, 0 -0.850651 -0.525731, -0.850651 -0.525731 0",t=[1,2,0,2,3,0,3,4,0,4,5,0,5,1,0,5,6,1,6,7,1,7,2,1,2,8,3,2,7,8,6,9,7,9,8,7,8,10,3,8,9,10,6,11,9,11,10,9,10,4,3,10,11,4,6,5,11,5,4,11],n="0.5 0.808708, 0.5 0.999501, 0.5 0.808708, 0.191292 0.5, 0.000499547 0.5, 0.5 0.808708, 0.9995 0.5, 0.808708 0.5,0.000499487 0.5, 0.5 0.191292, 0.5 0.000499487, 0.5 0.191292,0.5 0.191292, 0.999501 0.5, 0.5 0.808708, 0.5 0.808708,0.9995 0.5, 0.808708 0.999501, 0.191292 0.5, 0.808708 0.5,0.5 0.999501, 0.808708 0.5, 0.999501 0.808708, 0.5 0.999501,0.000499487 0.5, 0.5 0.191292, 0.5 0.808708, 0.9995 0.5,0.808708 0.999501, 0.191292 0.5, 0.808708 0.5, 0.5 0.999501,0.808708 0.5, 0.999501 0.808708, 0.5 0.808708, 0.5 0.191292,0.9995 0.5, 0.000499547 0.5, 0.5 0.191292, 0.191292 0.5,0.5 0.000499487, 0.808708 0.5, 0.5 0.000499487, 0.999501 0.191292,0.5 0.191292, 0.808708 0.000499487, 0.9995 0.5, 0.5 0.191292,0.5 0.808708, 0.9995 0.5, 0.5 0.191292, 0.808708 0.000499487,0.999501 0.5, 0.5 0.808708, 0.5 0.000499487, 0.808708 0.5,0.999501 0.191292, 0.808708 0.5, 0.5 0.808708, 0.5 0.191292",i=[12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,26,27,28,29,30,31,32,33,1,34,35,36,2,37,38,39,40,41,42,43,7,44,45,46,8,47,48,49,50,51,52,53,9,54,55,3,10,56,57,6,58,59,5,4,11],s=e.split(","),l=[];for(let g=0;g<s.length;g++){let v=s[g],y=il.parseFloats(v);l.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let p=n.split(","),u=[];for(let g=0;g<i.length;g++){let v=i[g],y=il.parseFloats(p[v]);u.push({x:y[0],y:y[1]})}let f=new ze(l,t,u);return f.key=`icosahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return rl.createMeshGeometry(r)}};rl=c([C({tagName:d+"-"+"3d"+"-primitive-icosahedron"})],rl);var nl=class extends as{static createMeshGeometry(r){r||=1;let e=et.from(.356822*r,.934172*r,0*r),t=et.from(-.356822*r,.934172*r,0*r),n=et.from(.57735*r,.57735*r,-.57735*r),i=et.from(0*r,.356822*r,-.934172*r),s=et.from(-.57735*r,.57735*r,-.57735*r),l=et.from(-.57735*r,.57735*r,.57735*r),p=et.from(0*r,.356822*r,.934172*r),u=et.from(.57735*r,.57735*r,.57735*r),f=et.from(.934172*r,0*r,-.356822*r),g=et.from(.934172*r,0*r,.356822*r),v=et.from(0*r,-.356822*r,.934172*r),y=et.from(.57735*r,-.57735*r,.57735*r),_=et.from(.57735*r,-.57735*r,-.57735*r),x=et.from(.356822*r,-.934172*r,0*r),w=et.from(-.57735*r,-.57735*r,.57735*r),E=et.from(-.356822*r,-.934172*r,0*r),k=et.from(0*r,-.356822*r,-.934172*r),N=et.from(-.57735*r,-.57735*r,-.57735*r),T=et.from(-.934172*r,0*r,.356822*r),O=et.from(-.934172*r,0*r,-.356822*r),D=[e,t,n,i,s,l,p,u,f,g,v,y,_,x,w,E,k,N,T,O],P=[0,2,3,0,3,4,0,4,1,1,5,6,1,6,7,1,7,0,7,9,8,7,8,2,7,2,0,7,6,10,7,10,11,7,11,9,11,13,12,11,12,8,11,8,9,11,10,14,11,14,15,11,15,13,15,17,16,15,16,12,15,12,13,15,14,18,15,18,19,15,19,17,19,4,3,19,3,16,19,16,17,19,18,5,19,5,1,19,1,4,18,14,10,18,10,6,18,6,5,3,2,8,3,8,12,3,12,16],F=`0.5 0.999501, 0.5 0.999501, 0.191292 0.808708, 0.5 0.690792,
|
|
16
|
+
${$.message??$}`),B()}else B()}else throw`Howcome? ${_} misinterpreted as ${N} binding...`}else{var D=e.find(P=>P.name===T);a.isNull(D)||(Kl(x,T),x[T]=D.config.converter.convert(_,x))}},configurable:!0,enumerable:!0});let f=Object.getOwnPropertyDescriptor(i,"propertyChangedCallback")||i.propertyChangedCallback;Object.defineProperty(i,"propertyChangedCallback",{value:function(v,y,_,x,w){let E=this,k=$e(E,Jl)===!0,N=()=>{let O=$e(E,tf+v);if(f&&f.value?f.value.apply(E,[v,y,_,!k]):typeof f=="function"&&f.apply(E,[v,y,_,!k]),!w||w.emit!==!1){let $=new ue({propertyName:v,oldValue:y,currentValue:_,firstChange:!k});E.dispatchEvent($)}if(a.isNullOrEmpty(O)){var D=e.find($=>$.name===v);if(w&&w.reflectBack===!0&&!A.polyfilling){var P=A.camelToKebab(v),F=E.attributes.getNamedItem(P);if(k||a.isNullOrEmpty(F)){var B;if(_==null)E.removeAttribute(P);else if(D&&(B=D.config)&&typeof B.converter.convertBack=="function"){let $=B.converter.convertBack(_,E);(F==null||$!==F.value)&&E.setAttribute(P,$)}}}}else if(O==="twoway"){let $=$e(E,Gp+v)[0].dep;A.set($.element,$.path,_)}else O==="once"&&Kl(E,v)};if(k)N.apply(E);else{var T=$e(E,lb,[]);T.push(N)}},configurable:!0,enumerable:!0})}a.customElements.define(o.tagName,r,o.options),a.customElements.whenDefined(o.tagName).then(()=>{})},CC=m.None;function h(o){return(r,e,t)=>{var n=$e(r.constructor,Wu,[]);n.push({name:e,config:a.extend({emit:!0,converter:CC},o)});let i=bo,s=t&&t.set,l=yC+e,p=ab,u=ab+":"+e;function f(){return $e(this,l)}function g(_,x,w){let E=this,k=o&&o.debounce,N;if(typeof(N=E.propertyChangedCallback)=="function"){let T=()=>N.apply(E,[_,x,$e(E,l),!1,o]);typeof k=="number"&&k>0?(clearTimeout(this["_handle_"+e]),this["_handle_"+e]=setTimeout(T,k)):k===!0?(cancelAnimationFrame(this["_handle_"+e]),this["_handle_"+e]=requestAnimationFrame(T)):T()}}function v(_){let x=this;if(_=_||x[e],$e(_,"pacem:array:decorated")===!0)return;Xt(_,"pacem:array:decorated",!0);let w=Array.prototype,E={splice:w.splice,pop:w.pop,copyWithin:w.copyWithin,push:w.push,shift:w.shift,unshift:w.unshift};for(let k in E){let N=k;_[N]=function(...T){let O=E[N].apply(this,T);return Xt(this,p,Date.now()),g.call(x,e,this,this),O}}}function y(_,x){let w=this,E=a.isArray(x);(!i(_,x)||E&&$e(x,p)!==$e(w,u))&&(Xt(w,l,x),E&&(Xt(w,u,$e(x,p)),v.call(w,x)),g.call(w,e,_,x))}if(s)t.set=function(_){let x=this,w=x[e];s.call(x,_);let E=x[e];y.call(x,w,E)};else{try{r.ownerDocument&&(r[l]=r[e])}catch{}delete r[e]&&Object.defineProperty(r,e,{get:function(){return f.call(this)},set:function(_){let x=this,w=$e(x,l);y.call(x,w,_)},enumerable:!0,configurable:!0})}}}function S(o){return(r,e,t)=>{let n=`${e}_${a.uniqueCode()}`;function i(){let l=this,p=(l.shadowRoot||l).querySelectorAll(o);for(let u=0;u<p.length;u++){let f=p.item(u);if($e(f,ea)===l)return f}return null}function s(){let l=this,p=$e(l,cb,{});return p[n]=p[n]||i.call(l)}delete r[e]&&Object.defineProperty(r,e,{get:function(){return s.call(this)},enumerable:!0,configurable:!0})}}function ub(){function o(r){return r&&typeof r.then=="function"}return function(r,e,t){let n=t.value,i=`pacem:concurrent-buffer:${e}`,s=`pacem:concurrent-running:${e}`;t.value=function(...l){var p=this,u=A.getAttachedPropertyValue(p,i,[]),f=A.getAttachedPropertyValue(p,s,!1);if(f){let v=_t.defer();return l.push(v),u.push(l),v.promise}var g=n.apply(p,l);if(o(g)){let v=l&&l.length>0&&l[l.length-1];return v&&v.promise instanceof _t?l.pop():v=_t.defer(),A.setAttachedPropertyValue(p,s,!0),g.then(y=>{v.resolve(y),A.setAttachedPropertyValue(p,s,!1),u.length>0&&n.apply(p,u.shift())},y=>{A.setAttachedPropertyValue(p,s,!1),v.reject(y)}),v.promise}else return g}}}function me(o=50,r=(e,...t)=>`pacem:debouncer:${e}`){return function(e,t,n){let i=n.value;o===!0?n.value=function(...s){let l=r(t,...s);var p=this;cancelAnimationFrame($e(p,l)),Xt(p,l,requestAnimationFrame(()=>{i.apply(p,s)}))}:o>0&&(n.value=function(...s){let l=r(t,...s);var p=this;clearTimeout($e(p,l,0)),Xt(p,l,setTimeout(()=>{i.apply(p,s)},o))})}}function Wp(o=50,r=(e,...t)=>`pacem:throttler:${e}`){return function(e,t,n){let i=n.value;n.value=function(...s){let l=r(t,...s),p=`${l}:args`,u=this,f=()=>{Fp(u,l);let g=$e(u,p);Fp(u,p),g&&i.apply(u,s)};if(!a.isNull($e(u,l))){Xt(u,p,s??["pacem"]);return}Xt(u,l,1),i.apply(u,s),o===!0?requestAnimationFrame(f):o>0&&setTimeout(f,o)}}}var rf=class{static register(r,e){let t=a.core,n=(r||e.name).split(".");for(let s of n.slice(0,-1))t=t[s]||(t[s]={});let i=n[n.length-1]||e.name;a.isNull(t[i])?t[i]=e:console.warn(`A transform named ${i} already exists in this set.`)}};function Te(o){return function(r,e,t){let n=t.value;rf.register(o,n)}}var j={USE_SHADOW_ROOT:!1};var qt=(s=>(s.Trace="trace",s.Debug="debug",s.Warn="warn",s.Error="error",s.Info="info",s.Log="log",s))(qt||{});var K=class extends HTMLElement{constructor(){super();this._isReady=!1;this.emitHandler=e=>{this.disabled||this.emit(e)}}emit(e){e.defaultPrevented||this._emitCore(e)}_emitCore(e){var t=`on-${e.type.toLowerCase()}`;if(t in this.attributes){this.log("debug",`Calling ${t} handler for event ${e.type}`);var n=this.attributes[t].value,i=ta.parse(n,this);!a.isNull(i)&&i.pending!==!0&&i.evaluatePlus({$event:e})}}handle(e,t){typeof e=="string"&&(e=a.isNull(t)?new Event(e,{cancelable:!1}):new CustomEvent(e,{cancelable:!1,detail:t})),this.emit(e)}get isReady(){return this._isReady}connectedCallback(){A.setAttachedPropertyValue(this,Bp,A.findScopeContext(this)),this.log("debug","Connected.")}disconnectedCallback(){this._isReady=!1,this.dispatchEvent(new Event("unload")),A.deleteAttachedPropertyValue(this,Bp),this.log("debug","Disconnected.")}viewActivatedCallback(){this._isReady=!0,this.log("debug","Loaded (view activated)."),this.dispatchEvent(new Event("load"))}propertyChangedCallback(e,t,n,i){i?this.log("log",`Property "${e}" changed at start-up`):this.log("log",`Property "${e}" changed from ${t} to ${n}`)}dispatchEvent(e){if(this.disabled)return!1;this.log("log",`Dispatching event "${e.type}"`);let t=super.dispatchEvent(e);return this.emit(e),t}log(e,t,n=this.localName+(this.id?"#"+this.id:"")){this.logger&&typeof this.logger.log=="function"&&this.logger.log(e,t,n)}refreshBindings(){for(let e=0;e<this.attributes.length;e++){let t=this.attributes.item(e);if(!A.isBindingAttribute(t.value))continue;let i=A.kebabToCamel(t.name),s=A.parseBindingAttribute(t.value,this);this[i]=s.evaluate()}}};c([h({reflectBack:!0,converter:m.Boolean})],K.prototype,"disabled",2),c([h({emit:!1,converter:m.Element})],K.prototype,"logger",2);var fS=/a^/,hb=class{static split(r,e){for(var t,n=0,i=[];(t=e.exec(r))!=null;){i.push({value:r.substr(n,t.index-n),match:!1,index:n});let s=t[0].length;i.push({value:r.substr(t.index,s),match:!0,index:t.index}),n=t.index+s}return n<r.length&&i.push({value:r.substr(n,r.length-n),match:!1,index:n}),i}};var nf="_exp",eh=class{_getStorage(r){return r?window.localStorage:window.sessionStorage}_parseValue(r,e){let t=r.getItem(e);if(a.isNullOrEmpty(t))return null;let n=a.Json.parse(t);return Object.hasOwnProperty(nf)?n[nf]<Date.now()?(r.removeItem(e),null):n.value:n}setPropertyValue(r,e,t){var n=this._getStorage(t===!0||typeof t=="number"&&t>0),i=e;if(typeof t=="number"&&t>0){let s=Date.now()+1e3*t;i={value:e},i[nf]=s}n.setItem(r,a.Json.stringify(i)),n=this._getStorage(!t),n.removeItem(r)}getPropertyValue(r){return this._parseValue(this._getStorage(!1),r)||this._parseValue(this._getStorage(!0),r)}clear(){var r=this._getStorage(!0);r.clear(),r=this._getStorage(!1),r.clear()}removeProperty(r){var e=this._getStorage(!0);e.removeItem(r),e=this._getStorage(!1),e.removeItem(r)}};function EC(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wC(o,r,e,t){let n="char",i="full",s,l;return["line","word","char"].includes(o)?(n=o,i=r,s=e,l=t):(i=o,s=r,l=e),{mode:n,output:i,cssAdd:s??"fill-green-container",cssRemove:l??"fill-red-container"}}var ct=class{static highlight(r,e,t=b+"-highlight"){if(!e||!r)return r;let n=r.substring(0),i=e.substring(0).split(" ");for(var s=0;s<i.length;s++){let l=EC(i[s]),p=new RegExp("(?![^<>]*>)"+l,"gi");n=n.replace(p,function(u,f,g){var v,y;return(v=g.indexOf("<",f))!=(y=g.indexOf("</",f))||v==-1?'<span class="'+t+'">'+u+"</span>":u})}return n}static diff(r,e,t="full",n,i,s){let{mode:l,output:p,cssAdd:u,cssRemove:f}=wC(t,n,i,s);return a.diff(r,e,l).reduce((v,y)=>{let _=y.type;if(_==="=")v+=y.value;else if(_==="+"&&p!=="left"||_==="-"&&p!=="right"){let x=y.value.split(/\r?\n/),w=x.length-1;for(let E=0;E<=w;E++){let k=x[E];(!a.isNullOrEmpty(k)||E<w)&&(v+=`<span class="${b}-token ${_==="-"?f:u} text-prewrap">${k||" "}</span>`),E<w&&(v+=`
|
|
17
|
+
`)}}return v},"")}static padleft(r,e,t){return a.leftPad(""+r,e,t)}static size(r){return r>0?r<1024?r+" B":r<1048576?(r/1024).toFixed(2)+" kB":r<1073741824?(r/1048576).toFixed(2)+" MB":(r/1073741824).toFixed(2)+" GB":"-"}static decToDeg(r,e="\xB0 ",t="' ",n='"'){let i=Math.sign(r);r=Math.abs(r);let s=Math.floor(r),l=(r-s)*60,p=Math.floor(l),u=(l-p)*60,f=Math.floor(u);return(i<0?"-":"")+s+e+p+t+f+n}static date(r,e,t){var n=a.parseDate(r),i=t||navigator.language;if(a.isNull(e)||typeof e=="string")switch(e){case"iso":return n.toISOString();case"isodate":return n.toISOString().substring(0,10);case"localdate":return`${n.getFullYear()}-${a.leftPad(n.getMonth()+1,2,"0")}-${a.leftPad(n.getDate(),2,"0")}`;case"time":case"localtime":return n.toLocaleTimeString(i,{hour:"numeric",minute:"numeric",second:"numeric",hour12:!1});case"full":let l=-(n.getTimezoneOffset()/60);var s="";return l!=0&&(s=" (UTC"+((l>0?"+":"-")+Math.abs(l).toLocaleString())+")"),n.toLocaleString(i)+s;default:return n.toLocaleDateString(i)}else return n.toLocaleString(t,e)}static timespan(r,e,t,n){let i=a.parseDate(r),s=a.parseDate(e),l=s.valueOf()-i.valueOf(),p=l<0?"-":"",u=Math.abs(l);if(typeof t=="object"){let k={timeZone:"UTC",hour12:!1},N=a.extend(k,t);return(p||(t.sign?"+":""))+Intl.DateTimeFormat(n??navigator.language,N).format(u)}let f=864e5,g=36e5,v=6e4,y=Math.floor(u/f),_=Math.floor(u%f/g),x=Math.floor(u%g/v),w=Math.floor(u%v/1e3),E=Math.floor(u%1e3);return`${p}${y}d ${_}h ${x}m ${w}s ${E}ms`}static currency(r,e,t){return new Intl.NumberFormat(t??navigator.language,{style:"currency",currency:e}).format(r)}static number(r,e,t){return typeof e=="string"?new Intl.NumberFormat(e||navigator.language).format(r):new Intl.NumberFormat(t??navigator.language,e).format(r)}static filter(r,e){return r.filter(e)}static orderby(r,e){return r.sort((t,n)=>(a.isNullOrEmpty(e)||(t=t[e],n=n[e]),t>n?1:t<n?-1:0))}static isMatch(r,e,t){return new RegExp(e,t).test(r)}static isEmpty(r){return a.isEmpty(r)}static isNull(r){return a.isNull(r)}static isNullOrEmpty(r){return a.isNullOrEmpty(r)}static getCssVariable(r){return a.Css.getVariableValue(r)}static getQuerystring(r){return a.URIs.parseQuery()[r]}static importThemeWebFonts(){return A.Theme.importWebFonts()}static findHostContext(r){return A.findHostContext(r)}};c([Te()],ct,"highlight",1),c([Te()],ct,"diff",1),c([Te()],ct,"padleft",1),c([Te()],ct,"size",1),c([Te()],ct,"decToDeg",1),c([Te()],ct,"date",1),c([Te()],ct,"timespan",1),c([Te()],ct,"currency",1),c([Te()],ct,"number",1),c([Te()],ct,"filter",1),c([Te()],ct,"orderby",1),c([Te("regex.")],ct,"isMatch",1),c([Te()],ct,"isEmpty",1),c([Te()],ct,"isNull",1),c([Te()],ct,"isNullOrEmpty",1),c([Te("cssvar")],ct,"getCssVariable",1),c([Te("querystring")],ct,"getQuerystring",1),c([Te()],ct,"importThemeWebFonts",1),c([Te("host")],ct,"findHostContext",1);var Bt={};Se(Bt,{AnimationEndEvent:()=>Yp,AnimationEvent:()=>jp,AnimationStartEvent:()=>Xp,Easings:()=>Ur,Timer:()=>sf,TweenService:()=>Fi});var th=Math.PI*.5,yo={linear:o=>o,sineIn:o=>Math.sin(o*th-th)+1,sineOut:o=>Math.sin(o*th),sineInOut:o=>.5*Math.sin(o*Math.PI-th)+.5,expoIn:o=>(Math.pow(Math.E,o)-1)/(Math.E-1),expoOut:o=>Math.log(o*(Math.E-1)+1),expoInOut:o=>o<.5?.5*Ur.expoIn(o*2):.5*(1+Ur.expoOut(o*2-1))};function _o(o,r){let e=t=>o(t);return e.css=r,e}var Ur={linear:_o(yo.linear,"linear"),sineIn:_o(yo.sineIn,"cubic-bezier(0.12, 0, 0.39, 0)"),sineOut:_o(yo.sineOut,"cubic-bezier(0.61, 1, 0.88, 1)"),sineInOut:_o(yo.sineInOut,"cubic-bezier(0.37, 0, 0.63, 1)"),expoIn:_o(yo.expoIn,"cubic-bezier(0.7, 0, 0.84, 0)"),expoOut:_o(yo.expoOut,"cubic-bezier(0.16, 1, 0.3, 1)"),expoInOut:_o(yo.expoInOut,"cubic-bezier(0.87, 0, 0.13, 1)")};var jp=class extends oe{constructor(r){super("step",r)}},Yp=class extends CustomEvent{constructor(){super("end")}},Xp=class extends CustomEvent{constructor(){super("start")}};var Fi=class{run(r,e,t,n=0,i=Ur.linear,s=null){return new Promise((l,p)=>{let f=(performance&&performance.now()||Date.now())+Math.abs(n||0),g=f+Math.abs(t||0),v=()=>{let y=performance&&performance.now()||Date.now();if(y>=f&&y<g){let _=(y-f)/t,x=r+(i||Ur.linear)(_)*(e-r);s&&s(_,x)}y<g?requestAnimationFrame(v):(s&&s(1,e),l())};v()})}};var sf=class o{constructor(r,e){this.#n=0;this._run=r=>{this.#r=requestAnimationFrame(this._run);let e=performance.now(),t=this.#e,n=e-this.#n;n>=t&&(this.#n=e-n%t,this.#t(r))};this.#e=1e3/e,this.#t=r,this.#r=requestAnimationFrame(this._run)}#e;#t;#r;#n;static run(r,e=60){return new o(r,e)}stop(){cancelAnimationFrame(this.#r)}};var pt={};Se(pt,{FetchErrorEventName:()=>Qm,FetchResultEventName:()=>Zm,FetchSuccessEventName:()=>ef,Fetcher:()=>Vp,Http:()=>zp,HttpMethod:()=>Zu,Response:()=>Qu,StatusCodeError:()=>Up});var J={};Se(J,{DragDataMode:()=>af,DragDropEvent:()=>vn,DragDropEventArgsClass:()=>Yn,DragDropEventType:()=>cf,DragDropInitEventArgsClass:()=>qp,DropBehavior:()=>of,DropTargetMissedBehavior:()=>lf,RescaleEvent:()=>Co,RescaleEventArgsClass:()=>xo,RescaleEventType:()=>df,RescaleHandle:()=>pf,RotateEvent:()=>wo,RotateEventArgsClass:()=>Eo,RotateEventType:()=>uf,SwipeEvent:()=>Wi,SwipeEventArgsClass:()=>Kp,SwipeEventType:()=>hf});var af=(t=>(t.Self="self",t.Alias="alias",t.Copy="copy",t))(af||{}),of=(e=>(e.InsertChild="insert",e.None="none",e))(of||{}),lf=(t=>(t.Revert="revert",t.Remove="remove",t.None="none",t))(lf||{}),cf=(l=>(l.Init="draginit",l.Start="dragstart",l.Drag="drag",l.Drop="drop",l.Over="dragover",l.Out="dragout",l.End="dragend",l))(cf||{}),rh=class{constructor(r){this._builder=r;this.currentPosition=r.currentPosition,this.target=r.target}get element(){return this._builder.element}get origin(){return this._builder.origin}get initialDelta(){return this._builder.initialDelta}get startTime(){return this._builder.startTime}get floater(){return this._builder.floater}get delta(){var r=this;return se.add(r.initialDelta,se.subtract(r.origin,r.currentPosition))}},qp=class o extends rh{constructor(r){super(r),this.placeholder=r.placeholder,this.data=r.data}static fromArgs(r){return new o(a.extend({},r))}},Yn=class o extends rh{constructor(e,t=e.placeholder,n=e.data){super(e);this._placeholder=t;this._data=n}get placeholder(){return this._placeholder}get data(){return this._data}static fromArgs(e){return new o(a.extend({},e))}},vn=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var pf=(i=>(i.All="all",i.Top="top",i.Left="left",i.Right="right",i.Bottom="bottom",i))(pf||{}),df=(t=>(t.Start="rescalestart",t.Rescale="rescale",t.End="rescaleend",t))(df||{}),xo=class o{constructor(r){this._builder=r}get currentPosition(){return this._builder.currentPosition}get targetRect(){return this._builder.targetRect}get element(){return this._builder.element}get handle(){return this._builder.handle}static fromArgs(r){return new o(a.extend({},r))}},Co=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var uf=(t=>(t.Start="rotatestart",t.Rotate="rotate",t.End="rotateend",t))(uf||{}),Eo=class o{constructor(r){this._builder=r}get currentPosition(){return this._builder.currentPosition}get rotation(){return this._builder.rotation}get element(){return this._builder.element}get center(){return this._builder.center}static fromArgs(r){return new o(a.extend({},r))}},wo=class extends ht{constructor(r,e,t,n){super(r,e,t,n)}};var hf=(g=>(g.Swipe="swipe",g.Pan="pan",g.SwipeLeft="swipeleft",g.SwipeRight="swiperight",g.SwipeUp="swipeup",g.SwipeDown="swipedown",g.SwipeAnimationEnd="swipeanimationend",g.SwipeLeftAnimationEnd="swipeleftanimationend",g.SwipeRightAnimationEnd="swiperightanimationend",g.SwipeUpAnimationEnd="swipeupanimationend",g.SwipeDownAnimationEnd="swipedownanimationend",g))(hf||{}),Kp=class o{constructor(r){this._builder=r}get#e(){let{verticalspeed:r,horizontalspeed:e,vertical:t}=this._builder;return t??Math.abs(e)<Math.abs(r)}get direction(){return this.#e?this._builder.verticalspeed>0?"down":"up":this._builder.horizontalspeed>0?"right":"left"}get speed(){let{verticalspeed:r,horizontalspeed:e}=this._builder;return this.#e?r:e}get delta(){let{position:{x:r,y:e},t0:{position:{x:t,y:n}}}=this._builder;return this.#e?e-n:r-t}get flinging(){let{fling:r}=this._builder;return r>0&&Math.abs(this.speed)>r}get predictedDelta(){let r=this._builder.inertia??8;return this.delta+this.speed/r}get predictedDuration(){let r=this._builder.inertia??8;return-Math.log(.01)/r}get element(){return this._builder.element}static fromArgs(r){return new o(a.extend({},r))}},Wi=class extends oe{constructor(r,e,t){super(r,e,t)}};var nh={};Se(nh,{PacemBehavior:()=>bn});var bn=class extends K{#e=new WeakSet;register(r){var e=this.#e;e.has(r)||(e.add(r),this.decorate(r))}unregister(r){var e=this.#e;e.has(r)&&(this.undecorate(r),e.delete(r))}has(r){return this.#e.has(r)}};var ce={};Se(ce,{LogLevel:()=>qt});var Db={};Se(Db,{DragEvent:()=>pc,DrawableEvent:()=>Cn,PresentationState:()=>hd,Shape:()=>Ki,StageEvent:()=>md,UI2DEvent:()=>cc,isDrawable:()=>dc,isGroup:()=>Bo,isImage:()=>fc,isLinearGradient:()=>fd,isPresentationObject:()=>gd,isRadialGradient:()=>uc,isShape:()=>hc,isText:()=>mc,isUiObject:()=>Cr});var R={};Se(R,{AnimationElement:()=>lr,CustomItemCommandEvent:()=>sd,DockMode:()=>yf,ItemCommandEvent:()=>id,ItemRegisterEvent:()=>td,ItemRegisterEventName:()=>xf,ItemUnregisterEvent:()=>rd,ItemUnregisterEventName:()=>Cf,KeyboardShortcutExecuteEventName:()=>Mf,PacemAdapter:()=>sh,PacemAnnihilatorElement:()=>tc,PacemBeforeunloadElement:()=>ia,PacemBodyProxyElement:()=>nc,PacemBroadcastChannelProxyElement:()=>Xn,PacemBrowserDetectElement:()=>Mo,PacemColorAnimationElement:()=>da,PacemContentElement:()=>ko,PacemCrossItemsContainerElement:()=>ac,PacemDataElement:()=>qn,PacemDockElement:()=>yn,PacemDragDropElement:()=>xr,PacemElement:()=>mt,PacemElementProxyElement:()=>So,PacemEventProxyElement:()=>ji,PacemFetchElement:()=>dt,PacemHistoryElement:()=>Kn,PacemHtmlProxyElement:()=>aa,PacemIfElement:()=>No,PacemItemElement:()=>Yi,PacemItemsContainerElement:()=>_n,PacemIterableElement:()=>oh,PacemIterativeElement:()=>To,PacemLayoutProxyElement:()=>oa,PacemMetaProxyElement:()=>Zn,PacemNumberAnimationElement:()=>ua,PacemOnlineStatusElement:()=>Ao,PacemPanelElement:()=>oc,PacemPointAnimationElement:()=>ha,PacemRepeaterElement:()=>zr,PacemRescaleElement:()=>Gr,PacemResizeElement:()=>la,PacemRotateElement:()=>ri,PacemRouterElement:()=>Qn,PacemSafeContentElement:()=>na,PacemScrollAwareElement:()=>ca,PacemServiceWorkerProxyElement:()=>ei,PacemShellProxyElement:()=>ic,PacemShortcutElement:()=>pa,PacemSpanElement:()=>Po,PacemStoryboardElement:()=>si,PacemStyleProxyElement:()=>Xi,PacemSwipeElement:()=>ni,PacemTemplateProxyElement:()=>xn,PacemTextElement:()=>Io,PacemTimerElement:()=>$o,PacemTitleProxyElement:()=>Ho,PacemTransferProxyElement:()=>Lo,PacemTweenElement:()=>_r,PacemUnsafeContentElement:()=>ih,PacemViewportAwareElement:()=>qi,PacemWebWorkerProxyElement:()=>ti,RepeaterItem:()=>Do,RepeaterItemCreateEvent:()=>Ql,RepeaterItemCreateEventName:()=>vf,RepeaterItemEvent:()=>Zl,RepeaterItemRemoveEvent:()=>ec,RepeaterItemRemoveEventName:()=>bf,ResizeEvent:()=>ad,ResizeEventName:()=>Ef,ScrollEvent:()=>od,ScrollEventName:()=>kf,StateEvent:()=>ed,TweenAnimationElement:()=>ii,isItemsContainer:()=>fb});var vf="repeateritemcreate",bf="repeateritemremove",Zl=class extends oe{constructor(r,e){super(r,e)}},Ql=class extends Zl{constructor(r){super(vf,r)}},ec=class extends Zl{constructor(r){super(bf,r)}},mf=["keydown","keyup","click","focus","blur","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","pointerdown","mouseup","pointerup","mousemove","contextmenu","wheel"],ff=class{constructor(r,e){this._element=r;this._aria=a.extend({},e||{})}toObject(){return a.extend({},this._aria)}set(r,e){this._aria[r]=e;let t=this._element;t.isConnected&&t.setAttribute("aria-"+r,e)}remove(r){delete this._aria[r];let e=this._element;e.isConnected&&e.removeAttribute("aria-"+r)}},gf=class{constructor(r,e,t){this._element=r;this._aria={role:e,attrs:new ff(r,t)}}get role(){return this._aria.role}set role(r){this._aria.role=r;let e=this._element;e.isConnected&&(a.isNullOrEmpty(r)?e.removeAttribute("role"):e.setAttribute("role",r))}get attributes(){return this._aria.attrs}},mt=class extends K{constructor(e,t){super();this.#t=[];this.#r=[];this._tabIndex=-1;this.behaviors=[];this._aria=new gf(this,e,t)}get aria(){return this._aria}static#e=null;static get emittedEventTypes(){return this.#e??=a.readonlyCopy(mf)}#t;#r;connectedCallback(){super.connectedCallback(),a.isNullOrEmpty(this._aria.role)||this.setAttribute("role",this._aria.role);let e=this._aria.attributes.toObject();if(!a.isNullOrEmpty(e))for(let t in e)this.setAttribute("aria-"+t,e[t])}viewActivatedCallback(){super.viewActivatedCallback(),mf.forEach(t=>{this.addEventListener(t,this.emitHandler,!1)});for(var e of this.behaviors||[])e.register(this)}disconnectedCallback(){for(var e of this.behaviors||[])e.unregister(this);mf.forEach(t=>{this.removeEventListener(t,this.emitHandler,!1)}),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"css":for(var s in this.css)this.style.setProperty(s,this.css[s]);break;case"cssClass":if(a.isArray(this.cssClass)){let g=this.cssClass;for(let v of this.#t.splice(0))a.removeClass(this,v);for(let v of g)this.#t.push(v),a.addClass(this,v)}else for(let g in this.cssClass)a.toggleClass(this,g,this.cssClass[g]);break;case"cssPart":let l=this.cssPart,p=this.#r;if(a.isArray(l)){let g=l;for(let v of p.splice(0))a.removePart(this,v);for(let v of g)p.push(v),a.addPart(this,v)}else for(let g in l)a.togglePart(this,g,l[g]);break;case"hide":let u=b+"-hiding";if(n){let g=this,v=b+"-anim",y=()=>{g.setAttribute("hidden",""),g.aria.attributes.set("hidden","true")};a.hasClass(g,v)&&!a.isNull(t)?(a.removeClass(g,v),requestAnimationFrame(()=>{a.addClass(g,u),a.addClass(g,v),a.waitForAnimationEnd(g,250).then(_=>{g.hide&&y(),a.removeClass(g,u)})})):y()}else a.removeClass(this,u),this.removeAttribute("hidden"),this.aria.attributes.remove("hidden");break;case"tooltip":this.title=n,a.isNullOrEmpty(n)?this.aria.attributes.remove("label"):this.aria.attributes.set("label",n);break;case"tabOrder":this._tabIndex=n,this.disabled||(this.tabIndex=n);break;case"behaviors":if(!a.isNullOrEmpty(t))for(let g of t)g.unregister(this);if(!a.isNullOrEmpty(n)&&!i)for(let g of n)g.register(this);break;case"disabled":let f=b+"-"+e;n?(this._tabIndex=this.tabIndex,this.tabIndex=-1,a.addClass(this,f)):(this.tabIndex=this._tabIndex,a.removeClass(this,f));break;case"culture":a.isNullOrEmpty(n)?this.removeAttribute("lang"):this.setAttribute("lang",n),i||this.refreshBindings();break}}};c([h({emit:!1,converter:m.Json})],mt.prototype,"cssClass",2),c([h({emit:!1,converter:m.Json})],mt.prototype,"cssPart",2),c([h({emit:!1,converter:m.Json})],mt.prototype,"css",2),c([h({emit:!1,converter:m.Boolean})],mt.prototype,"hide",2),c([h({emit:!1,converter:m.String})],mt.prototype,"tooltip",2),c([h({emit:!1,converter:m.Number})],mt.prototype,"tabOrder",2),c([h({converter:m.String})],mt.prototype,"culture",2),c([h({emit:!1})],mt.prototype,"behaviors",2);var ko=class extends mt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="content"&&!n&&this._fillContent(t)}_isContentNullOrEmpty(r=this.content){return a.isNullOrEmpty(r)||r instanceof DocumentFragment&&r.childElementCount===0}viewActivatedCallback(){super.viewActivatedCallback(),this._original=Array.from(this.children),this._isContentNullOrEmpty()||this._fillContent()}disconnectedCallback(){a.isNullOrEmpty(this._original)||(this.innerHTML="",Element.prototype.append.apply(this,this._original)),super.disconnectedCallback()}_fillContent(r=this.content){let e=this.sanitize(r);a.isNullOrEmpty(e)?this.innerHTML="":e instanceof Node?(this.innerHTML="",this.append(e)):this.innerHTML=e}};c([h({emit:!1,converter:m.String})],ko.prototype,"content",2);var ih=class extends ko{sanitize(r){return r}},na=class extends ko{_sanitizeLegacy(r){if(a.isNullOrEmpty(r))return r;if(r instanceof Node){for(let e=r.childNodes.length-1;e>=0;e--){let t=r.childNodes.item(e);t instanceof HTMLScriptElement?t.remove():this.sanitize(t)}return r}else{let e=/<script.+<\/script>/g;return(r||"").toString().replace(e,"")}}sanitize(r){return this._sanitizeLegacy(r)}};var sh=class extends mt{constructor(){super(...arguments);this._propertyChangeHandler=e=>{this.masterPropertyChangedCallback(e.detail.propertyName,e.detail.oldValue,e.detail.currentValue,e.detail.firstChange)}}get master(){return this._element}get initialized(){return!a.isNull(this._element)}masterPropertyChangedCallback(e,t,n,i){switch(e){case"items":this._adjustFocusIndex();break;case"index":this._element.dispatchEvent(new Ju({currentIndex:n,previousIndex:t}));break}}itemPropertyChangedCallback(e,t,n,i,s){}initializeCallback(){}destroyCallback(){}initialize(e){this._element!=null&&this.destroy(),e!=null&&(this._element=e,this._element.addEventListener(ee,this._propertyChangeHandler,!1)),this.initializeCallback()}destroy(){this._element!=null&&this._element.removeEventListener(ee,this._propertyChangeHandler,!1),this.destroyCallback()}disconnectedCallback(){this.destroy(),super.disconnectedCallback()}_adjustFocusIndex(){let e=this._element.items,t=this._element.index,n=e&&e.length,i=n?Math.max(0,Math.min(n-1,t)):-1,s=this._getAvailable(i);this._element.index=s}_getNextAvailable(e){return this._getAvailable(e,1)}_getPreviousAvailable(e){return this._getAvailable(Math.max(0,e),-1)}_getAvailable(e=this._element&&this._element.index,t=0){let n=this._element.items,i;if(!(n&&(i=n.length)>0))return-1;e=e%i;let s=(e+t+i)%i,l;for(t=t||-1;(l=n[s])instanceof K&&l.disabled===!0||l instanceof mt&&l.hide===!0;)if(s=(s+t+i)%i,s==e)return-1;return s}isClose(e){let t=this._getAvailable();return e===t||e===this._getPreviousAvailable(t)||e===this._getNextAvailable(t)}isPrevious(e){let t=this._getAvailable();return e===this._getPreviousAvailable(t)}isNext(e){let t=this._getAvailable();return e===this._getNextAvailable(t)}select(e){this._element.index=this._getAvailable(e)}previous(e=!0){var t=this._getPreviousAvailable(this._element.index);t>=0&&(e||this._element.index>t)&&(this._element.index=t)}next(e=!0){var t=this._getNextAvailable(this._element.index);t>=0&&(e||this._element.index<t)&&(this._element.index=t)}};var tc=class extends HTMLElement{constructor(){super()}connectedCallback(){this.remove()}};tc=c([C({tagName:d+"-annihilator"})],tc);var ia=class extends K{constructor(){super(...arguments);this._unloadingHandler=e=>{let t=this.message;!this.active||this.disabled||(e.type==="beforeunload"?(e.preventDefault(),e.returnValue=t||""):confirm(t||"Leave page?")||e.preventDefault())}}viewActivatedCallback(){super.viewActivatedCallback(),window.addEventListener("navigating",this._unloadingHandler,!1),window.addEventListener("beforeunload",this._unloadingHandler,!1)}disconnectedCallback(){window.removeEventListener("navigating",this._unloadingHandler,!1),window.removeEventListener("beforeunload",this._unloadingHandler,!1),super.disconnectedCallback()}};c([h({emit:!1,converter:m.String})],ia.prototype,"message",2),c([h({emit:!1,converter:m.Boolean})],ia.prototype,"active",2),ia=c([C({tagName:d+"-beforeunload"})],ia);var rc,Xn=class extends K{constructor(){super(...arguments);this.autosend=!0;this._messageHandler=e=>{this.result=e.data,this.dispatchEvent(new CustomEvent("receive",{detail:e.data,bubbles:!1,cancelable:!1}))};this._errorHandler=e=>{this.dispatchEvent(new CustomEvent("error",{detail:e.data,bubbles:!1,cancelable:!1}))};z(this,rc)}viewActivatedCallback(){super.viewActivatedCallback(),this._initializeChannel()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":this._disposeChannel(),this._initializeChannel(n);break;case"autosend":case"disabled":case"message":this.autosend&&this.send(this.message);break}}disconnectedCallback(){this._disposeChannel(),super.disconnectedCallback()}send(e=this.message){if(this.disabled)return;let t=M(this,rc);a.isNull(t)||t.postMessage(e)}_initializeChannel(e=this.channelName){if(!a.isNullOrEmpty(e)){let t=H(this,rc,new BroadcastChannel(e));t.addEventListener("message",this._messageHandler,!1),t.addEventListener("messageerror",this._errorHandler,!1),this.autosend&&!a.isNull(this.message)&&this.send()}}_disposeChannel(e=M(this,rc)){a.isNull(e)||(e.removeEventListener("messageerror",this._errorHandler,!1),e.removeEventListener("message",this._messageHandler,!1),e.close())}};rc=new WeakMap,c([h({emit:!1,converter:m.String})],Xn.prototype,"message",2),c([h({converter:m.String})],Xn.prototype,"result",2),c([h({emit:!1,converter:m.String})],Xn.prototype,"channelName",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Xn.prototype,"autosend",2),Xn=c([C({tagName:d+"-broadcastchannel-proxy"})],Xn);var Jp,Zp,Mo=class extends K{constructor(){super(...arguments);z(this,Jp);z(this,Zp)}viewActivatedCallback(){super.viewActivatedCallback(),this._detect()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="userAgent"&&this._detect(n)}get browser(){return M(this,Jp)}get version(){return M(this,Zp)}_detect(e=this.userAgent){let{version:t,name:n}=Bu(e),{browser:i,version:s}=this;n!=i&&(H(this,Jp,n),this.dispatchEvent(new ue({propertyName:"browser",currentValue:n,oldValue:i}))),t!=s&&(H(this,Zp,t),this.dispatchEvent(new ue({propertyName:"version",currentValue:t,oldValue:s})))}};Jp=new WeakMap,Zp=new WeakMap,c([h({emit:!1,converter:m.String})],Mo.prototype,"userAgent",2),Mo=c([C({tagName:d+"-browser-detect"})],Mo);var qn=class extends K{constructor(e=new eh){super();this.storage=e;this._handle=0;this._flag=!1}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"persistAs":a.isNullOrEmpty(t)||this.storage.removeProperty(t),i===!0&&!a.isNullOrEmpty(n)&&(this.model=this.storage.getPropertyValue(n)??this.model);break;case"model":let s=this.debounce,l=this.throttle,p=()=>{this.dispatchEvent(new ue({propertyName:e,oldValue:t,currentValue:n,firstChange:i}))};if(s>0&&!i)if(l){if(this._flag)return;this._flag=!0,p(),this._handle=window.setTimeout(()=>{this._flag=!1},s)}else clearTimeout(this._handle),this._handle=window.setTimeout(p,s);else p();!i&&!a.isNullOrEmpty(this.persistAs)&&(a.isNull(n)?this.storage.removeProperty(this.persistAs):this.storage.setPropertyValue(this.persistAs,n,!0));break}}};c([h({emit:!1,converter:m.Eval})],qn.prototype,"model",2),c([h({emit:!1,converter:m.String})],qn.prototype,"persistAs",2),c([h({emit:!1,converter:m.Number})],qn.prototype,"debounce",2),c([h({emit:!1,converter:m.BooleanStrict})],qn.prototype,"throttle",2),qn=c([C({tagName:d+"-data"})],qn);var yf=(e=>(e.Top="top",e.Bottom="bottom",e))(yf||{}),yn=class extends K{constructor(e=new Fi){super();this._tweener=e;this.mode="top";this.transitionDuration=300}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="dock"&&(!a.isNull(t)||n!=!1)?this._doDock():e==="mode"&&this.dock===!0&&this._doDock()}_animate(e,t){var n=this.transitionDuration;return n>0||(n=300),this._tweener.run(e,t,n,this.delay,Ur.sineInOut,(i,s)=>{this._setOffset(s)}).then(()=>{this._resetOffset()})}_setOffset(e){this.style.transform="translateY("+e+"px)"}_resetOffset(){this.style.transform=""}_compute(){let e=a.offset(this),t=getComputedStyle(this),n=a.scrollTop;switch(this.mode){case"bottom":let i=parseInt(t.marginBottom),s=e.top;return{delta:a.windowSize.height-(s-n+this.offsetHeight)+i};case"top":let p=parseInt(t.marginTop);return{delta:-(e.top-n+p)}}}_doDock(){if(this.dock){let t=this._compute();if(a.isNull(t))return;switch(a.addClass(this,b+"-dock"),this.mode){case"bottom":a.removeClass(this,b+"-dock-top"),a.addClass(this,b+"-dock-bottom");break;case"top":a.removeClass(this,b+"-dock-bottom"),a.addClass(this,b+"-dock-top");break}let n=-t.delta,i=0,s=A.getAttachedPropertyValue(this,"pacem-dock:state")||0;A.setAttachedPropertyValue(this,"pacem-dock:state",-n+s),this.log("info",`animating from ${n}px to ${i}px`),this._animate(n,i)}else{let t=A.getAttachedPropertyValue(this,"pacem-dock:state");A.deleteAttachedPropertyValue(this,"pacem-dock:state");let n=0;this.log("info",`animating back from ${t}px to ${n}px`),a.removeClass(this,`${b}-dock ${b}-dock-top ${b}-dock-bottom`),this._animate(t,n)}}};c([h({emit:!1,converter:m.String})],yn.prototype,"mode",2),c([h({converter:m.Boolean})],yn.prototype,"dock",2),c([h({emit:!1,converter:m.Element})],yn.prototype,"target",2),c([h({emit:!1,converter:m.Number})],yn.prototype,"delay",2),c([h({emit:!1,converter:m.Number})],yn.prototype,"transitionDuration",2),yn=c([C({tagName:d+"-dock"})],yn);var Lo=class extends K{constructor(){super(...arguments);this._dom=[];this._children=[]}get dom(){return this._children}viewActivatedCallback(){super.viewActivatedCallback(),this.moveContent(this.proxy)}moveContent(e){a.isNull(e)||(a.isNullOrEmpty(this._dom)?(this._dom=a.moveItems(this.childNodes,e),this._children=this._dom.filter(t=>t instanceof Element)):a.moveItems(this._children,e))}disconnectedCallback(){for(let e of(this._dom||[]).splice(0))e.remove();super.disconnectedCallback()}},nc=class extends Lo{get proxy(){return document.body}};nc=c([C({tagName:d+"-body-proxy"})],nc);var ic=class extends Lo{get proxy(){return A.findAncestorShell(this)}};ic=c([C({tagName:d+"-shell-proxy"})],ic);var So=class extends Lo{get proxy(){return this.target}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="target"&&!n&&this.moveContent(this.proxy)}};c([h({converter:m.Element})],So.prototype,"target",2),So=c([C({tagName:d+"-element-proxy"})],So);var _f=class extends Event{constructor(e){super("emit");this._originalEvent=e}get originalEvent(){return this._originalEvent}},kC={convert:function(o,r){return o==="$window"?window:m.Element.convert(o,r)},convertBack:(o,r)=>o===window?"$window":m.Element.convertBack(o,r)},ji=class extends K{constructor(){super(...arguments);this._emitHandler=e=>{var t=new _f(e);this.dispatchEvent(t)}}viewActivatedCallback(){super.viewActivatedCallback(),this._observe()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"target":this._unobserve(t,this.event,this.capture),this._observe();break;case"event":this._unobserve(this.target,t,this.capture),this._observe();break;case"capture":this._unobserve(this.target,this.event,t),this._observe();break}}disconnectedCallback(){this._unobserve(),super.disconnectedCallback()}_unobserve(e=this.target,t=this.event,n=this.capture){a.isNull(e)||a.isNullOrEmpty(t)||e.removeEventListener(t,this._emitHandler,{capture:n})}_observe(e=this.target,t=this.event,n=this.capture){a.isNull(e)||a.isNullOrEmpty(t)||e.addEventListener(t,this._emitHandler,{capture:n})}};c([h({emit:!1,converter:kC})],ji.prototype,"target",2),c([h({emit:!1,converter:m.String})],ji.prototype,"event",2),c([h({emit:!1,converter:m.Boolean})],ji.prototype,"capture",2),ji=c([C({tagName:d+"-event-proxy"})],ji);var mb="New incoming request overrides the ongoing one. Aborting.",sa,Qp,dt=class extends K{constructor(){super(...arguments);this.autofetch=!0;this.debounce=100;z(this,sa);z(this,Qp)}viewActivatedCallback(){super.viewActivatedCallback(),this._delayAndConditionallyFetch()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"url":case"method":case"type":case"as":case"mode":case"credentials":case"disabled":case"autofetch":this._delayAndConditionallyFetch();break;case"parameters":case"headers":(!this.diffByValues||a.jsonSortStringify(t)!=a.jsonSortStringify(n))&&this._delayAndConditionallyFetch();break}}_delayAndConditionallyFetch(){clearTimeout(this._handle),this.disabled?this._abortPending():this.autofetch&&(this._handle=setTimeout(()=>{this.fetch()},this.debounce||0))}_abortPending(){M(this,sa)&&(M(this,sa).abort(mb),H(this,sa,null))}fetch(){return this.throttle&&this.fetching?M(this,Qp):H(this,Qp,new Promise((e,t)=>{var n=this.url;if(!this.isReady||a.isNullOrEmpty(n)||this.disabled){e(null);return}let i=this;i.fetching=!0;let s=i.type||"json",l="application/json";s==="raw"&&(l="application/x-www-form-urlencoded");let p=(i.method||"GET").toUpperCase(),u={headers:a.extend({"Content-Type":l},i.headers),method:p,mode:i.mode||"cors",credentials:i.credentials||"same-origin",cache:i.cache||"default"},f=a.clone(i.parameters??{});if(n=a.URIs.format(n,f,p=="GET"),!a.isNullOrEmpty(f))switch(p){case"GET":n=a.URIs.appendQuery(n,f);break;case"PUT":case"POST":case"PATCH":switch(i.type){case"raw":let v=new URLSearchParams;for(let y in f)v.set(y,f[y]);u.body=v;break;default:u.body=a.Json.stringify(f);break}break}if(a.URIs.hasMandatoryTemplateSegments(n)){e(null);return}this._abortPending();let{signal:g}=H(this,sa,new AbortController);u.signal=g,fetch(n,u).then(v=>{if(H(this,sa,null),i.fetching=!1,v.ok)if(this.dispatchEvent(new CustomEvent(ef,{detail:v})),Vp.isEmpty(v)){switch(i.as){case"blob":case"image":i.result=null;break;case"text":i.result=null;break;default:i.result=null;break}e(v)}else switch(i.as){case"blob":case"image":v.blob().then(_=>{i.as==="image"?a.blobToDataURL(_).then(x=>{i._acceptFetchResult(x)}):i._acceptFetchResult(_),e(v)},_=>{this.log("warn",`Couldn't parse a ${i.as}. ${_}`),e(null)});break;case"text":v.text().then(_=>{i._acceptFetchResult(_),e(v)});break;default:v.json().then(_=>{i._acceptFetchResult(_),e(v)},_=>{this.log("warn",`Couldn't parse a ${i.as}. ${_}`),e(null)});break}else this.dispatchEvent(new CustomEvent(Qm,{detail:v})),t(v)},v=>{typeof v=="string"&&v===mb?(this.log("info",v),e(null)):t(v)})}))}_acceptFetchResult(e){this.dispatchEvent(new CustomEvent(Zm,{detail:e})),this.result=e}};sa=new WeakMap,Qp=new WeakMap,c([h({emit:!1,reflectBack:!0,converter:m.String})],dt.prototype,"url",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],dt.prototype,"method",2),c([h({emit:!1,converter:m.Json})],dt.prototype,"parameters",2),c([h({emit:!1,converter:m.Json})],dt.prototype,"headers",2),c([h({emit:!1,converter:m.String})],dt.prototype,"credentials",2),c([h({emit:!1,converter:m.String})],dt.prototype,"mode",2),c([h({emit:!1,converter:m.String})],dt.prototype,"cache",2),c([h({converter:m.BooleanStrict})],dt.prototype,"fetching",2),c([h({reflectBack:!0,converter:m.Boolean})],dt.prototype,"autofetch",2),c([h({emit:!1,converter:m.String})],dt.prototype,"as",2),c([h({emit:!1,converter:m.String})],dt.prototype,"type",2),c([h({reflectBack:!0,converter:m.Number})],dt.prototype,"debounce",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],dt.prototype,"throttle",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],dt.prototype,"diffByValues",2),c([h()],dt.prototype,"result",2),dt=c([C({tagName:d+"-fetch"})],dt);var ed=class extends CustomEvent{constructor(r,e){super(r,{detail:e})}},Jn,Kn=class extends K{constructor(){super(...arguments);z(this,Jn)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"state":this._handleStateChange(n);break;case"maxlength":let s=M(this,Jn);a.isNull(s)||(s.maxlength=n);break}}viewActivatedCallback(){super.viewActivatedCallback(),this._handleStateChange()}_handleStateChange(e=this.state){let t=M(this,Jn);a.isNull(t)?H(this,Jn,new Fl(e,this.maxlength)):bo(t.current,e)!==!0&&(t.push(e),this.log("log","Pushed state."),this._synchronize("push"))}redo(){let e=M(this,Jn);a.isNull(e)||(e.redo(),this.log("log","Redone state."),this._synchronize("redo"))}reset(){let e=M(this,Jn);a.isNull(e)||(e.reset(),this.log("log","Reset state."),this._synchronize("reset"))}undo(){let e=M(this,Jn);a.isNull(e)||(e.undo(),this.log("log","Undone state."),this._synchronize("undo"))}_synchronize(e){let t=M(this,Jn);this.canUndo=t.canUndo,this.canRedo=t.canRedo,this.state=t.current;let{canRedo:n,canUndo:i,current:s}=t;this.dispatchEvent(new ed(e,{canRedo:n,canUndo:i,state:s}))}};Jn=new WeakMap,c([h({emit:!0,converter:m.Json})],Kn.prototype,"state",2),c([h({emit:!1,converter:m.Number})],Kn.prototype,"maxlength",2),c([h({emit:!0,converter:m.Boolean})],Kn.prototype,"canUndo",2),c([h({emit:!0,converter:m.Boolean})],Kn.prototype,"canRedo",2),Kn=c([C({tagName:d+"-history"})],Kn);var aa=class extends K{constructor(){super(...arguments);this._html=document.documentElement}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="attr"&&t&&this._html.removeAttribute(t),this._update()}_update(){let e=this.attr;if(a.isNullOrEmpty(e)||this.disabled)return;let t=this.value,n=this._html;a.isNullOrEmpty(t)?n.removeAttribute(e):n.setAttribute(e,t)}};c([h({emit:!1,converter:m.String})],aa.prototype,"attr",2),c([h({emit:!1,converter:m.String})],aa.prototype,"value",2),aa=c([C({tagName:d+"-html-proxy"})],aa);var sc,No=class extends HTMLElement{constructor(){super(...arguments);z(this,sc)}propertyChangedCallback(e,t,n,i){a.isNullOrEmpty(M(this,sc))&&H(this,sc,this.innerHTML),n?this.innerHTML=M(this,sc):this.innerHTML=""}};sc=new WeakMap,c([h({emit:!1,converter:m.Boolean})],No.prototype,"match",2),No=c([C({tagName:d+"-if"})],No);var Yi=class extends mt{get container(){return this._container}findContainer(){return A.findAncestor(this,r=>r instanceof _n)}viewActivatedCallback(){super.viewActivatedCallback();let r=this._container=this.findContainer();a.isNull(r)||r.register(this)}disconnectedCallback(){a.isNull(this._container)||this._container.unregister(this),super.disconnectedCallback()}};function fb(o){return"items"in o&&(a.isNull(o.items)||a.isArray(o.items))&&typeof o.register=="function"&&typeof o.unregister=="function"}var xf="itemregister",Cf="itemunregister",td=class extends oe{constructor(r,e){super(xf,r,e)}},rd=class extends oe{constructor(r,e){super(Cf,r,e)}},ah=class{constructor(r){this._container=r;if(r==null||!(r instanceof _n||r instanceof ac))throw"Must provide a valid itemscontainer."}register(r){let e=this._container;var t=!1;return e.validate(r)?a.isNull(e.items)?(e.items=[r],t=!0):e.items.indexOf(r)===-1&&(e.items.push(r),t=!0):e.logger&&e.logger.log("debug",`${r&&r.localName} element couldn't be registered in a ${e.localName} element.`),t&&e.dispatchEvent(new td(r)),t}unregister(r){let e=this._container;if(!a.isNull(e.items)){let t=e.items.indexOf(r);if(t>=0){let n=e.items.splice(t,1);return e.dispatchEvent(new rd(n[0])),!0}}return!1}},ac=class extends Yi{constructor(r,e){super(r,e),this._registrar=new ah(this)}register(r){return this._registrar.register(r)}unregister(r){return this._registrar.unregister(r)}};c([h()],ac.prototype,"items",2);var _n=class extends mt{constructor(r,e){super(r,e),this._registrar=new ah(this)}register(r){return this._registrar.register(r)}unregister(r){return this._registrar.unregister(r)}};c([h()],_n.prototype,"items",2);var oh=class extends Yi{findContainer(){return A.findAncestor(this,r=>r instanceof To)}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.container,s=(i&&i.items||[]).indexOf(this);s>=0&&i&&i.adapter&&i.adapter.itemPropertyChangedCallback(s,r,e,t,n)}},To=class extends _n{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),this.adapter&&this.adapter.masterPropertyChangedCallback(r,e,t,n),r){case"adapter":a.isNull(e)||e.destroy(),a.isNull(t)||this.adapter.initialize(this);break;case"items":this.isReady&&this._checkIndex();break}}viewActivatedCallback(){super.viewActivatedCallback(),this._checkIndex()}_checkIndex(){let r=0;a.isNullOrEmpty(this.items)||this.index<this.items.length&&(r=this.index),this.index=r}disconnectedCallback(){a.isNull(this.adapter)||this.adapter.destroy(),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Element})],To.prototype,"adapter",2),c([h({converter:m.Number})],To.prototype,"index",2);var gb="false",MC="true",nd,oa=class extends K{constructor(){super(...arguments);z(this,nd)}connectedCallback(){super.connectedCallback(),H(this,nd,A.findAncestorShell(this))}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),this._update()}disconnectedCallback(){let e=this.attr;a.isNullOrEmpty(e)||this._update(e,gb,!1),super.disconnectedCallback()}_update(e=this.attr,t=this.value?.toString(),n=this.disabled){if(a.isNullOrEmpty(e)||n)return;let i=M(this,nd);a.isNull(i)||(a.isNullOrEmpty(t)||t===gb?i.removeAttribute(e):i.setAttribute(e,t===MC?"":t))}};nd=new WeakMap,c([h({emit:!1,converter:m.String})],oa.prototype,"attr",2),c([h({emit:!1,converter:m.String})],oa.prototype,"value",2),oa=c([C({tagName:d+"-layout-proxy"})],oa);var Zn=class extends K{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),this._update()}viewActivatedCallback(){super.viewActivatedCallback(),this._update()}_update(){let r=this.content,e=!a.isNullOrEmpty(this.name),t=e?this.name:this.itemprop;if(a.isNullOrEmpty(t)||this.disabled)return;let n=a.cssEscape(t),i=e?`meta[name='${n}']`:`meta[itemprop='${n}']`;var s=document.head.querySelector(i);if(a.isNull(s))s=document.createElement("meta"),document.head.appendChild(s);else if(a.isNullOrEmpty(r)){s.remove();return}s.setAttribute("content",r),s.setAttribute(e?"name":"itemprop",t),s.removeAttribute(e?"itemprop":"name")}};c([h({emit:!1,converter:m.String})],Zn.prototype,"name",2),c([h({emit:!1,converter:m.String})],Zn.prototype,"itemprop",2),c([h({emit:!1,converter:m.String})],Zn.prototype,"content",2),c([me(!0)],Zn.prototype,"_update",1),Zn=c([C({tagName:d+"-meta-proxy"})],Zn);var Ao=class extends K{constructor(){super(...arguments);this._onlineHandler=e=>{a.isNull(e)?this.online=navigator.onLine||!1:this.online=e.type==="online"}}connectedCallback(){super.connectedCallback(),window.addEventListener("online",this._onlineHandler,!1),window.addEventListener("offline",this._onlineHandler,!1)}viewActivatedCallback(){super.viewActivatedCallback(),this._onlineHandler()}disconnectedCallback(){window.removeEventListener("online",this._onlineHandler,!1),window.removeEventListener("offline",this._onlineHandler,!1),super.disconnectedCallback()}};c([h({converter:m.Boolean})],Ao.prototype,"online",2),Ao=c([C({tagName:d+"-online-status"})],Ao);var oc=class extends na{};oc=c([C({tagName:d+"-panel"})],oc);var xn=class extends Xl{propertyChangedCallback(r,e,t,n){r==="target"&&this.dispatchEvent(new Event("templatechange"))}addEventListener(r,e,t){super.addEventListener(r,e,t)}removeEventListener(r,e,t){super.removeEventListener(r,e,t)}};c([h({emit:!1,converter:m.Element})],xn.prototype,"target",2),xn=c([C({tagName:d+"-template-proxy"})],xn);var SC=A.getAttachedPropertyValue,GT=A.setAttachedPropertyValue,lh=class extends oe{constructor(e,t,n){super(e,t,{bubbles:!1,cancelable:!0});this._originalEvent=n}get srcEvent(){return this._originalEvent}},id=class extends lh{constructor(r){super("item"+Yt,r.detail,r)}},sd=class extends lh{constructor(r){super("item"+r.detail.commandName.toLowerCase(),r.detail.commandArgument,r)}},zr=class extends K{constructor(){super(...arguments);this._childItems=[];this._fragment=document.createDocumentFragment();this._setupItem=(e,t,n)=>{e.index=t,e.item=n};this._refreshItemTemplateHandler=e=>{let t=e.target;this._itemTemplate=t.target,this._databind()}}removeItem(e){this._removeItems(e,e)}_setItem(e,t,n){let i=this._childItems,s;t>=i.length?(s=new Do(this,this._itemTemplate,n,this._childTemplatePlaceholder),this._setupItem(s,t,e),i.push(s),s.append()):(s=i[t],this._setupItem(s,t,e),s.redrawEventually(this._itemTemplate,n)),this.dispatchEvent(new Ql(s))}_removeItems(e,t){let i=this._childItems.splice(e,t+1-e);for(var s=i.length-1;s>=0;s--){let l=i[s];this.dispatchEvent(new ec(l)),l.remove()}}databind(){this._databind()}_databind(e=this.datasource){if(!this.isConnected)return;let t=this._itemTemplate,n=this._childTemplatePlaceholder;if(t==null)throw`Missing template element in ${zr.name}.`;let i=this._childItems,s=0;try{for(var l of e||[])this._setItem(l,s,this._fragment),s++}catch(p){this.log("error",p)}s<i.length?this._removeItems(s,i.length-1):a.isNull(n&&n.parentNode)||n.parentNode.insertBefore(this._fragment,n)}_onCommand(e){this.dispatchEvent(new id(e)),this.dispatchEvent(new sd(e))}_buildupItemTemplate(){let e=A.findFirstDescendant(this,t=>t instanceof HTMLTemplateElement||t instanceof xn);return e instanceof xn?(e.addEventListener("templatechange",this._refreshItemTemplateHandler,!1),this._childTemplatePlaceholder=e,this._itemTemplate=e.target):this._itemTemplate=this._childTemplatePlaceholder=e}viewActivatedCallback(){super.viewActivatedCallback(),this.addEventListener(Yt,this._onCommand,!1),this._buildupItemTemplate()&&this._databind()}disconnectedCallback(){let e=this._childTemplatePlaceholder;!a.isNull(e)&&e instanceof xn&&e.removeEventListener("templatechange",this._refreshItemTemplateHandler,!1),this.removeEventListener(Yt,this._onCommand,!1),this.datasource=[],super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="datasource"&&(a.isNull(this._itemTemplate)||this._databind(n))}};c([h({emit:!1,converter:m.Eval})],zr.prototype,"datasource",2),zr=c([C({tagName:d+"-repeater"})],zr);var Do=class extends Gi{constructor(e,t,n,i){super(document.createComment("pacem-repeater-item"));this._repeater=e;this._template=t;this._fragment=n;this._holder=i;this._alterEgos=[];let s="_";function l(u,f){var g=this,v=s+u;if(f!==g[v]){var y=g[v];g[v]=f;var _=new ue({propertyName:u,oldValue:y,currentValue:f});g.dispatchEvent(_)}}let p=this.placeholder;Object.defineProperties(p,{item:{get:function(){return this[s+"item"]},set:function(u){l.apply(p,["item",u])},configurable:!0},index:{get:function(){let u=this[s+"index"];return a.isNull(u)?-1:u},set:function(u){l.apply(p,["index",u])},configurable:!0}})}append(){let e=this._template,t=this._fragment;this._alterEgos.push(t.appendChild(this.placeholder));let n=e.cloneNode(!0);var i;a.isNull(i=SC(this._repeater,ea))||A.assignHostContext(i,n);var s=n.content.childNodes;Array.prototype.push.apply(this._alterEgos,s),t.appendChild(n.content)}redrawEventually(e,t){if(e===this._template)return;this._fragment=t,this._template=e;let n=this._holder.parentElement,i=this._alterEgos;for(;i.length>0;)n.removeChild(i.pop());this.append()}get dom(){return this._alterEgos.filter(e=>!(e instanceof Comment||e instanceof Text))}get repeater(){return this._repeater}remove(){let e=this._holder.parentElement;for(var t of this._alterEgos)t.parentElement===e&&!a.isNull(e)&&e.removeChild(t)}get index(){return this.placeholder.index}set index(e){this.placeholder.index=e}get item(){return this.placeholder.item}set item(e){this.placeholder.item=e}};var Ef="resize",ad=class extends oe{constructor(r){super(Ef,r)}},vb={box:"border-box"},la=class extends K{constructor(){super(...arguments);this._checkSizeHandler=()=>{this._assignSizeDebounced()}}get _target(){return this.target||this}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":this._start();break;case"target":if(!a.isNull(this._observer)){var s=t||this;this._observer.unobserve(s)}case"watchPosition":var l=this.target||this;a.isNull(this._observer)||this._observer.observe(l,vb);break}}_start(){if(this.disabled){this._stop();return}this.watchPosition?this._startWatchIntensively():(this._observer=new ResizeObserver(e=>{var t=!1;for(let n of e)if(n.target===this._target&&n.contentRect){t=!0;break}t&&this._assignSizeDebounced()}),this._observer.observe(this._target,vb)),window.addEventListener("resize",this._checkSizeHandler,!1)}_stop(){window.cancelAnimationFrame(this._handle),window.removeEventListener("resize",this._checkSizeHandler,!1),a.isNull(this._observer)||(this._observer.disconnect(),this._observer=null)}_startWatchIntensively(){this._checkSize(),this._handle=window.requestAnimationFrame(()=>{this._startWatchIntensively()})}_assignSizeDebounced(){this._checkSize()}_checkSize(){this.log("log","Resize flow triggered.");let e=this._target,t=a.offset(e),n=t.height,i=t.width;(n!=this._previousHeight||i!=this._previousWidth||this.watchPosition&&(t.left!=this._previousLeft||t.top!=this._previousTop))&&(this._previousHeight=n,this._previousWidth=i,this._previousLeft=t.left,this._previousTop=t.top,this._dispatchResize())}get currentSize(){var e={height:this._previousHeight,width:this._previousWidth};return this.watchPosition&&(e.left=this._previousLeft,e.top=this._previousTop),e}_dispatchResize(){this.dispatchEvent(new ad(this.currentSize))}connectedCallback(){super.connectedCallback(),this._start()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Element})],la.prototype,"target",2),c([h({emit:!1,converter:m.Boolean})],la.prototype,"watchPosition",2),la=c([C({tagName:d+"-resize"})],la);var LC=/^([\w\.]:)?\/\/[^\/]+/,Ro,Oo,Qn=class extends K{constructor(){super(...arguments);z(this,Ro);z(this,Oo);this._onScroll=e=>{if(!(this.scrollRestoration??!0))return;let n=Math.floor(a.scrollTop);window.history.replaceState(a.extend({},window.history.state,{$scrollY:n}),document.title)};this._onPopState=e=>{if(!a.isNull(e.state)&&!M(this,Ro)){let t=e.state;this.path=t.$path}}}parseState(e={}){let t=this._stringifyMergedState(e),n=this._segmentateUrl(t);return this._parseState(n.path+n.query+n.hash,n.path,n.query,n.hash)}navigate(e,t){if(this.disabled||a.isNullOrEmpty(e))return;if(typeof e=="object"?e=this._stringifyMergedState(e):e=a.URIs.format(e,this.state),e!=this.path){this.path=e;return}let n=document.location;if(LC.test(e)&&!e.startsWith(n.protocol+"//"+n.host))throw`Only same-origin navigation is currently supported. "${e}" is not a valid path.`;if(!M(this,Ro)){let i=this.state&&this.state.$path||void 0,s=this._segmentateUrl(e),l=this._parseState(s.path+s.query+s.hash,s.path,s.query,s.hash),p=n.pathname+n.search+n.hash===s.path+s.query+s.hash,u=new qu(e);if(window.dispatchEvent(u),H(this,Ro,u.defaultPrevented)){p&&window.history.pushState(this.state,t,i),this.path=i;return}let f=p?a.extend({$scrollY:0},window.history.state,l):a.extend({$scrollY:0},l);this.state=f,window.history.scrollRestoration=this.scrollRestoration??!0?"manual":"auto",p?window.history.replaceState(f,document.title):window.history.pushState(f,t,e),a.isNullOrEmpty(t)||(document.title=t),window.dispatchEvent(new Xu({path:e,referrer:i,title:t}))}H(this,Ro,!1)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"template":H(this,Oo,null);break;case"path":this.navigate(n);break}}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState,!1),document.addEventListener("scroll",this._onScroll,!1)}viewActivatedCallback(){super.viewActivatedCallback();let e=this.path;a.isNullOrEmpty(e)||this.navigate(e)}disconnectedCallback(){document.removeEventListener("scroll",this._onScroll,!1),window.removeEventListener("popstate",this._onPopState,!1),super.disconnectedCallback()}_stringifyMergedState(e){let t=a.extend({},e),n=a.extend({},this.state,t),i=this.template,s=""+i;for(let u of this._parseTemplate(i)){let f=u.name,g=new RegExp("/{"+f+"\\??}"),v=n[f];delete t[f],s=s.replace(g,a.isNullOrEmpty(v)?"":"/"+v)}let l=a.extend({},this.state.$query);for(let u in t)l[u]=t[u];let{hash:p}=this._segmentateUrl(this.path);return a.URIs.appendQuery(s,l,!0)+p}_parseTemplate(e=this.template){return a.isNullOrEmpty(M(this,Oo))?H(this,Oo,a.URIs.parseRoute(e)):M(this,Oo)}_segmentateUrl(e){let t=a.URIs.split(e);return a.isNullOrEmpty(t.path)?null:t}_parseState(e,t,n,i){let s=this._parseTemplate();return a.URIs.parseState(s,e,t,n,i)}};Ro=new WeakMap,Oo=new WeakMap,c([h({emit:!1,converter:m.String})],Qn.prototype,"template",2),c([h({converter:m.Eval})],Qn.prototype,"state",2),c([h({emit:!1,converter:m.String})],Qn.prototype,"path",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Qn.prototype,"scrollRestoration",2),Qn=c([C({tagName:d+"-router"})],Qn);var kf="scroll",od=class extends oe{constructor(r){super(kf,r)}},wf=class{constructor(r){this.global=r;this.scrollers=[];this.scrollHandler=r=>{this._scroll(r)}}register(r){let e=this.scrollers;e.indexOf(r)===-1&&(e.push(r),e.length===1&&this.global.addEventListener("scroll",this.scrollHandler,!1),this._scroll())}unregister(r){var e;let t=this.scrollers;(e=t.indexOf(r))!==-1&&(t.splice(e,1),t.length===0&&this.global.removeEventListener("scroll",this.scrollHandler,!1))}_scroll(r){for(var e of this.scrollers){if(a.isNull(e.target)){let t=a.scrollTop,n=a.scrollLeft;e.offset={top:t,left:n}}else{let t=e.target.scrollTop,n=e.target.scrollLeft;e.offset={top:t,left:n}}e.dispatchEvent(new od(e.offset))}}},bb=new wf(window),ca=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),bb.register(this)}disconnectedCallback(){bb.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Element})],ca.prototype,"target",2),c([h({converter:m.Json})],ca.prototype,"offset",2),ca=c([C({tagName:d+"-scroll-aware"})],ca);function NC(o){let r="=".repeat((4-o.length%4)%4);o=(o+r).replace(/\-/g,"+").replace(/_/g,"/");let e=window.atob(o),t=new Uint8Array(e.length);for(var n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}var ei=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),this._tryRegister()}disconnectedCallback(){this._tryUnregister(),super.disconnectedCallback()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"pushSubscription":a.isNull(e)||this.dispatchEvent(new CustomEvent("unsubscribe",{detail:e})),a.isNull(t)||this.dispatchEvent(new CustomEvent("subscribe",{detail:t}));break;case"registration":a.isNull(e)||this.dispatchEvent(new CustomEvent("unregister",{detail:e})),a.isNull(t)||this.dispatchEvent(new CustomEvent("register",{detail:t}));break}}_tryUnregister(r=this.registration){return a.isNull(r)?Promise.resolve(!0):r.unregister()}_tryRegister(r=this.src){this._tryUnregister().then(e=>{!a.isNullOrEmpty(r)&&"serviceWorker"in navigator&&navigator.serviceWorker.register(r).then(t=>{this.registration=t,"PushManager"in window&&t.pushManager.getSubscription().then(n=>{this.pushSubscription=n})})})}unsubscribe(r=this.pushSubscription){return new Promise((e,t)=>{if(a.isNull(r))e(!1);else{let n=r===this.pushSubscription;r.unsubscribe().then(i=>{n&&(this.pushSubscription=null),e(i)})}})}subscribe(r=this.publicKey){return new Promise((e,t)=>{typeof r=="string"&&(r=NC(r));let n=this.registration?.pushManager;a.isNull(n)?e(null):n.subscribe({userVisibleOnly:!0,applicationServerKey:r}).then(i=>{Notification.permission==="denied"?e(this.pushSubscription=null):e(this.pushSubscription=i)})})}};c([h()],ei.prototype,"registration",2),c([h()],ei.prototype,"pushSubscription",2),c([h({emit:!1,converter:m.String})],ei.prototype,"src",2),c([h({emit:!1,converter:m.String})],ei.prototype,"publicKey",2),ei=c([C({tagName:d+"-serviceworker-proxy"})],ei);var yb="keydown";function TC(o,r,e=[]){if(a.isNullOrEmpty(r))return!1;let t=/(\w+)\s*\+/,n=[],i;for(;!a.isNullOrEmpty(i=t.exec(r));)r=r.substr(i.index+i[0].length),n.push(i[1]);if(!de.matchModifiers(o,n))return!1;let s=r.split(",").map(p=>p.trim().toLowerCase());if(a.isNullOrEmpty(s))return!1;var l=o.key.toLowerCase();return AC(l,s[e.length])?(e.push(l),e.length==s.length?!0:"ongoing"):!1}function AC(o,r){return o===r||o==="escape"&&r==="esc"||o==="backspace"&&r==="back"||o==="control"&&r==="ctrl"||o==="delete"&&(r==="del"||r==="canc")||/^arrow/.test(o)&&r===o.substr(5)}var Mf="execute",pa=class extends K{constructor(){super(...arguments);this._accumulator=[];this._shortcutHandler=e=>{switch(TC(e,this.combination,this._accumulator)){case!0:Q(e),this.dispatchEvent(new Event(Mf,{bubbles:!1,cancelable:!1}));case!1:this._accumulator.splice(0);break}}}viewActivatedCallback(){super.viewActivatedCallback(),this._addHandler()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&!i&&(this._removeHandler(t),this._addHandler(n))}disconnectedCallback(){this._removeHandler(),super.disconnectedCallback()}_removeHandler(e=this.target){(e||window).removeEventListener(yb,this._shortcutHandler,!1)}_addHandler(e=this.target){(e||window).addEventListener(yb,this._shortcutHandler,!1)}};c([h({emit:!1,converter:m.String})],pa.prototype,"combination",2),c([h({emit:!1,converter:m.Element})],pa.prototype,"target",2),pa=c([C({tagName:d+"-shortcut"})],pa);var Po=class extends na{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="text"&&!n&&(this.textContent=t)}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.text)||(this.textContent=this.text)}};c([h({converter:m.String})],Po.prototype,"text",2),Po=c([C({tagName:d+"-span"})],Po);var Xi=class extends K{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"cssText":a.isNull(this._style)||(this.cssReady=!1,this._style.textContent=t,a.isNullOrEmpty(t)?this.cssReady=!0:this._idleWhileReady());break;case"disabled":case"src":this._fetch();break}}viewActivatedCallback(){super.viewActivatedCallback();let r=this._style=document.createElement("style");r.setAttribute("type","text/css"),document.head.appendChild(r),this._fetch()}disconnectedCallback(){a.isNull(this._style)||this._style.remove(),super.disconnectedCallback()}_idleWhileReady(){let r=this._style.sheet,t=setInterval(()=>{try{r.cssRules.length>0&&(clearInterval(t),A.Theme.importWebFonts().then(n=>{this.cssReady=!0,this.dispatchEvent(new Event("cssready"))}))}catch{}},100)}_fetch(){let r=this.src,e=this._style;this.disabled||a.isNull(e)||(a.isNullOrEmpty(r)?e.textContent=this.cssText||"":(this.cssReady=!1,fetch(r).then(t=>{t.text().then(n=>{e.textContent=n,this._idleWhileReady()},n=>{this.cssReady=!0})},t=>{this.cssReady=!0})))}};c([h({emit:!1,converter:m.String})],Xi.prototype,"src",2),c([h({emit:!1,converter:m.String})],Xi.prototype,"cssText",2),c([h({converter:m.Boolean})],Xi.prototype,"cssReady",2),Xi=c([C({tagName:d+"-style-proxy"})],Xi);var Io=class extends HTMLElement{constructor(){super()}connectedCallback(){this.childNodes.length==0&&(this.innerHTML=" "),this._text=this.childNodes.item(0)}propertyChangedCallback(r,e,t,n){a.isNull(t)&&n===!0||(this._text.nodeValue=t)}};c([h({emit:!1,converter:m.String})],Io.prototype,"text",2),Io=c([C({tagName:d+"-text"})],Io);var $o=class extends K{constructor(){super();this._handle=0}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"interval":case"disabled":this._restart();break}}viewActivatedCallback(){super.viewActivatedCallback(),this._restart()}disconnectedCallback(){window.clearInterval(this._handle),super.disconnectedCallback()}_restart(){clearInterval(this._handle),!this.disabled&&this.interval>0&&(this._handle=window.setInterval(()=>{this.dispatchEvent(new Event("tick",{bubbles:!1,cancelable:!1}))},this.interval))}};c([h({emit:!1,converter:m.Number})],$o.prototype,"interval",2),$o=c([C({tagName:d+"-timer"})],$o);var Ho=class extends K{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),this._update()}viewActivatedCallback(){super.viewActivatedCallback(),this._update()}_update(){let r=this.value;a.isNullOrEmpty(r)||this.disabled||(document.title=r)}};c([h({emit:!1,converter:m.String})],Ho.prototype,"value",2),Ho=c([C({tagName:d+"-title-proxy"})],Ho);var _r=class extends K{constructor(e=new Fi){super();this._tweener=e;this.duration=1e3}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="start"&&n===!0&&this.disabled!=!0&&this._animate()}run(){return this._animate()}_animate(){var e=!1;return this._tweener.run(this.from,this.to,this.duration,this.delay,this.easing,(t,n)=>{e=e==!1&&this.dispatchEvent(new Xp),this.dispatchEvent(new jp({time:t,value:this.value=n})),this.log("info","value: "+this.value),t==1&&(this.dispatchEvent(new Yp),this.start=!1)})}};c([h({emit:!1})],_r.prototype,"easing",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],_r.prototype,"from",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],_r.prototype,"to",2),c([h({emit:!1,converter:m.Number})],_r.prototype,"duration",2),c([h({emit:!1,converter:m.Number})],_r.prototype,"delay",2),c([h({emit:!1,converter:m.Boolean})],_r.prototype,"start",2),c([h({converter:m.Number})],_r.prototype,"value",2),_r=c([C({tagName:d+"-tween"})],_r);var ch=class{constructor(r){this._global=r;this.viewports=[];this._checkHandler=r=>{this._oncheck(r)}}register(r){let e=this.viewports,t=this._global;e.indexOf(r)===-1&&(e.push(r),e.length===1&&(t.addEventListener("resize",this._checkHandler,!1),t.addEventListener("scroll",this._checkHandler,!1),t.addEventListener("transitionend",this._checkHandler,!1),t.addEventListener("animationend",this._checkHandler,!1)),this._oncheck())}unregister(r){var e;let t=this.viewports,n=this._global;(e=t.indexOf(r))!==-1&&(t.splice(e,1),t.length===0&&(n.removeEventListener("resize",this._checkHandler,!1),n.removeEventListener("scroll",this._checkHandler,!1),n.removeEventListener("transitionend",this._checkHandler,!1),n.removeEventListener("animationend",this._checkHandler,!1)),this._oncheck())}isElementVisible(r,e){let t=a.windowSize;var n=this._global.document,i=r.getBoundingClientRect(),s=t.width,l=t.height,p=function(u,f){return document.elementFromPoint(u,f)};return i.bottom>0&&i.top<0+l&&(e||i.left<s+0&&i.right>0)}_oncheck(r){for(var e of this.viewports){let n=e.target||e,i=this.isElementVisible(n,e.ignoreHorizontal);if(i!==e.visible){var t=e.visible=i;t?a.addClass(n,b+"-in-viewport"):a.removeClass(n,b+"-in-viewport")}}}};c([me(100)],ch.prototype,"_oncheck",1);var _b=new ch(window),qi=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),_b.register(this)}disconnectedCallback(){_b.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Boolean})],qi.prototype,"visible",2),c([h({emit:!1,converter:m.Element})],qi.prototype,"target",2),c([h({emit:!1,converter:m.Boolean})],qi.prototype,"ignoreHorizontal",2),qi=c([C({tagName:d+"-viewport-aware"})],qi);var ti=class extends K{constructor(){super(...arguments);this.autosend=!0;this._messageHandler=e=>{this.result=e.data,this.dispatchEvent(new CustomEvent("receive",{detail:e.data,bubbles:!1,cancelable:!1}))};this._errorHandler=e=>{this.dispatchEvent(new CustomEvent("error",{detail:e.error,bubbles:!1,cancelable:!1}))}}viewActivatedCallback(){super.viewActivatedCallback(),this._initializeWorker()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":this._disposeWorker(),this._initializeWorker(n);break;case"autosend":case"disabled":case"message":this.autosend&&this.send(this.message);break}}disconnectedCallback(){this._disposeWorker(),super.disconnectedCallback()}send(e=this.message){if(this.disabled)return;let t=this._worker;a.isNull(t)||t.postMessage(e)}_initializeWorker(e=this.src){if(!a.isNullOrEmpty(e)){let t=this._worker=new Worker(e);t.addEventListener("message",this._messageHandler,!1),t.addEventListener("error",this._errorHandler,!1),this.autosend&&!a.isNull(this.message)&&this.send()}}_disposeWorker(e=this._worker){a.isNull(e)||(e.removeEventListener("error",this._errorHandler,!1),e.removeEventListener("message",this._messageHandler,!1),e.terminate())}};c([h({emit:!1,converter:m.String})],ti.prototype,"message",2),c([h({converter:m.String})],ti.prototype,"result",2),c([h({emit:!1,converter:m.String})],ti.prototype,"src",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],ti.prototype,"autosend",2),ti=c([C({tagName:d+"-webworker-proxy"})],ti);var Sf=A.getAttachedPropertyValue,Lf=A.setAttachedPropertyValue,cd=A.deleteAttachedPropertyValue,ph="pacem:dragdrop:mousedown",ld="pacem:dragdrop:info",xb="pacem:dragdrop:delegate",Nf=class{constructor(r,e){this._logFn=e;this._started=!1;this._enterHandler=r=>{this._currentTarget=r.target};this._leaveHandler=r=>{this._currentTarget=null};this._revertTrackedTarget=null;this._moveHandler=r=>{r.type!=="wheel"&&Q(r);var e=this._element,t=this._dragDropper,n,i=Sf(e,ld);function s(){return n=n||(r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY})}if(!this._started){if(this._logFn("info","Dragging act started"),this._started=!0,t.dropBehavior==="insert"){var l=e;do l=l.parentElement;while(l&&t.dropTargets.indexOf(l)==-1);this._currentTarget=l}t.dispatchEvent(new vn("dragstart",Yn.fromArgs(i),{},r))}if(!a.isNull(i)){this._logFn("debug","Dragging act ongoing");let f=r instanceof MouseEvent;a.addClass(A.findAncestorShell(e),b+"-dragging");let g=i.currentPosition=s(),v=i.floater,y=new vn("drag",Yn.fromArgs(i),{cancelable:!0},r);if(t.dispatchEvent(y),!y.defaultPrevented&&(v instanceof HTMLElement||v instanceof SVGElement)){let _={x:y.detail.delta.x,y:y.detail.delta.y};v.style.transform=`translate3d(${_.x}px, ${_.y}px, 0)`}var p=this._currentTarget;!f&&t.dropTargets.length>0&&(p=document.elementsFromPoint(i.currentPosition.x-a.scrollLeft,i.currentPosition.y-a.scrollTop).find(_=>t.dropTargets.indexOf(_)>=0));var u=i.target;if(p!==u)if(a.isNull(u)||(a.removeClass(u,b+"-dropping"),t.dispatchEvent(new vn("dragout",Yn.fromArgs(i),{},r)),this._logFn("info",`Drop area left (${u.id||u.constructor.name})`)),t.dropTargets.indexOf(p)!=-1){i.target=p,this._logFn("info",`Drop area entering (${i.target.id||i.target.constructor.name})`);let _=new vn("dragover",Yn.fromArgs(i),{cancelable:!0},r);t.dispatchEvent(_),_.defaultPrevented?delete i.target:(a.addClass(i.target,b+"-dropping"),this._logFn("info",`Drop area entered (${i.target.id||i.target.constructor.name})`))}else delete i.target;if(this._revertTrackedTarget=i.target||u,!a.isNull(i.target)&&t.dropBehavior==="insert")this._insertChild(p,i);else if(a.isNull(i.target)&&t.mode==="copy"){let _=i.placeholder;_ instanceof Element&&_.remove()}}};this._endHandler=r=>{var e=this._element,t=A.findAncestorShell(e),n=this._dragDropper,i;if(!a.isNull(i=Sf(e,ld))){r instanceof MouseEvent&&Q(r);let l=()=>{let u=i.floater;(u instanceof HTMLElement||u instanceof SVGElement)&&(u.style.pointerEvents=""),n.mode!=="self"&&i.floater.remove(),a.removeClass(e,b+"-dragging"),a.removeClass(e,b+"-drag-lock"),cd(e,ld),a.isNull(i.placeholder)||(a.removeClass(i.placeholder,b+"-dragging"),a.removeClass(i.placeholder,"drag-placeholder"),a.removeClass(i.placeholder,b+"-drag-lock"),cd(i.placeholder,ld));let f=!a.isNull(i.target);f&&(n.dispatchEvent(new vn("drop",Yn.fromArgs(i),{},r)),a.removeClass(i.target,b+"-dropping"));let g=i.data,v=n.dropTargets,y=i.placeholder,_=this._repeaterItem,x=this._sourceRepeater,w=!a.isNull(_),E=y&&this._findTargetRepeaterItem(i.placeholder.parentElement,i.placeholder.nextElementSibling),k=E&&E.repeater,N=n.mode==="copy",T=f&&!a.isNull(k)&&!(a.isNull(_)&&x===k);if(w&&!N&&f&&x.removeItem(_.index),T)if(i.placeholder.remove(),k===x&&!N){let O=_.index,D=E.index;D>O&&D--,x.datasource.moveWithin(O,D)}else N||x&&x.datasource.splice(_.index,1),k&&(k.datasource=k.datasource||[]).splice(E.index,0,g);!f&&!a.isNullOrEmpty(n.dropTargets)&&n.spillBehavior==="remove"&&!N&&(w?x.datasource.splice(_.index,1):e.remove()),n.dispatchEvent(new vn("dragend",Yn.fromArgs(i),{},r)),a.removeClass(t,b+"-dragging")},p=i.placeholder||i.element;if(i.floater!=p){let u=i.floater;var s=a.deserializeTransform(getComputedStyle(u));if(!a.isNull(i.target)||n.spillBehavior==="revert"||n.dropBehavior==="insert"&&n.spillBehavior!=="remove"){let f=a.offset(p),g=a.offset(u);u.style.transition="transform .2s ease-in-out",s=ke.translate(s,{x:f.left-g.left,y:f.top-g.top})}else u.style.transition="transform .2s ease-in, opacity .2s linear",s=ke.scale(s,.1),u.style.opacity="0";a.addAnimationEndCallback(u,l,300),u.style.transform=`matrix(${s.a},${s.b},${s.c},${s.d},${s.e},${s.f})`}else l()}a.removeClass(e,b+"-drag-lock"),this.dispose(),this._logFn("info","Dragging act disposed")};this._dragDropper=r.dragDrop,a.addClass(this._element=r.element,b+"-drag-lock"),window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),document.addEventListener("wheel",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,{capture:!0,passive:!1}),this._dragDropper.dropTargets.forEach(n=>{n.addEventListener("mouseenter",this._enterHandler,!1),n.addEventListener("mouseleave",this._leaveHandler,!1)});var t=ra.findItemContext(this._element,0,null);t&&(t.dom&&t.dom.length===1&&t.dom[0]===this._element&&(this._repeaterItem=t),this._sourceRepeater=t.repeater),this._bootstrap(r.placeholder,r.data)}_getLogicalData(r){return r instanceof Gi?r.item:r instanceof HTMLElement?r.dataset:r}_getPhysicalData(r){return r instanceof Do?r.dom:[r]}_createFloater(r,e){let t=this._dragDropper,n=r;if(t.mode!="self"&&(n=n.cloneNode(!0),A.stripObservedAttributes(n),n instanceof HTMLElement||n instanceof SVGElement)){a.addClass(n,b+"-drag-floater"),A.findAncestorShell(this._element).appendChild(n),n.style.position="absolute";let i={left:e.x+n.clientWidth/2,top:e.y-n.clientHeight/2};if(r===this._element||r.classList.contains("drag-floater-resize")){let s=a.offset(this._element);n.style.boxSizing="border-box",n.style.width=s.width+"px",n.style.height=s.height+"px",i={left:s.left,top:s.top}}n.style.left=`${i.left}px`,n.style.top=`${i.top}px`}return(n instanceof HTMLElement||n instanceof SVGElement)&&(n.style.pointerEvents="none"),n}_findTargetRepeaterItem(r,e){var t=ra.findItemContext(e,0,null);if(a.isNull(t)){var n=null,i=-1;if(r instanceof zr?n=r:n=A.findAncestorOfType(r,zr),!a.isNull(n))return{repeater:n,index:n.datasource&&n.datasource.length||0}}else return{repeater:t.repeater,index:t.index};return null}_findNextSibling(r,e){var t=0,n=0;let i=Array.from(r.children),s=i.length,l=document.elementFromPoint(e.currentPosition.x-a.scrollLeft,e.currentPosition.y-a.scrollTop),p;if(l===r)return this._currentHover=p=e.placeholder,p.parentElement===r?p.nextElementSibling:null;for(var u=l;u.parentElement!=r&&u.parentElement!=null;)u=u.parentElement;if(u.parentElement!=r||u===e.placeholder)return this._currentHover=p=e.placeholder,p.nextElementSibling;if(u!=this._currentHover){p=this._currentHover;let f=i.indexOf(p),g=i.indexOf(u);return this._currentHover=u,f>g?u:u.nextElementSibling}return u}_insertChild(r,e){let t=e.placeholder||e.element,n=e.target,i=this._findNextSibling(n,e);(t.nextSibling!=i||t.parentElement!=n)&&(a.isNull(i)||i.parentElement==r)&&(r.insertBefore(t,i),this._logFn("info",`Positioned before ${i&&(i.id||i.constructor.name)||"null"} for drop`))}_bootstrap(r,e){var t=this._element,n=this._dragDropper,i,s;if(!a.isNull(i=Sf(t,ph))){this._started=!1,cd(t,ph),a.addClass(t,b+"-dragging");let l=getComputedStyle(t),p={x:0,y:0},u=a.deserializeTransform(l);p.x+=u.e,p.y+=u.f;let f=this._createFloater(n.floater||t,i);if(a.isNull(r))switch(n.mode){case"alias":r=t;break;case"copy":r=t.cloneNode(!0);break}a.isNull(r)||a.addClass(r,"drag-placeholder"),!a.isNull(this._repeaterItem)&&!a.isNull(r)&&A.freezeObservedAttributes(r);let g=e||this._getLogicalData(this._repeaterItem||t);s={element:t,placeholder:r||t,data:g,startTime:Date.now(),origin:i,initialDelta:p,currentPosition:i,floater:f},Lf(t,ld,s)}}dispose(){this._dragDropper.dropTargets.forEach(r=>{r.removeEventListener("mouseenter",this._enterHandler,!1),r.removeEventListener("mouseleave",this._leaveHandler,!1)}),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),document.removeEventListener("wheel",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,{capture:!0})}},xr=class extends bn{constructor(){super(...arguments);this._startHandler=e=>{if(this.disabled||!e.isTrusted||!a.isNullOrEmpty(this.handleSelector)&&e.currentTarget.querySelector(this.handleSelector)!==e.target)return;let t=e.currentTarget,n=de.getEventCoordinates(e),i=n.page,s=t,l=qp.fromArgs({element:s,placeholder:null,currentPosition:i,origin:i,initialDelta:{x:0,y:0},startTime:null,floater:null,data:null}),p=new vn("draginit",l,{cancelable:!0},e);if(this.dispatchEvent(p),p.defaultPrevented)return;Q(e);let u=()=>{t.removeEventListener("mouseup",f,!1),t.removeEventListener("touchend",f,!1),this.log("info","Drag locked!"),Lf(t,ph,i),Lf(t,xb,new Nf({element:s,dragDrop:this,placeholder:l.placeholder,data:l.data},(v,y,_)=>this.log.apply(this,[v,y,_])))},f=v=>{this.log("info","Drag avoided!"),clearTimeout(g)},g=setTimeout(u,this.lockTimeout);t.addEventListener("mouseup",f,!1),t.addEventListener("touchend",f,!1)};this.lockTimeout=100;this.dropTargets=[];this.mode="self"}decorate(e){let t={capture:!1,passive:!1};e.addEventListener("mousedown",this._startHandler,!1),e.addEventListener("touchstart",this._startHandler,t)}undecorate(e){let t={capture:!1,passive:!1};e.removeEventListener("mousedown",this._startHandler,!1),e.removeEventListener("touchstart",this._startHandler,t)}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}dispatchEvent(e){return e.type==="dragend"&&(cd(e.detail.element,ph),cd(e.detail.element,xb)),super.dispatchEvent(e)}};c([h({emit:!1,converter:m.Number})],xr.prototype,"lockTimeout",2),c([h({emit:!1})],xr.prototype,"dropTargets",2),c([h({emit:!1,converter:m.String})],xr.prototype,"mode",2),c([h({emit:!1,converter:m.Element})],xr.prototype,"floater",2),c([h({emit:!1,converter:m.String})],xr.prototype,"dropBehavior",2),c([h({emit:!1,converter:m.String})],xr.prototype,"spillBehavior",2),c([h({emit:!1,converter:m.String})],xr.prototype,"handleSelector",2),xr=c([C({tagName:d+"-drag-drop"})],xr);var Af=class{constructor(r,e,t,n){this._element=r;this._type=e;this._rescaler=t;this._logFn=n;this._startTime=Date.now();this._moveHandler=r=>{r.stopPropagation();let e=this._element,t=this._origin,n=this._rescaler,i=this._type,s=n.keepProportions,l=n.minWidth||0,p=n.minHeight||0,u=n.maxWidth||Number.MAX_SAFE_INTEGER,f=n.maxHeight||Number.MAX_SAFE_INTEGER,g=r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY},v={x:g.x,y:g.y},y=this._rect;switch(i){case"top":case"bottom":v.x=t.x;break;case"left":case"right":v.y=t.y;break}this._position=v;let _={x:v.x-t.x,y:v.y-t.y};var x;if(s){let k={x:y.x,y:y.y},N={x:y.x+y.width,y:y.y},T={x:y.x+y.width,y:y.y+y.height},O={x:y.x,y:y.y+y.height},D=se.distance(T,O)/se.distance(T,k),P=se.distance(k,O)/se.distance(T,k),F=se.distance(k,T),B=($,U)=>($.x*U.x+$.y*U.y)/F;switch(i){case"topleft":let $=se.subtract(T,k),U=B(se.subtract(T,v),$),I={x:T.x-U*D,y:T.y-U*P};x={x:I.x,y:I.y,width:T.x-I.x,height:T.y-I.y};break;case"topright":let G=se.subtract(O,N),Y=B(se.subtract(O,v),G),W={x:O.x+Y*D,y:O.y-Y*P};x={x:O.x,y:W.y,width:W.x-O.x,height:O.y-W.y};break;case"bottomleft":let V=se.subtract(N,O),X=B(se.subtract(N,v),V),q={x:N.x-X*D,y:N.y+X*P};x={x:q.x,y:N.y,width:N.x-q.x,height:q.y-N.y};break;default:let Z=se.subtract(k,T),ne=B(se.subtract(k,v),Z),te={x:k.x+ne*D,y:k.y+ne*P};x={x:k.x,y:k.y,width:te.x-k.x,height:te.y-k.y};break}}else x={x:this._rect.x,y:this._rect.y,width:this._rect.width+_.x,height:this._rect.height+_.y},i.startsWith("top")&&(x.y=this._rect.y+_.y,x.height=this._rect.height-_.y),i.endsWith("left")&&(x.x=this._rect.x+_.x,x.width=this._rect.width-_.x);this._logFn("log",`handle: ${i}, origin: ${JSON.stringify(t)}, currentPosition: ${JSON.stringify(g)}`,"Rescaling"),this._logFn("log",`delta: ${JSON.stringify(_)}, position: ${JSON.stringify(v)}`,"Rescaling"),this._logFn("log",`from: ${JSON.stringify(this._rect)}, to: ${JSON.stringify(x)}`,"Rescaling");let w=x.width>=l&&x.width<=u,E=x.height>=p&&x.height<=f;if(s&&(!w||!E)&&(w=E=!1),w||(x.x=this._targetRect.x,x.width=this._targetRect.width),E||(x.y=this._targetRect.y,x.height=this._targetRect.height),w||E){let k={currentPosition:v,element:e,handle:i,origin:t,targetRect:x,startTime:this._startTime},N=new Co("rescale",xo.fromArgs(k),{cancelable:!0},r);if(n.dispatchEvent(N),!N.defaultPrevented){let T=this._originalTransform;e.style.transform=`matrix(${T.a},${T.b},${T.c},${T.d},${T.e+x.x-this._rect.x},${T.f+x.y-this._rect.y})`,e.style.width=x.width+"px",e.style.height=x.height+"px"}this._targetRect=x}};this._endHandler=r=>{r.stopPropagation();let e=this._type,t=new Co("rescaleend",xo.fromArgs({element:this._element,origin:this._origin,handle:e,startTime:this._startTime,currentPosition:this._position,targetRect:this._targetRect}),{},r);a.removeClass(document.body,b+"-rescaling rescale-"+e),this._rescaler.dispatchEvent(t),Cb(this._element,wb),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,!1)};window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,!1),this._origin=this._position=Df(r,Eb),this._rect=this._targetRect=a.offsetRect(r),this._originalTransform=a.deserializeTransform(getComputedStyle(r)),a.addClass(document.body,b+"-rescaling rescale-"+e)}},Df=A.getAttachedPropertyValue,Tf=A.setAttachedPropertyValue,Cb=A.deleteAttachedPropertyValue,DC="top right bottom left topleft topright bottomright bottomleft".split(" "),dh="pacem:rescale:frame",Eb="pacem:rescale:origin",wb="pacem:rescale:delegate",Gr=class extends bn{constructor(){super(...arguments);this._bag=[];this._startHandler=e=>{e.stopPropagation();let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.page,s=/rescale-(.+)/.exec(n.className)[1],l=n.parentElement,p=new Co("rescalestart",xo.fromArgs({currentPosition:i,origin:i,element:l,handle:s,startTime:Date.now()}),{cancelable:!0},e);this.dispatchEvent(p),!p.defaultPrevented&&(Q(e),Tf(l,Eb,i),Tf(l,wb,new Af(l,s,this,(u,f,g)=>this.log.apply(this,[u,f,g]))))}}decorate(e){let t=e,n=getComputedStyle(t);a.addClass(t,b+"-rescalable"),this._setFrame(t)}undecorate(e){let t=e;a.removeClass(t,b+"-rescalable"),this._removeFrame(t)}viewActivatedCallback(){super.viewActivatedCallback(),this._syncHandles()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":case"handles":case"keepProportions":this._syncHandles();break}}_syncHandles(){let e=this.handles||["all"],t=e.find(s=>s==="all")!=null,n=this.disabled,i=this.keepProportions;for(let s of this._bag){let l=Df(s,dh);l.top.hidden=n||!t&&e.find(p=>p==="top")==null,l.bottom.hidden=n||!t&&e.find(p=>p==="bottom")==null,l.left.hidden=n||!t&&e.find(p=>p==="left")==null,l.right.hidden=n||!t&&e.find(p=>p==="right")==null,l.topleft.hidden=l.top.hidden||l.left.hidden,l.topright.hidden=l.top.hidden||l.right.hidden,l.bottomleft.hidden=l.bottom.hidden||l.left.hidden,l.bottomright.hidden=l.bottom.hidden||l.right.hidden,i&&(l.top.hidden=l.bottom.hidden=l.left.hidden=l.right.hidden=!0)}}_setFrame(e){let t={};for(let n of DC){let i=t[n]=document.createElement("div");a.addClass(i,b+"-rescale rescale-"+n),e.setAttribute("pacem",""),e.appendChild(i),i.addEventListener("mousedown",this._startHandler,!1),i.addEventListener("touchstart",this._startHandler,{capture:!1,passive:!0})}Tf(e,dh,t),this._bag.push(e),this._syncHandles()}_removeFrame(e){let t=Df(e,dh);for(var n in t){let i=t[n];i.removeEventListener("mousedown",this._startHandler,!1),i.removeEventListener("touchstart",this._startHandler,{capture:!1}),i.remove()}Cb(e,dh),this._bag.splice(this._bag.indexOf(e),1)}};c([h({emit:!1,converter:m.StringArray})],Gr.prototype,"handles",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"minWidth",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"maxWidth",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"minHeight",2),c([h({emit:!1,converter:m.Number})],Gr.prototype,"maxHeight",2),c([h({emit:!1,converter:m.Boolean})],Gr.prototype,"keepProportions",2),Gr=c([C({tagName:d+"-rescale"})],Gr);var uh=A.getAttachedPropertyValue,hh=A.setAttachedPropertyValue,RC=A.deleteAttachedPropertyValue,kb="pacem:rotate:origin",Mb="pacem:rotate:delegate",Rf="pacem:rotate:offset",Sb="pacem:rotate:center",bR=2*Math.PI,Of=class{constructor(r,e,t){this._element=r;this._rotator=e;this._logFn=t;this._startTime=Date.now();this._moveHandler=r=>{r.stopPropagation();let e=this._element,t=this._previousPosition,n=this._rotator,i=n.minRotation,s=n.maxRotation,l=r instanceof MouseEvent?{x:r.pageX,y:r.pageY}:{x:r.touches[0].pageX,y:r.touches[0].pageY},p=this._pivot;var u=this._computeAngle(p,l,t)+this._previousAngle,f=this._constraintAngle(u,n.step);for(this._logFn("log",`previousPosition: ${JSON.stringify(t)}, currentPosition: ${JSON.stringify(l)}`,"Rotating"),u>s&&(u=s);f>s&&n.step>0;)this._logFn("log",`angle: ${f} constrained to max: ${s}`,"Rotating"),f-=n.step;for(u<i&&(u=i);f<i&&n.step>0;)this._logFn("log",`angle: ${f} constrained to min: ${i}`,"Rotating"),f+=n.step;if(this._logFn("log",`angle: ${f}, origin: ${JSON.stringify(this._originalPosition)}, current: ${JSON.stringify(l)}`,"Rotating"),f!=this._previousRenderedAngle){let g=new wo("rotate",Eo.fromArgs({element:this._element,origin:this._originalPosition,startTime:this._startTime,currentPosition:l,rotation:f,center:this._pivot}),{cancelable:!0},r);if(this._rotator.dispatchEvent(g),!g.defaultPrevented){let v=this._originalTransform,y=ke.rotate(v,f-this._originalAngle);e.style.transform=`matrix(${y.a}, ${y.b}, ${y.c}, ${y.d}, ${y.e}, ${y.f})`,hh(this._element,Rf,f)}this._previousRenderedAngle=f}this._previousPosition=l,this._previousAngle=u};this._endHandler=r=>{r.stopPropagation();let e=new wo("rotateend",Eo.fromArgs({element:this._element,origin:this._originalPosition,startTime:this._startTime,currentPosition:this._previousPosition,rotation:this._previousAngle,center:this._pivot}),{},r);this._rotator.dispatchEvent(e),RC(this._element,Mb),window.removeEventListener("mouseup",this._endHandler,!1),window.removeEventListener("touchend",this._endHandler,!1),window.removeEventListener("mousemove",this._moveHandler,!1),window.removeEventListener("touchmove",this._moveHandler,!1)};window.addEventListener("mouseup",this._endHandler,!1),window.addEventListener("touchend",this._endHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),window.addEventListener("touchmove",this._moveHandler,!1),this._originalPosition=this._previousPosition=uh(r,kb),this._originalAngle=this._previousAngle=this._previousRenderedAngle=uh(r,Rf,0),this._pivot=uh(r,Sb),this._originalTransform=a.Css.deserializeTransform(r)}_computeAngle(r,e,t){return Wn.angleBetween(r,e,t)}_constraintAngle(r,e){return e>0?go.round(r,e):r}},ri=class extends bn{constructor(){super(...arguments);this._startHandler=e=>{if(this.disabled)return;let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.page,s=a.offsetRect(n),l=s.width/2,p=s.height/2;var u=this.center;if(a.isNull(u))u={x:s.x+l,y:s.y+p},n.style.transformOrigin="50% 50%";else{let g=s.x+l-u.x,v=s.y+p-u.y;n.style.transformOrigin=`${-g}px ${-v}px`}let f=new wo("rotatestart",Eo.fromArgs({currentPosition:i,rotation:uh(n,Rf,0),center:u,origin:i,element:n,startTime:Date.now()}),{cancelable:!0},e);this.dispatchEvent(f),!f.defaultPrevented&&(Q(e),hh(n,kb,i),hh(n,Sb,u),hh(n,Mb,new Of(n,this,(g,v,y)=>this.log.apply(this,[g,v,y]))))}}decorate(e){let t=e;a.addClass(t,b+"-rotatable");let n={capture:!1,passive:!1};e.addEventListener("mousedown",this._startHandler,!1),e.addEventListener("touchstart",this._startHandler,n)}undecorate(e){let t=e;a.removeClass(t,b+"-rotatable");let n={capture:!1,passive:!1};e.removeEventListener("mousedown",this._startHandler,!1),e.removeEventListener("touchstart",this._startHandler,n)}};c([h({emit:!1,converter:m.Number})],ri.prototype,"step",2),c([h({emit:!1,converter:m.Number})],ri.prototype,"minRotation",2),c([h({emit:!1,converter:m.Number})],ri.prototype,"maxRotation",2),c([h({emit:!1,converter:m.Point})],ri.prototype,"center",2),ri=c([C({tagName:d+"-rotate"})],ri);var Lb=A.getAttachedPropertyValue,Pf=A.setAttachedPropertyValue,If=A.deleteAttachedPropertyValue,lc="pacem:swipe:preparing",Nb="pacem:swipe:delegate",Tb={fling:400,inertia:8,start:32,autoresetSpans:!1,bouncy:!0},$f=class{constructor(r,e,t,n){this._element=r;this._swiper=e;this._init=t;this._logFn=n;this._moveHandler=r=>{let e=this.#t,t=this._buildStateFromUiEvent(r);for(e.push(this.#n=t);e.length>0&&t.timestamp-e[0].timestamp>100;)e.shift();let n=this._buildSwipeArgsFromState(t),i=new Wi("pan",n,{cancelable:!0,bubbles:!1}),s=this._swiper;if(s.dispatchEvent(i),!i.defaultPrevented){let{delta:l}=this._delta(this._init,t);if(!s.options.bouncy){let p=s.snaps.slice().sort(),u=p[0],f=p[p.length-1],g=this._swiper.direction,{x:v,y}=l,_=v.clamp(u,f),x=y.clamp(u,f);l=g==="vertical"?{x:0,y:x}:{x:_,y:0}}this._animateOffsetBy(l,0)}};this._endHandler=r=>{if(window.removeEventListener("pointermove",this._moveHandler),a.isNull(this.#n))console.log("How come?!");else{let e=this._buildSwipeArgsFromState(),t=new Wi("swipe",e,{cancelable:!0,bubbles:!1}),n=this._swiper;if(n.dispatchEvent(t),!t.defaultPrevented){let i=new Wi("swipe"+e.direction,e,{cancelable:!0,bubbles:!1});if(n.dispatchEvent(i),!i.defaultPrevented){let s=n.snaps??[0];s.sort();let l=n.options.bouncy?e.predictedDelta:e.predictedDelta.clamp(s[0],s[s.length-1]),p=s.reduce((y,_)=>{let x=Math.abs(_-l),w=Math.abs(y-l);return x<w?_:y},0),u=n.direction==="vertical",f=e.predictedDuration,g=u?{x:0,y:l}:{x:l,y:0},v=()=>{let y=new Wi("swipeanimationend",e,{cancelable:!1,bubbles:!1});return n.dispatchEvent(y)?y:null};if(p.isCloseTo(0))this._animateOffsetBy(g,f).then(()=>{this._animateOffsetBy({x:0,y:0},.3,"cubic-bezier(.37,-0.01,.34,1.43)").then(()=>v())});else{let y=(p-l)*(p-e.delta)>=0,_=u?{x:0,y:p}:{x:p,y:0},x=()=>this._animateOffsetBy(_,y?f:.2,"cubic-bezier(0,0,0,1)");(y?Promise.resolve():this._animateOffsetBy(g,f)).then(()=>x().then(()=>{v();let E=new Wi("swipe"+e.direction+"animationend",e,{cancelable:!1,bubbles:!1});n.dispatchEvent(E)}))}this.#e.autoresetSpans&&(this._swiper.snaps=s.map(y=>y-p))}}}this.dispose()};this.#t=[];let i=r;this.#e=a.extend({},Tb,e.options??{}),this.#r=a.deserializeTransform(getComputedStyle(i)),window.addEventListener("pointermove",this._moveHandler,!1),window.addEventListener("pointerup",this._endHandler,!1),window.addEventListener("pointercancel",this._endHandler,!1)}_serializeTransformMatrix(r){return`matrix3d(${r.a},${r.b},0,0,${r.c},${r.d},0,0,0,0,1,0,${r.e},${r.f},0,1)`}_animateOffsetBy(r,e,t=a.Css.getVariableValue(`--${b}-easing-out-sine`)){let n=ke.translate(this.#r,r),i=Math.min(.3,e)*1e3,s=this._element,l=this._serializeTransformMatrix(n);return new Promise((p,u)=>{let f=s.animate([{transform:l}],{fill:"forwards",duration:i,easing:t}),g=v=>{f.removeEventListener("finish",g),f.commitStyles(),f.cancel(),p()};f.addEventListener("finish",g,!1)})}_buildStateFromUiEvent(r){let e=de.getEventCoordinates(r),t=performance.now();return{position:e.client,timestamp:t}}_buildSwipeArgsFromState(r=this.#n){let e=this.#e,t=this.speed,i=this._swiper.direction==="vertical",s=i?0:t,l=i?t:0;return Kp.fromArgs({position:r.position,element:this._element,t0:this._init,timestamp:r.timestamp,inertia:e.inertia,fling:e.fling,horizontalspeed:s,verticalspeed:l,vertical:i})}_delta(r,e){let{position:{x:t,y:n},timestamp:i}=r,{position:{x:s,y:l},timestamp:p}=e;return{delta:this._swiper.direction==="vertical"?{x:0,y:l-n}:{x:s-t,y:0},time:p-i}}get speed(){let r=this.#t;if(r.length<2)return 0;let e=r[0],t=r[r.length-1],{delta:n,time:i}=this._delta(e,t),s=i/1e3,l=n.x+n.y;return s>0?l/s:0}#e;#t;#r;#n;dispose(){let r=this._element;If(r,Nb),window.removeEventListener("pointercancel",this._endHandler),window.removeEventListener("pointerup",this._endHandler)}},pd,ni=class extends bn{constructor(){super(...arguments);z(this,pd);this._prepareHandler=e=>{if(this.disabled)return;let t=de.getEventCoordinates(e),n=e.currentTarget,i=t.client,s=this.handleSelector;!a.isNullOrEmpty(s)&&n.querySelector(s)!==e.target||(e.stopPropagation(),Pf(n,lc,{position:i,timestamp:performance.now()}),Pf(window,lc,n),window.addEventListener("pointermove",this._startHandler,!1),window.addEventListener("pointerup",this._undoHandler,!1))};this._startHandler=e=>{let t=Lb(window,lc),n=Lb(t,lc);if(a.isNull(n)){this._undo(t);return}let i=de.getEventCoordinates(e),{x:s,y:l}=i.client,{position:{x:p,y:u}}=n,v=(this.direction||"horizontal")==="vertical"?l-u:s-p,y=M(this,pd),{start:_}=y;if(Math.abs(v)>_){this._undo(t);let x=this,w=new $f(t,x,n,(E,k,N)=>{x.log(E,k,N)});Pf(t,Nb,w)}};this._undoHandler=e=>{let t=e.currentTarget;this._undo(t)}}decorate(e){(e instanceof HTMLElement||e instanceof SVGElement)&&a.addClass(e,b+"-swipe"),e.addEventListener("pointerdown",this._prepareHandler,!1)}undecorate(e){(e instanceof HTMLElement||e instanceof SVGElement)&&a.removeClass(e,b+"-swipe"),e.removeEventListener("pointerdown",this._prepareHandler,!1)}viewActivatedCallback(){super.viewActivatedCallback(),this._setOptions()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&e==="options"&&this._setOptions(n)}_setOptions(e=this.options){H(this,pd,a.extend({},Tb,e??{}))}_undo(e){window.removeEventListener("pointermove",this._startHandler),window.removeEventListener("pointerup",this._undoHandler),If(e,lc),If(window,lc)}};pd=new WeakMap,c([h({emit:!1,reflectBack:!0,converter:{convert:(e,t)=>e.match(/[-+]?[\d\.]+/g).map(n=>parseFloat(n)),convertBack:(e,t)=>e?.join(" ")}})],ni.prototype,"snaps",2),c([h({emit:!1,converter:m.String,reflectBack:!0})],ni.prototype,"direction",2),c([h({emit:!1,converter:m.Json})],ni.prototype,"options",2),c([h({emit:!1,converter:m.String,reflectBack:!0})],ni.prototype,"handleSelector",2),ni=c([C({tagName:d+"-swipe"})],ni);var OC={convert:o=>Ur[o]??Ur.linear},lr=class extends Yi{};c([h({emit:!1,converter:m.Element})],lr.prototype,"target",2),c([h({emit:!1,converter:m.String})],lr.prototype,"property",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"delay",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"duration",2),c([h({emit:!1,converter:OC})],lr.prototype,"easing",2),c([h({emit:!1,converter:m.Number})],lr.prototype,"iterations",2),c([h({emit:!1,converter:m.String})],lr.prototype,"direction",2);var ii=class extends lr{constructor(e=new Fi){super();this._tweener=e}get tweener(){return this._tweener}#e=!1;startAnimation(){return this.#e=!1,new Promise((e,t)=>{this._tweener.run(0,1,this.duration??0,this.delay??0,this.easing??Ur.linear,(n,i)=>{this.#e||(this.target[this.property]=this.tweenInterpolationCallback(n,i))}).then(e)})}cancelAnimation(){this.#e=!0}};var Hf={h:0,l:0,s:.5,a:1},PC={h:0,l:1,s:.5,a:1},dd,ud,da=class extends ii{constructor(){super(...arguments);z(this,dd,Hf);z(this,ud,PC)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"from":this._precomputeFrom(n);break;case"to":this._precomputeTo(n);break}}viewActivatedCallback(){super.viewActivatedCallback(),this._precomputeColors()}_precomputeColors(){this._precomputeFrom(),this._precomputeTo()}_precomputeFrom(e=this.from){H(this,dd,this._precomputeColor(e)??Hf)}_precomputeTo(e=this.to){H(this,ud,this._precomputeColor(e)??Hf)}_precomputeColor(e){if(!a.isNullOrEmpty(e))try{return this._parseColor(e)}catch{return null}}_parseColor(e){return Be.hsl(Be.parse(e))}tweenInterpolationCallback(e,t){let n=M(this,dd),i=M(this,ud),s={h:(i.h-n.h)*t+n.h,s:(i.s-n.s)*t+n.s,l:(i.l-n.l)*t+n.l,a:(i.a-n.a)*t+n.a};return Be.stringify(s)}};dd=new WeakMap,ud=new WeakMap,c([h({emit:!1,converter:m.String})],da.prototype,"from",2),c([h({emit:!1,converter:m.String})],da.prototype,"to",2),da=c([C({tagName:d+"-color-animation"})],da);var IC=0,$C=1,ua=class extends ii{tweenInterpolationCallback(r,e){let t=this.to??$C,n=this.from??IC;return(t-n)*e+n}};c([h({emit:!1,converter:m.Number})],ua.prototype,"from",2),c([h({emit:!1,converter:m.Number})],ua.prototype,"to",2),ua=c([C({tagName:d+"-number-animation"})],ua);var HC={x:0,y:0},BC={x:1,y:1},ha=class extends ii{tweenInterpolationCallback(r,e){let t=this.to??BC,n=this.from??HC;return{x:(t.x-n.x)*e+n.x,y:(t.y-n.y)*e+n.y}}};c([h({emit:!1,converter:m.Point})],ha.prototype,"from",2),c([h({emit:!1,converter:m.Point})],ha.prototype,"to",2),ha=c([C({tagName:d+"-point-animation"})],ha);var si=class extends _n{validate(r){return r instanceof lr}viewActivatedCallback(){super.viewActivatedCallback(),this._animate()}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"datasource":this._buildDatasourceFromDatasource(t);break;case"items":this._buildDatasourceFromItems(t);break;case"_adaptedDatasource":case"autostart":this._animate();break}}_buildDatasourceFromItems(r=this.items){this._adaptedDatasource=r||[]}_buildDatasourceFromDatasource(r=this.datasource){this._adaptedDatasource=r||[]}_animate(r=this.autostart){let e=this._adaptedDatasource,t=[];if(r&&!a.isNullOrEmpty(e))for(let n of e)t.push(n.startAnimation());return Promise.all(t)}cancelAnimation(){let r=this._adaptedDatasource||[];for(let e of r)e.cancelAnimation()}startAnimation(){return this._animate(!0)}};c([h({emit:!1,converter:m.Boolean})],si.prototype,"autostart",2),c([h({emit:!1,converter:m.Number})],si.prototype,"duration",2),c([h({emit:!1})],si.prototype,"datasource",2),c([h({emit:!1})],si.prototype,"_adaptedDatasource",2),si=c([C({tagName:d+"-storyboard"})],si);function dc(o){return!a.isNull(o)&&"stage"in o}function Cr(o){return dc(o)}function Ab(o){return"stops"in o&&a.isArray(o.stops)}function fd(o){return Ab(o)&&"start"in o&&se.isPoint(o.start)&&"end"in o&&se.isPoint(o.end)}function uc(o){return Ab(o)&&"center"in o&&se.isPoint(o.center)&&"radius"in o&&typeof o.radius=="number"}var hd=class{static combine(r,e,t=null){return{opacity:(r.opacity??1)*(e.opacity??1),transformMatrix:t??ke.multiply(e.transformMatrix,r.transformMatrix),dashArray:r.dashArray??e.dashArray,fill:r.fill??e.fill,lineCap:r.lineCap??e.lineCap,lineJoin:r.lineJoin??e.lineJoin,lineWidth:r.lineWidth??e.lineWidth,stroke:r.stroke??e.stroke}}};function gd(o){return Cr(o)&&("fill"in o||"transformMatrix"in o||"stroke"in o||"lineJoin"in o||"dashArray"in o||"lineWidth"in o||"opacity"in o||"lineCap"in o)}function hc(o){return Cr(o)&&"pathData"in o}function Bo(o){return Cr(o)&&"childDrawables"in o&&!a.isNullOrEmpty(o.childDrawables)}function mc(o){return Cr(o)&&"text"in o&&typeof o.text=="string"}function fc(o){return Cr(o)&&"src"in o&&typeof o.src=="string"}var cc=class extends ht{constructor(r,e,t,n){super(r,e,t),this.#e=n}#e;get transformMatrix(){return this.#e}project(r={x:this.screenX,y:this.screenY}){return ke.multiply(r,this.#e)}},Ki=class{static empty(){return{pathData:"",vertices:[],boundingRect:{x:0,y:0,width:0,height:0}}}},pc=class extends cc{},Cn=class extends cc{constructor(r,e,t,n){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}},md=class extends cc{constructor(r,e,t,n=e.transformMatrix){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}};var we={};Se(we,{LinearAlgebra:()=>Gf,Polygon:()=>Bf,Utils:()=>ai,Utils3D:()=>zf});var Fr=class o{static unit(r){let e={x:r.x,y:r.y};return this.normalize(e),e}static magSqr(r){return r.x*r.x+r.y*r.y}static mag(r){return Math.sqrt(o.magSqr(r))}static normalize(r){let e=o.mag(r);if(e<=0)throw"Cannot normalize a vector of length 0.";let t=1/e;r.x*=t,r.y*=t}static from(r,e){return se.subtract(r,e)}static dot(r,e){return r.x*e.x+r.y*e.y}static cross(r,e){return r.x*e.y-r.y*e.x}static areClose(r,e){return(e.x-r.x).isCloseTo(0)&&(e.y-r.y).isCloseTo(0)}};var gc=class{constructor(r,e,t=-1){this.x=r;this.y=e;this.index=t}equals(r){return this.x===r.x&&this.y===r.y}};function UC(o,r,e){let t=o.x,n=o.y,i=r.x,s=r.y,l=e.x,p=e.y,u=2*(t*(s-p)+i*(p-n)+l*(n-s));if(Math.abs(u)<1e-12)return{c:{x:0,y:0},r:1/0};let f=((t*t+n*n)*(s-p)+(i*i+s*s)*(p-n)+(l*l+p*p)*(n-s))/u,g=((t*t+n*n)*(l-i)+(i*i+s*s)*(t-l)+(l*l+p*p)*(i-t))/u,v=Math.hypot(f-t,g-n);return{c:{x:f,y:g},r:v}}var mh=class{constructor(r,e,t){this.v0=r;this.v1=e;this.v2=t;this.circumCirc=UC(r,e,t)}inCircumcircle(r){let e=this.circumCirc.c.x-r.x,t=this.circumCirc.c.y-r.y;return Math.hypot(e,t)<=this.circumCirc.r+1e-9}};function zC(o){let r=1/0,e=1/0,t=-1/0,n=-1/0;for(let f of o)r=Math.min(r,f.x),e=Math.min(e,f.y),t=Math.max(t,f.x),n=Math.max(n,f.y);let i=(t-r)*10,s=(n-e)*10,l=new gc(r-i,e-s*3),p=new gc(r-i,n+s),u=new gc(t+i*3,n+s);return new mh(l,p,u)}function GC(o){let r=[];for(let e=0;e<o.length;++e){let t=!0;for(let n=0;n<o.length;++n)if(e!==n){let i=o[e],s=o[n];if(i.v0.equals(s.v0)&&i.v1.equals(s.v1)||i.v0.equals(s.v1)&&i.v1.equals(s.v0)){t=!1;break}}t&&r.push(o[e])}return r}function FC(o,r){let e=[];r=r.filter(n=>n.inCircumcircle(o)?(e.push({v0:n.v0,v1:n.v1}),e.push({v0:n.v1,v1:n.v2}),e.push({v0:n.v2,v1:n.v0}),!1):!0);let t=GC(e);for(let n of t)r.push(new mh(n.v0,n.v1,o));return r}function WC(o){if(o.length<3)return[];let r=zC(o),e=[r];for(let t of o)e=FC(t,e);return e=e.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)),e}function jC(o){if(o.length<3)return[];let r=o.map((n,i)=>new gc(n.x,n.y,i)),e=WC(r),t=[];for(let n of e)t.push(n.v0.index,n.v1.index,n.v2.index);return t}var fh=class{static triangulate(r){return jC(r)}};var YC=180/Math.PI,Rb=2*Math.PI,Vo=12;function gh(o){return se.isPoint(o)}function XC(o){return o!=null&&Array.isArray(o)&&o.length===2&&gh(o[0])&&gh(o[1])}var ai=class o{static slopeRad(r,e){return Math.atan2(e.y-r.y,e.x-r.x)}static slopeRad2(r,e){return(Rb+o.slopeRad(r,e))%Rb}static slopeDeg(r,e){return o.slopeRad(r,e)*YC}static slopeDeg2(r,e){return(360+o.slopeDeg(r,e))%360}static intersect(r,e,...t){return Array.isArray(r)&&Array.isArray(e)?o._intersectSegments(r,e,!0):Ze.isRect(r)?o._intersectRects(...arguments):"vertices"in r?o._mergePolygons(r,e,"intersect")?.polygons??null:null}static boundingBox(r){let e=Number.MAX_VALUE,t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=-Number.MAX_VALUE,s=r.length;for(let l of r)e=Math.min(e,l.x),t=Math.min(t,l.y),n=Math.max(n,l.x),i=Math.max(i,l.y);return{x:e,y:t,width:n-e,height:i-t}}static combinePolygons(r,e,t){return o._mergePolygons(r,e,t)}static _mergePolygons(r,e,t){if(be.isNullOrEmpty(r?.vertices)||be.isNullOrEmpty(e?.vertices))return null;let n=r.vertices.filter(V=>o.inPolygon(V,e.vertices));if(r.vertices.length==n.length)return{polygons:t==="intersect"?[r]:[e]};let i=e.vertices.filter(V=>o.inPolygon(V,r.vertices));if(e.vertices.length===i.length)return{polygons:t==="intersect"?[e]:[r]};let s=o.boundingBox(r.vertices),l=o.boundingBox(e.vertices),p=o.intersect(s,l);if(t!=="union"&&(!Ze.isRect(p)||!(p.width>0)||!(p.height>0)))return null;let{vertices:u}=r,{vertices:f}=e;if(u.length<3||f.length<3)return null;let g=(V,X,q)=>[V,q[(X+1)%q.length]],v=(V,X)=>V.x===X.x?V.y-X.y:V.x-X.x,y=u.map(g),_=f.map(g),x=u.concat(f),w=new Map,E=V=>{if(!w.has(V)){let X=[];w.set(V,X)}return w.get(V)},k=!1;for(let V of y){let X=E(V);for(let q of _){let Z=E(q),ne=o.intersect(V,q);be.isNull(ne)||(k=!0,x.push(ne),X.push(ne),Z.push(ne))}}if(n.length===0&&i.length===0&&!k)return t==="union"?{polygons:[r,e]}:null;let N=[];for(let V of y.concat(_)){let X=E(V);if(be.isNullOrEmpty(X))N.push(V);else{let q=V.concat(X).sort(v);for(let Z=0;Z<q.length-1;Z++)N.push([q[Z],q[Z+1]])}}var T=!1,O;do{x.sort(v),x.filter((q,Z,ne)=>Z===0||!o.areClose(q,ne[Z-1])),O=o.mesh(x);let{vertices:V,triangleIndices:X}=O;T=!1;for(let q=0;q<X.length;q+=3){let Z=X[q],ne=X[q+1],te=X[q+2],ae=V[Z],Le=V[ne],he=V[te],fe=[[ae,Le],[Le,he],[he,ae]];for(let le of N)for(let re of fe){let ge=o.areClose(re[0],le[0])||o.areClose(re[1],le[1])||o.areClose(re[0],le[1])||o.areClose(re[1],le[0])?null:o.intersect(re,le);!be.isNull(ge)&&x.findIndex(Ne=>o.areClose(Ne,ge,4))===-1&&(T=!0,x.push(ge))}}}while(T);let{vertices:D,triangleIndices:P}=O,F=[];for(let V=0;V<P.length;V+=3){let X=V,q=V+1,Z=V+2,ne=D[P[X]],te=D[P[q]],ae=D[P[Z]],Le={x:(ne.x+te.x+ae.x)/3,y:(ne.y+te.y+ae.y)/3},he=o.inPolygon(Le,u),fe=o.inPolygon(Le,f);(he&&fe&&t==="intersect"||(he||fe)&&t==="union"||(he&&!fe||!he&&fe)&&t==="difference")&&F.push([ne,te,ae])}let B=F.flatMap(([V,X,q])=>[[V,X],[X,q],[q,V]]),$=[];for(let V=0;V<B.length;V++){let X=B[V];if(V==0){$.push(X);continue}let q=$.findIndex(Z=>o.areClose(Z[0],X[0])&&o.areClose(Z[1],X[1])||o.areClose(Z[0],X[1])&&o.areClose(Z[1],X[0]));q===-1?$.push(X):$.splice(q,1)}if($.length<3)return null;let U=[],I=V=>{let{length:X}=V,q=o.areClose(V[0],V[X-1]),Z=V.slice(0,q?X-1:X);return Z.length>3&&o.inSegment(Z[0],[Z[1],Z[Z.length-1]])&&Z.shift(),Z},[G,Y]=$.shift(),W=[G,Y];for(;$.length>1;){let V=W[W.length-1],X=$.findIndex(q=>o.areClose(q[0],V)||o.areClose(q[1],V));if(X===-1){U.push({vertices:I(W.splice(0))});let[q,Z]=$.shift();W.push(q,Z)}else{let[q]=$.splice(X,1),Z=o.areClose(q[0],V)?q[1]:o.areClose(q[1],V)?q[0]:null;W.length>1&&o.inSegment(W[W.length-1],[W[W.length-2],Z])?W.splice(W.length-1,1,Z):W.push(Z)}}return U.push({vertices:I(W)}),{polygons:U,mesh:O,triangles:F.map(V=>({vertices:V}))}}static mesh(r,...e){let t=[].concat(r).concat(e),n=fh.triangulate(t);return{vertices:t,triangleIndices:n}}static intersectLines(r,e,t,n){let i,s;if(Array.isArray(r)&&Array.isArray(e)&&r.length===2&&e.length===2&&typeof r[0]=="number"&&typeof e[0]=="number"&&typeof r[1]=="number"&&typeof e[1]=="number"&&(t=e[0],n=e[1],e=r[1],r=r[0]),typeof r=="number"&&typeof e=="number"){let l=r,p=e;i=[{x:0,y:p},{x:1,y:l+p}],s=[{x:0,y:n},{x:1,y:t+n}]}else i=r,s=e;return o._intersectSegments(i,s,!1)}static cramer(r,e){Array.isArray(r)&&(r={a:r[0],b:r[1],c:r[2]}),Array.isArray(e)&&(e={a:e[0],b:e[1],c:e[2]});let t=(r.b*e.c-r.c*e.b)/(r.b*e.a-r.a*e.b),n=(r.c*e.a-r.a*e.c)/(r.b*e.a-r.a*e.b);return{x:-t.roundoff(),y:-n.roundoff()}}static mq(r,e){let t;if(gh(r)?t=r:(t=r[0],e=r[1]),t.x===e.x)return[Number.NaN,Number.NaN];let n=(e.y-t.y)/(e.x-t.x),i=t.y-n*t.x;return[n,i]}static _intersectSegments(r,e,t){let n=r[0],i=r[1],s=e[0],l=e[1],p=Math.min(n.x,i.x),u=Math.min(n.y,i.y),f=Math.max(n.x,i.x),g=f-p,v=Math.max(n.y,i.y),y=v-u,_=Math.min(s.x,l.x),x=Math.min(s.y,l.y),w=Math.max(s.x,l.x),E=w-_,k=Math.max(s.y,l.y),N=k-x;if(g===0&&E===0||y===0&&N===0)return null;let T=P=>P.x<_||P.x>w||P.x<p||P.x>f,O=P=>P.y<x||P.y>k||P.y<u||P.y>v;var D=null;if(g===0){if(t&&(_>p||w<f))return null;let P=o.mq(s,l);D=o.cramer([1,0,-p],[P[0],-1,P[1]]),t&&O(D)&&(D=null)}else if(E===0){if(t&&(p>_||f<w))return null;let P=o.mq(n,i);D=o.cramer([P[0],-1,P[1]],[1,0,-_]),t&&O(D)&&(D=null)}else if(y===0){if(t&&(x>u||k<v))return null;let P=o.mq(s,l);D=o.cramer([0,1,-u],[P[0],-1,P[1]]),t&&T(D)&&(D=null)}else if(N===0){if(t&&(u>x||v<k))return null;let P=o.mq(n,i);D=o.cramer([P[0],-1,P[1]],[0,1,-x]),t&&T(D)&&(D=null)}else{let P;if(!t||(P=o._intersectRects({x:p,y:u,width:g,height:y},{x:_,y:x,width:E,height:N}))&&P.width>0&&P.height>0){let F=o.mq(n,i),B=o.mq(s,l),$=F[0],U=B[0],I=F[1],G=B[1];if($!==U){D=o.cramer([$,-1,I],[U,-1,G]);let Y=D.x,W=D.y;t&&(Y<P.x||Y>P.x+P.width||W<P.y||W>P.y+P.height)&&(D=null)}}}return D===null?null:{x:D.x,y:D.y}}static _intersectRects(...r){return Ze.intersect(...r)}static _areClose(r,e,t=Vo){return Math.abs(r.x-e.x).isCloseTo(0,t)&&Math.abs(r.y-e.y).isCloseTo(0,t)}static areClose(r,e,t=Vo){return o._areClose(r,e,t)}static dot(r,e){return Fr.dot(r,e)}static cross(r,e){return Fr.cross(r,e)}static distance(r,e){if(XC(r))return se.distance(r[0],r[1]);if(gh(e))return se.distance(r,e);{let t=e[0],n=e[1];return Math.abs(t*r.x-r.y+n)/Math.sqrt(Math.pow(t,2)+1)}}static _pointSegmentDistance(r,e){let t=Fr.from(e[0],e[1]),n=Fr.from(e[0],r);return o.cross(t,n)}static isWithin(r,e,t,n=Vo){let i=o._pointSegmentDistance(r,e);return i.isCloseTo(0,n)?!1:t?i<0:i>0}static isBeyond(r,e,t,n=Vo){return o.isWithin(r,e,!t,n)}static inLine(r,e,t=Vo){return o._pointSegmentDistance(r,e).isCloseTo(0,t)}static inSegment(r,e,t=Vo){let n=Math.min(e[0].x,e[1].x),i=Math.max(e[0].x,e[1].x),s=Math.min(e[0].y,e[1].y),l=Math.max(e[0].y,e[1].y);return r.x>=n&&r.x<=i&&r.y>=s&&r.y<=l&&o.inLine(r,e,t)}static inTriangle(r,e){let t;for(let n=0;n<3;n++){let i=e[n],s=e[(n+1)%3],l=se.subtract(s,r),p=se.subtract(i,r),u=o.cross(l,p);if(n>0&&u*t<=0)return!1;t=u}return!0}static inPolygon(r,e,t=Vo){if(!(e?.length>=3))throw"Not enough vertices";let n=e.length;if(n===3)return o.inTriangle(r,[e[0],e[1],e[2]]);t>0&&(e=e.map(v=>({x:v.x.roundoff(t),y:v.y.roundoff(t)})),r={x:r.x.roundoff(t),y:r.y.roundoff(t)});let i=Number.MAX_VALUE,s=Number.MAX_VALUE,l=Number.MIN_VALUE,p=Number.MIN_VALUE;for(let v=0;v<n;v++){let y=e[v];i=Math.min(i,y.x),s=Math.min(s,y.y),l=Math.max(l,y.x),p=Math.max(p,y.y)}if(r.x<i||r.x>l||r.y<s||r.y>p)return!1;let u={x:i-1,y:r.y},f=[u,r],g=0;for(let v=0;v<n;v++){let y=e[v],_=e[(v+1)%n],x=[y,_];if(y.y===r.y){let w=e[(v-1+n)%n];r.x>y.x&&(w.y-r.y)*(_.y-r.y)<0&&g++}else{if(_.y===r.y)continue;o.intersect(x,f)!=null&&g++}}return g%2===1}static area(r,...e){let t=[].concat(r).concat(e),n=0,i=t.length;if(i>=3){for(let s=0;s<t.length;s++){let{x:l,y:p}=t[s],u=s===i-1?0:s+1,{x:f,y:g}=t[u];n+=l*g-p*f}n*=.5}return Math.abs(n.roundoff())}static convexHull(r,...e){let t=[].concat(r).concat(e);if(!(t?.length>1))return t?.slice()??[];let n=t.map(u=>({x:u.x,y:u.y})).sort((u,f)=>u.x===f.x?u.y-f.y:u.x-f.x),i=[];for(let u of n){let f=i[i.length-1];(!f||f.x!==u.x||f.y!==u.y)&&i.push(u)}if(i.length<=2)return i;let s=(u,f,g)=>(f.x-u.x)*(g.y-u.y)-(f.y-u.y)*(g.x-u.x),l=[];for(let u of i){for(;l.length>=2&&s(l[l.length-2],l[l.length-1],u)<=0;)l.pop();l.push(u)}let p=[];for(let u=i.length-1;u>=0;u--){let f=i[u];for(;p.length>=2&&s(p[p.length-2],p[p.length-1],f)<=0;)p.pop();p.push(f)}return l.pop(),p.pop(),l.concat(p)}};function qC(o){let r;return"vertices"in o&&Array.isArray(o.vertices)&&(r=o.vertices).length>=3&&r.every(e=>se.isPoint(e))}var Bf=class o{static{this._eps=1e-12}static isPolygon(r){return qC(r)}static from(...r){return{vertices:Array.from(r)}}static contains(r,e){return ai.inPolygon(e,r.vertices,12)}static centroid(r){let e=o.boundingBox(r);return{x:e.x+e.width/2,y:e.y+e.height/2}}static boundingBox(r){return ai.boundingBox(r.vertices)}static sides(r){let{vertices:e}=r,t=[];for(let n=1;n<=e.length;n++){let i=e[n%e.length],s=e[n-1];t.push([s,i])}return t}static isConvex(r){let{vertices:e}=r,t=e.length;if(t<=3)return!0;let n=0;for(let i=0;i<e.length;i++){let s=e[(i-1+t)%t],l=e[i],p=e[(i+1)%t],u=Wn.angleBetween(l,s,p);if(n===0){n=Math.sign(u);continue}if(n!=Math.sign(u))return!1}return!0}static isSelfIntersecting(r){let{vertices:e}=r;if(e.length<=3)return!1;let t=o.sides(r);for(let n of t)for(let i of t){if(i===n||i[0]===n[1]||n[0]===i[1])continue;let s=ai.intersect(i,n);if(!be.isNull(s))return!0}return!1}static isCounterClockwise(r){let{vertices:[e,t,n]}=r;return Wn.angleBetween(t,e,n)>0}static expand(r,e){let{vertices:t}=r,n=t.length,i=[];for(let s=0;s<t.length;s++){let l=t[(s-1+n)%n],p=t[s],u=t[(s+1)%n],f=Wn.angleBetween(p,l,u),g=-e/Math.sin(Math.abs(f)/2),v=ke.scale(ke.identity,g),y=se.subtract(p,l);Fr.normalize(y);let _=se.subtract(p,u);Fr.normalize(_);let x=se.add(y,_);Fr.normalize(x);let w=ke.multiply(x,v);i.push(se.add(p,{x:w.x.roundoff(),y:w.y.roundoff()}))}return{vertices:i}}static area(r){return ai.area(r.vertices)}static intersect(r,e){return ai.intersect(r,e)}static convexHull(r){return{vertices:ai.convexHull(r.vertices)}}};var vh=180/Math.PI,vd=1/vh,We=class o{static from(...r){if(r.length!==3)throw new RangeError("Must provide exactly 3 numbers");return{x:r[0],y:r[1],z:r[2]}}static parse(r){let e=yr(r);if(e&&e.length===3)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" 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(r,e){return{x:e.x-r.x,y:e.y-r.y,z:e.z-r.z}}static add(...r){var e={x:0,y:0,z:0};for(var t of r)e.x+=t.x,e.y+=t.y,e.z+=t.z;return e}static dot(r,e){return r.x*e.x+r.y*e.y+r.z*e.z}static cross(r,e){return{x:r.y*e.z-r.z*e.y,y:r.z*e.x-r.x*e.z,z:r.x*e.y-r.y*e.x}}static scale(r,e,t=e,n=e){return{x:r.x*e,y:r.y*t,z:r.z*n}}static magSqr(r){return r.x*r.x+r.y*r.y+r.z*r.z}static areClose(r,e){return(e.x-r.x).isCloseTo(0)&&(e.y-r.y).isCloseTo(0)&&(e.z-r.z).isCloseTo(0)}static mag(r){return Math.sqrt(o.magSqr(r))}static negate(r){return{x:-r.x,y:-r.y,z:-r.z}}static unit(r){let e={x:r.x,y:r.y,z:r.z};return this.normalize(e),e}static normalize(r){let e=o.mag(r);if(e<=0)throw"Cannot normalize a vector of length 0.";let t=1/e;r.x*=t,r.y*=t,r.z*=t}static angleBetween(r,e){let t,n=o.unit(r),i=o.unit(e);if(o.dot(n,i)<0){let l={x:-n.x-i.x,y:-n.y-i.y,z:-n.z-i.z},p=o.mag(l);t=Math.PI-2*Math.asin(p/2)}else{let l={x:n.x-i.x,y:n.y-i.y,z:n.z-i.z},p=o.mag(l);t=2*Math.asin(p/2)}return vh*t}},Vf=class o{static from(r,e,t){return{rho:r.clamp(0,1/0),theta:e.clamp(-180,180),phi:t.clamp(0,360)}}static fromVector(r,e,t){typeof r=="number"&&(r=We.from(r,e,t));let n=We.mag(r);if(n.isCloseTo(0))return o.from(0,0,0);let i=Math.atan2(r.x,r.z),s=Math.acos((r.y/n).clamp(-1,1));return o.from(n,i*vh,s*vh)}static toVector(r){let{rho:e,theta:t,phi:n}=r,i=n*vd,s=t*vd,l=Math.sin(i)*e;return{x:l*Math.sin(s),y:Math.cos(i)*e,z:l*Math.cos(s)}}static toRotationMatrix(r){let{theta:e,phi:t}=r,n=vd*e,i=Math.sin(n),s=Math.cos(n),l=vd*t,p=Math.sin(l),u=Math.cos(l);return ma.from(i*u,i*p,s,0,s*u,s*p,-i,0,-p,u,0,0,0,0,0,1)}},Uo=class o{static modify(r,e){let{m11:t,m12:n,m13:i,m14:s,m21:l,m22:p,m23:u,m24:f,m31:g,m32:v,m33:y,m34:_,offsetX:x,offsetY:w,offsetZ:E,m44:k}=r,N={m11:t,m12:n,m13:i,m14:s,m21:l,m22:p,m23:u,m24:f,m31:g,m32:v,m33:y,m34:_,offsetX:x,offsetY:w,offsetZ:E,m44:k};return e(N),N}static clone(r){return o.modify(r,e=>{})}static multiply(r,e){return ma.isIdentity(r)?e:ma.isIdentity(e)?r:ma.from(r.m11*e.m11+r.m12*e.m21+r.m13*e.m31+r.m14*e.offsetX,r.m11*e.m12+r.m12*e.m22+r.m13*e.m32+r.m14*e.offsetY,r.m11*e.m13+r.m12*e.m23+r.m13*e.m33+r.m14*e.offsetZ,r.m11*e.m14+r.m12*e.m24+r.m13*e.m34+r.m14*e.m44,r.m21*e.m11+r.m22*e.m21+r.m23*e.m31+r.m24*e.offsetX,r.m21*e.m12+r.m22*e.m22+r.m23*e.m32+r.m24*e.offsetY,r.m21*e.m13+r.m22*e.m23+r.m23*e.m33+r.m24*e.offsetZ,r.m21*e.m14+r.m22*e.m24+r.m23*e.m34+r.m24*e.m44,r.m31*e.m11+r.m32*e.m21+r.m33*e.m31+r.m34*e.offsetX,r.m31*e.m12+r.m32*e.m22+r.m33*e.m32+r.m34*e.offsetY,r.m31*e.m13+r.m32*e.m23+r.m33*e.m33+r.m34*e.offsetZ,r.m31*e.m14+r.m32*e.m24+r.m33*e.m34+r.m34*e.m44,r.offsetX*e.m11+r.offsetY*e.m21+r.offsetZ*e.m31+r.m44*e.offsetX,r.offsetX*e.m12+r.offsetY*e.m22+r.offsetZ*e.m32+r.m44*e.offsetY,r.offsetX*e.m13+r.offsetY*e.m23+r.offsetZ*e.m33+r.m44*e.offsetZ,r.offsetX*e.m14+r.offsetY*e.m24+r.offsetZ*e.m34+r.m44*e.m44)}},ma=class o{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(...r){if(r.length!==16)throw new RangeError("Must provide exactly 16 numbers");return{m11:r[0],m12:r[1],m13:r[2],m14:r[3],m21:r[4],m22:r[5],m23:r[6],m24:r[7],m31:r[8],m32:r[9],m33:r[10],m34:r[11],offsetX:r[12],offsetY:r[13],offsetZ:r[14],m44:r[15]}}static transpose(r){return o.from(r.m11,r.m21,r.m31,r.offsetX,r.m12,r.m22,r.m32,r.offsetY,r.m13,r.m23,r.m33,r.offsetZ,r.m14,r.m24,r.m34,r.m44)}static toArray(r){return[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.offsetX,r.offsetY,r.offsetZ,r.m44]}static clone(r,e){return typeof e=="function"?Uo.modify(r,e):Uo.clone(r)}static scale(r,e,t,n){return typeof e=="number"?(t??=e,n??=e):(n=e.z,t=e.y,e=e.x),Uo.modify(r,i=>{i.m11*=e,i.m22*=t,i.m33*=n})}static translate(r,e){return Uo.modify(r,t=>{t.offsetX+=e.x,t.offsetY+=e.y,t.offsetZ+=e.z})}static parse(r){let e=yr(r);if(e&&e.length===16)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" as a valid Matrix3D.`)}static isIdentity(r){return r.m11==1&&r.m12==0&&r.m13==0&&r.m14==0&&r.m21==0&&r.m22==1&&r.m23==0&&r.m24==0&&r.m31==0&&r.m32==0&&r.m33==1&&r.m34==0&&r.offsetX==0&&r.offsetY==0&&r.offsetZ==0&&r.m44==1}static isAffine(r){return r.m14==0&&r.m24==0&&r.m34==0&&r.m44==1}static determinant(r){if(o.isIdentity(r))return 1;if(o.isAffine(r))return r.m11*(r.m22*r.m33-r.m32*r.m23)-r.m12*(r.m21*r.m33-r.m31*r.m23)+r.m13*(r.m21*r.m32-r.m31*r.m22);{let e=r.m13*r.m24-r.m23*r.m14,t=r.m13*r.m34-r.m33*r.m14,n=r.m13*r.m44-r.offsetZ*r.m14,i=r.m23*r.m34-r.m33*r.m24,s=r.m23*r.m44-r.offsetZ*r.m24,l=r.m33*r.m44-r.offsetZ*r.m34,p=r.m22*t-r.m32*e-r.m12*i,u=r.m12*s-r.m22*n+r.offsetY*e,f=r.m32*n-r.offsetY*t-r.m12*l,g=r.m22*l-r.m32*s+r.offsetY*i;return r.offsetX*p+r.m31*u+r.m21*f+r.m11*g}}static multiply(...r){if(r.length===0)throw new ReferenceError("Matrix not provided.");let e=Array.from(r),t=e[0];for(let n=1;n<e.length;n++)t=Uo.multiply(t,e[n]);return t}static invert(r){if(o.isAffine(r)){let e=o.determinant(r);if(e==0)return null;let t=r.m12*r.m23-r.m22*r.m13,n=r.m32*r.m13-r.m12*r.m33,i=r.m22*r.m33-r.m32*r.m23,s=r.m21*r.m13-r.m11*r.m23,l=r.m11*r.m33-r.m31*r.m13,p=r.m31*r.m23-r.m21*r.m33,u=r.m11*r.m22-r.m21*r.m12,f=r.m11*r.m32-r.m31*r.m12,g=r.m11*r.offsetY-r.offsetX*r.m12,v=r.m21*r.m32-r.m31*r.m22,y=r.m21*r.offsetY-r.offsetX*r.m22,_=r.m31*r.offsetY-r.offsetX*r.m32,x=r.m23*g-r.offsetZ*u-r.m13*y,w=r.m13*_-r.m33*g+r.offsetZ*f,E=r.m33*y-r.offsetZ*v-r.m23*_,k=u,N=-f,T=v,O=1/e;return o.from(i*O,n*O,t*O,0,p*O,l*O,s*O,0,T*O,N*O,k*O,0,E*O,w*O,x*O,1)}else{let e=o.determinant(r);if(e==0)return null;let t=r.m33*r.m44-r.m34*r.offsetZ,n=r.m32*r.m44-r.m34*r.offsetY,i=r.m31*r.m44-r.m34*r.offsetX,s=r.m32*r.offsetZ-r.m33*r.offsetY,l=r.m31*r.offsetZ-r.m33*r.offsetX,p=r.m31*r.offsetY-r.m32*r.offsetX,u=r.m33*r.m44-r.m34*r.offsetZ,f=r.m32*r.m44-r.m34*r.offsetY,g=r.m31*r.m44-r.m34*r.offsetX,v=r.m32*r.offsetZ-r.m33*r.offsetY,y=r.m31*r.offsetZ-r.m33*r.offsetX,_=r.m31*r.offsetY-r.m32*r.offsetX,x=r.m23*r.m44-r.m24*r.offsetZ,w=r.m22*r.m44-r.m24*r.offsetY,E=r.m21*r.m44-r.m24*r.offsetX,k=r.m22*r.offsetZ-r.m23*r.offsetY,N=r.m21*r.offsetZ-r.m23*r.offsetX,T=r.m21*r.offsetY-r.m22*r.offsetX,O=r.m23*r.m34-r.m24*r.m33,D=r.m22*r.m34-r.m24*r.m32,P=r.m21*r.m34-r.m24*r.m31,F=r.m22*r.m33-r.m23*r.m32,B=r.m21*r.m33-r.m23*r.m31,$=r.m21*r.m32-r.m22*r.m31,U=r.m22*t-r.m23*n+r.m24*s,I=-(r.m21*t-r.m23*i+r.m24*l),G=r.m21*n-r.m22*i+r.m24*p,Y=-(r.m21*s-r.m22*l+r.m23*p),W=-(r.m12*u-r.m13*f+r.m14*v),V=r.m11*u-r.m13*g+r.m14*y,X=-(r.m11*f-r.m12*g+r.m14*_),q=r.m11*v-r.m12*y+r.m13*_,Z=r.m12*x-r.m13*w+r.m14*k,ne=-(r.m11*x-r.m13*E+r.m14*N),te=r.m11*w-r.m12*E+r.m14*T,ae=-(r.m11*k-r.m12*N+r.m13*T),Le=-(r.m12*O-r.m13*D+r.m14*F),he=r.m11*O-r.m13*P+r.m14*B,fe=-(r.m11*D-r.m12*P+r.m14*$),le=r.m11*F-r.m12*B+r.m13*$,re=1/e;return o.from(U*re,W*re,Z*re,Le*re,I*re,V*re,ne*re,he*re,G*re,X*re,te*re,fe*re,Y*re,q*re,ae*re,le*re)}}static transform(r,e){var t={x:r.x,y:r.y,z:r.z};if(!o.isIdentity(e)){var n=t.x,i=t.y,s=t.z;if(t.x=n*e.m11+i*e.m21+s*e.m31+e.offsetX,t.y=n*e.m12+i*e.m22+s*e.m32+e.offsetY,t.z=n*e.m13+i*e.m23+s*e.m33+e.offsetZ,!o.isAffine(e)){var l=n*e.m14+i*e.m24+s*e.m34+e.m44;l!=0&&(t.x/=l,t.y/=l,t.z/=l)}}return t}},Uf=class o{static identity(){return o.from(0,0,0,1)}static from(...r){if(r.length!==4)throw new RangeError("Must provide exactly 4 numbers");return{x:r[0],y:r[1],z:r[2],w:r[3]}}static parse(r){let e=yr(r);if(e&&e.length===4)return o.from.apply(null,e);throw new Error(`Cannot parse "${r}" as a valid Quaternion.`)}static fromVectors(r,e){We.normalize(r),We.normalize(e);let t=(i,s,l,p)=>{let u=o.from(i,s,l,p);return o.normalize(u),u},n=We.dot(r,e)+1;return n.isCloseTo(0)?Math.abs(r.x)>Math.abs(r.z)?t(-r.y,r.x,0,0):t(0,-r.z,r.y,0):t(r.y*e.z-r.z*e.y,r.z*e.x-r.x*e.z,r.x*e.y-r.y*e.x,n)}static normalize(r){let e=o.mag(r);if(e.isCloseTo(0))r.x=r.y=r.z=0,r.w=1;else{let t=1/e;r.x*=t,r.y*=t,r.z*=t,r.w*=t}}static unit(r){let e=o.from(r.x,r.y,r.z,r.w);return o.normalize(e),e}static fromAxisAngle(r,e){e%=360;var t=vd*e,n=We.mag(r);if(n==0)throw new RangeError("Invalid argument");var i=Math.sin(.5*t)/n,s=r.x*i,l=r.y*i,p=r.z*i;return o.from(s,l,p,Math.cos(.5*t))}static fromRotationMatrix(r){let e=r.m11+r.m22+r.m33+r.m44;if(e>0){let t=.5/Math.sqrt(e),n=.25/t,i=(r.m23-r.m32)*t,s=(r.m31-r.m13)*t,l=(r.m12-r.m21)*t;return o.from(i,s,l,n)}else if(r.m11>r.m22&&r.m11>r.m22){let t=.5/Math.sqrt(r.m44+r.m11-r.m22-r.m33),n=(r.m23-r.m32)*t,i=.25/t,s=(r.m12+r.m21)*t,l=(r.m31+r.m13)*t;return o.from(i,s,l,n)}else if(r.m22>r.m33){let t=.5/Math.sqrt(r.m44+r.m22-r.m11-r.m33),n=(r.m23+r.m32)*t,i=.25/t,s=(r.m12+r.m21)*t,l=(r.m31-r.m13)*t;return o.from(s,i,n,l)}else{let t=.5/Math.sqrt(r.m44+r.m33-r.m11-r.m22),n=(r.m23+r.m32)*t,i=.25/t,s=(r.m12-r.m21)*t,l=(r.m31-r.m13)*t;return o.from(l,n,i,s)}}static conjugate(r){return o.from(-r.x,-r.y,-r.z,r.w)}static mag(r){return Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z+r.w*r.w)}static norm(r){return r.x*r.x+r.y*r.y+r.z*r.z}static axis(r){return r.x==0&&r.y==0&&r.z==0?We.j():We.unit(r)}static transform(r,e){o.normalize(e);let t=We.cross(e,r),n=We.scale(t,2),i=We.cross(e,n);return{x:r.x+e.w*n.x+i.x,y:r.y+e.w*n.y+i.y,z:r.z+e.w*n.z+i.z}}static angle(r){let e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z),t=r.w;if(e>Number.MAX_VALUE){let n=Math.max(Math.abs(r.x),Math.max(Math.abs(r.y),Math.abs(r.z))),i=r.x/n,s=r.y/n,l=r.z/n;e=Math.sqrt(i*i+s*s+l*l),t/=n}return Math.atan2(e,t)*114.59155902616465}static toRotationMatrix(r){var e=ma.identity(),t=r.x,n=r.y,i=r.z,s=r.w;return e.m11=1-2*n*n-2*i*i,e.m12=2*t*n+2*s*i,e.m13=2*t*i-2*s*n,e.m21=2*t*n-2*s*i,e.m22=1-2*t*t-2*i*i,e.m23=2*n*i+2*s*t,e.m31=2*s*n+2*t*i,e.m32=2*n*i-2*s*t,e.m33=1-2*t*t-2*n*n,e}static invert(r){let e=o.unit(r);return o.conjugate(e)}static multiply(r,e){return o.from(r.w*e.x+r.x+e.w+r.y*e.z-r.z*e.y,r.w*e.y-r.x*e.z+r.y*e.w+r.z*e.x,r.w*e.z+r.x*e.y-r.y*e.x+r.z*e.w,r.w*e.w-r.x*e.x-r.y*e.y-r.z*e.z)}static dot(r,e){var t=o.multiply(r,o.conjugate(e));return t.w}};var zf=class{static intersect(r,e){let[t,n]=r,i=We.subtract(t,n),[s,l,p]=e,u=We.subtract(s,l),f=We.subtract(s,p),g=We.cross(i,f),v=We.dot(u,g);if(v.isCloseTo(0))return null;let y=1/v,_=We.subtract(t,s),x=y*We.dot(_,g);if(x<0||x>1)return null;let w=We.cross(_,u),E=y*We.dot(i,w);if(E<0||x+E>1)return null;let k=y*We.dot(f,w);return k<0||k.isCloseTo(0)?null:We.add(t,We.scale(i,k))}};var Gf={};Se(Gf,{Matrix3D:()=>ma,Quaternion:()=>Uf,Spherical:()=>Vf,Vector:()=>Fr,Vector3D:()=>We});var Bb={};Se(Bb,{Complex:()=>Kt,DataAnalysis:()=>Qf,NumberTheory:()=>rg});function oi(o){return typeof o=="number"&&(o={real:o,img:0}),o}var Ob;function zo(o,r){let e={};return Object.defineProperty(e,"real",{value:o,writable:!1}),Object.defineProperty(e,"img",{value:r,writable:!1}),e}function Ff(){return Ob||(Ob=zo(Number.NaN,Number.NaN))}var Kt=class{static build(r,e){return this.isComplex(r)?r:(e??=0,typeof r!="number"||typeof e!="number"?Ff():zo(r,e||0))}static add(r,e){let t=oi(r),n=oi(e);return zo(t.real+n.real,t.img+n.img)}static subtract(r,e){let t=oi(r),n=oi(e);return zo(t.real-n.real,t.img-n.img)}static multiply(r,e){let t=oi(r),n=oi(e);return zo(t.real*n.real-t.img*n.img,t.real*n.img+t.img*n.real)}static divide(r,e){let t=oi(r),n=oi(e),i=this.absSquare(n).roundoff();if(i===0)return Ff();let s=1/i;return zo(s*(t.real*n.real+t.img*n.img),s*(t.img*n.real-t.real*n.img))}static absSquare(r){let e=oi(r);return Math.pow(e.real,2)+Math.pow(e.img,2)}static modulus(r){return Math.sqrt(this.absSquare(r))}static isComplex(r){return r!=null&&typeof r=="object"&&"real"in r&&"img"in r&&typeof r.real=="number"&&typeof r.img=="number"}static conjugate(r){return r=oi(r),zo(r.real,Math.abs(r.img)==0?0:-r.img)}static equals(r,e){let t=this.build(r),n=this.build(e);return!this.isComplex(r)||!this.isComplex(e)?!1:t.real===n.real&&t.img===n.img}static get NaC(){return Ff()}};var Qf={};Se(Qf,{Fourier:()=>jf,Gaussian:()=>vc,Lagrange:()=>bh,Lagrangian:()=>tE,Newton:()=>Xf,Pchip:()=>Yf,SearchFunctions:()=>cE,Utils:()=>Kf});function KC(o,r){let e=2*Math.PI*o/r;return Kt.build(Math.cos(e),Math.sin(e))}var Pb={};function Ib(o,r){let e=Pb[r]=Pb[r]||{};return e[o]=e[o]||KC(o,r)}function JC(o){return o>0&&(o&o-1)===0}function Wf(o){let r=[],e=o.length;if(e===1)return[Kt.build(o[0])];let t=Wf(o.filter((s,l)=>l%2===0)),n=Wf(o.filter((s,l)=>l%2===1));for(var i=0;i<e/2;i++){let s=t[i],l=Kt.multiply(Ib(i,e),n[i]);r[i]=Kt.add(s,l),r[i+e/2]=Kt.subtract(s,l)}return r}var jf=class{static transform(r,e=!0){return r=r||[],JC(r.length)?this.fft(r,e):this.dft(r,e)}static invert(r,e=!0){return this.idft(r||[],e)}static dft(r,e=!0){let t=(r||[])?.length,n=e?1/Math.sqrt(t):1,i=[];for(let s=0;s<t;s++){i.push({real:0,img:0});for(let l=0;l<t;l++){let p=Ib(s*l,t),u=Kt.multiply(r[l],p),f=Kt.multiply(u,n);i[s]=Kt.add(i[s],f)}}return i}static idft(r,e=!0){let t=r.map(i=>Kt.build(i.img,i.real));return this.transform(t,e).map(i=>Kt.build(i.img,i.real))}static fft(r,e=!0){let t=Wf(r);if(!e)return t;let n=1/Math.sqrt(r.length);return t.map(i=>Kt.multiply(i,n))}};var ZC=Math.sqrt(Math.PI);function QC(o){let r=Math.abs(o),e=1/(1+.5*r),t=e*Math.exp(-r*r-1.26551223+e*(1.00002368+e*(.37409196+e*(.09678418+e*(-.18628806+e*(.27886807+e*(-1.13520398+e*(1.48851587+e*(-.82215223+e*.17087277)))))))));return o>=0?t:2-t}var vc=class{constructor(r,e){this.mean=r,this.stdev=Math.abs(e),this.variance=Math.pow(e,2)}static get normal(){return eE}weight(r){return Math.exp(-.5*Math.pow(this._z(r),2))}probabilityDensity(r){let e=this.stdev*Math.SQRT2*ZC;return this.weight(r)/e}_z(r){return(r-this.mean)/this.stdev}probability(r){return .5*QC(-this._z(r)/Math.SQRT2)}},eE=new vc(0,1);var bh=class o{constructor(r){this.#e=r}#e;#t=null;_prepareBarycentric(){if(this.#t)return;let r=this.#e||[],e=r.length;if(e===0){this.#t=[];return}let t=new Array(e),n=new Array(e);for(let l=0;l<e;l++){let p=0,u=1,f=r[l].x;for(let g=0;g<e;g++){if(g===l)continue;let v=f-r[g].x;if(v===0)throw new Error("Invalid function provided.");v<0&&(u=-u),p+=Math.log(Math.abs(v))}t[l]=-p,n[l]=u}let i=t[0];for(let l=1;l<e;l++)t[l]>i&&(i=t[l]);let s=new Array(e);for(let l=0;l<e;l++){let p=Math.exp(t[l]-i);s[l]=n[l]*p}this.#t=s}_computeBarycentric(r){let e=this.#e||[];this.#t||this._prepareBarycentric();let t=this.#t||[],n=0,i=0;for(let s=0;s<e.length;s++){let l=e[s].x;if(r===l)return e[s].y;let p=t[s]/(r-l);n+=p*e[s].y,i+=p}return n/i}interpolate(r){return this._computeBarycentric(r)}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}},tE={create:bh.create},Yf=class o{constructor(r){if(!r||r.length<2)throw new Error("Need at least 2 points");let e=r.slice().sort((t,n)=>t.x-n.x);this.xs=e.map(t=>t.x),this.ys=e.map(t=>t.y),this.ms=this.computeDerivatives()}computeDerivatives(){let r=this.xs.length,e=new Array(r-1),t=new Array(r-1);for(let i=0;i<r-1;i++)e[i]=this.xs[i+1]-this.xs[i],t[i]=(this.ys[i+1]-this.ys[i])/e[i];let n=new Array(r).fill(0);n[0]=t[0],n[r-1]=t[r-2];for(let i=1;i<r-1;i++){let s=t[i-1],l=t[i];if(s===0||l===0||s*l<=0)n[i]=0;else{let p=2*e[i]+e[i-1],u=e[i]+2*e[i-1];n[i]=(p+u)/(p/s+u/l)}}for(let i=0;i<r-1;i++)if(t[i]===0)n[i]=0,n[i+1]=0;else{let s=n[i]/t[i],l=n[i+1]/t[i],p=s*s+l*l;if(p>9){let u=3/Math.sqrt(p);n[i]=u*s*t[i],n[i+1]=u*l*t[i]}}return n}interpolate(r){let e=this.xs,t=this.ys,n=this.ms,i=e.length;if(r<=e[0]){let w=n[0];return t[0]+w*(r-e[0])}if(r>=e[i-1]){let w=n[i-1];return t[i-1]+w*(r-e[i-1])}let s=0,l=i-1;for(;l-s>1;){let w=s+l>>1;e[w]<=r?s=w:l=w}let p=e[s+1]-e[s],u=(r-e[s])/p,f=u*u,g=f*u,v=2*g-3*f+1,y=g-2*f+u,_=-2*g+3*f,x=g-f;return v*t[s]+y*(n[s]*p)+_*t[s+1]+x*(n[s+1]*p)}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}},Xf=class o{constructor(r){if(!r||r.length===0)throw new Error("Need at least 1 point");let e=r.slice().sort((i,s)=>i.x-s.x);this.xs=e.map(i=>i.x);let t=e.length,n=e.map(i=>i.y);for(let i=1;i<t;i++)for(let s=t-1;s>=i;s--){let l=this.xs[s]-this.xs[s-i];if(l===0)throw new Error("Invalid function provided.");n[s]=(n[s]-n[s-1])/l}this.coeffs=n}interpolate(r){let e=this.xs,t=this.coeffs,n=t.length;if(n===0)return NaN;let i=t[n-1];for(let s=n-2;s>=0;s--)i=i*(r-e[s])+t[s];return i}static create(...r){var e=[];arguments.length>0&&Array.isArray(arguments[0])?e=arguments[0]:e=Array.from(r);let t=e.map((n,i)=>typeof n=="number"?{x:i,y:n}:n);return new o(t)}};var li=(o,r)=>o;function rE(o,r=li){let e=Object.groupBy(o,r),t,n=0;for(let i in e){let s=e[i].length;s>n&&(t=parseInt(i),n=s)}return t}function nE(o,r=li){let e=o.slice(0),t=e.length;e.sort((i,s)=>{let l=r(i),p=r(s);return l-p});let n=Math.ceil(e.length/2)-1;return t%2==1?e[n]:.5*(e[n+1]+e[n])}function Hb(o,r=li){return o.reduce((e,t,n)=>e+r(t,n),0)}function yh(o,r=li){return Hb(o,r)/o.length}function qf(o,r=li,e=!1){let t=yh(o,r);return o.reduce((n,i)=>Math.pow(i-t,2)+n,0)/(o.length-(e?1:0))}function $b(o,r=li,e=!1){let t=qf(o,r,e);return Math.sqrt(t)}function iE(o,r,e=li,t=li){let n=Array.isArray(r);if(n&&r.length!==o.length)throw new Error("Sets must be of the same length.");let i=o.length,s=o,l=n?r:o,p=n?e:r,u=n?t:e,f=yh(s,p),g=yh(l,u),v=0,y=0,_=0;for(let x=0;x<i;x++){let w=s[x],E=l[x],k=p(w,x)-f,N=u(E,x)-g;v+=k*N,y+=k*k,_+=N*N}return v/Math.sqrt(y*_)}function sE(o,r,e=li,t=li){let n=Array.isArray(r);if(n&&r.length!==o.length)throw new Error("Sets must be of the same length.");let i=o,s=n?r:o,l=n?e:r,p=n?t:l,u=l??(N=>N.x),f=p??(N=>N.y),g=o.length,v=0,y=0,_=0,x=0,w=0;for(let N=0;N<g;N++){let T=i[N],O=s[N],D=u(T,N),P=f(O,N);v+=D*P,y+=D,_+=P,x+=D*D,w+=P*P}let E=(g*v-y*_)/(g*x-Math.pow(y,2)),k=(_-E*y)/g;return[E,k]}var Kf=class{static sum(r,e){return Hb(r,e)}static mean(r,e){return yh(r,e)}static median(r,e){return nE(r,e)}static mode(r,e){return rE(r,e)}static var(r,e){return qf(r,e,!0)}static varp(r,e){return qf(r,e,!1)}static stdevp(r,e){return $b(r,e,!1)}static stdev(r,e){return $b(r,e,!0)}static correlation(r,e,t,n){return iE(r,e,t,n)}static linearRegression(r,e,t,n){return sE(r,e,t,n)}static gaussian(r,e){return new vc(r,e)}};function Jf(o,r){return(t,n,i,s)=>{let l=t,p=n,u=o(l,p),f=r(l,p),g=i(u),v=i(f);for(;p-l>s;)g<v?(p=f,f=u,v=g,u=o(l,p),g=i(u)):(l=u,u=f,g=v,f=r(l,p),v=i(f));return .5*(u+f)}}var Zf=.001,aE=(o,r,e,t=Zf)=>Jf((p,u)=>u-(u-p)/1.618,(p,u)=>p+(u-p)/1.618)(o,r,e,t);function oE(o){if(o<=1)throw new RangeError("segments must be a number grater than 1.");return(r,e,t,n=Zf)=>Jf((p,u)=>p+(u-p)/o,(p,u)=>u-(u-p)/o)(r,e,t,n)}var lE=(o,r,e,t=Zf)=>{var n=null,i=null;let s=(f,g)=>(i??=g-f,n??=i/Math.sqrt(12),n*(g-f)/i);return Jf((f,g)=>Math.max(f,(g+f)/2-s(f,g)),(f,g)=>Math.min(g,(g+f)/2+s(f,g)))(o,r,e,t)},cE={linear:(o=2)=>oE(o),goldenRatio:aE,gaussian:lE};var rg={};Se(rg,{Utils:()=>tg});var _h="0123456789abcdefghijklmnopqrstuvwxyz",eg=`Radix out of range: possible values go between positive 1 exclusive and ${_h.length} inclusive`,tg=class o{static lcd(...r){if(be.isNullOrEmpty(r)||r.length<=1)throw"Insufficient set of numbers.";function e(i,s){return s?e(s,i%s):s===0?i:NaN}function t(i,s){return i*s/e(i,s)}let n=Math.round(r[0]);for(let i=1;i<r.length;i++)n=t(n,Math.round(r[i]));return n}static gcd(r,e){return r=Math.round(r),e=Math.round(e),r===0?e:o.gcd(e%r,r)}static rebaseInt(r,e,t){return go.rebase(r,e,t)}static rebaseFloat(r,e,t,n=12){let i=o.rebaseFloat10ToN,s=o.rebaseFloatNTo10;if(e===10){let p=parseFloat(r.toString());return t%1===0?o.rebaseFloat10ToNIntBase(p,t,n):i(p,t,n)}if(t===10)return s(r.toString(),e,n);let l=s(r.toString(),e,n+1);return i(l,t,n)}static rebaseFloatNTo10(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=(r??"0").toString().toLowerCase(),s=Number.NaN;if(i==="0")return 0;let l=/^([-+]?) *([\da-z]+)?(.[\da-z]+)?$/.exec(i);if(l.length<2)return s;let p=l[1]==="-"?-1:1,u=l[2]||"0",f=l[3]||".0",g=0,v=0;for(let y of u+f.substr(1)){let _=n.indexOf(y);if(_===-1||_>=e)return s;g+=_*Math.pow(e,u.length-v-1),v++}return p*g}static rebaseFloat10ToNIntBase(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=e,s=Math.abs(r??0);if(s===0||Number.isNaN(s))return r.toString();let l=(s%1).roundoff(),p="";do{let f=s/i,g=Math.floor(f),v=(s-g*i).roundoff(),y=Math.floor(v);if(y>=n.length?p=`[${y}]`+p:p=n[y]+p,g<=0)break;s=g}while(!0);if(p=p.replace(/^0+/,""),p||="0",l===0)return p;let u="";do{s=(l*i).roundoff();let f=Math.floor(s),g=(s-f).roundoff();f>=n.length?u=`[${f}]`:u+=n[f],l=g}while(!l.isCloseTo(0)&&u.length<t);return/^0*$/.test(u)?p:(Math.sign(r)<0?"-":"")+p+"."+u.replace(/0+$/,"")}static rebaseFloat10ToN(r,e,t=12){let n=_h;if(e<=1||e>n.length)throw new Error(eg);let i=e,s=Math.abs(r??0);if(s===0||Number.isNaN(s))return r.toString();let l=Math.sign(r)<0?"-":"",p=[],u=[];for(let y=0;y<20;y++)p.push("0"),u.push("0");let f=i%1===0?i:Math.ceil(i);function g(y,_,x){let w=y?p:u,E=w[_]=w[_]||"0",k=n.indexOf(E)+x,N=k%f,T=Math.floor(k/f);return w[_]=n[N],T>0&&(y?g(y,_+1,T):_===0?g(!0,0,T):g(!1,_-1,T)),T}let v=0;do{let y=Math.floor(go.log(s,i)),_=y>=0,x=_?y:Math.abs(1+y);if(g(_,x,1),s=(s-Math.pow(i,y).roundoff()).roundoff(),_||v++,s===0||v>=100){let w=l+(p.reverse().map(k=>k||"0").join("").replace(/^0+/,"")||"0"),E=u.map(k=>k||"0").join("").substr(0,t).replace(/0+$/,"");return/^0*$/.test(E)?w:w+"."+E}}while(!0)}};var Ub={};Se(Ub,{BooleanOrNumberConverter:()=>ig,DragEvent:()=>Go,KnownShader:()=>kn,LineGeometry:()=>ga,MaterialElement:()=>ft,MeshGeometry:()=>ze,NodeGeometry:()=>Yo,NotifyChange:()=>jo,Pacem3DAdapterElement:()=>fa,Pacem3DCameraElement:()=>jr,Pacem3DGroupElement:()=>di,Pacem3DLightElement:()=>Er,Pacem3DMeshElement:()=>En,Pacem3DObjectElement:()=>wn,Pacem3DOrthographicCameraElement:()=>Wr,Pacem3DPerspectiveCameraElement:()=>pi,Point3DConverter:()=>Ji,Point3DOrNumberConverter:()=>xh,QuaternionConverter:()=>ng,RenderableElement:()=>ci,RenderableEvent:()=>Fo,StalePropertyFlag:()=>hi,UI3DEvent:()=>xc,Ui3DElement:()=>At,computePlaneNormal:()=>ag,computeSharpVertexNormals:()=>Dt,isBasicMaterial:()=>kh,isCamera:()=>Vt,isGeometry:()=>_d,isGroup:()=>Wo,isInteraction:()=>wh,isLambertMaterial:()=>Mh,isLight:()=>ui,isLineMaterial:()=>va,isMaterial:()=>Yr,isMesh:()=>wr,isMeshGeometry:()=>Ec,isOrthographicCamera:()=>Eh,isPerspectiveCamera:()=>Ch,isPhongMaterial:()=>Sh,isRenderable:()=>yd,isShaderMaterial:()=>Vb,isStage:()=>sg,isStandardMaterial:()=>Lh,isUi3DObject:()=>Cc});var Ji={convert:o=>we.LinearAlgebra.Vector3D.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0}`},xh={convert:o=>{let r=yr(o),e=()=>{throw new Error(`Cannot parse "${o}" as a valid Vector3D.`)};if(a.isNullOrEmpty(r)&&e(),r.length===3)return we.LinearAlgebra.Vector3D.from(...r);if(r.length===1){let t=r[0];return we.LinearAlgebra.Vector3D.from(t,t,t)}e()},convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0}`},ng={convert:o=>we.LinearAlgebra.Quaternion.parse(o),convertBack:o=>`${o.x||0} ${o.y||0} ${o.z||0} ${o.w||0}`},ig={convert:o=>o==="true"?!0:o==="false"?!1:yr(o)[0],convertBack:o=>o.toString()};var Zi=Math.PI/180;var bc,yc,Jt=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._itemPropertyChangeHandler=e=>{let t=e.target;this.adapter&&this.adapter.updateItem(this,t),t.flags.splice(0)};this._clickHandler=e=>{let t=this;if(!t.interactive||a.isNull(t._lastHitResult))return;let n=e.type.replace(/^mouse/,""),i=t._lastHitResult,s=i.object,l=i.point;this._itemDispatch(s,l,n,e)};this._hitTestCallback=(e,t)=>{let n=this;if(e!=n._lastHitResult){if(e?.object!=n._lastHitResult?.object){let i=e?.object,s=n._lastHitResult?.object,l=e?.point;a.isNull(s)||this._itemDispatch(s,l,"out",t),a.isNull(i)||this._itemDispatch(i,l,"over",t)}n._lastHitResult=e}};this._moveHandler=e=>{let t=this;if(!t.adapter||!t.interactive)return;let n=t._resizer.currentSize,i=l=>t._hitTestCallback(l,e),s=e.type==="mousemove"?{x:e.pageX-n.left,y:e.pageY-n.top}:{x:-1,y:-1};t.adapter.raycast(this,s,n,i)};z(this,bc);this._resizeHandler=e=>{let t=M(this,bc),n=e.detail;if(!a.isNull(t)&&t.height===n.height&&t.width===n.width)return;H(this,bc,n);let i=this.adapter;a.isNull(i)||(this.adapter.invalidateSize(this,n),this.dispatchEvent(new R.ResizeEvent(n)))};z(this,yc)}validate(e){return e instanceof ci}get stage(){return this._container}get scene(){return this.adapter&&this.adapter.getScene(this)}register(e){let t=super.register(e);return t&&(this._add(e),e.addEventListener(ee,this._itemPropertyChangeHandler,!1)),t}unregister(e){let t=super.unregister(e);return t&&(e.removeEventListener(ee,this._itemPropertyChangeHandler,!1),this._erase(e)),t}_refreshDatasource(e=this.datasource){this.adapter?.updateItem(this,void 0)}_buildUpDatasourceFromDOM(e=this.items){a.isNullOrEmpty(e)||(this.datasource=e.slice())}_add(e){this.adapter&&this.adapter.addItem(this,e)}_erase(e){this.adapter&&this.adapter.removeItem(this,e)}_initializeAdapter(e,t){return new Promise((n,i)=>{let s=this.datasource||[];a.isNull(e)||s.forEach(l=>e.removeItem(this,l)),!a.isNull(this._container)&&!a.isNull(t)?t.initialize(this).then(l=>{(s||[]).forEach(p=>this._add(p)),n()},l=>{this.log(ce.LogLevel.Error,l?.toString()),i(l)}):n()})}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"adapter":this._initializeAdapter(t,n);break;case"items":this._buildUpDatasourceFromDOM(n);break;case"transparent":this.adapter?.invalidateSize(this,this.size);break;case"datasource":this._refreshDatasource(n);case"disabled":case"background":this.render();break}}viewActivatedCallback(){super.viewActivatedCallback();let e=this._container,t=this._resizer;t.addEventListener("resize",this._resizeHandler,!1),t.target=e,this._initializeAdapter(null,this.adapter).then(n=>{e.addEventListener("mousemove",this._moveHandler,!1),e.addEventListener("click",this._clickHandler,!1),e.addEventListener("mouseup",this._clickHandler,!1),e.addEventListener("mousedown",this._clickHandler,!1),e.addEventListener("mouseout",this._moveHandler,!1),this._buildUpDatasourceFromDOM(),this.render()})}_itemDispatch(e,t,n,i){if(!a.isNull(e)){var s,l,p;i instanceof Event?l=i:s={item:e,offset:i},typeof n=="string"?p=n:(p=n.type,l=n.originalEvent);let f=t,g=()=>i instanceof Event?new Fo(p,e,l,f):new Go(p,{detail:s,cancelable:p===J.DragDropEventType.Init||p===J.DragDropEventType.Drag},l,f),v=i instanceof Event?new Fo("item"+p,e,l,f):new Go("item"+p,{detail:s,cancelable:p===J.DragDropEventType.Init||p===J.DragDropEventType.Drag},l,f);var u=!1;if(e instanceof EventTarget){let y=g();e.dispatchEvent(y),u=y.defaultPrevented}return e.stage.dispatchEvent(v),u||v.defaultPrevented}return!1}disconnectedCallback(){M(this,yc)?.stop();let e=this._resizer,t=this._container;a.isNull(t)||(t.removeEventListener("click",this._clickHandler,!1),t.removeEventListener("mouseup",this._clickHandler,!1),t.removeEventListener("mousedown",this._clickHandler,!1),t.removeEventListener("mousemove",this._moveHandler,!1),t.removeEventListener("mouseout",this._moveHandler,!1)),a.isNull(e)||e.removeEventListener("resize",this._resizeHandler,!1),super.disconnectedCallback()}get size(){return M(this,bc)}render(e,t,n=performance.now()){if(a.isNull(e))M(this,yc)?.stop(),H(this,yc,Bt.Timer.run(i=>this._doRender()));else{let i=this.adapter;a.isNull(i)||i.updateItem(this,e)}}_doRender(){if(!this.disabled&&!a.isNull(this.adapter)){let e=this.adapter.getScene(this),t=new CustomEvent("prerender",{detail:{scene:e},cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(this.adapter.render(this),this.dispatchEvent(new CustomEvent("render",{detail:{scene:e}})))}}};bc=new WeakMap,yc=new WeakMap,c([S(`.${b}-3d`)],Jt.prototype,"_container",2),c([S(d+"-resize")],Jt.prototype,"_resizer",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"interactive",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"transparent",2),c([h({emit:!1,converter:m.String})],Jt.prototype,"background",2),c([h({emit:!1,converter:m.Element})],Jt.prototype,"adapter",2),c([h({emit:!1,converter:m.Json})],Jt.prototype,"datasource",2),c([h({emit:!1,converter:m.Boolean})],Jt.prototype,"orbit",2),Jt=c([C({tagName:d+"-"+"3d",shadow:j.USE_SHADOW_ROOT,template:`<${d}-resize watch-position="true"></${d}-resize><div class="${b}-3d"></div><${d}-content></${d}-content>`})],Jt);function sg(o){return!a.isNull(o)&&"render"in o&&typeof o.render=="function"}function yd(o){return sg(o?.stage)}function Cc(o){return"transformMatrix"in o&&yd(o)}function Vt(o){return"type"in o&&"up"in o&&"lookAt"in o&&yd(o)}function Ch(o){return Vt(o)&&"type"in o&&o.type==="perspective"}function Eh(o){return Vt(o)&&"type"in o&&o.type==="orthographic"}function ui(o){return"type"in o&&(o.type==="ambient"||o.type==="omni"||o.type==="direction"||o.type=="spot")&&yd(o)}function wr(o){return"geometry"in o&&Cc(o)}function _d(o){return"positions"in o&&a.isArray(o.positions)}function Ec(o){return("triangleIndices"in o&&a.isArray(o.triangleIndices)||"normals"in o&&a.isArray(o.normals)||"textureCoordinates"in o&&a.isArray(o.textureCoordinates))&&_d(o)}function Wo(o){return"childRenderables"in o&&a.isArray(o.childRenderables)&&Cc(o)}function Dt(o){let r=[];if(!a.isNullOrEmpty(o)){let e=o.triangleIndices;if(e.length%3!==0)throw new RangeError(`Invalid mesh geometry: ${e.length} is not multiple of 3.`);for(let t=2;t<e.length;t+=3){let n=e[t-2],i=e[t-1],s=e[t],l=o.positions[n],p=o.positions[i],u=o.positions[s],f=ag(l,p,u);r.push(f,f,f)}}o.normals=r}function ag(o,r,e){let t=we.LinearAlgebra.Vector3D.subtract(o,r),n=we.LinearAlgebra.Vector3D.subtract(o,e),i=we.LinearAlgebra.Vector3D.cross(t,n);return we.LinearAlgebra.Vector3D.unit(i)}var xc=class extends ht{constructor(r,e,t,n){super(r,e,t),this.#e=n}#e;get point(){return this.#e}},Go=class extends xc{},Fo=class extends xc{constructor(r,e,t,n){super(r,{detail:e,bubbles:!0,cancelable:!0},t,n)}},hi=(p=>(p.Position="position",p.Transform="transform",p.Geometry="geometry",p.Children="children",p.Material="material",p.Light="light",p.Camera="camera",p.Visibility="visibility",p))(hi||{});function wh(o){return typeof o=="object"&&"time"in o&&typeof o.time=="number"}var Qi={OBJECT_SELECTOR:d+"-"+"3d"+"-object",LIGHT_SELECTOR:d+"-"+"3d"+"-light",PERSPECTIVE_CAMERA_SELECTOR:d+"-"+"3d"+"-perspective-camera",ORTHO_CAMERA_SELECTOR:d+"-"+"3d"+"-orthographic-camera",LINE_SELECTOR:d+"-"+"3d"+"-line",MESH_SELECTOR:d+"-"+"3d"+"-mesh",GROUP_SELECTOR:d+"-"+"3d"+"-group",DEFAULT_COORDS:{x:0,y:0,z:0}},_c=class _c extends R.PacemCrossItemsContainerElement{constructor(){super(...arguments);this.position=Qi.DEFAULT_COORDS;this.#e=[]}validate(e){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||A.findAncestorOfType(this,Jt)}get parent(){return this._drawableParent=this._drawableParent||A.findAncestor(this,e=>e instanceof _c)}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"hide":this.setAsDirty("visibility");break;case"items":this.setAsDirty("children");break;case"position":this.setAsDirty("position");break}}#e;get flags(){return this.#e}setAsDirty(...e){for(let t of e)this.flags.includes(t)||this.flags.push(t);this.stage?.render(this)}};c([h({emit:!1,converter:Ji})],_c.prototype,"position",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],_c.prototype,"tag",2),c([h({emit:!1,converter:m.Boolean})],_c.prototype,"inert",2);var ci=_c,At=class extends ci{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"transformMatrix":this.setAsDirty("transform");break;case"translateZ":case"translateX":case"translateY":this.offset={x:this.translateX,y:this.translateY,z:this.translateZ};break;case"scaleX":case"scaleY":case"scaleZ":this.scale={x:this.scaleX,y:this.scaleY,z:this.scaleZ};break;case"scale":case"offset":case"rotate":this._computeTransformMatrix();break}}_computeTransformMatrix(){let r=we.LinearAlgebra.Matrix3D,e=we.LinearAlgebra.Vector3D,t=we.LinearAlgebra.Quaternion,n=this.scale??e.from(1,1,1),i=r.scale(r.identity(),n);if(!a.isNull(this.rotate)){let l=t.toRotationMatrix(this.rotate);i=r.multiply(i,l)}let s=this.offset??e.from(0,0,0);i=r.translate(i,s),this.transformMatrix=i}};c([h({emit:!1,converter:ng})],At.prototype,"rotate",2),c([h({emit:!1,converter:xh})],At.prototype,"scale",2),c([h({emit:!1,converter:xh})],At.prototype,"offset",2),c([h({emit:!1})],At.prototype,"transformMatrix",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleX",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleY",2),c([h({emit:!1,converter:m.Number})],At.prototype,"scaleZ",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateX",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateY",2),c([h({emit:!1,converter:m.Number})],At.prototype,"translateZ",2);var bd,di=class extends At{constructor(){super(...arguments);z(this,bd,[])}validate(e){return e instanceof ci}get childRenderables(){return M(this,bd)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"items":case"datasource":H(this,bd,n||[]),this.setAsDirty("children");break}}};bd=new WeakMap,c([h({emit:!1})],di.prototype,"datasource",2),di=c([C({tagName:Qi.GROUP_SELECTOR})],di);var En=class extends At{propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"geometry":this.setAsDirty("geometry");break;case"material":case"backMaterial":this.setAsDirty("material");break}}};c([h({emit:!1,converter:m.Json})],En.prototype,"geometry",2),c([h({emit:!1,converter:m.Json})],En.prototype,"material",2),c([h({emit:!1,converter:m.Json})],En.prototype,"backMaterial",2),En=c([C({tagName:Qi.MESH_SELECTOR})],En);var wn=class extends At{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),(r==="content"||r==="type")&&this.setAsDirty("geometry","material")}};c([h({emit:!1})],wn.prototype,"content",2),c([h({emit:!1,converter:m.String})],wn.prototype,"type",2),wn=c([C({tagName:Qi.OBJECT_SELECTOR})],wn);var Er=class extends ci{constructor(){super(...arguments);this.intensity=.85;this.target=Qi.DEFAULT_COORDS;this.color="#fff";this.type="omni"}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"type":case"color":case"intensity":case"target":this.setAsDirty("light");break}}};c([h({emit:!1,converter:m.Number})],Er.prototype,"intensity",2),c([h({emit:!1,converter:Ji})],Er.prototype,"target",2),c([h({emit:!1,converter:m.String})],Er.prototype,"color",2),c([h({emit:!1,converter:m.String})],Er.prototype,"type",2),Er=c([C({tagName:Qi.LIGHT_SELECTOR})],Er);var jr=class extends ci{constructor(){super(...arguments);this.near=.1;this.far=1e3;this.up=we.LinearAlgebra.Vector3D.j();this.lookAt=Qi.DEFAULT_COORDS}#e;_resetBoundingSphere(){let e=this.#e,t=this.position,n=this.lookAt,i=a.isNullOrEmpty(t)||a.isNullOrEmpty(n)?0:we.LinearAlgebra.Vector3D.mag(we.LinearAlgebra.Vector3D.subtract(t,n)),s=this.#e={center:n,radius:i};this.dispatchEvent(new ue({currentValue:s,propertyName:"boundingSphere",oldValue:e}))}get boundingSphere(){return this.#e}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"lookAt":case"position":this._resetBoundingSphere();case"near":case"far":case"up":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],jr.prototype,"near",2),c([h({emit:!1,converter:m.Number})],jr.prototype,"far",2),c([h({emit:!1,converter:Ji})],jr.prototype,"up",2),c([h({emit:!1,converter:Ji})],jr.prototype,"lookAt",2);var pi=class extends jr{constructor(){super(...arguments);this.fov=45;this.aspect=1}get type(){return"perspective"}get aspectRatio(){return this.aspect}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"fov":case"aspect":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],pi.prototype,"fov",2),c([h({emit:!1,converter:m.Number})],pi.prototype,"aspect",2),pi=c([C({tagName:Qi.PERSPECTIVE_CAMERA_SELECTOR})],pi);var Wr=class extends jr{constructor(){super(...arguments);this.top=1;this.left=-1;this.bottom=-1;this.right=1}get type(){return"orthographic"}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"top":case"left":case"bottom":case"right":this.setAsDirty("camera");break}}};c([h({emit:!1,converter:m.Number})],Wr.prototype,"top",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"left",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"bottom",2),c([h({emit:!1,converter:m.Number})],Wr.prototype,"right",2),Wr=c([C({tagName:Qi.ORTHO_CAMERA_SELECTOR})],Wr);var fa=class extends K{};function jo(o){return(r,e,t)=>{let n=`_${e}_${a.uniqueCode()}_backingField`;function i(){return this[n]}function s(l){if(l!==this[n]){let p=this[n];this[n]=l,o.call(this,e,p,l)}}Object.defineProperty(r,e,{get:function(){return i.call(this)},set:function(l){s.call(this,l)},enumerable:!0,configurable:!1})}}var Yo=class{constructor(r=[]){this.positions=r}static barycenter(r){var e={x:0,y:0,z:0};if(!a.isNullOrEmpty(r)){for(var t=r.length,n=0;n<r.length;n++){var i=r[n];e.x+=i.x,e.y+=i.y,e.z+=i.z}var s=1*t;e.x/=s,e.y/=s,e.z/=s}return e}static boundingBox(r){let e={minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0};if(!a.isNullOrEmpty(r))for(var t=0;t<r.length;t++){var n=r[t];e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.minZ=Math.min(e.minZ,n.z),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y),e.maxZ=Math.max(e.maxZ,n.z)}return e}setAsDirty(){wc.call(this)}};function wc(){let o=this;o.flags=["geometry"]}var ga=class extends Yo{};c([jo(wc)],ga.prototype,"positions",2);var ze=class extends Yo{#e;#t;#r;get barycenter(){return this.#r??=Yo.barycenter(this.positions)}set barycenter(r){this.#r=r}get boundingBox(){return this.#e??=Yo.boundingBox(this.positions)}set boundingBox(r){this.#e=r}get boundingSphere(){return this.#t}set boundingSphere(r){this.#t=r}constructor(r,e,t=[],n=[]){super(r),this.triangleIndices=e,this.textureCoordinates=t,this.normals=n}};c([jo(wc)],ze.prototype,"positions",2),c([jo(wc)],ze.prototype,"triangleIndices",2),c([jo(wc)],ze.prototype,"textureCoordinates",2),c([jo(wc)],ze.prototype,"normals",2);var kn=(s=>(s.Basic="basic",s.Lambert="lambert",s.Phong="phong",s.Standard="standard",s.Line="line",s.Custom="custom",s))(kn||{});function Yr(o){return"shader"in o}function kh(o){return Yr(o)&&o.shader==="basic"}function va(o){return Yr(o)&&o.shader==="line"}function Mh(o){return Yr(o)&&o.shader==="lambert"}function Sh(o){return Yr(o)&&o.shader==="phong"}function Lh(o){return Yr(o)&&o.shader==="standard"}function Vb(o){return Yr(o)&&o.shader==="custom"}var ft=class extends K{constructor(r){super(),this.#e=r}#e;get shader(){return this.#e}async _loadMap(r,e=this.material?.texture){if(a.isNull(e)||e.close(),a.isNullOrEmpty(r))return null;let t=await fo.loadImage(r);return a.isNull(t)?null:await createImageBitmap(t)}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"map":case"opacity":case"wireframe":case"color":case"hide":this.updateMaterial();break}}viewActivatedCallback(){super.viewActivatedCallback(),this.updateMaterial()}updateMaterial(){this.createMaterial().then(r=>{this.material=a.extend(r,{flags:["material"]})})}async createMaterial(){return{opacity:this.opacity??1,wireframe:this.wireframe??!1,color:this.color||a.Css.getVariableValue(`--${b}-color-primary`),visible:!(this.hide??!1),map:this.map,texture:await this._loadMap(this.map),shader:this.shader,flags:[]}}};c([h()],ft.prototype,"material",2),c([h({emit:!1,converter:m.Number})],ft.prototype,"opacity",2),c([h({emit:!1,converter:m.Boolean})],ft.prototype,"wireframe",2),c([h({emit:!1,converter:m.String})],ft.prototype,"color",2),c([h({emit:!1,converter:m.Boolean})],ft.prototype,"hide",2),c([h({emit:!1,converter:m.String})],ft.prototype,"map",2);var lg=class{static parse(r){let e=[],t=/^v((\s+-?[\d\.]+){3})/gm,n=t.exec(r);for(;n&&n.length;)e.push(Ji.convert(n[1])),n=t.exec(r);let i=[],s=/^vt((\s+-?[\d\.]+){2})/gm;for(n=s.exec(r);n&&n.length;)i.push(se.parse(n[1])),n=s.exec(r);let l=[],p=/^vn((\s+-?[\d\.]+){3})/gm;for(n=p.exec(r);n&&n.length;)l.push(Ji.convert(n[1])),n=p.exec(r);let u=[],f=[],g=[],v=/^f((\s+([\d]+\/[\d]+\/[\d]+)){3,})/gm;for(n=v.exec(r);n&&n.length;){let N=/([\d]+)\/([\d]+)\/([\d]+)/g,T=n[1],O=N.exec(T),D=0;for(var y,_,x,w,E,k;O&&O.length;)D>2&&(g.push(y),f.push(i[_]),u.push(l[x]),g.push(w),f.push(i[E]),u.push(l[k])),w=parseInt(O[1])-1,E=parseInt(O[2])-1,k=parseInt(O[3])-1,g.push(w),f.push(i[E]),u.push(l[k]),D===0&&(y=w,_=E,x=k),D++,O=N.exec(T);n=v.exec(r)}return new ze(e,g,f,u)}},og=class{static parseGeometry(r,e){if(e.toLowerCase()==="obj")return lg.parse(r);throw new Error(`Type '${e}' is not supported.`)}};c([Te("parse3D")],og,"parseGeometry",1);var es={};Se(es,{LatLng:()=>it,LatLngBounds:()=>st,MapProjection:()=>cg});var zb={lat:Number.NaN,lng:Number.NaN},it=class{static get Empty(){return zb}static isEmpty(r){return r===zb||isNaN(r.lat)&&isNaN(r.lng)}static isLatLng(r){return"lat"in r&&typeof r.lat=="number"&&"lng"in r&&typeof r.lng=="number"}static translate(r,e){return{lat:r.lat+e.lat,lng:r.lng+e.lng}}static equals(r,e){return r===e||r.lat===e.lat&&r.lng===e.lng}},Gb={ne:it.Empty,sw:it.Empty},st=class o{static get Empty(){return Gb}static isEmpty(r){return r===Gb||it.isEmpty(r.ne)&&it.isEmpty(r.sw)}static isPoint(r){return!this.isEmpty(r)&&(r.ne===r.sw||r.ne.lat===r.sw.lat&&r.ne.lng===r.sw.lng)}static isLatLngBounds(r){return typeof r=="object"&&"ne"in r&&it.isLatLng(r.ne)&&"sw"in r&&it.isLatLng(r.sw)}static union(r,e){if(o.isEmpty(r))return o.isLatLngBounds(e)?e:{ne:e,sw:e};if(o.isLatLngBounds(e)){if(o.isEmpty(e))return r;let t=Math.max(r.ne.lat,e.ne.lat),n=Math.max(r.ne.lng,e.ne.lng),i=Math.min(r.sw.lat,e.sw.lat),s=Math.min(r.sw.lng,e.sw.lng);return{ne:{lat:t,lng:n},sw:{lat:i,lng:s}}}if(it.isLatLng(e)){if(it.isEmpty(e))return r;let t=Math.max(r.ne.lat,e.lat),n=Math.max(r.ne.lng,e.lng),i=Math.min(r.sw.lat,e.lat),s=Math.min(r.sw.lng,e.lng);return{ne:{lat:t,lng:n},sw:{lat:i,lng:s}}}return r}static equals(r,e){return r===e||it.equals(r.ne,e.ne)&&it.equals(r.sw,e.sw)}},ba={SIZE:256,RAD:Math.PI/180,DEG:180/Math.PI,EPSILON:1e-15,SIN_LIMIT:1-1e-15,EARTH_RADIUS:6378137},Nh={TRANSFORMERS_NS:"maps"},mi=class mi{constructor(r,e,t=ba.SIZE){this._pixelSize=r;this._bounds=e;this._normalizedSize=t;let n=t/2;this.#e={x:n,y:n},this.#n=t/360,this.#i=n/Math.PI,this.#t=this._latLngToWorldNormalizedPoint(e.sw),this.#r=this._latLngToWorldNormalizedPoint(e.ne)}#e;#t;#r;#n;#i;_latLngToWorldNormalizedPoint(r){let e=this.#e.x+r.lng*this.#i,t=r.lat*ba.RAD,n=ba.SIN_LIMIT,i=Math.sin(t).clamp(-n,n),s=this.#e.y+.5*Math.log((1+i)/(1-i))*-this.#n;return{x:e,y:s}}_worldNormalizedPointToLatLng(r){let e=ba.DEG*(2*Math.atan(Math.exp((r.y-this.#e.y)/-this.#n))-Math.PI/2),t=(r.x-this.#e.x)/this.#i;return{lat:e,lng:t}}_latLngToPoint(r){let e=this.#r,t=this.#t,n=-e.y+t.y,i=e.x-t.x,s=this._latLngToWorldNormalizedPoint(r),{width:l,height:p}=this._pixelSize,u=(s.x-t.x)*(l/i),f=(s.y-e.y)*(p/n);return{x:u,y:f}}_pointToLatLng(r){let e=this.#r,t=this.#t,n=-e.y+t.y,i=e.x-t.x,{width:s,height:l}=this._pixelSize,p=r.x/(s/i)+this.#t.x,u=r.y/(l/n)+this.#r.y;return this._worldNormalizedPointToLatLng({x:p,y:u})}static _haversine(r,e){let t=ba.RAD,n=r.lng*t,i=e.lng*t,s=r.lat*t,l=e.lat*t;return 2*Math.asin(Math.sqrt(Math.pow(Math.sin((s-l)/2),2)+Math.cos(s)*Math.cos(l)*Math.pow(Math.sin((n-i)/2),2)))}static _offsetByMeters(r,e,t,n){let{RAD:i,DEG:s}=ba,l=r.lat*i,p=r.lng*i,u=e/n,f=t/(n*Math.cos(l)),g=l+u,v=p+f;return{lat:g*s,lng:v*s}}static offsetBy(r,e,t,n=ba.EARTH_RADIUS){return mi._offsetByMeters(r,e,t,n)}static distanceBetween(r,e,t=ba.EARTH_RADIUS){return mi._haversine(r,e)*t}static latLngToPoint(r,e,t){return new mi(t,e)._latLngToPoint(r)}static pointToLatLng(r,e,t){return new mi(e,t)._pointToLatLng(r)}};c([Te(Nh.TRANSFORMERS_NS+".")],mi,"offsetBy",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"distanceBetween",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"latLngToPoint",1),c([Te(Nh.TRANSFORMERS_NS+".")],mi,"pointToLatLng",1);var cg=mi;var Fb={};Se(Fb,{FieldChangeEvent:()=>xd,FieldChangeEventName:()=>kc,L10n:()=>hg,OpenApi:()=>dg});var kc="change",xd=class extends oe{constructor(r){super(kc,r,{bubbles:!0,cancelable:!1})}};var dg={};Se(dg,{ApiParameterType:()=>Th,ApiParserBase:()=>ts,OpenApi3Parser:()=>Ed,OpenApiParser:()=>pg,SwaggerParser:()=>Cd,getOpenApiDefinition:()=>dE});var Th=(s=>(s.String="string",s.Number="number",s.Datetime="datetime",s.Boolean="boolean",s.Binary="binary",s.Object="object",s))(Th||{}),ts=class{async load(r,e){let t=await fetch(r,{mode:"cors",credentials:"omit",headers:e});try{let n=await t.json();return this.parse(n,r)}catch{return null}}},pE=/^#\/(definitions|components\/schemas)\/(.+)$/;function dE(o,r){var e=pE.exec(r);return e&&e.length>2?{name:e[2],schema:o.definitions[e[2]]}:null}var Ah=pt.HttpMethod,Cd=class extends ts{_findDefinitionName(r){var e=/#\/definitions\/(.+)/,t=e.exec(r);return t==null||t.length<2?r:t[1]}parse(r,e){let t=r;typeof t=="string"&&(t=JSON.parse(t));let n=t,i={};for(let p in n.definitions){let u=this._findDefinitionName(p);i[u]=n.definitions[p]}let s="";if(n.host&&n.schemes.length>0)s=n.schemes[0]+"://"+n.host+n.basePath;else if(e){let p=/^(https?):\/\/([^\/]+)/.exec(e);p&&p.length&&(!n.schemes&&p.length>1&&(n.schemes=[p[1]]),!n.host&&p.length>2&&(n.host=p[2],n.basePath=""),s=p[0])}else console.warn("Not able to find a base url from the OpenApi specs.");let l={endpoints:[],definitions:i,baseUrl:s};for(let p in n.paths){let u=n.paths[p];for(let f of[Ah.Get,Ah.Delete,Ah.Post,Ah.Put]){let g=u[f.toLowerCase()];if(g){let v=this._tryGetEndpoint(n,g,p,f);l.endpoints.push(v)}}}return l}_tryGetEndpoint(r,e,t,n){return{response:this._tryGetResponse(r,e),path:t,method:n,parameters:this._tryGetParameters(r,e)}}_translateType(r,e){switch(r){case"number":case"integer":return"number";case"boolean":return"boolean";case"string":switch(e){case"date":case"date-time":return"datetime";case"byte":return"binary";case"binary":throw"Binary octets not supported."}return"string"}return"string"}_tryGetParameters(r,e){return(e.parameters||[]).map(t=>{let n=t,i={name:n.name,required:n.required||!1},s=t.type;if(t.schema){let l=t;i.type="object";let p=i.fullType=this._findDefinitionName(l.schema.$ref);i.meta=r.definitions[p]}else s&&(i.type=this._translateType(s,t.format));return i})}_tryGetResponse(r,e){let t=e.responses[200];if(!t||!t.schema)return null;let n=t.schema.type||"object",i,s;return t.schema.$ref?(s=this._findDefinitionName(t.schema.$ref),i=r.definitions[s]):(i=t.schema,t.schema.items&&(t.schema.items.hasOwnProperty("$ref")?(s=this._findDefinitionName(t.schema.items.$ref),i=r.definitions[s]):i=t.schema.items)),{type:n,fullType:s,meta:i}}};var Ed=class extends ts{parse(r,e){let t=r;typeof t=="string"&&(t=JSON.parse(t));let n=t,i=[],s=this._gatherDefinitions(new Map,n.components.schemas);for(let l in n.paths)for(let p in n.paths[l]){let u=n.paths[l][p];i.push({path:l,method:p.toUpperCase(),parameters:this._convertToApiParameters(u.parameters),response:this._tryGetResponse(s,u.responses)})}return{endpoints:i,definitions:s,baseUrl:e}}_convertToApiParameters(r=[]){let e=[];for(let t of r){let n=t.schema;"type"in n&&e.push({name:t.name,required:t.required,type:this._translateType(n.type,n.format)})}return e}_translateType(r,e){switch(r){case"number":case"integer":return"number";case"boolean":return"boolean";case"string":switch(e){case"date":case"date-time":return"datetime";case"byte":return"binary";case"binary":throw"Binary octets not supported."}return"string"}return"string"}_gatherDefinitions(r,e){let t={};for(let n in e)t[n]=this._findDefinition(r,e,n);return t}_findDefinition(r,e,t){if(r.has(t))return r.get(t);if(t in e){let n=e[t];return r.set(t,n),n}return null}_findDefinitionName(r){var e=/#\/components\/schemas\/(.+)/,t=e.exec(r);return t==null||t.length<2?r:t[1]}_tryGetResponse(r,e){let n={responses:e}.responses[200];if(a.isNullOrEmpty(n&&n.content))return null;let i;for(let u in n.content){i=n.content[u].schema;break}let s="object",l,p;return"$ref"in i?(p=this._findDefinitionName(i.$ref),l=r[p]):(s=i.type,l=i,i.type==="array"&&("$ref"in i.items?(p=this._findDefinitionName(i.items.$ref),l=r[p]):l=i.items)),{type:s,fullType:p,meta:l}}};var pg=class extends ts{constructor(e=new Ed,t=new Cd){super();this._openApi3=e;this._swagger=t}parse(e,t){let n=e;typeof n=="string"&&(n=JSON.parse(n));let i=n;return"openapi"in i?this._openApi3.parse(i,t):this._swagger.parse(i,t)}};var hg={};Se(hg,{Forms:()=>ug});var uE={display:(o,r,e)=>e[`${o}_${r}`],validator:(o,r,e,t)=>t["validator_"+o+"_"+e]??t["validator_"+o+r+"_"+e],commandTooltip:(o,r)=>r["command_tooltip_"+o]},wd=class wd{static localizeMetadata(r,e,t){return wd._localizeMetadata(r,e,t)}static _localizeMetadata(r,e,t,n=""){t=a.extend({},uE,t);for(let i of r.props){if("props"in i&&typeof i.props=="object"&&!a.isArray(i.props)){let p=n+i.prop+".";i.props=wd._localizeMetadata(i.props,e,t,p)}let s=i.display=i.display??{},l=n+i.prop;if(s.name=t.display("name",l,e)??s.name,s.watermark=t.display("watermark",l,e)??s.watermark,s.description=t.display("description",l,e)??s.description,!a.isNullOrEmpty(i.commands))for(let p of i.commands){let u=t.commandTooltip(p.name,e);a.isNullOrEmpty(u)||(p.tooltip=u)}if(!a.isNullOrEmpty(i.validators)){let p={};for(let u of i.validators){let f=u.type;if(typeof f=="string"){let g=p[f]=(p[f]??-1)+1,v=t.validator(f,g,l,e);a.isNullOrEmpty(v)||(u.errorMessage=v)}}}}return r}};c([Te("forms.localizeMetadata")],wd,"localizeMetadata",1);var ug=wd;var Wb={};Se(Wb,{L10n:()=>mg,PacemBaseCellElement:()=>Mn});var Mn=class extends R.PacemSafeContentElement{viewActivatedCallback(){super.viewActivatedCallback(),this.updateColumnPosition(),this.updateLayout(this.metadata)}updateColumnPosition(r=this.metadata,e=this.gridState){this.style.gridColumn=(e.orderedColumns.indexOf(r.prop)+1).toString()}updateVisibility(r=this.state){this.hide=!!r.hidden}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"metadata":this.updateLayout(t);break;case"gridState":this.updateColumnPosition();break;case"state":this.updateVisibility();break}}};c([h({converter:m.Json})],Mn.prototype,"metadata",2),c([h({converter:m.Json})],Mn.prototype,"state",2),c([h({converter:m.Json})],Mn.prototype,"gridState",2);var mg={};Se(mg,{DataGrids:()=>Dh});var hE={headCell:(o,r,e)=>{switch(o){case"name":return e["column_name_"+r]??e["name_"+r];case"description":return e["column_description_"+r]??e["description_"+r]}return null}},Dh=class{static localizeMetadata(r,e,t){t=a.extend({},hE,t??{});for(let n of r){let i=n.headCell=n.headCell??{};i.name=t.headCell("name",n.prop,e)??i.name,i.description=t.headCell("description",n.prop,e)??i.description}return r}};c([Te("datagrids.localizeMetadata")],Dh,"localizeMetadata",1);var px={};Se(px,{AnimationElement:()=>lr,Charts:()=>jg,CustomItemCommandEvent:()=>sd,DockMode:()=>yf,Drawing:()=>vg,Drawing3D:()=>Gg,Fx:()=>Yg,ItemCommandEvent:()=>id,ItemRegisterEvent:()=>td,ItemRegisterEventName:()=>xf,ItemUnregisterEvent:()=>rd,ItemUnregisterEventName:()=>Cf,KeyboardShortcutExecuteEventName:()=>Mf,Logging:()=>Xg,Maps:()=>dm,Media:()=>pv,Networking:()=>dv,PacemAdapter:()=>sh,PacemAnnihilatorElement:()=>tc,PacemBeforeunloadElement:()=>ia,PacemBodyProxyElement:()=>nc,PacemBroadcastChannelProxyElement:()=>Xn,PacemBrowserDetectElement:()=>Mo,PacemColorAnimationElement:()=>da,PacemContentElement:()=>ko,PacemCrossItemsContainerElement:()=>ac,PacemDataElement:()=>qn,PacemDockElement:()=>yn,PacemDragDropElement:()=>xr,PacemElement:()=>mt,PacemElementProxyElement:()=>So,PacemEventProxyElement:()=>ji,PacemFetchElement:()=>dt,PacemHistoryElement:()=>Kn,PacemHtmlProxyElement:()=>aa,PacemIfElement:()=>No,PacemItemElement:()=>Yi,PacemItemsContainerElement:()=>_n,PacemIterableElement:()=>oh,PacemIterativeElement:()=>To,PacemLayoutProxyElement:()=>oa,PacemMetaProxyElement:()=>Zn,PacemNumberAnimationElement:()=>ua,PacemOnlineStatusElement:()=>Ao,PacemPanelElement:()=>oc,PacemPointAnimationElement:()=>ha,PacemRepeaterElement:()=>zr,PacemRescaleElement:()=>Gr,PacemResizeElement:()=>la,PacemRotateElement:()=>ri,PacemRouterElement:()=>Qn,PacemSafeContentElement:()=>na,PacemScrollAwareElement:()=>ca,PacemServiceWorkerProxyElement:()=>ei,PacemShellProxyElement:()=>ic,PacemShortcutElement:()=>pa,PacemSpanElement:()=>Po,PacemStoryboardElement:()=>si,PacemStyleProxyElement:()=>Xi,PacemSwipeElement:()=>ni,PacemTemplateProxyElement:()=>xn,PacemTextElement:()=>Io,PacemTimerElement:()=>$o,PacemTitleProxyElement:()=>Ho,PacemTransferProxyElement:()=>Lo,PacemTweenElement:()=>_r,PacemUnsafeContentElement:()=>ih,PacemViewportAwareElement:()=>qi,PacemWebWorkerProxyElement:()=>ti,Plus:()=>Ov,RepeaterItem:()=>Do,RepeaterItemCreateEvent:()=>Ql,RepeaterItemCreateEventName:()=>vf,RepeaterItemEvent:()=>Zl,RepeaterItemRemoveEvent:()=>ec,RepeaterItemRemoveEventName:()=>bf,ResizeEvent:()=>ad,ResizeEventName:()=>Ef,Scaffolding:()=>$m,ScrollEvent:()=>od,ScrollEventName:()=>kf,StateEvent:()=>ed,TweenAnimationElement:()=>ii,UI:()=>Tm,isItemsContainer:()=>fb});var vg={};Se(vg,{AdapterUtils:()=>at,CornerType:()=>Xb,DrawableElement:()=>rs,Pacem2DElement:()=>Rt,PacemCanvasAdapterElement:()=>Td,PacemCircleElement:()=>Sn,PacemEllipseElement:()=>kr,PacemGroupElement:()=>ya,PacemImageElement:()=>cr,PacemLineElement:()=>ns,PacemPathElement:()=>Nc,PacemPolygonElement:()=>Sr,PacemPolylineElement:()=>gi,PacemRectElement:()=>Mr,PacemSvgAdapterElement:()=>Rd,PacemTextElement:()=>Ot,PresentationElement:()=>Xr,ShapeElement:()=>ut,UiElement:()=>St,getStageOptions:()=>Lc});var l1=2*Math.PI;var mE=/^\s*[xX]\s*([Mm](in|ax|id))\s*[yY]\s*([Mm](in|ax|id))(\s+(none|slice|meet))?\s*$/,fE={convert:o=>{let r=mE.exec(o);return r&&r.length>=4?{x:r[1].toLowerCase(),y:r[3].toLowerCase(),slice:r[6]==="slice"}:"none"},convertBack:o=>a.isNull(o)||typeof o=="string"?"none":`xM${o.x.substring(1)}YM${o.y.substring(1)} ${o.slice?"slice":"meet"}`},jb={panControl:!0,zoomControl:!0,panModifiers:["Alt"],zoomModifiers:["Alt"],clickModifiers:[]};function Lc(o){let r=o instanceof Rt?o.options:{};return a.extend({},jb,r)}var Mc,Xo,qo,fi,Sc,Rt=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);z(this,Mc);z(this,Xo,ke.identity);z(this,qo,jb);z(this,fi);this._resizeHandler=e=>{H(this,fi,{x:e.detail.left,y:e.detail.top,width:e.detail.width,height:e.detail.height});let t=this.adapter;a.isNull(t)||this._invalidateSize()};this._zoomHandler=e=>{if(!e.isTrusted)return;let t=M(this,qo);if(t.zoomControl&&de.matchModifiers(e,t.zoomModifiers)){Q(e);let n=e.deltaY<0,i=.1,s=n?-1:1,l=i*s,p=1+l,u=a.offsetRect(e.currentTarget),f={x:e.clientX,y:e.clientY};this._zoom(p,u,f)}};this._panHandler=e=>{let t=M(this,Sc),n=this._getPanPoint(e);if(!a.isNullOrEmpty(t&&t.point)&&!a.isNull(n)){Q(e);let i=t.factor,s=t.box,l=t.point;this.viewbox={x:s.x-i*(n.x-l.x),y:s.y-i*(n.y-l.y),width:s.width,height:s.height}}};z(this,Sc);this._panStartHandler=e=>{if(!M(this,qo).panControl||!e.isTrusted)return;let n=M(this,fi),i=this.viewbox||{x:0,y:0,width:n.width,height:n.height},s=this._getPanPoint(e);if(s){Q(e),this._stage.style.pointerEvents="none";let l=this._getActualAspectRatio(),p=i.width/n.width,u=i.height/n.height,f=l.slice?Math.min(p,u):Math.max(p,u);H(this,Sc,{point:s,box:i,factor:f})}};this._panEndHandler=e=>{this._stage.style.pointerEvents="",H(this,Sc,null)}}get stage(){return this._stage}snapshot(e,t,n){let i=this.adapter;return a.isNull(i)?Promise.resolve(null):i.snapshot(this,e,t,n)}get transformMatrix(){return M(this,Xo)}_transformMatrixScale(){let e=M(this,fi)||a.offsetRect(this._stage);var t=M(this,Mc)||e;let n=this.viewbox||t,i=this.aspectRatio||"none",s=i==="none"?"stretch":i.slice?"cover":"contain";return Ze.findTransform(n,t,s).a}validate(e){return e instanceof rs&&a.isNull(e.parent)}draw(e,t=!1){let n=this.adapter;if(!this.disabled&&!a.isNull(n)){let i=new CustomEvent("predraw",{cancelable:!0});this.dispatchEvent(i),i.defaultPrevented||(n.draw(this,e,t),this.dispatchEvent(new CustomEvent("draw")))}}_drawDebounced(e,t=!1){!a.isNull(e)&&Bo(e)?this.draw(e,t):this.draw(e)}requestDraw(e,t=!1){this._drawDebounced(e,t)}_buildUpDatasourceFromDOM(){this.datasource=(this.items||[]).slice()}_getActualAspectRatio(){let e=this.aspectRatio||"none",t=e==="none"?"mid":e.x,n=e==="none"?"mid":e.y,i=e==="none"?!1:e.slice;return{x:t,y:n,slice:i}}_zoomFromValue(e){let t=M(this,fi);if(a.isNull(t))return;let n=t,i=M(this,Mc)||n,s=this.viewbox||i,l=this.aspectRatio||"none",p=l==="none"?"stretch":l.slice?"cover":"contain",u=Ze.findTransform(s,n,p),f=Ze.findTransform(i,n,p),g=u.a,y=f.a*e,_=g/y;this._zoom(_)}_zoom(e,t,n){a.isNull(t)&&(t=a.offsetRect(this._stage)),a.isNull(n)&&(n={x:t.x+t.width*.5,y:t.y+t.height*.5});let i=M(this,fi),s=this.viewbox||i,l=Math.min(s.width,s.height),p=l*e,u=l*e;if(p>0&&u>0){let f=this._getActualAspectRatio(),g=f.x,v=f.y,y=f.slice,_=s.width/s.height,x=y?Math.max(t.width,t.height):Math.min(t.width,t.height),w,E;switch(g){case"mid":w=(p-s.width)*(n.x-t.x-.5*(t.width-x))/(x*_);break;case"max":w=(p-s.width)*(n.x-t.x-(t.width-x))/(x*_);break;default:w=(p-s.width)*(n.x-t.x)/(x*_);break}switch(v){case"mid":E=(u-s.height)*(n.y-t.y-.5*(t.height-x))/(x*_);break;case"max":E=(u-s.height)*(n.y-t.y-(t.height-x))/(x*_);break;default:E=(u-s.height)*(n.y-t.y)/(x*_);break}let k=s.x-w,N=s.y-E;this.viewbox={x:k,y:N,width:p,height:u}}}_getPanPoint(e){let t=M(this,qo);return e instanceof MouseEvent&&de.matchModifiers(e,t.panModifiers)?de.getEventCoordinates(e).page:null}_invalidateSize(){this.adapter.invalidateSize(this,M(this,fi));let e=M(this,Xo);H(this,Xo,this.adapter.getTransformMatrix(this)),this.dispatchEvent(new ue({propertyName:"transformMatrix",currentValue:M(this,Xo),oldValue:e})),this.zoom=this._transformMatrixScale(),this.dispatchEvent(new R.ResizeEvent(M(this,fi)))}viewActivatedCallback(){super.viewActivatedCallback();let e=this.adapter;a.isNull(e)||(e.initialize(this),this._invalidateSize(),this._drawDebounced());let t=this._resize;t.addEventListener(R.ResizeEventName,this._resizeHandler,!1);let n=this._stage;t.target=n;let i={capture:!1,passive:!0};n.addEventListener("wheel",this._zoomHandler,!1),n.addEventListener("mousedown",this._panStartHandler,!1),n.addEventListener("touchstart",this._panStartHandler,i),window.addEventListener("mousemove",this._panHandler,!1),window.addEventListener("mouseup",this._panEndHandler,!1),window.addEventListener("touchmove",this._panHandler,i),window.addEventListener("touchend",this._panEndHandler,i)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"adapter":a.isNull(t)||t.dispose(this),a.isNull(n)||(n.initialize(this),this._invalidateSize(),this._drawDebounced());break;case"aspectRatio":a.isNull(this.adapter)||this._invalidateSize();break;case"viewbox":a.isNull(this.adapter)||this._invalidateSize(),M(this,Mc)??H(this,Mc,this.viewbox||null);break;case"items":this._buildUpDatasourceFromDOM();break;case"zoom":n!==this._transformMatrixScale()&&this._zoomFromValue(n);break;case"options":H(this,qo,Lc(this));break;case"disabled":case"datasource":this._drawDebounced();break}}disconnectedCallback(){let e=this._resize,t=this._stage;a.isNull(e)||e.removeEventListener(R.ResizeEventName,this._resizeHandler,!1),a.isNull(t)||(t.removeEventListener("wheel",this._zoomHandler,!1),t.removeEventListener("mousedown",this._panStartHandler,!1),t.removeEventListener("touchstart",this._panStartHandler),window.removeEventListener("mousemove",this._panHandler,!1),window.removeEventListener("mouseup",this._panEndHandler,!1),window.removeEventListener("touchmove",this._panHandler),window.removeEventListener("touchend",this._panEndHandler)),a.isNull(this.adapter)||this.adapter.dispose(this),super.disconnectedCallback()}};Mc=new WeakMap,Xo=new WeakMap,qo=new WeakMap,fi=new WeakMap,Sc=new WeakMap,c([h({converter:m.Element})],Rt.prototype,"adapter",2),c([h({reflectBack:!0,converter:m.Rect})],Rt.prototype,"viewbox",2),c([h({emit:!1,reflectBack:!0,converter:fE})],Rt.prototype,"aspectRatio",2),c([h({emit:!1,converter:m.Json})],Rt.prototype,"datasource",2),c([h({emit:!1,converter:m.Json})],Rt.prototype,"options",2),c([h({converter:m.Number})],Rt.prototype,"zoom",2),c([S("."+b+"-2d")],Rt.prototype,"_stage",2),c([S(d+"-resize")],Rt.prototype,"_resize",2),c([me(!0)],Rt.prototype,"_drawDebounced",1),Rt=c([C({tagName:d+"-"+"2d",shadow:!0,template:`<${d}-resize watch-position="true"></${d}-resize><div class="${b}-2d" part="container"></div><slot></slot>`})],Rt);var kd=class kd extends R.PacemCrossItemsContainerElement{validate(r){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||A.findAncestorOfType(this,Rt)}get parent(){return this._drawableParent=this._drawableParent||A.findAncestor(this,r=>r instanceof kd)}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),n||r==="hide"&&this.stage?.draw(this)}};c([h({emit:!1,reflectBack:!0,converter:m.String})],kd.prototype,"tag",2),c([h({emit:!1,converter:m.Boolean})],kd.prototype,"inert",2);var rs=kd;var gE=Math.PI/180,St=class extends rs{#e=ke.identity;viewActivatedCallback(){super.viewActivatedCallback(),this._updateTransformMatrix()}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"rotate":case"scaleX":case"scaleY":case"translateX":case"translateY":this._updateTransformMatrix();case"opacity":this.stage?.draw(this);break}}_updateTransformMatrix(){let r=gE*(this.rotate??0),e=Math.cos(r),t=Math.sin(r),n=(this.scaleX??1)*e,i=-t,s=t,l=(this.scaleY??1)*e,p=this.translateX??0,u=this.translateY??0;this.#e={a:n,b:i,c:s,d:l,e:p,f:u}}get transformMatrix(){let r=this.#e;return{a:r.a,b:r.b,c:r.c,d:r.d,e:r.e,f:r.f}}};c([h({emit:!1,converter:m.Number})],St.prototype,"rotate",2),c([h({emit:!1,converter:m.Number})],St.prototype,"scaleX",2),c([h({emit:!1,converter:m.Number})],St.prototype,"scaleY",2),c([h({emit:!1,converter:m.Number})],St.prototype,"translateX",2),c([h({emit:!1,converter:m.Number})],St.prototype,"translateY",2),c([h({emit:!1,converter:m.Number})],St.prototype,"opacity",2);var Xr=class extends St{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"stroke":case"lineWidth":case"lineJoin":case"lineCap":case"dashArray":case"fill":a.isNull(this.stage)||this.stage.draw(this);break}}};c([h({emit:!1,converter:m.String})],Xr.prototype,"stroke",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"fill",2),c([h({emit:!1,converter:{convert:r=>r?.split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),convertBack:r=>r?.join(",")}})],Xr.prototype,"dashArray",2),c([h({emit:!1,converter:m.Number})],Xr.prototype,"lineWidth",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"lineJoin",2),c([h({emit:!1,converter:m.String})],Xr.prototype,"lineCap",2);var ut=class extends Xr{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),n||r==="data"&&this.stage?.draw(this)}viewActivatedCallback(){super.viewActivatedCallback(),this.recomputeShape()}recomputeShape(){let{pathData:r,vertices:e,boundingRect:t}=this.getShapeGeometry();this.#t=e,this.#e=t,this.data=r}get pathData(){return this.data}#e;get boundingRect(){return this.#e}#t;get vertices(){return this.#t}};c([h({emit:!1,converter:m.String})],ut.prototype,"data",2);var Md,ya=class extends Xr{constructor(){super(...arguments);z(this,Md,[])}validate(e){return e instanceof rs&&e.parent===this}get childDrawables(){return M(this,Md)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"items":case"datasource":H(this,Md,n||[]);let s=this.stage;a.isNull(s)||s.draw(this,!0);break}}};Md=new WeakMap,c([h({emit:!1})],ya.prototype,"datasource",2),ya=c([C({tagName:d+"-"+"2d"+"-group"})],ya);function vE(o,r,e){let t=2*r,n=o.x,i=o.y;return{pathData:`M ${n} ${i} m ${-r},0 a ${r},${e} 0 1,1 ${t},0 a ${r},${e} 0 1,1 ${-t},0`,vertices:[],boundingRect:{x:n-r,y:i-e,width:2*r,height:2*e}}}function bE(o,r,e,t,n){let i=Math.PI/180,s=i*t,l=i*n,p=k=>r*e/Math.sqrt(Math.pow(Math.cos(k)*e,2)+Math.pow(Math.sin(k)*r,2)),u=p(s),f=p(l),g=(k,N)=>({x:k*Math.cos(N),y:k*Math.sin(N)}),v=g(u,s),y=g(f,l),_={x:o.x+v.x,y:o.y+v.y},x={x:o.x+y.x,y:o.y+y.y},w=Ze.expand(o,_,x);n<t&&(n+=360),(t<=0&&n>0||n>=360)&&(w=Ze.expand(w,{x:o.x+r,y:o.y})),(t<=90&&n>90||n>=450)&&(w=Ze.expand(w,{x:o.x,y:o.y+e})),(t<=180&&n>180||n>=540)&&(w=Ze.expand(w,{x:o.x-r,y:o.y})),(t<=270&&n>270||n>=630)&&(w=Ze.expand(w,{x:o.x,y:o.y-e}));let E=l-s>Math.PI?"1":"0";return{pathData:`M ${_.x} ${_.y} A ${r},${e} 0 ${E},1 ${x.x},${x.y} L ${o.x},${o.y} Z`,vertices:[_,x],boundingRect:w}}function fg(o,r,e,t,n){for(t??=0,n??=0,t%=360,n%=360;t<0;)t+=360;for(;n<t;)n+=360;return(t-n).isCloseTo(0)?vE(o,r,e):bE(o,r,e,t,n)}var kr=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"center":case"rx":case"ry":case"start":case"end":this.recomputeShape();break}}getPathData(){let r=this.rx,e=this.ry,t=this.center,n=this.start??0,i=this.end??0;return!a.isNull(t)&&!a.isNull(r)&&!a.isNull(e)?kr.getPathData(t,r,e,n,i):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.rx??0,t=this.ry??0;return fg(r,e,t,this.start,this.end)}static getPathData(r={x:NaN,y:NaN},e=NaN,t=NaN,n,i){let{pathData:s}=fg(r,e,t,n,i);return s}};c([h({emit:!1,converter:m.Point})],kr.prototype,"center",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"rx",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"ry",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"start",2),c([h({emit:!1,converter:m.Number})],kr.prototype,"end",2),kr=c([C({tagName:d+"-"+"2d"+"-ellipse"})],kr);var Sn=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"center":case"radius":case"start":case"end":this.recomputeShape();break}}getPathData(){let r=this.radius,e=this.center;return!a.isNull(e)&&!a.isNull(r)?Sn.getPathData(e,r,this.start,this.end):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.radius??0;return fg(r,e,e,this.start,this.end)}static getPathData(r={x:NaN,y:NaN},e=NaN,t,n){return kr.getPathData(r,e,e,t,n)}};c([h({emit:!1,converter:m.Point})],Sn.prototype,"center",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"start",2),c([h({emit:!1,converter:m.Number})],Sn.prototype,"end",2),Sn=c([C({tagName:d+"-"+"2d"+"-circle"})],Sn);function Sd(o){let r=o[2],e=o[4]??r,t=o[6]==="cut"?"cut":"rounded";return{rx:Yb(r),ry:Yb(e),type:t}}function Yb(o){return{value:parseFloat(o),unit:o.endsWith("%")?"pct":"u"}}function _a(o){return`${o.value}${o.unit==="pct"?"%":""}`}var yE=/(([\d\.]+%?)(\s*,?\s*([\d\.]+%?))?(\s+(cut|round))?)/g;function _E(o){let r,e=[];for(;r=yE.exec(o);)e.push(r);switch(e.length){case 1:let t=Sd(e[0]);return[t,t,t,t];case 4:let n=Sd(e[0]),i=Sd(e[1]),s=Sd(e[2]),l=Sd(e[3]);return[n,i,s,l];default:return null}}function xE(o){let r=o[0],e=o[1],t=o[2],n=o[3],i=_a(r.rx),s=_a(r.ry),l=_a(e.rx),p=_a(e.ry),u=_a(t.rx),f=_a(t.ry),g=_a(n.rx),v=_a(n.ry);return`${i},${s} ${l},${p} ${u},${f} ${g},${v}`}var Xb=(e=>(e.Rounded="rounded",e.Cut="cut",e))(Xb||{}),Mr=class extends ut{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="x"||r==="y"||r==="w"||r==="h"||r==="r"||r==="cornerType")&&this.recomputeShape()}getPathData(){let r=this.x,e=this.y,t=this.w,n=this.h,i=this.r??{rx:{value:0},ry:{value:0},type:"rounded"};return a.isArray(i)||(i=[i,i,i,i]),i=i.map(s=>typeof s=="number"?{rx:{value:s},ry:{value:s},type:this.cornerType}:s),!a.isNull(r)&&!a.isNull(e)&&!a.isNull(t)&&!a.isNull(n)?Mr.getPathData(r,e,t,n,i):null}getShapeGeometry(){let r=this.x,e=this.y,t=r+this.w,n=e+this.h;return{pathData:this.getPathData(),vertices:[{x:r,y:e},{x:t,y:e},{x:t,y:n},{x:r,y:n}],boundingRect:{x:r,y:e,width:this.w,height:this.h}}}static getPathData(r=NaN,e=NaN,t=NaN,n=NaN,i=null){if(!i)return`M ${r} ${e} h ${t} v ${n} h ${-t} z`;a.isArray(i)||(i=[i,i,i,i]);let s=i[0],l=i[1],p=i[2],u=i[3],f=O=>O.unit==="pct"?O.value*.01*t:O.value,g=O=>O.unit==="pct"?O.value*.01*n:O.value,v=f(s.rx),y=g(s.ry),_=f(l.rx),x=g(l.ry),w=f(p.rx),E=g(p.ry),k=f(u.rx),N=g(u.ry),T=`M ${r},${e+y}`;return s.type==="cut"?T+=` l ${v},${-y}`:T+=` a ${v} ${y} 0 0 1 ${v} ${-y}`,T+=` h ${t-v-_}`,l.type==="cut"?T+=` l ${_},${x}`:T+=` a ${_} ${x} 0 0 1 ${_} ${x}`,T+=` v ${n-x-E}`,p.type==="cut"?T+=` l ${-w},${E}`:T+=` a ${w} ${E} 0 0 1 ${-w} ${E}`,T+=` h ${-(t-w-k)}`,u.type==="cut"?T+=` l ${-k},${-N}`:T+=` a ${k} ${N} 0 0 1 ${-k} ${-N}`,T+" z"}};c([h({emit:!1,converter:m.Number})],Mr.prototype,"x",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"y",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"w",2),c([h({emit:!1,converter:m.Number})],Mr.prototype,"h",2),c([h({emit:!1,converter:{convert:r=>_E(r),convertBack:r=>xE(r)}})],Mr.prototype,"r",2),c([h({emit:!1,converter:m.String})],Mr.prototype,"cornerType",2),Mr=c([C({tagName:d+"-"+"2d"+"-rect"})],Mr);var ns=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"from":case"to":this.recomputeShape();break}}getShapeGeometry(){let r=this.from,e=this.to;if(a.isNull(r)||a.isNull(e))return Ki.empty();let t=r.x,n=r.y,i=e.x,s=e.y,l={x:Math.min(t,i),y:Math.min(n,s),width:Math.abs(t-i),height:Math.abs(n-s)};return{pathData:this.getPathData(),vertices:[r,e],boundingRect:l}}getPathData(){let r=this.from,e=this.to;return!a.isNull(r)&&!a.isNull(e)?ns.getPathData(r,e):null}static getPathData(r={x:NaN,y:NaN},e={x:NaN,y:NaN}){let t=r.x,n=r.y,i=e.x,s=e.y;return`M ${t} ${n} L ${i} ${s}`}};c([h({emit:!1,converter:m.Point})],ns.prototype,"from",2),c([h({emit:!1,converter:m.Point})],ns.prototype,"to",2),ns=c([C({tagName:d+"-"+"2d"+"-line"})],ns);var Nc=class extends ut{constructor(){super(...arguments);this.getPathData=()=>this.d}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="d"&&!i&&this.recomputeShape()}getShapeGeometry(){return{pathData:this.getPathData(),boundingRect:null,vertices:[]}}};c([h({emit:!1,converter:m.String})],Nc.prototype,"d",2),Nc=c([C({tagName:d+"-"+"2d"+"-path"})],Nc);var Sr=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"radius":case"starIndent":case"sides":this.recomputeShape();break}}getPathData(){let r=this.sides,e=this.radius,t=this.center;return!a.isNull(r)&&!a.isNull(e)?Sr.getPathData(t,e,r,this.starIndent):null}getShapeGeometry(){let r=this.center??{x:0,y:0},e=this.radius??0,t=this.sides??3,n=this.starIndent;return t<3?Ki.empty():Sr.getShapeGeometry(r,e,t,n)}static getShapeGeometry(r,e,t,n=0){let i={x:r.x,y:r.y-e},s=`M ${i.x} ${i.y}`,l=[i],p=2*Math.PI/t,u=.5*p,f=n>0,g=e*Math.cos(u);for(let y=1;y<t;y++){let _=y*p,x=r.x+Math.sin(_)*e,w=r.y-Math.cos(_)*e;if(f){let E=g*(1-n),k=_-u,N=r.x+Math.sin(k)*E,T=r.y-Math.cos(k)*E;s+=` L ${N} ${T} L ${x} ${w}`,l.push({x:N,y:T})}else s+=` L ${x} ${w}`;l.push({x,y:w})}if(f){let y=g*(1-n),_=2*Math.PI-u,x=r.x+Math.sin(_)*y,w=r.y-Math.cos(_)*y;s+=` L ${x} ${w}`,l.push({x,y:w})}l.push(i);let v=e*2;return{pathData:s+" Z",vertices:l,boundingRect:{x:i.x-e,y:i.y,width:v,height:v}}}static getPathData(r,e,t,n=0){let{pathData:i}=Sr.getShapeGeometry(r,e,t,n);return i}};c([h({emit:!1,converter:m.Number})],Sr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Sr.prototype,"radius",2),c([h({emit:!1,converter:m.Point})],Sr.prototype,"center",2),c([h({emit:!1,converter:m.Number})],Sr.prototype,"starIndent",2),Sr=c([C({tagName:d+"-"+"2d"+"-polygon"})],Sr);var CE={convert:o=>{let r=yr(o);if(r.length%2===0){let e=[];for(let t=0;t<r.length;t+=2)e.push({x:r[t],y:r[t+1]});return e}return JSON.parse(o)},convertBack:o=>JSON.stringify(o)},gi=class extends ut{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"points":case"closed":this.recomputeShape();break}}static getShapeGeometry(r,e){if(a.isNullOrEmpty(r))return Ki.empty();let t="",n=Number.MAX_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE,l=Number.MIN_VALUE;for(let u=0;u<r.length;u++){let{x:f,y:g}=r[u];t+=`${u===0?"M":"L"} ${f} ${g} `,n=Math.min(n,f),s=Math.max(s,f),i=Math.min(i,g),l=Math.max(l,g)}let p={x:n,y:i,width:s-n,height:l-i};return e&&(t+="Z"),{pathData:t,vertices:r,boundingRect:p}}getShapeGeometry(){return gi.getShapeGeometry(this.points,this.closed)}getPathData(){let{pathData:r}=this.getShapeGeometry();return r}static getPathData(r,e){let{pathData:t}=gi.getShapeGeometry(r,e);return t}};c([h({emit:!1,converter:CE})],gi.prototype,"points",2),c([h({emit:!1,converter:m.Boolean})],gi.prototype,"closed",2),gi=c([C({tagName:d+"-"+"2d"+"-polyline"})],gi);var cr=class extends St{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"src":case"x":case"y":case"width":case"height":this.stage?.draw(this);break}}};c([h({emit:!1,converter:m.String})],cr.prototype,"src",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"x",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"y",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"width",2),c([h({emit:!1,converter:m.Number})],cr.prototype,"height",2),cr=c([C({tagName:d+"-"+"2d"+"-image"})],cr);var Ot=class extends St{propertyChangedCallback(r,e,t,n){if(!n)switch(r){case"text":case"color":case"fontFamily":case"fontSize":case"fontWeight":case"fontStyle":case"anchor":a.isNull(this.stage)||this.stage.draw(this);break}}};c([h({emit:!1,converter:m.String})],Ot.prototype,"text",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"color",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontFamily",2),c([h({emit:!1,converter:m.Number})],Ot.prototype,"fontSize",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontWeight",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"fontStyle",2),c([h({emit:!1,converter:m.Point})],Ot.prototype,"anchor",2),c([h({emit:!1,converter:m.String})],Ot.prototype,"textAnchor",2),Ot=c([C({tagName:d+"-"+"2d"+"-text"})],Ot);var at=class{static stageDispatch(r,e,t){r instanceof EventTarget&&r.dispatchEvent(new md("stage"+e,r,t,r.transformMatrix))}static isValidViewbox(r){return!a.isNullOrEmpty(r)&&Ze.isRect(r)&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.width)&&Number.isFinite(r.height)}static itemDispatch(r,e,t){if(a.isNull(r?.stage))return!1;var n,i,s;t instanceof Event?i=t:n={item:r,offset:t},typeof e=="string"?s=e:(s=e.type,i=e.originalEvent);let l=r.stage.transformMatrix,p=()=>t instanceof Event?new Cn(s,r,i,l):new pc(s,{detail:n,cancelable:s===J.DragDropEventType.Init||s===J.DragDropEventType.Drag},i,l),u=t instanceof Event?new Cn("item"+s,r,i,l):new pc("item"+s,{detail:n,cancelable:s===J.DragDropEventType.Init||s===J.DragDropEventType.Drag},i,l);var f=!1;if(r instanceof EventTarget){let g=p();r.dispatchEvent(g),f=g.defaultPrevented}return r.stage.dispatchEvent(u),f||u.defaultPrevented}};var EE=.9,Tc=class extends K{constructor(){super(...arguments);this.DefaultShapeValues={stroke:"#000",lineWidth:1,fill:"#fff"}}snapshotElement(e,t,n,i){let s=!a.isNullOrEmpty(t),l=n??(s?"image/jpeg":null),p=i??(s?EE:null);return a.snapshotElement(e,t,l,p)}};var Rh="pacem:2d-canvas-scene",qb="pacem:2d-parent-matrix",wE="pacem:2d-world-matrix",Oh=A.setAttachedPropertyValue,Ld=A.getAttachedPropertyValue;function Ko(o){return o==="none"||a.isNullOrEmpty(o)}function Nd(o,r){return a.isNull(o)?r:o}var Jo,xa,Td=class extends Tc{constructor(){super(...arguments);z(this,Jo);z(this,xa);this._pointer={page:{x:Number.NaN,y:Number.NaN},screen:{x:Number.NaN,y:Number.NaN},client:{x:Number.NaN,y:Number.NaN}};this._dragInitHandler=e=>{let t=this._hitTarget;if(a.isNull(t)||!Cr(t)||!t.draggable){e.preventDefault();return}let n=e.detail,i=t,s=t.transformMatrix??ke.identity,l=Ld(t,qb,ke.identity);n.data={item:i,initialTransformMatrix:s,parentMatrix:l},at.itemDispatch(i,e,{x:0,y:0})&&e.preventDefault()};this._draggingHandler=e=>{Q(e),this._dragging=!0;let t=e.detail,n=t.data,i={x:t.currentPosition.x-t.origin.x,y:t.currentPosition.y-t.origin.y},s={x:i.x*n.parentMatrix.a+n.initialTransformMatrix.e,y:i.y*n.parentMatrix.d+n.initialTransformMatrix.f},l=n.item.stage.transformMatrix;if(!at.itemDispatch(n.item,e,{x:i.x*l.a+l.e,y:i.y*l.d+l.f}))if(n.item instanceof St)n.item.translateX=s.x,n.item.translateY=s.y;else{let u=n.initialTransformMatrix,f={a:u.a,b:u.b,c:u.c,d:u.d,e:s.x,f:s.y};a.extend(n.item,{transformMatrix:f})}};this._dragEndHandler=e=>{this._dragging=!1;let t=e.detail,n=t.data,i=n.item.transformMatrix;at.itemDispatch(n.item,e,{x:i.e,y:i.f})};this._mouseleaveHandler=e=>{if(this._dragging)return;let t=this._hitTarget;if(a.isNull(t))return;this._scopeEvent=e;let n={x:Number.NaN,y:Number.NaN};this._pointer={page:n,screen:n,client:n};let i=e.srcElement,s=Ld(i,Rh);this._requestDraw(s)};this._mousemoveHandler=e=>{this._scopeEvent=e,this._pointer=de.getEventCoordinates(e);let t=e.srcElement,n=Ld(t,Rh);this._requestDraw(n),this._dragging||a.isNull(this._hitTarget)||at.stageDispatch(n,"move",e)};this._mouseDownUpHandler=e=>{this._scopeEvent=e,this._pointer=de.getEventCoordinates(e);let t=e.target;if(t instanceof HTMLCanvasElement){let n=Ld(t,Rh),i=this._hitTarget,s=e.type.replace(/^(mouse|touch)/,""),l=s==="end"?"click":s,p=Lc(n);de.matchModifiers(e,p.clickModifiers)&&(!a.isNull(i)&&i.stage===n?at.itemDispatch(i,l,e):at.stageDispatch(n,l,e))}};this._scenes=new WeakMap;this._handles=new WeakMap}snapshot(e,t,n,i){let s=this._scenes;if(s.has(e)){let l=s.get(e).context,p=l.canvas;return this.snapshotElement(p,t,n,i)}else return Promise.resolve(null)}getCanvas(e){let t=this._scenes;return t.has(e)?t.get(e).context.canvas:null}_getScreenInverseMatrix(e,t){return ke.invert({a:e.a,b:e.b,c:e.c,d:e.d,e:e.e+t.x,f:e.f+t.y})}getTransformMatrix(e){let t=this._scenes;return t.has(e)?t.get(e).screenInverseMatrix:ke.identity}viewActivatedCallback(){super.viewActivatedCallback();let e=H(this,Jo,document.createElement(d+"-drag-drop"));e.mode=J.DragDataMode.Copy,e.dropBehavior=J.DropBehavior.None,e.spillBehavior=J.DropTargetMissedBehavior.None;let t=document.createElement("div");t.hidden=!0,e.floater=t,A.findAncestorShell(this).appendChild(e),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){let e=M(this,Jo);a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,t){let n=this._scenes;if(!a.isNull(e)&&!a.isNullOrEmpty(t)&&n.has(e)){let i=n.get(e),s=i.context;s.canvas.width=t.width,s.canvas.height=t.height;let l=i.offset=a.offsetRect(s.canvas),p={x:0,y:0,width:t.width,height:t.height},u=e.aspectRatio,f=e.viewbox;if(at.isValidViewbox(f)){let g="contain",v="center",y="middle";if(typeof u=="object"){switch(g=u.slice?"cover":"contain",u.x){case"min":v="left";break;case"max":v="right";break}switch(u.y){case"min":y="top";break;case"max":y="bottom";break}}let _=Ze.findTransform({x:0,y:0,width:f.width,height:f.height},p,g,v,y),x=ke.translate(_,{x:-_.a*f.x,y:-_.a*f.y});i.transformMatrix=x,i.screenInverseMatrix=this._getScreenInverseMatrix(x,l)}else i.transformMatrix=ke.identity}this._requestDraw(e)}getHitTarget(e){let t=this._hitTarget;return!a.isNull(t)&&t.stage===e?t:null}initialize(e){if(a.isNull(e))throw"Provided scene is null or undefined.";let t=this._scenes,n=M(this,Jo);if(t.has(e)){let p=t.get(e).context.canvas;return a.isNull(n)||n.register(p),p}let i=e.stage;i.innerHTML="";let s=document.createElement("canvas");s.setAttribute("part","stage"),Oh(s,Rh,e);let l=s.getContext("2d");return s.addEventListener("mousemove",this._mousemoveHandler,!1),s.addEventListener("mouseleave",this._mouseleaveHandler,!1),s.addEventListener("touchstart",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("touchmove",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("touchend",this._mouseDownUpHandler,{passive:!0}),s.addEventListener("click",this._mouseDownUpHandler,!1),s.addEventListener("mousedown",this._mouseDownUpHandler,!1),s.addEventListener("mouseup",this._mouseDownUpHandler,!1),i.appendChild(s),t.set(e,{context:l,transformMatrix:ke.identity,offset:a.offsetRect(s),screenInverseMatrix:ke.identity}),a.isNull(n)||n.register(s),s}dispose(e){let t=this._scenes;if(t.has(e)){var n=t.get(e),i=n.context,s=i.canvas;let l=M(this,Jo);a.isNull(l)||l.unregister(s),s.removeEventListener("click",this._mouseDownUpHandler,!1),s.removeEventListener("touchend",this._mouseDownUpHandler,!1),s.removeEventListener("mousedown",this._mouseDownUpHandler,!1),s.removeEventListener("mouseup",this._mouseDownUpHandler,!1),s.removeEventListener("touchstart",this._mouseDownUpHandler),s.removeEventListener("mouseleave",this._mouseleaveHandler,!1),s.removeEventListener("mousemove",this._mousemoveHandler,!1),s.remove(),t.delete(e)}}_requestDraw(e){let t=this._handles;t.has(e)&&cancelAnimationFrame(t.get(e));let n=()=>(this.draw(e),requestAnimationFrame(()=>{}));t.set(e,n())}draw(e){let t=this._scenes,n=this._handles;if(!a.isNull(e)){if(e.adapter!==this){t.has(e)&&(t.delete(e),n.get(e));return}if(!t.has(e)){this.initialize(e);return}n.has(e)&&cancelAnimationFrame(n.get(e));let i=this._hitTarget,s=e.datasource||[];this._hitTarget=null;let l=t.get(e),p=l.context,u=p.canvas;H(this,xa,getComputedStyle(u)),p.resetTransform(),p.clearRect(0,0,u.width,u.height);let f=l.transformMatrix;p.setTransform(f);let g=this._pointer,v=l.offset,y=Number.isNaN(g.page.x)||Number.isNaN(g.page.y)?null:{x:g.page.x-v.x,y:g.page.y-v.y};for(let x of s)this._draw(e,p,x,{transformMatrix:f},y);let _=this._hitTarget;_!=i&&(a.isNull(i)||(i instanceof Element&&i.dispatchEvent(new Cn("out",i,this._scopeEvent,f)),e.dispatchEvent(new Cn("itemout",i,this._scopeEvent,f))),a.isNull(_)||(_ instanceof Element&&_.dispatchEvent(new Cn("over",_,this._scopeEvent,f)),e.dispatchEvent(new Cn("itemover",_,this._scopeEvent,f))))}}_draw(e,t,n,i,s){if(n.stage??=e,dc(n)&&n.hide)return;Cr(n)&&n.draggable&&!n.hide&&!n.inert&&Oh(n,qb,t.getTransform().inverse());let l;Cr(n)&&(l=n.transformMatrix,!a.isNull(l)&&!ke.isIdentity(l)&&t.transform(l.a,l.b,l.c,l.d,l.e,l.f));let p=i;if(gd(n)&&(p=hd.combine(n,i,t.getTransform()),this._setPresentationState(t,p)),hc(n)||n instanceof ut)this._drawShape(t,n,s);else if(mc(n)||n instanceof Ot)this._drawText(t,n,s);else if(fc(n)||n instanceof cr)this._drawImage(t,n,s);else if(Bo(n)||n instanceof ya)for(let u of n.childDrawables||[])this._draw(e,t,u,p,s);Cr(n)&&n.draggable&&!n.hide&&!n.inert&&Oh(n,wE,t.getTransform().inverse()),this._setPresentationState(t,i)}_setPresentationState(e,t){if(e.setTransform(t.transformMatrix),!a.isNullOrEmpty(t.stroke)&&!Ko(t.stroke)?e.strokeStyle=t.stroke:e.strokeStyle="transparent",a.isNullOrEmpty(t.lineWidth)?e.lineWidth=0:e.lineWidth=t.lineWidth,a.isNullOrEmpty(t.dashArray)?e.setLineDash([]):e.setLineDash(t.dashArray),a.isNullOrEmpty(t.lineCap)?e.lineCap="butt":e.lineCap=t.lineCap,a.isNullOrEmpty(t.lineJoin)?e.lineJoin="miter":e.lineJoin=t.lineJoin,typeof t.fill=="object"&&!a.isNullOrEmpty(t.fill)){let{stops:n}=t.fill,i;if(fd(t.fill)){let{start:s,end:l}=t.fill;i=e.createLinearGradient(s.x,s.y,l.x,l.y)}else if(uc(t.fill)){let{center:s,radius:l}=t.fill;i=e.createRadialGradient(s.x,s.y,l,s.x,s.y,l)}else throw new Error("Unmanaged gradient type.");for(let s of n)i.addColorStop(s.offset,s.color);e.fillStyle=i}else!a.isNullOrEmpty(t.fill)&&typeof t.fill=="string"&&!Ko(t.fill)?e.fillStyle=t.fill:e.fillStyle="transparent";a.isNullOrEmpty(t.opacity)?e.globalAlpha=1:e.globalAlpha=t.opacity}_drawImage(e,t,n){let i="pacem:2d-canvas-imagesrc",s=Ld(t,i),l=()=>{let p=s.naturalWidth,u=s.naturalHeight,f=t.width,g=t.height;if(f>0&&g>0||(f>0?g=u*f/p:g>0?f=p*g/u:(f=p,g=u)),!this._dragging&&!t.inert&&!a.isNull(n)){let v=new Path2D(`M ${t.x} ${t.y} h ${f} v ${g} H ${t.x} Z`);e.isPointInPath(v,n.x,n.y)&&(this._hitTarget=t)}e.globalAlpha=Nd(t.opacity,1),e.drawImage(s,t.x,t.y,f,g)};a.isNull(s)?(s=new Image,s.src=t.src,s.onload=()=>{Oh(t,i,s),l()}):l()}_drawText(e,t,n){let i=this.DefaultShapeValues,s=e.fillStyle=Nd(t.color,i.stroke),l=e.getTransform(),p=t.fontSize>0?`${t.fontSize}px`:M(this,xa).fontSize,u=t.fontStyle||M(this,xa).fontStyle,f=t.fontWeight||M(this,xa).fontWeight;e.font=`${u} ${f} ${p} ${t.fontFamily??M(this,xa).fontFamily}`,e.textAlign=t.textAnchor==="middle"?"center":t.textAnchor,e.fillText(t.text,t.anchor.x,t.anchor.y),e.globalAlpha=Nd(t.opacity,1);let g=!Ko(s);if(!this._dragging&&!t.inert&&!a.isNull(n)){let v=e.measureText(t.text),y=v.width,_=v.actualBoundingBoxAscent+v.actualBoundingBoxDescent,x=t.anchor.x-v.actualBoundingBoxLeft,w=t.anchor.y-v.actualBoundingBoxAscent,E=new Path2D(`M ${x} ${w} h ${y} v ${_} H ${x} z`);g&&e.isPointInPath(E,n.x,n.y)&&(this._hitTarget=t)}}_drawShape(e,t,n){if(a.isNullOrEmpty(t?.pathData))return;e.beginPath();let i=typeof e.fillStyle!="string"||!Ko(e.fillStyle),s=typeof e.strokeStyle!="string"||!Ko(e.strokeStyle);var l=new Path2D(t.pathData);!this._dragging&&!t.inert&&!a.isNull(n)&&(i&&e.isPointInPath(l,n.x,n.y)||s&&e.isPointInStroke(l,n.x,n.y))&&(this._hitTarget=t),s&&e.stroke(l),i&&e.fill(l);let p=!a.isNullOrEmpty(t.vertices)&&t.vertices.length>1,u=!a.isNull(t.markerEnd),f=!a.isNull(t.markerStart),g=!a.isNull(t.markerMid);if((u||g||f)&&(p||this.log(ce.LogLevel.Warn,"Not enough vertices were explicited in order to make markers renderable.")),p){let v=e.getTransform();if(f){let y=t.markerEnd,_=t.vertices[1],x=t.vertices[0],w=Math.atan2(x.y-_.y,x.x-_.x);this._drawMarker(e,y,x,w)}if(g){let y=t.markerEnd;for(let _=1;_<t.vertices.length-1;_++){e.setTransform(v);let x=t.vertices[_],w=t.vertices[_+1],E=Math.atan2(w.y-x.y,w.x-x.x);this._drawMarker(e,y,w,E)}}if(u){e.setTransform(v);let y=t.markerEnd,_=t.vertices[t.vertices.length-2],x=t.vertices[t.vertices.length-1],w=Math.atan2(x.y-_.y,x.x-_.x);this._drawMarker(e,y,x,w)}}}_drawMarker(e,t,n,i){let s=this.DefaultShapeValues,l=t.ref?.x||0,p=t.ref?.y||0,u=(t.width||1)*e.lineWidth,f=(t.width||1)*e.lineWidth,g=t.viewbox,v={x:0,y:0,width:u,height:f};a.isNull(g)&&(g=v);let y={a:v.width/g.width,d:v.height/g.height};e.translate(n.x,n.y),e.rotate(i),e.scale(y.a,y.d),e.translate(-l,-p),e.fillStyle=Nd(t.fill,s.fill),e.strokeStyle=Nd(t.stroke,s.stroke);let _=!Ko(t.fill),x=!Ko(t.stroke);var w=new Path2D(t.pathData);_&&e.fill(w),x&&e.stroke(w)}};Jo=new WeakMap,xa=new WeakMap,Td=c([C({tagName:d+"-"+"2d"+"-canvas-adapter"})],Td);var vi="http://www.w3.org/2000/svg",Ad="pacem:2-svg-drawable",Ph="pacem:2d-svg-stage",Dd=A.getAttachedPropertyValue,Kb=A.setAttachedPropertyValue,Jb=A.deleteAttachedPropertyValue;function gg(o,r){return a.isNull(o)?r:o}function Zb(o,r,e){return e>=o.children.length?(o.appendChild(r),null):o.replaceChild(r,o.children.item(e))}var Ca,Zo,Rd=class extends Tc{constructor(){super(...arguments);z(this,Ca);this._hitTarget=null;z(this,Zo);this._dragInitHandler=e=>{let t=e.detail,n=t.element,i=Dd(n,Ad),s=i.stage.transformMatrix,l=i.transformMatrix??ke.identity;t.data={stageTransformMatrix:s,item:i,initialTransformMatrix:l},at.itemDispatch(i,e,{x:0,y:0})&&e.preventDefault()};this._draggingHandler=e=>{Q(e),H(this,Zo,!0);let t=e.detail.element,n=e.detail.data,i=e.detail,s={x:(i.currentPosition.x-i.origin.x)*n.stageTransformMatrix.a,y:(i.currentPosition.y-i.origin.y)*n.stageTransformMatrix.d},l={x:s.x+n.initialTransformMatrix.e,y:s.y+n.initialTransformMatrix.f},p={x:s.x+n.stageTransformMatrix.e,y:s.y+n.stageTransformMatrix.f};if(!at.itemDispatch(n.item,e,p)){let f=n.initialTransformMatrix;t.style.transform=`matrix(${f.a},${f.b},${f.c},${f.d},${l.x},${l.y})`}};this._dragEndHandler=e=>{H(this,Zo,!1);let t=e.detail,n=t.element,i=t.data,s=a.deserializeTransform(n.style),l={x:s.e,y:s.f};if(i.item instanceof St)i.item.translateX=l.x,i.item.translateY=l.y;else{let p=i.initialTransformMatrix,u={a:p.a,b:p.b,c:p.c,d:p.d,e:l.x,f:l.y};a.extend(i.item,{transformMatrix:u})}n.style.transform="",at.itemDispatch(i.item,e,l)};this._mouseleaveHandler=e=>{if(M(this,Zo))return;let t=this._hitTarget;a.isNull(t)||(this._hitTarget=null,a.isNull(t)||(M(this,Ca).unregister(this._items.get(t)),at.itemDispatch(t,"out",e)))};this._mousemoveHandler=e=>{var t=de.getEventCoordinates(e).client;if(!M(this,Zo)){var n=null;e.target.getRootNode().elementsFromPoint(t.x,t.y).find(u=>(n=Dd(u,Ad),n&&!n.inert));var i=this._hitTarget,s=n;(a.isNull(n&&n.stage)||!this._scenes.has(n.stage)||n.inert)&&(s=null);let p=this._hitTarget=s;if(s!==i&&(a.isNull(i)||(M(this,Ca).unregister(this._items.get(i)),at.itemDispatch(i,"out",e)),a.isNull(s)||(s.draggable&&M(this,Ca).register(this._items.get(s)),at.itemDispatch(s,"over",e))),a.isNull(p)){let u=e.currentTarget,f=Dd(u,Ph);a.isNull(f)||at.stageDispatch(f,"move",e)}}};this._mouseDownUpHandler=e=>{let t=e.currentTarget;if(t instanceof SVGSVGElement){let n=Dd(t,Ph),i=this._hitTarget,s=e.type.replace(/^mouse/,""),l=Lc(n);de.matchModifiers(e,l.clickModifiers)&&(!a.isNull(i)&&i.stage===n?at.itemDispatch(i,s,e):at.stageDispatch(n,s,e))}};this._scenes=new WeakMap;this._markers=new WeakMap;this._gradients=new WeakMap;this._items=new WeakMap}snapshot(e,t,n,i){if(this._scenes.has(e)){let s=this._scenes.get(e);return this.snapshotElement(s,t,n,i)}else return Promise.resolve(null)}getTransformMatrix(e){let t=this._scenes;return t.has(e)?t.get(e).getScreenCTM().inverse():ke.identity}viewActivatedCallback(){super.viewActivatedCallback();let e=H(this,Ca,document.createElement(d+"-drag-drop"));e.mode=J.DragDataMode.Self,A.findAncestorShell(this).appendChild(e),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){let e=M(this,Ca);a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,t){let n=this._scenes;if(!a.isNull(e)&&!a.isNullOrEmpty(t)&&n.has(e)){var i=n.get(e);i.setAttribute("width",t.width+""),i.setAttribute("height",t.height+"");let s=e.viewbox,l=e.aspectRatio;at.isValidViewbox(s)?i.setAttribute("viewBox",`${s.x} ${s.y} ${s.width} ${s.height}`):i.removeAttribute("viewBox"),a.isNullOrEmpty(l)||typeof l=="string"?i.removeAttribute("preserveAspectRatio"):i.setAttribute("preserveAspectRatio",`xM${l.x.substring(1)}YM${l.y.substring(1)} ${l.slice?"slice":"meet"}`)}}initialize(e){if(a.isNull(e))throw"Provided scene is null or undefined.";let t=this._scenes;if(t.has(e))return t.get(e);let n=e.stage;n.innerHTML="",this._items=new WeakMap;var i=document.createElementNS(vi,"svg");i.setAttribute("part","stage"),Kb(i,Ph,e),n.appendChild(i),t.set(e,i);let s={passive:!1,capture:!0};return i.addEventListener("mousemove",this._mousemoveHandler,!1),i.addEventListener("click",this._mouseDownUpHandler,!1),i.addEventListener("mousedown",this._mouseDownUpHandler,!1),i.addEventListener("mouseup",this._mouseDownUpHandler,!1),i.addEventListener("mouseleave",this._mouseleaveHandler,!1),i}dispose(e){let t=this._scenes;if(t.has(e)){var n=t.get(e);n.removeEventListener("mousemove",this._mousemoveHandler),n.removeEventListener("click",this._mouseDownUpHandler),n.removeEventListener("mousedown",this._mouseDownUpHandler),n.removeEventListener("mouseup",this._mouseDownUpHandler),n.removeEventListener("mouseleave",this._mouseleaveHandler),Jb(n,Ph),n.remove(),t.delete(e)}}getHitTarget(e){return this._hitTarget}draw(e,t,n=!1){let i=this._scenes,s=this._items;if(!a.isNull(e)){if(e.adapter===this)i.has(e)||this.initialize(e);else{i.has(e)&&i.delete(e);return}var l=e.datasource,p=!0,u=i.get(e);!a.isNull(t)&&s.has(t)&&(l=[t],u=s.get(t).parentNode,p=!1),p&&(u.innerHTML="<defs></defs>",this._markers=new WeakMap),this._draw(e,u,l||[],p,n)}}_hasItems(e){return Bo(e)}_disposeSvg(e){if(!a.isNull(e)){var t=Dd(e,Ad);Jb(e,Ad),this._items.delete(t)}}_draw(e,t,n,i,s){let l=this._items,p=0;if(t.firstElementChild instanceof SVGDefsElement&&p++,!a.isNullOrEmpty(n))for(let u of n){u.stage??=e;let f;if(l.has(u)?(f=l.get(u),f.parentNode!==t&&this._disposeSvg(Zb(t,f,p))):(f=this._buildSVGElement(u),Kb(f,Ad,u),this._disposeSvg(Zb(t,f,p)),l.set(u,f)),dc(u)&&(u.hide?f.setAttribute("display","none"):f.removeAttribute("display"),f.style.transform=""),hc(u)){let g=f;g.setAttribute("d",gg(u.pathData,"M0,0"));for(let{marker:v,suffix:y}of[{marker:u.markerStart,suffix:"start"},{marker:u.markerEnd,suffix:"end"},{marker:u.markerMid,suffix:"mid"}])if(v){let _=this._ensureMarker(t,v);g.setAttribute("marker-"+y,`url(#${_.id})`)}else g.removeAttribute("marker-"+y)}else if(mc(u)){let g=f;g.textContent=u.text,g.style.fill=a.isNullOrEmpty(u.color)?"":u.color,g.style.fontFamily=a.isNullOrEmpty(u.fontFamily)?"":u.fontFamily,g.style.fontSize=a.isNull(u.fontSize)?"":u.fontSize+"px",a.isNullOrEmpty(u.fontWeight)||(g.style.fontWeight=u.fontWeight),a.isNullOrEmpty(u.fontStyle)||(g.style.fontStyle=u.fontStyle),g.setAttribute("text-anchor",gg(u.textAnchor,"start")),a.isNull(u.anchor)?(g.removeAttribute("x"),g.removeAttribute("y")):(g.setAttribute("x",u.anchor.x.toString()),g.setAttribute("y",u.anchor.y.toString()))}else if(fc(u)){let g=f;g.setAttribute("href",u.src),g.setAttribute("preserveAspectRatio","none"),u.width>0?g.setAttribute("width",""+u.width):g.removeAttribute("width"),u.height>0?g.setAttribute("height",""+u.height):g.removeAttribute("height"),a.isNull(u.x)?g.removeAttribute("x"):g.setAttribute("x",""+u.x),a.isNull(u.y)?g.removeAttribute("y"):g.setAttribute("y",""+u.y)}if(Cr(u)){let g=u.transformMatrix;a.isNull(g)||ke.isIdentity(g)?f.removeAttribute("transform"):f.setAttribute("transform",`matrix(${g.a} ${g.b} ${g.c} ${g.d} ${g.e} ${g.f})`);let v=gg(u.opacity,1);v===1?f.removeAttribute("opacity"):f.setAttribute("opacity",""+v)}if(gd(u)){if(a.isNullOrEmpty(u.fill))f.removeAttribute("fill");else if(typeof u.fill=="string")f.setAttribute("fill",u.fill);else{let g=this._ensureGradient(t,u.fill);f.setAttribute("fill",`url(#${g.id})`)}a.isNullOrEmpty(u.stroke)?f.removeAttribute("stroke"):f.setAttribute("stroke",u.stroke),a.isNullOrEmpty(u.dashArray)?f.removeAttribute("stroke-dasharray"):f.setAttribute("stroke-dasharray",u.dashArray.join(" ")),a.isNullOrEmpty(u.lineCap)?f.removeAttribute("stroke-linecap"):f.setAttribute("stroke-linecap",u.lineCap),a.isNullOrEmpty(u.lineJoin)?f.removeAttribute("stroke-linejoin"):f.setAttribute("stroke-linejoin",u.lineJoin),a.isNullOrEmpty(u.lineWidth)?f.removeAttribute("stroke-width"):f.setAttribute("stroke-width",""+u.lineWidth)}u.inert?f.style.pointerEvents="none":f.style.pointerEvents="",(i||s)&&this._hasItems(u)&&this._draw(e,f,u.childDrawables,!0,s),p++}if(i)for(let u=t.children.length-1;u>=p;u--){let f=t.children.item(u);this._disposeSvg(f),f.remove()}}_buildSVGElement(e){return hc(e)||e instanceof ut?document.createElementNS(vi,"path"):mc(e)||e instanceof Ot?document.createElementNS(vi,"text"):fc(e)||e instanceof cr?document.createElementNS(vi,"image"):document.createElementNS(vi,"g")}_ensureGradient(e,t){let n=this._gradients;n.has(e)||n.set(e,new WeakMap);let i=n.get(e),s=fd(t),l=uc(t);if(i.has(t)){let g=i.get(t);(s&&g instanceof SVGLinearGradientElement||l&&g instanceof SVGRadialGradientElement)&&(g.remove(),i.delete(t))}if(!i.has(t)){let g=e,v;for(;a.isNull(v=g.querySelector(":scope > defs"));){let y=g.parentElement;if(y instanceof SVGElement)g=y;else break}if(a.isNull(v))throw new Error("Must provide a <defs> element.");var p=null;if(s)p=document.createElementNS(vi,"linearGradient");else if(uc(t))p=document.createElementNS(vi,"radialGradient");else throw new Error("Unmanaged gradient type.");p.setAttribute("gradientUnits","userSpaceOnUse"),p.setAttribute("id",`grad-${a.uniqueCode()}`),v.appendChild(p),i.set(t,p)}let u=i.get(t);s?(u.setAttribute("x1",t.start.x.toString()),u.setAttribute("y1",t.start.y.toString()),u.setAttribute("x2",t.end.x.toString()),u.setAttribute("y2",t.end.y.toString())):l&&(u.setAttribute("cx",t.center.x.toString()),u.setAttribute("cy",t.center.y.toString()),u.setAttribute("r",t.radius.toString()));let f=0;for(let g of t.stops){for(;u.children.length<=f;){let y=document.createElementNS(vi,"stop");u.appendChild(y)}let v=u.children.item(f);v.setAttribute("offset",g.offset*100+"%"),v.setAttribute("stop-color",g.color),a.isNull(g.opacity)||v.setAttribute("stop-opacity",g.opacity.toString()),f++}for(;u.children.length>t.stops.length;){let g=u.children.item(u.children.length-1);u.removeChild(g)}return u}_ensureMarker(e,t){let n=this._markers;n.has(e)||n.set(e,new WeakMap);let i=n.get(e);if(!i.has(t)){let p=document.createElementNS(vi,"marker");i.set(t,p);let u=document.createElementNS(vi,"path");p.appendChild(u),p.setAttribute("id","mark"+a.uniqueCode());let f=e,g;for(;a.isNull(g=f.querySelector(":scope > defs"));){let v=f.parentElement;if(v instanceof SVGElement)f=v;else break}if(a.isNull(g))throw new Error("Must provide a <defs> element.");g.appendChild(p)}let s=i.get(t),l=s.firstElementChild;return s.setAttribute("orient","auto-start-reverse"),a.isNullOrEmpty(t.viewbox)?s.removeAttribute("viewBox"):s.setAttribute("viewBox",`${t.viewbox.x} ${t.viewbox.y} ${t.viewbox.width} ${t.viewbox.height}`),a.isNullOrEmpty(t.ref)?(s.removeAttribute("refX"),s.removeAttribute("refY")):(s.setAttribute("refX",t.ref.x.toString()),s.setAttribute("refY",t.ref.y.toString())),t.height>0?s.setAttribute("markerHeight",t.height.toString()):s.removeAttribute("markerHeight"),t.width>0?s.setAttribute("markerWidth",t.width.toString()):s.removeAttribute("markerWidth"),l.setAttribute("d",t.pathData),a.isNullOrEmpty(t.fill)?l.removeAttribute("fill"):l.setAttribute("fill",t.fill),a.isNullOrEmpty(t.stroke)?l.removeAttribute("stroke"):l.setAttribute("stroke",t.stroke),s}};Ca=new WeakMap,Zo=new WeakMap,Rd=c([C({tagName:d+"-"+"2d"+"-svg-adapter"})],Rd);var Gg={};Se(Gg,{AdapterUtils:()=>os,BasicMaterialElement:()=>Od,DragEvent:()=>Go,KnownShader:()=>kn,LambertMaterialElement:()=>Ea,LineMaterialElement:()=>is,MaterialElement:()=>ft,OrbitCameraBehavior:()=>em,Pacem3DAdapterElement:()=>fa,Pacem3DCameraElement:()=>jr,Pacem3DDetector:()=>bg,Pacem3DElement:()=>Jt,Pacem3DGroupElement:()=>di,Pacem3DLightElement:()=>Er,Pacem3DMeshElement:()=>En,Pacem3DObjectElement:()=>wn,Pacem3DOrthographicCameraElement:()=>Wr,Pacem3DPerspectiveCameraElement:()=>pi,Pacem3DPrimitiveElement:()=>gt,Pacem3DThreeAdapterElement:()=>Ac,Pacem3DWebgpuAdapterElement:()=>ls,Pacem3DWgslScriptElement:()=>Da,PacemBoxElement:()=>Ut,PacemConeElement:()=>Lr,PacemCylinderElement:()=>Nr,PacemDodecahedronElement:()=>nl,PacemHexahedronElement:()=>tl,PacemIcosahedronElement:()=>rl,PacemLineElement:()=>ss,PacemOctahedronElement:()=>el,PacemOrbitCameraBehaviorElement:()=>Ar,PacemPlaneElement:()=>qr,PacemSphereElement:()=>yi,PacemTetrahedronElement:()=>Qo,PacemTorusElement:()=>Kr,PhongMaterialElement:()=>Ln,PolyhedronElement:()=>as,RenderableElement:()=>ci,RenderableEvent:()=>Fo,StalePropertyFlag:()=>hi,StandardMaterialElement:()=>bi,UI3DEvent:()=>xc,Ui3DElement:()=>At,computePlaneNormal:()=>ag,computeSharpVertexNormals:()=>Dt,isBasicMaterial:()=>kh,isCamera:()=>Vt,isGeometry:()=>_d,isGroup:()=>Wo,isInteraction:()=>wh,isLambertMaterial:()=>Mh,isLight:()=>ui,isLineMaterial:()=>va,isMaterial:()=>Yr,isMesh:()=>wr,isMeshGeometry:()=>Ec,isOrthographicCamera:()=>Eh,isPerspectiveCamera:()=>Ch,isPhongMaterial:()=>Sh,isRenderable:()=>yd,isShaderMaterial:()=>Vb,isStage:()=>sg,isStandardMaterial:()=>Lh,isUi3DObject:()=>Cc});var bg=class{constructor(){this._detected={supported:!1,info:{}};let r=document.createElement("canvas"),e=["webgl","experimental-webgl","moz-webgl","webkit-3d"],t,n=function(l){if(l)return t.getParameter(l)},i=(l,p,u)=>{let f=this._detected;var g=f.info[l]=f.info[l]||{};p=p.replace(/[^\w]+/g,""),p=p.substring(0,1).toLowerCase()+p.substring(1),g[p]=u};if(navigator.userAgent.indexOf("MSIE")>=0)try{t=window.WebGLHelper.CreateGLContext(r,"canvas")}catch{}else for(var s=0;s<e.length;s++)try{if(t=r.getContext(e[s]),t){i("main","Context Name",e[s]);break}}catch{}this._detected.supported=!!t,i("main","Platform",navigator.platform),i("main","Agent",navigator.userAgent),t&&(i("main","Vendor",n(t.VENDOR)),i("main","Version",n(t.VERSION)),i("main","Renderer",n(t.RENDERER)),i("main","Shading Language Version",n(t.SHADING_LANGUAGE_VERSION)),i("bits","Rgba Bits",n(t.RED_BITS)+", "+n(t.GREEN_BITS)+", "+n(t.BLUE_BITS)+", "+n(t.ALPHA_BITS)),i("bits","Depth Bits",n(t.DEPTH_BITS)),i("shader","Max Vertex Attribs",n(t.MAX_VERTEX_ATTRIBS)),i("shader","Max Vertex Texture Image Units",n(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),i("shader","Max Varying Vectors",n(t.MAX_VARYING_VECTORS)),i("shader","Max Uniform Vectors",n(t.MAX_VERTEX_UNIFORM_VECTORS)),i("tex","Max Combined Texture Image Units",n(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),i("tex","Max Texture Size",n(t.MAX_TEXTURE_SIZE)),i("tex","Max Cube Map Texture Size",n(t.MAX_CUBE_MAP_TEXTURE_SIZE)),i("tex","Num. Compressed Texture Formats",n(t.COMPRESSED_TEXTURE_FORMATS)),i("misc","Max Render Buffer Size",n(t.MAX_RENDERBUFFER_SIZE)),i("misc","Max Viewport Dimensions",n(t.MAX_VIEWPORT_DIMS)),i("misc","Aliased Line Width Range",n(t.ALIASED_LINE_WIDTH_RANGE)),i("misc","Aliased Point Size Range",n(t.ALIASED_POINT_SIZE_RANGE)),i("misc","Supported Extensions",t.getSupportedExtensions()||[]))}get info(){return this._detected.info}get supported(){return this._detected.supported}};var Od=class extends ft{constructor(){super("basic")}};Od=c([C({tagName:`${d}-${"3d"}-material-basic`})],Od);var Ea=class extends ft{constructor(){super("lambert")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:this.reflectivity??0,refractionRatio:this.refractionRatio??0},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"reflectivity":case"refractionRatio":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],Ea.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],Ea.prototype,"reflectivity",2),c([h({emit:!1,converter:m.Number})],Ea.prototype,"refractionRatio",2),Ea=c([C({tagName:`${d}-${"3d"}-material-lambert`})],Ea);var is=class extends ft{constructor(){super("line")}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"lineWidth":case"lineJoin":case"lineCap":case"dashArray":this.updateMaterial();break}}async createMaterial(){return a.extend({lineWidth:this.lineWidth??1,lineJoin:this.lineJoin??"round",lineCap:this.lineCap??"round",dashArray:this.dashArray},await super.createMaterial())}};c([h({emit:!1,converter:m.Number})],is.prototype,"lineWidth",2),c([h({emit:!1,converter:m.String})],is.prototype,"lineJoin",2),c([h({emit:!1,converter:m.String})],is.prototype,"lineCap",2),c([h({emit:!1,converter:{convert:r=>r?.split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),convertBack:r=>r?.join(",")}})],is.prototype,"dashArray",2),is=c([C({tagName:`${d}-${"3d"}-material-line`})],is);var Ln=class extends ft{constructor(){super("phong")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:this.reflectivity??0,refractionRatio:this.refractionRatio??0,specularColor:this.specularColor||"#000",shininess:this.shininess??0,flatShading:this.flatShading??!0},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"reflectivity":case"refractionRatio":case"specularColor":case"shininess":case"flatShading":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],Ln.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"reflectivity",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"refractionRatio",2),c([h({emit:!1,converter:m.String})],Ln.prototype,"specularColor",2),c([h({emit:!1,converter:m.Number})],Ln.prototype,"shininess",2),c([h({emit:!1,converter:m.Boolean})],Ln.prototype,"flatShading",2),Ln=c([C({tagName:`${d}-${"3d"}-material-phong`})],Ln);var bi=class extends ft{constructor(){super("standard")}async createMaterial(){return a.extend({emissiveColor:this.emissiveColor||"#000",refractionRatio:this.refractionRatio??0,metalness:this.metalness??0,roughness:this.roughness??0,flatShading:this.flatShading??!1},await super.createMaterial())}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"emissiveColor":case"roughness":case"metalness":case"refractionRatio":case"flatShading":this.updateMaterial();break}}};c([h({emit:!1,converter:m.String})],bi.prototype,"emissiveColor",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"refractionRatio",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"roughness",2),c([h({emit:!1,converter:m.Number})],bi.prototype,"metalness",2),c([h({emit:!1,converter:m.Boolean})],bi.prototype,"flatShading",2),bi=c([C({tagName:`${d}-${"3d"}-material-standard`})],bi);var gt=class extends K{viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.geometry)&&(this.geometry=this.createDefaultGeometry())}};c([h({converter:m.Json})],gt.prototype,"geometry",2);var Ut=class extends gt{static createMeshGeometry(r,e,t,n,i,s){let l=r||1,p=e||1,u=t||1,f=n||1,g=i||1,v=s||1,y=[],_=[],x=[];for(var w=0;w<=g;w++)for(var E=p/2-p*(1*w)/(1*g),k=0;k<=v;k++)for(var N=-u/2+u*(1*k)/(1*v),T=0;T<=f;T++){var O=-l/2+l*(1*T)/(1*f);(T==0||T==f||k==0||k==v||w==0||w==g)&&y.push({x:O,y:E,z:N})}for(var D=function(he,fe,le){for(var re=1e-5,Oe=0;Oe<y.length;Oe++){var ge=y[Oe];if(Math.abs(ge.x-he)<re&&Math.abs(ge.y-fe)<re&&Math.abs(ge.z-le)<re)return Oe}return-1},P=function(he,fe,le,re,Oe,ge,Ne,Pe){x.push(he),x.push(fe),x.push(le),x.push(he),x.push(le),x.push(re),_.push({x:Oe,y:Pe}),_.push({x:Ne,y:Pe}),_.push({x:Ne,y:ge}),_.push({x:Oe,y:Pe}),_.push({x:Ne,y:ge}),_.push({x:Oe,y:ge})},k=0;k<v;k++)for(var E=p/2,N=-u/2+u*(1*k)/(1*v),F=-u/2+u*(1*(k+1))/(1*v),T=0;T<f;T++){var O=-l/2+1*T*l/(1*f),B=-l/2+1*(T+1)*l/(1*f),$=D(O,E,F),U=D(B,E,F),I=D(B,E,N),G=D(O,E,N),Y=1*(T+1)/(1*f),W=1*T/(1*f),V=1-1*(k+1)/(1*v),X=1-1*k/(1*v);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-1*w*p/(1*g),q=p/2-(w+1)*p/(1*g),N=-u/2,T=0;T<f;T++){var O=l/2-1*T*l/(1*f),B=l/2-(T+1)*l/(1*f),$=D(O,q,N),U=D(B,q,N),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-1*w*p/(1*g),q=p/2-(w+1)*p/(1*g),O=-l/2,k=0;k<v;k++){var N=-u/2+k*u/(1*v),F=-u/2+(k+1)*u/(1*v),$=D(O,q,N),U=D(O,q,F),I=D(O,E,F),G=D(O,E,N),Y=(k+1)/(1*v),W=1*k/(1*v),V=1-(w+1)/(1*g),X=1-w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-w*p/(1*g),q=p/2-(w+1)*p/(1*g),N=u/2,T=0;T<f;T++){var O=-l/2+T*l/(1*f),B=-l/2+(T+1)*l/(1*f),$=D(O,q,N),U=D(B,q,N),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var w=0;w<g;w++)for(var E=p/2-w*p/(1*g),q=p/2-(w+1)*p/(1*g),O=l/2,k=0;k<v;k++){var N=u/2-k*u/(1*v),F=u/2-(k+1)*u/(1*v),$=D(O,q,N),U=D(O,q,F),I=D(O,E,F),G=D(O,E,N),Y=(k+1)/(1*v),W=1*k/(1*v),V=1-(w+1)/(1*g),X=1-1*w/(1*g);P($,U,I,G,W,X,Y,V)}for(var k=0;k<v;k++)for(var E=-p/2,N=u/2-u*k/(1*v),F=u/2-u*(k+1)/(1*v),T=0;T<f;T++){var O=-l/2+T*l/(1*f),B=-l/2+(T+1)*l/(1*f),$=D(O,E,F),U=D(B,E,F),I=D(B,E,N),G=D(O,E,N),Y=(T+1)/(1*f),W=1*T/(1*f),V=1-(k+1)/(1*v),X=1-1*k/(1*v);P($,U,I,G,W,X,Y,V)}let Z=new ze(y,x,_);Z.key=`box_${r}x${e}x${t}_w${n}_h${i}_d${s}`,Dt(Z);let ne={x:0,y:0,z:0},te=r/2,ae=e/2,Le=t/2;return Z.barycenter=ne,Z.boundingBox={maxX:te,maxY:ae,maxZ:Le,minX:-te,minY:-ae,minZ:-Le},Z.boundingSphere={center:ne,radius:Math.sqrt(Math.pow(te,2)+Math.pow(ae,2)+Math.pow(Le,2))},Z}createDefaultGeometry(){return Ut.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"width":case"height":case"depth":case"widthSegments":case"heightSegments":case"depthSegments":this.geometry=Ut.createMeshGeometry(this.width,this.height,this.depth,this.widthSegments,this.heightSegments,this.depthSegments);break}}};c([h({emit:!1,converter:m.Number})],Ut.prototype,"width",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"depth",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"widthSegments",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Ut.prototype,"depthSegments",2),Ut=c([C({tagName:d+"-"+"3d"+"-primitive-box"})],Ut);var Lr=class extends gt{static createMeshGeometry(r=1,e=1,t=18,n=5,i=1){let s=r,l=[],p=[],u=[],f=Zi*(360/t),g=s/e,v=e/n,y=1/t;l.push({x:0,y:e,z:0});for(let E=1;E<=n;E++){let k=e-v*E,N=k/e,T=(e-k)*g,D=(k+v)/e;for(let P=0;P<t;P++){let F=f*P,B=Math.cos(F)*T,$=-Math.sin(F)*T;l.push({x:B,y:k,z:$});let U=1+t*(E-1)+P,I=P==0?U+t-1:U-1,G=P*y,Y=P==0?1-y:y*(P-1);if(E==1){u.push(0,I,U),p.push({x:G,y:1},{x:Y,y:N},{x:G,y:N});continue}let W=1+t*(E-2)+P,X=P==0?W+t-1:W-1,q=I,Z=U,ne=W;u.push(Z,X,q),u.push(Z,ne,X);let te={x:Y,y:D},ae={x:Y,y:N},Le={x:G,y:N},he={x:G,y:D};p.push(Le,te,ae),p.push(Le,he,te)}}let _=1+(n-1)*t;l.push({x:0,y:0,z:0});let x=_+t;for(let E=1;E<=i;E++){let k=E/i,N=r*k,T=(E-1)/i;for(let O=0;O<t;O++){let D=f*O,P=Math.cos(D),F=Math.sin(D),B=D-f,$=Math.cos(B),U=Math.sin(B),I=.5*(1+P*k),G=.5*(1+F*k),Y=.5*(1+$*k),W=.5*(1+U*k),V,X;if(E!=i){let He=Math.cos(D)*N,Wt=-Math.sin(D)*N;l.push({x:He,y:0,z:Wt}),V=x+1+(E-1)*t+O,X=O==0?V+t-1:V-1}else V=_+O,X=O==0?_+t-1:V-1;if(E==1){u.push(x,V,X),p.push({x:.5,y:.5},{x:I,y:G},{x:Y,y:W});continue}let q=.5*(1+P*T),Z=.5*(1+F*T),ne=.5*(1+$*T),te=.5*(1+U*T),ae=x+1+(E-2)*t+O,he=O==0?ae+t-1:ae-1,fe=X,le=V,re=ae;u.push(he,re,fe),u.push(fe,re,le);let Oe={x:ne,y:te},ge={x:Y,y:W},Ne={x:I,y:G},Pe={x:q,y:Z};p.push(Oe,Pe,ge),p.push(ge,Pe,Ne)}}let w=new ze(l,u,p);return w.key=`cone_${r}x${e}_s${t}_h${n}_c${i}`,Dt(w),w}createDefaultGeometry(){return Lr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"height":case"sides":case"heightSegments":case"capSegments":this.geometry=Lr.createMeshGeometry(this.radius,this.height,this.sides,this.heightSegments,this.capSegments);break}}};c([h({emit:!1,converter:m.Number})],Lr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Lr.prototype,"capSegments",2),Lr=c([C({tagName:d+"-"+"3d"+"-primitive-cone"})],Lr);var Nr=class extends gt{static createMeshGeometry(r=1,e=1,t=18,n=5,i=1){let s=r,l=[],p=[],u=[],f=Zi*(360/t);l.push({x:0,y:e,z:0}),l.push({x:0,y:0,z:0});let g=s/i;for(let D=1;D<=i;D++)for(var v=g*D,y=0;y<t;y++){let P=2+2*t*(D-1),F=y==0?P+2*(t-1):P+2*(y-1),B=P+2*y,$=Math.cos(f*y),U=-Math.sin(f*y),I=Math.cos(f*(y-1)),G=-Math.sin(f*(y-1)),Y=v*$,W=v*U,V={x:Y,y:e,z:W},X={x:Y,y:0,z:W};l.push(V),l.push(X);let q=.5*v/s,Z=$*q,ne=U*q,te=I*q,ae=G*q;if(D==1){let Le=[0,F,B],he=[1,B+1,F+1],fe=[{x:.5,y:.5},{x:.5+te,y:.5-ae},{x:.5+Z,y:.5-ne}],le=[{x:.5,y:.5},{x:.5+Z,y:.5+ne},{x:.5+te,y:.5+ae}];u.push(...Le),u.push(...he);for(let re=0;re<fe.length;re++)p.push(fe[re]);for(let re=0;re<le.length;re++)p.push(le[re])}else{let Le=2+2*t*(D-2),he=y==0?Le+2*(t-1):Le+2*(y-1),fe=Le+2*y,le=.5*((D-1)/i),re=$*le,Oe=U*le,ge=I*le,Ne=G*le,Pe={x:.5+te,y:.5-ae},He={x:.5+Z,y:.5-ne},Wt={x:.5+re,y:.5-Oe},Gn={x:.5+ge,y:.5-Ne},vr={x:.5+te,y:.5+ae},qs={x:.5+Z,y:.5+ne},Vi={x:.5+re,y:.5+Oe},Ks={x:.5+ge,y:.5+Ne};u.push(F),u.push(B),u.push(he),u.push(he),u.push(B),u.push(fe),u.push(fe+1),u.push(B+1),u.push(F+1),u.push(fe+1),u.push(F+1),u.push(he+1),p.push(Pe),p.push(He),p.push(Gn),p.push(Gn),p.push(He),p.push(Wt),p.push(Vi),p.push(qs),p.push(vr),p.push(Vi),p.push(vr),p.push(Ks)}}let _=2+2*t*i,x=2+2*t*(i-1),w=1/t,E=1/n;for(let D=1;D<=n;D++)for(let P=0;P<t;P++){if(D!=n){var k=s*Math.cos(f*P),N=-s*Math.sin(f*P),T=e*D/n;l.push({x:k,y:T,z:N})}let F=P==0?t-1:P-1,B=D==1?x+2*F+1:_+t*(D-2)+F,$=D==1?x+2*P+1:_+t*(D-2)+P,U=D==n?x+2*P:_+t*(D-1)+P,I=D==n?x+2*F:_+t*(D-1)+F,G=F*w,Y=(D-1)*E,W=P==0?1:P*w,V=D*E,X={x:G,y:Y},q={x:W,y:Y},Z={x:W,y:V},ne={x:G,y:V};u.push(B),u.push($),u.push(U),u.push(B),u.push(U),u.push(I),p.push(X),p.push(q),p.push(Z),p.push(X),p.push(Z),p.push(ne)}let O=new ze(l,u,p);return O.key=`cylinder_${r}x${e}_s${t}_h${n}_c${i}`,Dt(O),O}createDefaultGeometry(){return Nr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"height":case"sides":case"heightSegments":case"capSegments":this.geometry=Nr.createMeshGeometry(this.radius,this.height,this.sides,this.heightSegments,this.capSegments);break}}};c([h({emit:!1,converter:m.Number})],Nr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"height",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"sides",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"heightSegments",2),c([h({emit:!1,converter:m.Number})],Nr.prototype,"capSegments",2),Nr=c([C({tagName:d+"-"+"3d"+"-primitive-cylinder"})],Nr);var kE=[{x:0,y:0,z:0},{x:0,y:1,z:0}],ss=class extends gt{static createLineGeometry(r){return new ga(r||kE)}createDefaultGeometry(){return ss.createLineGeometry()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="positions"&&(this.geometry=ss.createLineGeometry(t))}};c([h({emit:!1,converter:m.Json})],ss.prototype,"positions",2),ss=c([C({tagName:d+"-"+"3d"+"-primitive-line"})],ss);var qr=class extends gt{static createMeshGeometry(r,e,t,n){r||=1,e||=1,t||=4,n||=4;let i=r*.5,s=e*.5,l=[],p=[],u=[],f=[],g=we.LinearAlgebra.Vector3D.from(0,0,1);for(let y=0;y<=n;y++)for(let _=0;_<=t;_++){let x=-i+_*r/(1*t),w=0,E=-s+y*e/(1*n);if(l.push({x,y:w,z:E}),y<n&&_<t){let k=t+1,N=(_+1)/(1*t),T=1*_/(1*t),O=1-(y+1)/(1*n),D=1-1*y/(1*n);u.push((y+1)*k+_),u.push((y+1)*k+_+1),u.push(y*k+_+1),u.push((y+1)*k+_),u.push(y*k+_+1),u.push(y*k+_),p.push({x:T,y:O}),p.push({x:N,y:O}),p.push({x:N,y:D}),p.push({x:T,y:O}),p.push({x:N,y:D}),p.push({x:T,y:D}),f.push(g,g,g,g,g,g)}}let v=new ze(l,u,p,f);return v.key=`plane_${r}x${e}_w${t}_l${n}`,v}createDefaultGeometry(){return qr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"width":case"length":case"widthSegments":case"lengthSegments":this.geometry=qr.createMeshGeometry(this.width,this.length,this.widthSegments,this.lengthSegments);break}}};c([h({emit:!1,converter:m.Number})],qr.prototype,"width",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"length",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"widthSegments",2),c([h({emit:!1,converter:m.Number})],qr.prototype,"lengthSegments",2),qr=c([C({tagName:d+"-"+"3d"+"-primitive-plane"})],qr);var il={parseFloats:function(o){let r=/([\d.-]+)/i;var e=r.exec(o);let t=[];for(;e!=null;){let n=e[0],i=parseFloat(n);t.push(i),o=o.replace(n,""),e=r.exec(o)}return t}},et=we.LinearAlgebra.Vector3D,as=class extends gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="radius"&&this._assignMeshGeometry(t)}_assignMeshGeometry(r){this.geometry=this.createMeshGeometry(r>0?r:1)}createDefaultGeometry(){return this.createMeshGeometry(1)}};c([h({emit:!1,converter:m.Number})],as.prototype,"radius",2);var Qo=class extends as{static createMeshGeometry(r){r||=1;let t="0 0.5774 -0.8165, 0 0.5774 0.8165, 0.8165 -0.5774 0, -0.8165 -0.5774 0".split(","),n=[];for(let g=0;g<t.length;g++){let v=t[g],y=il.parseFloats(v);n.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let i=[1,2,0,2,3,0,3,1,0,3,2,1],l="0.5 0.9995, 0.5 0.0004995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995".split(","),p=[4,5,6,7,8,9,10,11,0,3,2,1],u=[];for(let g=0;g<p.length;g++){let v=p[g],y=il.parseFloats(l[v]);u.push({x:y[0],y:y[1]})}let f=new ze(n,i,u);return f.key=`tetrahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return Qo.createMeshGeometry(r)}};Qo=c([C({tagName:d+"-"+"3d"+"-primitive-tetrahedron"})],Qo);var el=class extends as{static createMeshGeometry(r){r||=1;let e="0 0.7071 -0.7071, 0 0.7071 0.7071, 1 0 0, 0 -0.7071 -0.7071, -1 0 0, 0 -0.7071 0.7071",t=[1,2,0,2,3,0,3,4,0,4,1,0,4,5,1,5,2,1,2,5,3,4,3,5],n="0.5 0.9995, 0.5 0.9995, 0.0004995 0.5, 0.5 0.9995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.9995",i=[6,7,8,9,10,11,12,13,14,15,16,0,17,18,19,20,21,1,2,22,23,4,3,5],s=e.split(","),l=[];for(let g=0;g<s.length;g++){let v=s[g],y=il.parseFloats(v);l.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let p=n.split(","),u=[];for(let g=0;g<i.length;g++){let v=i[g],y=il.parseFloats(p[v]);u.push({x:y[0],y:y[1]})}let f=new ze(l,t,u);return f.key=`octahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return el.createMeshGeometry(r)}};el=c([C({tagName:d+"-"+"3d"+"-primitive-octahedron"})],el);var tl=class extends as{static createMeshGeometry(r){r||=1;let e=1/Math.sqrt(3),t=2*r*e,n=Ut.createMeshGeometry(t,t,t);return n.key=`hexahedron_${r}`,n}createMeshGeometry(r=this.radius){return tl.createMeshGeometry(r)}};tl=c([C({tagName:d+"-"+"3d"+"-primitive-hexahedron"})],tl);var rl=class extends as{static createMeshGeometry(r){r||=1;let e="0 0.850651 -0.525731, 0 0.850651 0.525731, 0.850651 0.525731 0, 0.525731 0 -0.850651, -0.525731 0 -0.850651, -0.850651 0.525731 0, -0.525731 0 0.850651, 0.525731 0 0.850651, 0.850651 -0.525731 0, 0 -0.850651 0.525731, 0 -0.850651 -0.525731, -0.850651 -0.525731 0",t=[1,2,0,2,3,0,3,4,0,4,5,0,5,1,0,5,6,1,6,7,1,7,2,1,2,8,3,2,7,8,6,9,7,9,8,7,8,10,3,8,9,10,6,11,9,11,10,9,10,4,3,10,11,4,6,5,11,5,4,11],n="0.5 0.808708, 0.5 0.999501, 0.5 0.808708, 0.191292 0.5, 0.000499547 0.5, 0.5 0.808708, 0.9995 0.5, 0.808708 0.5,0.000499487 0.5, 0.5 0.191292, 0.5 0.000499487, 0.5 0.191292,0.5 0.191292, 0.999501 0.5, 0.5 0.808708, 0.5 0.808708,0.9995 0.5, 0.808708 0.999501, 0.191292 0.5, 0.808708 0.5,0.5 0.999501, 0.808708 0.5, 0.999501 0.808708, 0.5 0.999501,0.000499487 0.5, 0.5 0.191292, 0.5 0.808708, 0.9995 0.5,0.808708 0.999501, 0.191292 0.5, 0.808708 0.5, 0.5 0.999501,0.808708 0.5, 0.999501 0.808708, 0.5 0.808708, 0.5 0.191292,0.9995 0.5, 0.000499547 0.5, 0.5 0.191292, 0.191292 0.5,0.5 0.000499487, 0.808708 0.5, 0.5 0.000499487, 0.999501 0.191292,0.5 0.191292, 0.808708 0.000499487, 0.9995 0.5, 0.5 0.191292,0.5 0.808708, 0.9995 0.5, 0.5 0.191292, 0.808708 0.000499487,0.999501 0.5, 0.5 0.808708, 0.5 0.000499487, 0.808708 0.5,0.999501 0.191292, 0.808708 0.5, 0.5 0.808708, 0.5 0.191292",i=[12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,26,27,28,29,30,31,32,33,1,34,35,36,2,37,38,39,40,41,42,43,7,44,45,46,8,47,48,49,50,51,52,53,9,54,55,3,10,56,57,6,58,59,5,4,11],s=e.split(","),l=[];for(let g=0;g<s.length;g++){let v=s[g],y=il.parseFloats(v);l.push({x:y[0]*r,y:y[1]*r,z:y[2]*r})}let p=n.split(","),u=[];for(let g=0;g<i.length;g++){let v=i[g],y=il.parseFloats(p[v]);u.push({x:y[0],y:y[1]})}let f=new ze(l,t,u);return f.key=`icosahedron_${r}`,Dt(f),f.boundingSphere={center:et.zero(),radius:r},f}createMeshGeometry(r=this.radius){return rl.createMeshGeometry(r)}};rl=c([C({tagName:d+"-"+"3d"+"-primitive-icosahedron"})],rl);var nl=class extends as{static createMeshGeometry(r){r||=1;let e=et.from(.356822*r,.934172*r,0*r),t=et.from(-.356822*r,.934172*r,0*r),n=et.from(.57735*r,.57735*r,-.57735*r),i=et.from(0*r,.356822*r,-.934172*r),s=et.from(-.57735*r,.57735*r,-.57735*r),l=et.from(-.57735*r,.57735*r,.57735*r),p=et.from(0*r,.356822*r,.934172*r),u=et.from(.57735*r,.57735*r,.57735*r),f=et.from(.934172*r,0*r,-.356822*r),g=et.from(.934172*r,0*r,.356822*r),v=et.from(0*r,-.356822*r,.934172*r),y=et.from(.57735*r,-.57735*r,.57735*r),_=et.from(.57735*r,-.57735*r,-.57735*r),x=et.from(.356822*r,-.934172*r,0*r),w=et.from(-.57735*r,-.57735*r,.57735*r),E=et.from(-.356822*r,-.934172*r,0*r),k=et.from(0*r,-.356822*r,-.934172*r),N=et.from(-.57735*r,-.57735*r,-.57735*r),T=et.from(-.934172*r,0*r,.356822*r),O=et.from(-.934172*r,0*r,-.356822*r),D=[e,t,n,i,s,l,p,u,f,g,v,y,_,x,w,E,k,N,T,O],P=[0,2,3,0,3,4,0,4,1,1,5,6,1,6,7,1,7,0,7,9,8,7,8,2,7,2,0,7,6,10,7,10,11,7,11,9,11,13,12,11,12,8,11,8,9,11,10,14,11,14,15,11,15,13,15,17,16,15,16,12,15,12,13,15,14,18,15,18,19,15,19,17,19,4,3,19,3,16,19,16,17,19,18,5,19,5,1,19,1,4,18,14,10,18,10,6,18,6,5,3,2,8,3,8,12,3,12,16],F=`0.5 0.999501, 0.5 0.999501, 0.191292 0.808708, 0.5 0.690792,
|
|
18
18
|
0.191292 0.808708, 0.191292 0.808708, 0.5 0.690792,
|
|
19
19
|
0.808708 0.808708, 0.000499517 0.5, 0.309208 0.5, 0.5 0.309208,
|
|
20
20
|
0.191292 0.191292, 0.191292 0.191292, 0.309208 0.5,
|
|
@@ -43,10 +43,10 @@ ${$.message??$}`),B()}else B()}else throw`Howcome? ${_} misinterpreted as ${N} b
|
|
|
43
43
|
0.808708 0.808708, 0.309208 0.5, 0.808708 0.808708,
|
|
44
44
|
0.5 0.999501, 0.000499517 0.5, 0.5 0.309208, 0.000499517 0.5,
|
|
45
45
|
0.5 0.690792, 0.5 0.690792, 0.000499517 0.5, 0.5 0.690792,
|
|
46
|
-
0.191292 0.191292`,B=[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,0,46,47,48,49,50,51,7,52,53,54,55,56,57,58,59,60,61,9,62,63,64,65,66,67,11,68,69,70,71,72,73,74,75,76,77,13,78,79,80,81,82,83,15,84,85,86,87,88,89,90,91,92,93,17,94,95,96,97,98,99,19,1,4,100,14,101,102,10,103,18,6,5,104,2,105,106,8,107,3,12,16],$=F.split(","),U=[];for(let G=0;G<B.length;G++){let Y=B[G],W=il.parseFloats($[Y]);U.push({x:W[0],y:W[1]})}let I=new ze(D,P,U);return I.key=`dodecahedron_${r}`,Dt(I),I.boundingSphere={center:et.zero(),radius:r},I}createMeshGeometry(r=this.radius){return nl.createMeshGeometry(r)}};nl=c([C({tagName:d+"-"+"3d"+"-primitive-dodecahedron"})],nl);var yi=class extends gt{static createMeshGeometry(r=1,e=8){let t=[],n=[],i=[],s=r,l=e,p=Zi*(360/l),u=l%2==0?l/2:(l-1)/2;t.push({x:0,y:s,z:0});for(let v=1;v<u;v++){let y=p*v,_=Math.cos(y),x=Math.sin(y),w=1-1*v/u;for(let E=0;E<l;E++){let k=p*E-Math.PI/2,N=Math.cos(k),T=Math.sin(k),O=s*x*N,D=s*_,P=s*x*T;t.push({x:O,y:D,z:P});let F=E==0?l-1:E-1,B=E==0?0:1-1*E/l,$=1-1*F/l;if(v==1)i.push(1+E),i.push(1+F),i.push(0),n.push({x:B,y:w}),n.push({x:$,y:w}),n.push({x:.5,y:1});else{i.push((v-1)*l+E+1),i.push((v-1)*l+F+1),i.push((v-2)*l+F+1),i.push((v-1)*l+E+1),i.push((v-2)*l+F+1),i.push((v-2)*l+E+1);let U=1-(v-1)/u;n.push({x:B,y:w}),n.push({x:$,y:w}),n.push({x:$,y:U}),n.push({x:B,y:w}),n.push({x:$,y:U}),n.push({x:B,y:U})}}}t.push({x:0,y:-s,z:0});let f=t.length-1;for(let v=0;v<l;v++){let y=u-2,_=v==0?l-1:v-1,x=v==0?0:1-1*v/l,w=1-1*_/l,E=1-(y+1)/u;i.push(f),i.push(y*l+1+_),i.push(y*l+1+v),n.push({x:.5,y:0}),n.push({x:w,y:E}),n.push({x,y:E})}let g=new ze(t,i,n);return g.key=`sphere_${r}_s${e}`,Dt(g),g}createDefaultGeometry(){return yi.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"segments":this.geometry=yi.createMeshGeometry(this.radius,this.segments);break}}};c([h({emit:!1,converter:m.Number})],yi.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],yi.prototype,"segments",2),yi=c([C({tagName:d+"-"+"3d"+"-primitive-sphere"})],yi);var Kr=class extends gt{static createMeshGeometry(r=1,e=.25,t=24,n=12){let i=[],s=[],l=[],p=Zi*(360/t),u=Zi*(360/n),f=r,g=e;for(let y=0;y<t;y++){let _=p*y-Math.PI/2,x=Math.sin(_),w=Math.cos(_);for(let E=0;E<n;E++){let k=u*E+Math.PI,N=Math.cos(k),T=f*w+g*N*w,O=g*Math.sin(k),D=f*x+g*N*x;i.push({x:T,y:O,z:D});let P=y>0?y-1:t-1,F=E>0?E-1:n-1,B=y==0?0:1-1*y/t,$=E>0?1*E/n:1,U=y>0?1-(y-1)/t:1/t,I=E>0?(E-1)/n:1-1/n;l.push(y*n+F),l.push(P*n+F),l.push(P*n+E),l.push(y*n+F),l.push(P*n+E),l.push(y*n+E),s.push({x:B,y:I}),s.push({x:U,y:I}),s.push({x:U,y:$}),s.push({x:B,y:I}),s.push({x:U,y:$}),s.push({x:B,y:$})}}let v=new ze(i,l,s);return v.key=`torus_${r}x${e}_t${t}_s${n}`,Dt(v),v}createDefaultGeometry(){return Kr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"innerRadius":case"segments":case"sides":this.geometry=Kr.createMeshGeometry(this.radius,this.innerRadius,this.segments,this.sides);break}}};c([h({emit:!1,converter:m.Number})],Kr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"innerRadius",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"segments",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"sides",2),Kr=c([C({tagName:d+"-"+"3d"+"-primitive-torus"})],Kr);function kE(o,r){let e,t;if(se.isPoint(o))e=o.x,t=o.y;else{let{page:s}=de.getEventCoordinates(o),l={x:s.x-r.x,y:s.y-r.y};e=l.x,t=l.y}let n=e/r.width*2-1,i=t/r.height*-2+1;return{x:n,y:i}}var os=class o{static isMeshGeometry(r){return"positions"in r&&a.isArray(r.positions)&&"triangleIndices"in r&&a.isArray(r.triangleIndices)}static isVector3D(r){return"x"in r&&typeof r.x=="number"&&"y"in r&&typeof r.y=="number"&&"z"in r&&typeof r.z=="number"}static isRgba(r){return"r"in r&&typeof r.r=="number"&&"g"in r&&typeof r.g=="number"&&"b"in r&&typeof r.b=="number"}static flattenVectorArray(r){let e=[];for(let t of r)o.isVector3D(t)?e.push(t.x,t.y,t.z):o.isRgba(t)?e.push(t.r,t.g,t.b,t.a??1):e.push(t.x,t.y);return e}static findCamera(r){return(r||[]).find(e=>Vt(e)&&!e.hide)}clipPixel(r,e){return e instanceof HTMLElement&&(e=a.offsetRect(e)),kE(r,e)}};function Ih(o){return os.flattenVectorArray(o)}var Zb="0.152.2",ME="0.147.0",$h={VERSION:Zb,API_URI:`https://unpkg.com/three@${Zb}/build/three.min.js`,ORBIT_URI:`https://unpkg.com/three@${ME}/examples/js/controls/OrbitControls.js`,LOADERS:[],DEFAULT_MATERIAL:function(){return new THREE.MeshStandardMaterial({color:"#069",flatShading:!0})}};function SE(o,r,e,t=1.333){let n=new THREE.Box3;for(let y of e)n.expandByObject(y);let i=n.getSize(new THREE.Vector3),s=n.getCenter(new THREE.Vector3),p=Math.max(i.x,i.y,i.z)/(2*Math.atan(Math.PI*o.fov/360)),u=p/o.aspect,f=t*Math.max(p,u),g=!a.isNull(r);var v;g&&(v=r.target.clone().sub(o.position).normalize().multiplyScalar(f),r.maxDistance=f*10,r.target.copy(s)),o.near=f/100,o.far=f*100,o.updateProjectionMatrix(),g&&(o.position.copy(r.target).sub(v),r.update())}function LE(o){return[o.m11,o.m21,o.m31,o.offsetX,o.m12,o.m22,o.m32,o.offsetY,o.m13,o.m23,o.m33,o.offsetZ,o.m14,o.m24,o.m34,o.m44]}function NE(o){let r=new THREE.BufferGeometry,e=Ih(o.positions);if(r.setAttribute("position",new THREE.Float32BufferAttribute(e,3)),o instanceof ze){a.isNullOrEmpty(o.triangleIndices)||r.setIndex(o.triangleIndices);let t=Ih(o.positions);r.setAttribute("position",new THREE.Float32BufferAttribute(t,3));let n=Ih(o.textureCoordinates);if(r.setAttribute("uv",new THREE.Float32BufferAttribute(n,2)),a.isNullOrEmpty(o.normals))r.computeVertexNormals();else{let i=Ih(o.normals);r.setAttribute("normal",new THREE.Float32BufferAttribute(i,3))}}return r}function TE(o){var r;if(o.type==="spot"){let e=new THREE.SpotLight;e.target.position.set(o.target.x,o.target.y,o.target.z),r=e}else r=new THREE.PointLight;return r}function Qb(o){if(a.isNull(o))return null;let r={color:typeof o.color=="string"?o.color:Be.stringify(o.color),opacity:o.opacity??1,transparent:!0,wireframe:o.wireframe??!1,visible:o.visible??!0},e=a.extend({},r,{wireframe:o.wireframe??!1}),t=n=>(o.map&&(n.map=new THREE.TextureLoader().load(o.map,i=>{n.needsUpdate=!0})),n);if(Lh(o))return t(new THREE.MeshStandardMaterial(a.extend(e,{roughness:o.roughness,metalness:o.metalness,emissive:o.emissiveColor,flatShading:o.flatShading,refractionRatio:o.refractionRatio})));if(Sh(o))return t(new THREE.MeshPhongMaterial(a.extend(e,{shininess:o.shininess,emissive:o.emissiveColor,flatShading:o.flatShading,specular:o.specularColor,reflectivity:o.reflectivity,refractionRatio:o.refractionRatio})));if(Mh(o))return t(new THREE.MeshLambertMaterial(a.extend(e,{emissive:o.emissiveColor,reflectivity:o.reflectivity,refractionRatio:o.refractionRatio})));if(va(o)){let n=o.dashArray&&o.dashArray[0]||null,i=o.dashArray&&o.dashArray.length>1&&o.dashArray[1]||n,s=a.extend(r,{linecap:o.lineCap??"round",linejoin:o.lineJoin??"round",linewidth:o.lineWidth??1});return a.isNullOrEmpty(o.dashArray)?new THREE.LineBasicMaterial(s):new THREE.LineDashedMaterial(a.extend({dashSize:n,gapSize:i},s))}else return Yr(o)?t(new THREE.MeshBasicMaterial(e)):null}function AE(o,r,e){let t=e,n=[],i=Qb(o);if(a.isNull(i)||(i.side=THREE.FrontSide,n.push(i)),!a.isNull(r))if(r==o)i.side=THREE.DoubleSide;else{let s=Qb(r);a.isNull(s)||(s.side=THREE.BackSide,n.push(s))}return t&&n.length>1?n:i}function ey(o){if(a.isNullOrEmpty(o.content))throw new Error("Missing content.");return o.type?.toLowerCase()==="obj"?new THREE.OBJLoader().parse(o.content):new THREE.ObjectLoader().parse(o.content)}function DE(o){return o instanceof ga?THREE.Line:THREE.Mesh}function ty(o){if(a.isNullOrEmpty(o.geometry))return null;let r=DE(o.geometry);return new r}function Pd(){return"THREE"in window}async function RE(...o){let r=Date.now();var e=!1;do{e=Pd();for(let t of o)e&&=t();e||await new Promise(t=>setTimeout(t,500))}while(!e&&Date.now()-r<3e4);if(!e)throw new Error("The wait for THREE adapter initialization timed out.")}var Ac=class extends fa{constructor(){super(...arguments);this._renderer=null;this._camera=null;this._scene=null;this._orbitCtrls=null;this._objects=new WeakMap;this._dict={};this._orbitControlsDelegate=e=>{};this._ensureAndRefresh=(e,t,n)=>{if(t.matrixAutoUpdate=!1,t.visible=!e.hide){if(wr(e)){let s=t;if(e.flags.indexOf("geometry")>=0){s.geometry.dispose();let l=ty(e);l.constructor.name!==s.constructor.name&&(n.remove(t),delete this._dict[t.id],t=s=l),s.geometry=NE(e.geometry)}if(e.flags.indexOf("material")>=0){if(a.isArray(s.material))for(let l of s.material)l.dispose();else s.material.dispose();s.material=AE(e.material)||$h.DEFAULT_MATERIAL()}}else if(e instanceof wn&&(e.flags.indexOf("material")>=0||e.flags.indexOf("geometry")>=0))t.parent&&t.parent.remove(t),t=ey(e);else if(e instanceof di){if(e.flags.indexOf("children")>=0){for(let s=t.children.length-1;s>=0;s--){let l=t.children[s];t.remove(l)}for(let s of e.items)this._addOrUpdateItem(s,t)}}else if(e instanceof Er){let s=t;e.flags.indexOf("light")>=0&&(s.color=new THREE.Color(e.color),s.intensity=e.intensity)}let i=e.position;if(Cc(e)&&!a.isNull(e.transformMatrix)&&(e.flags.indexOf("position")>=0||e.flags.indexOf("transform")>=0)){let s=we.LinearAlgebra.Matrix3D.from(1,0,0,0,0,1,0,0,0,0,1,0,i.x,i.y,i.z,1),l=we.LinearAlgebra.Matrix3D.multiply(e.transformMatrix,s);THREE.Matrix4.prototype.set.apply(t.matrix,LE(l))}else e.flags.indexOf("position")>=0&&(t.position.set(i.x,i.y,i.z),t.updateMatrix())}return t.userData=e.tag,a.isNull(n.getObjectById(t.id))&&(n.add(t),this._dict[t.id]=e),e.flags.splice(0),t}}_assertMonoStage(e){if(e!=this._3d&&!a.isNull(this._3d))throw new Error("Stage mismatch.")}dispose(e){}snapshot(e,t,n,i){if(e!=this._3d)return Promise.resolve(null);let s=!a.isNullOrEmpty(t),l=n??(s?"image/jpeg":null),p=i??(s?.9:null);return new Promise((u,f)=>{this.render(),a.snapshotElement(this._stage,t,l,p).then(u)})}project(e,t){if(this._assertMonoStage(e),a.isNull(this._camera)||a.isNull(this._stage))return null;let n=this._stage,i=new THREE.Vector3(t.x,t.y,t.z),s=n.width,l=n.height,p=s/2,u=l/2,f=i.project(this._camera),g=f.x*p+p,v=-(f.y*u)+u;return{x:g,y:v}}zoomFit(e,...t){return this._assertMonoStage(e),new Promise((n,i)=>{let s=this._camera,l=this._objects,p=t.filter(u=>l.has(u)).map(u=>l.get(u));(a.isNull(s)||a.isNullOrEmpty(p))&&n(),SE(s,this._orbitCtrls,p),n()})}getScene(e){return this._assertMonoStage(e),this._scene}raycast(e,t,n,i){if(this._assertMonoStage(e),Pd()&&!a.isNull(this._camera)){let s=this._camera,l=new THREE.Vector2(t.x/n.width*2-1,-(t.y/n.height)*2+1),p=new THREE.Raycaster;p.setFromCamera(l,s);let u=p.intersectObjects(this._scene.children,!0),f,g,v=0;for(;u.length>v&&(g=u[v++])&&(f=g.object);){if(this._dict[f.id].inert)continue;let _=g.point,x=_.x,w=_.y,E=_.z,k={x,y:w,z:E};i({object:this._dict[f.id],point:k});return}}i(null)}async initialize(e){if(!a.isNull(this._stage))return this._stage;this._3d=e;let t=e.stage,n=this._stage=document.createElement("canvas");t.innerHTML="",t.appendChild(n),Pd()||(await A.importjs($h.API_URI),await RE(),await Promise.all([A.importjs($h.ORBIT_URI)].concat($h.LOADERS.map(p=>A.importjs(p))))),this._scene=new THREE.Scene,this.invalidateSize(e);let i=this._stage.width,s=this._stage.height,l={canvas:n,antialias:!0,stencil:!1,alpha:e.transparent??!0};if(this._renderer=new THREE.WebGLRenderer(l),this._renderer.setSize(i,s),e.background&&!e.transparent){let p=e.background;typeof p=="string"&&(p=Be.parse(p));let u=new THREE.Color(p.r,p.g,p.b);this._renderer.setClearColor(u,p.a)}return this.orbit=e.orbit,n}_setCamera(e){this._camera=e,this.invalidateSize(this._3d),this._disposeOrbitControls(),this.orbit&&this._initOrbitControls()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="orbit"&&(n===!0?this._initOrbitControls():this._disposeOrbitControls())}_initOrbitControls(){let e=this._camera;if(a.isNull(this._3d)||a.isNull(e))return;(this._orbitCtrls=new THREE.OrbitControls(e,this._3d.stage)).addEventListener("change",this._orbitControlsDelegate)}_disposeOrbitControls(){let e=this._orbitCtrls;a.isNull(e)||(e.removeEventListener("change",this._orbitControlsDelegate),e.dispose())}_updateRenderer(e,t=this._renderer){if(e.transparent)t.setClearAlpha(0);else if(e.background){let n=e.background;typeof n=="string"&&(n=Be.parse(n));let i=new THREE.Color(n.r,n.g,n.b);t.setClearColor(i,n.a)}else t.setClearColor(null)}invalidateSize(e,t=e.size){if(this._assertMonoStage(e),!Pd()||a.isNull(t))return;let n=t.width,i=t.height;this._stage.width=n,this._stage.height=i;let s=this._camera;s instanceof THREE.PerspectiveCamera&&(s.aspect=n/i,s.updateProjectionMatrix()),this._renderer&&(this._renderer.setSize(n,i),this._updateRenderer(e))}removeItem(e,t){this._assertMonoStage(e);let n=this._objects,i=n.get(t);a.isNull(i)||(this._scene.remove(i),delete this._dict[i.id],n.delete(t))}updateItem(e,t){this._assertMonoStage(e);let n=this._objects;if(!a.isNull(t.parent)&&n.has(t.parent)){let i=n.get(t.parent);this._addOrUpdateItem(t,i)}else this._addOrUpdateItem(t)}addItem(e,t){this._assertMonoStage(e),this._addOrUpdateItem(t)}_addOrUpdateItem(e,t=this._scene){if(!(!Pd()||a.isNull(t)))if(e instanceof jr)if(e instanceof pi){var n;if(this._camera instanceof THREE.PerspectiveCamera)var n=this._camera;else n=new THREE.PerspectiveCamera;let s=new THREE.Vector3(e.lookAt.x,e.lookAt.y,e.lookAt.z);n.lookAt(s),n.position.set(e.position.x,e.position.y,e.position.z),n.fov=e.fov,n.aspect=e.aspect,n.near=e.near,n.far=e.far,this._setCamera(n);let l=this._orbitCtrls;!a.isNull(l)&&l.object===n&&(l.target=s,l.update())}else if(e instanceof Wr){var i;if(this._camera instanceof THREE.OrthographicCamera)var i=this._camera;else i=new THREE.OrthographicCamera;let s=new THREE.Vector3(e.lookAt.x,e.lookAt.y,e.lookAt.z);i.lookAt(s),i.position.set(e.position.x,e.position.y,e.position.z),i.left=e.left,i.right=e.right,i.top=e.top,i.bottom=e.bottom,i.near=e.near,i.far=e.far,this._setCamera(i);let l=this._orbitCtrls;!a.isNull(l)&&l.object===i&&(l.target=s,l.update())}else throw new Error(`Camera ${e} not supported.`);else if(this._objects.has(e)){let s=this._objects.get(e),l=this._ensureAndRefresh(e,s,t);l!=s&&this._objects.set(e,l)}else{let s=l=>{l&&(l=this._ensureAndRefresh(e,l,t),this._objects.set(e,l))};if(e instanceof wn){let l=ey(e);s(l)}else if(e instanceof En){let l=ty(e);s(l)}else if(e instanceof Er){let l=TE(e);s(l)}else if(e instanceof di){let l=new THREE.Group;s(l)}}}render(){this._camera&&this._renderer.render(this._scene,this._camera)}};c([h({emit:!1,converter:m.Boolean})],Ac.prototype,"orbit",2),Ac=c([C({tagName:d+"-3d-three-adapter"})],Ac);var Ve="pacem-3d-";var sl="color",Hh="ambient",Id="lighting",_i="VertexInput",Zt="VertexOutput",wa="InteractionData";var Lt=class{static create(r,e,t=""){let n=r.createBuffer({size:e.byteLength,label:t,usage:40,mappedAtCreation:!0});return new Float32Array(n.getMappedRange()).set(e),n.unmap(),n}static createUniform(r,e,t=""){return r.createBuffer({size:e.byteLength,label:t,usage:72})}static createStorage(r,e,t=""){return r.createBuffer({size:e.byteLength,label:t,usage:136})}static createIndexed(r,e,t=""){let n=r.createBuffer({size:e.byteLength,label:t,usage:24,mappedAtCreation:!0});return new Uint16Array(n.getMappedRange()).set(e),n.unmap(),n}},al=class{static createVertex(r=0,e=3,...t){let n=[],i=0,s=0;for(let l of[e].concat(t))n.push({shaderLocation:r+s,offset:i*Float32Array.BYTES_PER_ELEMENT,format:`float32x${l}`}),i+=l,s++;return{arrayStride:i*Float32Array.BYTES_PER_ELEMENT,attributes:n,stepMode:"vertex"}}};var ry={outputNormalLocation:0,outputVertexLocation:1,outputUvLocation:2,outputVertexIndexLocation:3,outputRayIndexLocation:4,outputInstanceIndexLocation:5,storageMaterialGroupIndex:2,storageMaterialBindingIndex:0};function ny(o=[]){return o.join(`\r
|
|
47
|
-
`)}function
|
|
46
|
+
0.191292 0.191292`,B=[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,0,46,47,48,49,50,51,7,52,53,54,55,56,57,58,59,60,61,9,62,63,64,65,66,67,11,68,69,70,71,72,73,74,75,76,77,13,78,79,80,81,82,83,15,84,85,86,87,88,89,90,91,92,93,17,94,95,96,97,98,99,19,1,4,100,14,101,102,10,103,18,6,5,104,2,105,106,8,107,3,12,16],$=F.split(","),U=[];for(let G=0;G<B.length;G++){let Y=B[G],W=il.parseFloats($[Y]);U.push({x:W[0],y:W[1]})}let I=new ze(D,P,U);return I.key=`dodecahedron_${r}`,Dt(I),I.boundingSphere={center:et.zero(),radius:r},I}createMeshGeometry(r=this.radius){return nl.createMeshGeometry(r)}};nl=c([C({tagName:d+"-"+"3d"+"-primitive-dodecahedron"})],nl);var yi=class extends gt{static createMeshGeometry(r=1,e=8){let t=[],n=[],i=[],s=r,l=e,p=Zi*(360/l),u=l%2==0?l/2:(l-1)/2;t.push({x:0,y:s,z:0});for(let v=1;v<u;v++){let y=p*v,_=Math.cos(y),x=Math.sin(y),w=1-1*v/u;for(let E=0;E<l;E++){let k=p*E-Math.PI/2,N=Math.cos(k),T=Math.sin(k),O=s*x*N,D=s*_,P=s*x*T;t.push({x:O,y:D,z:P});let F=E==0?l-1:E-1,B=E==0?0:1-1*E/l,$=1-1*F/l;if(v==1)i.push(1+E),i.push(1+F),i.push(0),n.push({x:B,y:w}),n.push({x:$,y:w}),n.push({x:.5,y:1});else{i.push((v-1)*l+E+1),i.push((v-1)*l+F+1),i.push((v-2)*l+F+1),i.push((v-1)*l+E+1),i.push((v-2)*l+F+1),i.push((v-2)*l+E+1);let U=1-(v-1)/u;n.push({x:B,y:w}),n.push({x:$,y:w}),n.push({x:$,y:U}),n.push({x:B,y:w}),n.push({x:$,y:U}),n.push({x:B,y:U})}}}t.push({x:0,y:-s,z:0});let f=t.length-1;for(let v=0;v<l;v++){let y=u-2,_=v==0?l-1:v-1,x=v==0?0:1-1*v/l,w=1-1*_/l,E=1-(y+1)/u;i.push(f),i.push(y*l+1+_),i.push(y*l+1+v),n.push({x:.5,y:0}),n.push({x:w,y:E}),n.push({x,y:E})}let g=new ze(t,i,n);return g.key=`sphere_${r}_s${e}`,Dt(g),g}createDefaultGeometry(){return yi.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"segments":this.geometry=yi.createMeshGeometry(this.radius,this.segments);break}}};c([h({emit:!1,converter:m.Number})],yi.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],yi.prototype,"segments",2),yi=c([C({tagName:d+"-"+"3d"+"-primitive-sphere"})],yi);var Kr=class extends gt{static createMeshGeometry(r=1,e=.25,t=24,n=12){let i=[],s=[],l=[],p=Zi*(360/t),u=Zi*(360/n),f=r,g=e;for(let y=0;y<t;y++){let _=p*y-Math.PI/2,x=Math.sin(_),w=Math.cos(_);for(let E=0;E<n;E++){let k=u*E+Math.PI,N=Math.cos(k),T=f*w+g*N*w,O=g*Math.sin(k),D=f*x+g*N*x;i.push({x:T,y:O,z:D});let P=y>0?y-1:t-1,F=E>0?E-1:n-1,B=y==0?0:1-1*y/t,$=E>0?1*E/n:1,U=y>0?1-(y-1)/t:1/t,I=E>0?(E-1)/n:1-1/n;l.push(y*n+F),l.push(P*n+F),l.push(P*n+E),l.push(y*n+F),l.push(P*n+E),l.push(y*n+E),s.push({x:B,y:I}),s.push({x:U,y:I}),s.push({x:U,y:$}),s.push({x:B,y:I}),s.push({x:U,y:$}),s.push({x:B,y:$})}}let v=new ze(i,l,s);return v.key=`torus_${r}x${e}_t${t}_s${n}`,Dt(v),v}createDefaultGeometry(){return Kr.createMeshGeometry()}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"radius":case"innerRadius":case"segments":case"sides":this.geometry=Kr.createMeshGeometry(this.radius,this.innerRadius,this.segments,this.sides);break}}};c([h({emit:!1,converter:m.Number})],Kr.prototype,"radius",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"innerRadius",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"segments",2),c([h({emit:!1,converter:m.Number})],Kr.prototype,"sides",2),Kr=c([C({tagName:d+"-"+"3d"+"-primitive-torus"})],Kr);function ME(o,r){let e,t;if(se.isPoint(o))e=o.x,t=o.y;else{let{page:s}=de.getEventCoordinates(o),l={x:s.x-r.x,y:s.y-r.y};e=l.x,t=l.y}let n=e/r.width*2-1,i=t/r.height*-2+1;return{x:n,y:i}}var os=class o{static isMeshGeometry(r){return"positions"in r&&a.isArray(r.positions)&&"triangleIndices"in r&&a.isArray(r.triangleIndices)}static isVector3D(r){return"x"in r&&typeof r.x=="number"&&"y"in r&&typeof r.y=="number"&&"z"in r&&typeof r.z=="number"}static isRgba(r){return"r"in r&&typeof r.r=="number"&&"g"in r&&typeof r.g=="number"&&"b"in r&&typeof r.b=="number"}static flattenVectorArray(r){let e=[];for(let t of r)o.isVector3D(t)?e.push(t.x,t.y,t.z):o.isRgba(t)?e.push(t.r,t.g,t.b,t.a??1):e.push(t.x,t.y);return e}static findCamera(r){return(r||[]).find(e=>Vt(e)&&!e.hide)}clipPixel(r,e){return e instanceof HTMLElement&&(e=a.offsetRect(e)),ME(r,e)}};function Ih(o){return os.flattenVectorArray(o)}var Qb="0.152.2",SE="0.147.0",$h={VERSION:Qb,API_URI:`https://unpkg.com/three@${Qb}/build/three.min.js`,ORBIT_URI:`https://unpkg.com/three@${SE}/examples/js/controls/OrbitControls.js`,LOADERS:[],DEFAULT_MATERIAL:function(){return new THREE.MeshStandardMaterial({color:"#069",flatShading:!0})}};function LE(o,r,e,t=1.333){let n=new THREE.Box3;for(let y of e)n.expandByObject(y);let i=n.getSize(new THREE.Vector3),s=n.getCenter(new THREE.Vector3),p=Math.max(i.x,i.y,i.z)/(2*Math.atan(Math.PI*o.fov/360)),u=p/o.aspect,f=t*Math.max(p,u),g=!a.isNull(r);var v;g&&(v=r.target.clone().sub(o.position).normalize().multiplyScalar(f),r.maxDistance=f*10,r.target.copy(s)),o.near=f/100,o.far=f*100,o.updateProjectionMatrix(),g&&(o.position.copy(r.target).sub(v),r.update())}function NE(o){return[o.m11,o.m21,o.m31,o.offsetX,o.m12,o.m22,o.m32,o.offsetY,o.m13,o.m23,o.m33,o.offsetZ,o.m14,o.m24,o.m34,o.m44]}function TE(o){let r=new THREE.BufferGeometry,e=Ih(o.positions);if(r.setAttribute("position",new THREE.Float32BufferAttribute(e,3)),o instanceof ze){a.isNullOrEmpty(o.triangleIndices)||r.setIndex(o.triangleIndices);let t=Ih(o.positions);r.setAttribute("position",new THREE.Float32BufferAttribute(t,3));let n=Ih(o.textureCoordinates);if(r.setAttribute("uv",new THREE.Float32BufferAttribute(n,2)),a.isNullOrEmpty(o.normals))r.computeVertexNormals();else{let i=Ih(o.normals);r.setAttribute("normal",new THREE.Float32BufferAttribute(i,3))}}return r}function AE(o){var r;if(o.type==="spot"){let e=new THREE.SpotLight;e.target.position.set(o.target.x,o.target.y,o.target.z),r=e}else r=new THREE.PointLight;return r}function ey(o){if(a.isNull(o))return null;let r={color:typeof o.color=="string"?o.color:Be.stringify(o.color),opacity:o.opacity??1,transparent:!0,wireframe:o.wireframe??!1,visible:o.visible??!0},e=a.extend({},r,{wireframe:o.wireframe??!1}),t=n=>(o.map&&(n.map=new THREE.TextureLoader().load(o.map,i=>{n.needsUpdate=!0})),n);if(Lh(o))return t(new THREE.MeshStandardMaterial(a.extend(e,{roughness:o.roughness,metalness:o.metalness,emissive:o.emissiveColor,flatShading:o.flatShading,refractionRatio:o.refractionRatio})));if(Sh(o))return t(new THREE.MeshPhongMaterial(a.extend(e,{shininess:o.shininess,emissive:o.emissiveColor,flatShading:o.flatShading,specular:o.specularColor,reflectivity:o.reflectivity,refractionRatio:o.refractionRatio})));if(Mh(o))return t(new THREE.MeshLambertMaterial(a.extend(e,{emissive:o.emissiveColor,reflectivity:o.reflectivity,refractionRatio:o.refractionRatio})));if(va(o)){let n=o.dashArray&&o.dashArray[0]||null,i=o.dashArray&&o.dashArray.length>1&&o.dashArray[1]||n,s=a.extend(r,{linecap:o.lineCap??"round",linejoin:o.lineJoin??"round",linewidth:o.lineWidth??1});return a.isNullOrEmpty(o.dashArray)?new THREE.LineBasicMaterial(s):new THREE.LineDashedMaterial(a.extend({dashSize:n,gapSize:i},s))}else return Yr(o)?t(new THREE.MeshBasicMaterial(e)):null}function DE(o,r,e){let t=e,n=[],i=ey(o);if(a.isNull(i)||(i.side=THREE.FrontSide,n.push(i)),!a.isNull(r))if(r==o)i.side=THREE.DoubleSide;else{let s=ey(r);a.isNull(s)||(s.side=THREE.BackSide,n.push(s))}return t&&n.length>1?n:i}function ty(o){if(a.isNullOrEmpty(o.content))throw new Error("Missing content.");return o.type?.toLowerCase()==="obj"?new THREE.OBJLoader().parse(o.content):new THREE.ObjectLoader().parse(o.content)}function RE(o){return o instanceof ga?THREE.Line:THREE.Mesh}function ry(o){if(a.isNullOrEmpty(o.geometry))return null;let r=RE(o.geometry);return new r}function Pd(){return"THREE"in window}async function OE(...o){let r=Date.now();var e=!1;do{e=Pd();for(let t of o)e&&=t();e||await new Promise(t=>setTimeout(t,500))}while(!e&&Date.now()-r<3e4);if(!e)throw new Error("The wait for THREE adapter initialization timed out.")}var Ac=class extends fa{constructor(){super(...arguments);this._renderer=null;this._camera=null;this._scene=null;this._orbitCtrls=null;this._objects=new WeakMap;this._dict={};this._orbitControlsDelegate=e=>{};this._ensureAndRefresh=(e,t,n)=>{if(t.matrixAutoUpdate=!1,t.visible=!e.hide){if(wr(e)){let s=t;if(e.flags.indexOf("geometry")>=0){s.geometry.dispose();let l=ry(e);l.constructor.name!==s.constructor.name&&(n.remove(t),delete this._dict[t.id],t=s=l),s.geometry=TE(e.geometry)}if(e.flags.indexOf("material")>=0){if(a.isArray(s.material))for(let l of s.material)l.dispose();else s.material.dispose();s.material=DE(e.material)||$h.DEFAULT_MATERIAL()}}else if(e instanceof wn&&(e.flags.indexOf("material")>=0||e.flags.indexOf("geometry")>=0))t.parent&&t.parent.remove(t),t=ty(e);else if(e instanceof di){if(e.flags.indexOf("children")>=0){for(let s=t.children.length-1;s>=0;s--){let l=t.children[s];t.remove(l)}for(let s of e.items)this._addOrUpdateItem(s,t)}}else if(e instanceof Er){let s=t;e.flags.indexOf("light")>=0&&(s.color=new THREE.Color(e.color),s.intensity=e.intensity)}let i=e.position;if(Cc(e)&&!a.isNull(e.transformMatrix)&&(e.flags.indexOf("position")>=0||e.flags.indexOf("transform")>=0)){let s=we.LinearAlgebra.Matrix3D.from(1,0,0,0,0,1,0,0,0,0,1,0,i.x,i.y,i.z,1),l=we.LinearAlgebra.Matrix3D.multiply(e.transformMatrix,s);THREE.Matrix4.prototype.set.apply(t.matrix,NE(l))}else e.flags.indexOf("position")>=0&&(t.position.set(i.x,i.y,i.z),t.updateMatrix())}return t.userData=e.tag,a.isNull(n.getObjectById(t.id))&&(n.add(t),this._dict[t.id]=e),e.flags.splice(0),t}}_assertMonoStage(e){if(e!=this._3d&&!a.isNull(this._3d))throw new Error("Stage mismatch.")}dispose(e){}snapshot(e,t,n,i){if(e!=this._3d)return Promise.resolve(null);let s=!a.isNullOrEmpty(t),l=n??(s?"image/jpeg":null),p=i??(s?.9:null);return new Promise((u,f)=>{this.render(),a.snapshotElement(this._stage,t,l,p).then(u)})}project(e,t){if(this._assertMonoStage(e),a.isNull(this._camera)||a.isNull(this._stage))return null;let n=this._stage,i=new THREE.Vector3(t.x,t.y,t.z),s=n.width,l=n.height,p=s/2,u=l/2,f=i.project(this._camera),g=f.x*p+p,v=-(f.y*u)+u;return{x:g,y:v}}zoomFit(e,...t){return this._assertMonoStage(e),new Promise((n,i)=>{let s=this._camera,l=this._objects,p=t.filter(u=>l.has(u)).map(u=>l.get(u));(a.isNull(s)||a.isNullOrEmpty(p))&&n(),LE(s,this._orbitCtrls,p),n()})}getScene(e){return this._assertMonoStage(e),this._scene}raycast(e,t,n,i){if(this._assertMonoStage(e),Pd()&&!a.isNull(this._camera)){let s=this._camera,l=new THREE.Vector2(t.x/n.width*2-1,-(t.y/n.height)*2+1),p=new THREE.Raycaster;p.setFromCamera(l,s);let u=p.intersectObjects(this._scene.children,!0),f,g,v=0;for(;u.length>v&&(g=u[v++])&&(f=g.object);){if(this._dict[f.id].inert)continue;let _=g.point,x=_.x,w=_.y,E=_.z,k={x,y:w,z:E};i({object:this._dict[f.id],point:k});return}}i(null)}async initialize(e){if(!a.isNull(this._stage))return this._stage;this._3d=e;let t=e.stage,n=this._stage=document.createElement("canvas");t.innerHTML="",t.appendChild(n),Pd()||(await A.importjs($h.API_URI),await OE(),await Promise.all([A.importjs($h.ORBIT_URI)].concat($h.LOADERS.map(p=>A.importjs(p))))),this._scene=new THREE.Scene,this.invalidateSize(e);let i=this._stage.width,s=this._stage.height,l={canvas:n,antialias:!0,stencil:!1,alpha:e.transparent??!0};if(this._renderer=new THREE.WebGLRenderer(l),this._renderer.setSize(i,s),e.background&&!e.transparent){let p=e.background;typeof p=="string"&&(p=Be.parse(p));let u=new THREE.Color(p.r,p.g,p.b);this._renderer.setClearColor(u,p.a)}return this.orbit=e.orbit,n}_setCamera(e){this._camera=e,this.invalidateSize(this._3d),this._disposeOrbitControls(),this.orbit&&this._initOrbitControls()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="orbit"&&(n===!0?this._initOrbitControls():this._disposeOrbitControls())}_initOrbitControls(){let e=this._camera;if(a.isNull(this._3d)||a.isNull(e))return;(this._orbitCtrls=new THREE.OrbitControls(e,this._3d.stage)).addEventListener("change",this._orbitControlsDelegate)}_disposeOrbitControls(){let e=this._orbitCtrls;a.isNull(e)||(e.removeEventListener("change",this._orbitControlsDelegate),e.dispose())}_updateRenderer(e,t=this._renderer){if(e.transparent)t.setClearAlpha(0);else if(e.background){let n=e.background;typeof n=="string"&&(n=Be.parse(n));let i=new THREE.Color(n.r,n.g,n.b);t.setClearColor(i,n.a)}else t.setClearColor(null)}invalidateSize(e,t=e.size){if(this._assertMonoStage(e),!Pd()||a.isNull(t))return;let n=t.width,i=t.height;this._stage.width=n,this._stage.height=i;let s=this._camera;s instanceof THREE.PerspectiveCamera&&(s.aspect=n/i,s.updateProjectionMatrix()),this._renderer&&(this._renderer.setSize(n,i),this._updateRenderer(e))}removeItem(e,t){this._assertMonoStage(e);let n=this._objects,i=n.get(t);a.isNull(i)||(this._scene.remove(i),delete this._dict[i.id],n.delete(t))}updateItem(e,t){this._assertMonoStage(e);let n=this._objects;if(!a.isNull(t.parent)&&n.has(t.parent)){let i=n.get(t.parent);this._addOrUpdateItem(t,i)}else this._addOrUpdateItem(t)}addItem(e,t){this._assertMonoStage(e),this._addOrUpdateItem(t)}_addOrUpdateItem(e,t=this._scene){if(!(!Pd()||a.isNull(t)))if(e instanceof jr)if(e instanceof pi){var n;if(this._camera instanceof THREE.PerspectiveCamera)var n=this._camera;else n=new THREE.PerspectiveCamera;let s=new THREE.Vector3(e.lookAt.x,e.lookAt.y,e.lookAt.z);n.lookAt(s),n.position.set(e.position.x,e.position.y,e.position.z),n.fov=e.fov,n.aspect=e.aspect,n.near=e.near,n.far=e.far,this._setCamera(n);let l=this._orbitCtrls;!a.isNull(l)&&l.object===n&&(l.target=s,l.update())}else if(e instanceof Wr){var i;if(this._camera instanceof THREE.OrthographicCamera)var i=this._camera;else i=new THREE.OrthographicCamera;let s=new THREE.Vector3(e.lookAt.x,e.lookAt.y,e.lookAt.z);i.lookAt(s),i.position.set(e.position.x,e.position.y,e.position.z),i.left=e.left,i.right=e.right,i.top=e.top,i.bottom=e.bottom,i.near=e.near,i.far=e.far,this._setCamera(i);let l=this._orbitCtrls;!a.isNull(l)&&l.object===i&&(l.target=s,l.update())}else throw new Error(`Camera ${e} not supported.`);else if(this._objects.has(e)){let s=this._objects.get(e),l=this._ensureAndRefresh(e,s,t);l!=s&&this._objects.set(e,l)}else{let s=l=>{l&&(l=this._ensureAndRefresh(e,l,t),this._objects.set(e,l))};if(e instanceof wn){let l=ty(e);s(l)}else if(e instanceof En){let l=ry(e);s(l)}else if(e instanceof Er){let l=AE(e);s(l)}else if(e instanceof di){let l=new THREE.Group;s(l)}}}render(){this._camera&&this._renderer.render(this._scene,this._camera)}};c([h({emit:!1,converter:m.Boolean})],Ac.prototype,"orbit",2),Ac=c([C({tagName:d+"-3d-three-adapter"})],Ac);var Ve="pacem-3d-";var sl="color",Hh="ambient",Id="lighting",_i="VertexInput",Zt="VertexOutput",wa="InteractionData";var Lt=class{static create(r,e,t=""){let n=r.createBuffer({size:e.byteLength,label:t,usage:40,mappedAtCreation:!0});return new Float32Array(n.getMappedRange()).set(e),n.unmap(),n}static createUniform(r,e,t=""){return r.createBuffer({size:e.byteLength,label:t,usage:72})}static createStorage(r,e,t=""){return r.createBuffer({size:e.byteLength,label:t,usage:136})}static createIndexed(r,e,t=""){let n=r.createBuffer({size:e.byteLength,label:t,usage:24,mappedAtCreation:!0});return new Uint16Array(n.getMappedRange()).set(e),n.unmap(),n}},al=class{static createVertex(r=0,e=3,...t){let n=[],i=0,s=0;for(let l of[e].concat(t))n.push({shaderLocation:r+s,offset:i*Float32Array.BYTES_PER_ELEMENT,format:`float32x${l}`}),i+=l,s++;return{arrayStride:i*Float32Array.BYTES_PER_ELEMENT,attributes:n,stepMode:"vertex"}}};var ny={outputNormalLocation:0,outputVertexLocation:1,outputUvLocation:2,outputVertexIndexLocation:3,outputRayIndexLocation:4,outputInstanceIndexLocation:5,storageMaterialGroupIndex:2,storageMaterialBindingIndex:0};function iy(o=[]){return o.join(`\r
|
|
47
|
+
`)}function IE(o=[]){let r="";for(let e of o){let t=e.trim();t.endsWith(";")?r+=t+`\r
|
|
48
48
|
`:r+=`${sl} = ${t};\r
|
|
49
|
-
`}return r}function
|
|
49
|
+
`}return r}function sy(o={},r=ny){let e=a.extend({},ny,r),t=iy(o.definitions),n=iy(o.bindings),i=IE(o.modifiers),s=sl,l=Id,p=Hh;return`// definitions
|
|
50
50
|
|
|
51
51
|
${t}
|
|
52
52
|
|
|
@@ -75,10 +75,10 @@ const white = vec4f(1,1,1,1);
|
|
|
75
75
|
|
|
76
76
|
${l} = select(white, ${l}, ${l}.a > 0);
|
|
77
77
|
return ${s} * ${l} + ${p};
|
|
78
|
-
}`}var
|
|
79
|
-
`)}function
|
|
78
|
+
}`}var ay={outputInstanceIndexLocation:0,outputVertexIndexLocation:1,storageMaterialGroupIndex:3,storageMaterialBindingIndex:0};function oy(o=[]){return o.join(`\r
|
|
79
|
+
`)}function $E(o=[]){let r="";for(let e of o){let t=e.trim();t.endsWith(";")?r+=t+`\r
|
|
80
80
|
`:r+=`output = ${t};\r
|
|
81
|
-
`}return r}function
|
|
81
|
+
`}return r}function ly(o={},r=ay){let e=a.extend({},ay,r),t=oy(o.definitions),n=oy(o.bindings),i=$E(o.modifiers);return`// definitions
|
|
82
82
|
${t}
|
|
83
83
|
|
|
84
84
|
// bindings
|
|
@@ -102,7 +102,7 @@ fn getVertexColor(index: u32) -> vec4f {
|
|
|
102
102
|
${i}
|
|
103
103
|
|
|
104
104
|
return output;
|
|
105
|
-
}`}var Bh=class{static create(r){if(kh(r))return new Hd(r);if(va(r))return new Bd(r);throw new TypeError(`Material type '${r.shader}' not supported.`)}}
|
|
105
|
+
}`}var Bh=class{static create(r){if(kh(r))return new Hd(r);if(va(r))return new Bd(r);throw new TypeError(`Material type '${r.shader}' not supported.`)}},HE={},Vh=class{constructor(r){if(a.isNull(this.#e=r))throw new ReferenceError("Null material provided.")}#e;get material(){return this.#e}get wgsl(){return HE}buffer({device:r},e=Ve+"material-"+this.shader+"-buffer"){let{r:t,g:n,b:i,a:s}=this._diffuseColor(),l=new Float32Array([t,n,i,s]);return{buffer:Lt.createStorage(r,l,e),value:l,version:performance.now()}}_diffuseColor(){let{visible:r,opacity:e,color:t}=this.material;if(!(r??!0))return{r:0,g:0,b:0,a:0};let n=typeof t=="string"?Be.parse(t):t??{r:1,g:1,b:1,a:1};return e>=0&&e<=1?a.extend(n,{a:n.a*e}):n}},Hd=class extends Vh{get shader(){return"basic"}constructor(r){if(super(r),r.shader!=this.shader)throw new TypeError("Basic material expected.")}texture({device:r},e="texture"){let t=this.material;if(e==="texture"&&!a.isNull(t.texture)){let n=t.texture;return{texture:r.createTexture({format:"rgba8unorm",usage:22,size:[n.width,n.height]}),source:n}}return null}static{this.fragment=sy}},Bd=class extends Vh{get shader(){return"line"}constructor(r){if(super(r),r.shader!=this.shader)throw new TypeError("Line material expected.")}buffer(r,e){if(e==="line"){let{device:t,canvas:n}=r,i=this.material,s=new Float32Array([n.clientWidth,n.clientHeight,i.lineWidth/2]);return{buffer:Lt.createUniform(t,s,Ve+"line-"+this.shader+"-buffer"),value:s,version:performance.now()}}else return super.buffer(r)}texture(r){return null}static{this.fragment=ly}};var BE=["input","data"];function kg(o){typeof o!="string"&&(o=o(...BE));let r=new RegExp(`fn\\s+(\\w+)\\s*\\(([^)]*)\\)\\s*->\\s*(${_i}|${Zt})\\s*{((.|\\n)+)}\\s*$`),e=o.match(r);if(e){let t=e[1],n=e[2].split(",").map(s=>{let l=s.split(":");return{name:l[0].trim(),type:l[1].trim()}});if(n.length!==2||n[0].type!==e[3]||n[1].type!==wa)throw new Error(`Invalid modifier function. Invalid signature types (arg1: ${n[0]?.type}, arg2: ${n[1]?.type})`);let i=e[4].trim();return{name:t,args:n.map(s=>s.name),body:i}}else throw new Error(`Invalid modifier function. Must be a valid WGSL function with the signature: fn name(arg1: ${_i}|${Zt}, arg2: ${wa}) -> ${_i}|${Zt}`)}var Uh={outputNormalLocation:0,outputVertexLocation:1,outputUvLocation:2,outputVertexIndexLocation:3,outputInstanceIndexLocation:5,outputRayLocation:4,inputPositionLocation:0,inputNormalLocation:1,inputUvLocation:2,uniformViewBindingIndex:0,uniformViewGroupIndex:0,uniformWorldBindingIndex:0,uniformWorldGroupIndex:1,uniformInteractionBindingIndex:1,uniformInteractionGroupIndex:0};function py(o=Uh){o!=Uh&&(o=a.extend({},Uh,o));let r=o.inputModifier,e="vertexInput",t="";if(!a.isNullOrEmpty(r)){let{name:p,args:[u,f],body:g}=kg(r);e=`${p}(vertexInput, interaction)`,t=`fn ${p} (${u}: ${_i}, ${f}: ${wa}) -> ${_i} {
|
|
106
106
|
${g}
|
|
107
107
|
}`}let n=o.outputModifier,i="output",s="";if(!a.isNullOrEmpty(n)){let{name:p,args:[u,f],body:g}=kg(n);i=`${p}(output, interaction)`,s=`fn ${p} (${u}: ${_i}, ${f}: ${wa}) -> ${Zt} {
|
|
108
108
|
${g}
|
|
@@ -169,11 +169,11 @@ ${s}
|
|
|
169
169
|
input.instance
|
|
170
170
|
);
|
|
171
171
|
return ${i};
|
|
172
|
-
}`}var Wh={inputPositionLocation:0,outputInstanceIndexLocation:0,outputVertexIndexLocation:1,storagePositionsGroupIndex:2,storagePositionsBindingIndex:0,uniformDimensionsGroupIndex:2,uniformDimensionsBindingIndex:1,uniformViewGroupIndex:0,uniformViewBindingIndex:0,uniformWorldGroupIndex:1,uniformWorldBindingIndex:0};function
|
|
172
|
+
}`}var Wh={inputPositionLocation:0,outputInstanceIndexLocation:0,outputVertexIndexLocation:1,storagePositionsGroupIndex:2,storagePositionsBindingIndex:0,uniformDimensionsGroupIndex:2,uniformDimensionsBindingIndex:1,uniformViewGroupIndex:0,uniformViewBindingIndex:0,uniformWorldGroupIndex:1,uniformWorldBindingIndex:0};function dy(o){return`struct ${Zt} {
|
|
173
173
|
@builtin(position) position : vec4f, // clip space position
|
|
174
174
|
@location(${o.outputInstanceIndexLocation}) @interpolate(flat) instance : u32, // instance index
|
|
175
175
|
@location(${o.outputVertexIndexLocation}) @interpolate(flat) index : u32, // vertex index
|
|
176
|
-
}`}function
|
|
176
|
+
}`}function uy(o=Wh){let r=a.extend({},Wh,o);return`${dy(r)}
|
|
177
177
|
|
|
178
178
|
struct Transforms {
|
|
179
179
|
world: mat4x4f,
|
|
@@ -205,7 +205,7 @@ struct Camera {
|
|
|
205
205
|
worldViewProjectionTransform * position4,
|
|
206
206
|
instance,
|
|
207
207
|
index);
|
|
208
|
-
}`}function
|
|
208
|
+
}`}function hy(o=Wh){let r=a.extend({},Wh,o);return`${dy(r)}
|
|
209
209
|
|
|
210
210
|
struct Transforms {
|
|
211
211
|
world: mat4x4f,
|
|
@@ -325,7 +325,7 @@ fn computeOffsetPosition(p0: vec4f, p1: vec4f, index: u32) -> vec4f {
|
|
|
325
325
|
fn main(@builtin(position) position: vec4f) -> @location(0) u32 {
|
|
326
326
|
return colorPicker.id;
|
|
327
327
|
}
|
|
328
|
-
`}var
|
|
328
|
+
`}var my={uv:"uv"};function fy(o=my,r,e=1){let t=a.uniqueCode(),n=`sampler_${t}`,i=`tex_${t}`,s=a.extend({},my,o),l=s.inputColor,p=s.outputColors;if(a.isNullOrEmpty(l))throw new Error("Must provide either input and output vertex color parameter names.");let u=p?p.map((f,g)=>g===0?`${f} = textureSample(${i}, ${n}, ${s.uv}) * ${l};`:`${f} = ${p[0]};`):[`textureSample(${i}, ${n}, ${s.uv}) * ${l}`];return{bindings:[`@group(${r}) @binding(${e}) var ${n}: sampler;`,`@group(${r}) @binding(${e+1}) var ${i}: texture_2d<f32>;`],modifiers:u}}var VE={normal:"normal",inputColor:"white"};function gy(o,r,e){let n=`directional_${a.uniqueCode()}`,i=a.extend({},VE,o),s=i.inputColor,l=i.outputColor,p=i.normal??"normal";if(a.isNullOrEmpty(s))throw new Error("Must provide input vertex color parameter name.");return{definitions:[`struct DirectionalLight {
|
|
329
329
|
color: vec4f,
|
|
330
330
|
direction: vec3f,
|
|
331
331
|
intensity: f32
|
|
@@ -335,7 +335,7 @@ fn computeOffsetPosition(p0: vec4f, p1: vec4f, index: u32) -> vec4f {
|
|
|
335
335
|
let factor = light.intensity * .5 * (1.0 + dot(n, -d));
|
|
336
336
|
let output = color.rgb * light.color.rgb * factor;
|
|
337
337
|
return vec4f(output, color.a);
|
|
338
|
-
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: DirectionalLight;`],modifiers:l?[`${l} += computeDirectional(${p}, ${s}, ${n});`]:[`computeDirectional(${p}, ${s}, ${n})`]}}var
|
|
338
|
+
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: DirectionalLight;`],modifiers:l?[`${l} += computeDirectional(${p}, ${s}, ${n});`]:[`computeDirectional(${p}, ${s}, ${n})`]}}var UE={normal:"normal",position:"vertex",ray:"ray",inputColor:"white",specularColor:"empty",shininess:"0"};function vy(o,r,e){let n=`omni_${a.uniqueCode()}`,i=a.extend({},UE,o),s=i.inputColor,l=i.outputColor,p=i.normal,u=i.ray,f=i.position,g=i.shininess,v=i.specularColor;if(a.isNullOrEmpty(s))throw new Error("Must provide input vertex color parameter name.");return{definitions:[`struct OmniLight {
|
|
339
339
|
color: vec4f,
|
|
340
340
|
position: vec3f,
|
|
341
341
|
intensity: f32
|
|
@@ -353,12 +353,12 @@ fn computeOffsetPosition(p0: vec4f, p1: vec4f, index: u32) -> vec4f {
|
|
|
353
353
|
|
|
354
354
|
let output = color.rgb * light.color.rgb * factor + specular;
|
|
355
355
|
return vec4f(output, color.a);
|
|
356
|
-
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: OmniLight;`],modifiers:l?[`${l} += computeOmni(${f}, ${p}, ${u}, ${s}, ${v}, ${g}, ${n});`]:[`computeOmni(${f}, ${p}, ${u}, ${s}, ${v}, ${g}, ${n})`]}}function
|
|
356
|
+
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: OmniLight;`],modifiers:l?[`${l} += computeOmni(${f}, ${p}, ${u}, ${s}, ${v}, ${g}, ${n});`]:[`computeOmni(${f}, ${p}, ${u}, ${s}, ${v}, ${g}, ${n})`]}}function by(o,r,e){let n=`ambient_${a.uniqueCode()}`,i=o.inputColor,s=o.outputColor;if(a.isNullOrEmpty(i)||a.isNullOrEmpty(s))throw new Error("Must provide either input and output vertex color parameter names.");return{definitions:[`struct AmbientLight {
|
|
357
357
|
color: vec4f,
|
|
358
358
|
intensity: f32
|
|
359
359
|
}`,`fn computeAmbient(color: vec4f, light: AmbientLight) -> vec4f {
|
|
360
360
|
return vec4f(light.intensity * color.rgb * light.color.rgb, color.a);
|
|
361
|
-
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: AmbientLight;`],modifiers:[`${s} = computeAmbient(${i}, ${n});`]}}var Jr=we.LinearAlgebra.Vector3D,Tg=we.LinearAlgebra.Matrix3D,by={width:1,height:1},Yh=class{static create(r){if(Ch(r))return new Ng(r);if(Eh(r))return new Lg(r);throw new TypeError(`Camera type '${r.type}' not supported.`)}};function yy(o,r,e){let t=Jr.subtract(r,o),n=Jr.cross(e,t),i=Jr.cross(t,n);Jr.normalize(n),Jr.normalize(t),Jr.normalize(i);let s=-Jr.dot(n,o),l=-Jr.dot(i,o),p=-Jr.dot(t,o);return Tg.from(n.x,i.x,t.x,0,n.y,i.y,t.y,0,n.z,i.z,t.z,0,s,l,p,1)}function _y(o,r){if(o<=0)throw new RangeError("Near plane distance must be positive.");if(r<=o)throw new RangeError("Far plane distance must be greater than near plane distance.")}function UE(o=120,r=1,e=.1,t=1e3){_y(e,t);let n=Math.tan(.5*Math.PI*(1-o/180)),i=n/r,s=Number.isFinite(t),l=s?t/(e-t):-1,p=s?t*e/(e-t):-e;return Tg.from(i,0,0,0,0,n,0,0,0,0,l,-1,0,0,p,0)}function zE(o,r,e,t,n=.1,i=1e3){return _y(n,i),Tg.from(2/(r-o),0,0,0,0,2/(e-t),0,0,0,0,1/(n-i),0,(o+r)/(o-r),(e+t)/(t-e),n/(n-i),1)}var Lg=class o{constructor(r){this._camera=r}static view(r){return yy(r.position,r.lookAt,r.up)}static projection(r,e=by){let t=r.position,n=r.lookAt,i=Jr.subtract(n,t);Jr.normalize(i);let s=Jr.dot(i,t),{height:l,width:p}=e,u=p/l,f=.5*s,g=f*u,v=f,y=r.top*v,_=r.bottom*v,x=r.right*g,w=r.left*g;return zE(w,x,y,_,r.near,r.far)}view(){return o.view(this._camera)}projection(r){return o.projection(this._camera,r)}},Ng=class o{constructor(r){this._camera=r}static view(r){return yy(r.position,r.lookAt,r.up)}static projection(r,e=by){let t=e.width/e.height/r.aspectRatio;return UE(r.fov,t,r.near,r.far)}view(){return o.view(this._camera)}projection(r){return o.projection(this._camera,r)}};var Ag=we.LinearAlgebra.Vector3D,Tr=we.LinearAlgebra.Matrix3D;function Pc(o,r){throw typeof r=="function"&&(r=r.name),new RangeError(`Buffer '${o}' not available for ${r}.`)}function xy(o,r,...e){if(o.stage??=r?.item.stage,Wo(o))return o.key??="group_"+a.uniqueCode(),new Dg(o,r,...e);if(wr(o))return o.key??="mesh_"+a.uniqueCode(),new Pg(o,r,...e);if(Vt(o))return o.key??="camera_"+a.uniqueCode(),new Rg(o);if(ui(o))return o.key??="light_"+o.type+"_"+a.uniqueCode(),new Ig(o);throw new Error("Renderable is not supported.")}var Xh=class{constructor(r){this._set=r}get items(){return this._set}loop(r){let{meshes:e,cameras:t,groups:n,lights:i}=this._set,s=t[0],l=!1,p=!1;for(let u of e)u.disposed||!r(u,s,i)||(tt.clearFlags(u),l||(tt.clearFlags(s),l=!0),p||(i.forEach(g=>tt.clearFlags(g)),p=!0));for(let u of n)tt.clearFlags(u)}},Dc=class{static create(r){if(_d(r))return r.key??="geometry_"+a.uniqueCode(),new Ud(r);if(Yr(r))return new zd(r);if(wh(r))return new Og(r);throw new Error("Object is not supported.")}},tt=class o{static create(r,...e){return xy(r,null,...e)}static clearFlags(r,e=!1){if(r.item.flags.splice(0),e){let t=r;a.isNull(t.parent)||o.clearFlags(t.parent,!0)}}static allFlags(r){let e=r,t=e.parent,n=a.isNull(t)?[]:o.allFlags(t);return e.item.flags.union(n)}},Rc=class{#e;constructor(r){this.#e=r}get item(){return this.#e}#t=!1;lock(){this.#t=!0}unlock(){this.#t=!1;let r=this.#r;for(;r.length>0;){let e=r.shift();this._destroyUnsafe(e)}}#r=[];_destroyUnsafe(r){"texture"in r?r.texture.destroy():"buffer"in r&&r.buffer.destroy()}destroySafely(...r){for(let e of Array.from(r).concat(...this.#r.splice(0)))e&&(this.#t?this.#r.push(e):this._destroyUnsafe(e))}#n=!1;destroy(){this.dispose(),this.#n=!0}get disposed(){return this.#n}},Oc=class extends Rc{constructor(r,e){super(r),this.#t=e,this.#e=a.uniqueId()%4294967295}#e;#t;#r=new Map;get parent(){return this.#t}get id(){return this.#e}allFlags(){let r=this.parent;return this.item.flags.union(r?.allFlags()??[])}buildParentWorldTransform(){let r=Tr.identity(),e=this;for(;!a.isNull(e.parent);){let t=e.parent.item,n=Tr.translate(t.transformMatrix??Tr.identity(),t.position??Ag.zero());r=Tr.multiply(r,n),e=e.parent}return r}buildWorldTransform(){let r=Tr.translate(this.item.transformMatrix??Tr.identity(),this.item.position??Ag.zero()),e=this.buildParentWorldTransform();return Tr.multiply(r,e)}#n=new Map;version(r){return this.#n.get(r)??0}buffer(r,e){if(e==="u32id"){let n=this.#r,{pipeline:i,device:s}=r;if(n.has(i))return a.extend({fresh:!1},n.get(i));let l=new Uint32Array([this.id]),p=Lt.createUniform(s,l,Ve+"u32id-buffer"),u=a.extend({buffer:p,value:l,version:performance.now()},{fresh:!0});return this.#r.set(i,u),u}let t=this.specificBuffer(r,e);return this.#n.set(e,t.version),t}},FE={shader:"basic",color:"#c0c0c0",flags:[]},Dg=class extends Oc{#e;constructor(r,e,...t){super(r,e),this.#e=r.childRenderables.map(n=>xy(n,this,...t))}get children(){return this.#e}specificBuffer(r,e){return null}texture(r){throw new Error("Method not implemented.")}dispose(){this.#e.forEach(r=>r.destroy())}},Rg=class o extends Oc{#e=new Map;#t;constructor(r){super(r)}texture(r){throw new Error("Method not implemented.")}specificBuffer(r,e){let t=!1;(this.allFlags().length>0||a.isNull(this.#t))&&(t=!0,this.#e.clear(),this._rebuildMatrices(r));let{pipeline:n}=r;if(this.#e.has(n)||(t=!0,this.#e.set(n,this.#t)),tt.clearFlags(this),e==="cameraViewTransform")return a.extend(this.#t,{fresh:t});Pc(e,o)}_rebuildMatrices({device:r,canvas:e}){let t=this.item,n=Yh.create(t),{x:i,y:s,z:l}=t.position,p=n.view(),u=n.projection(e),f=Tr.multiply(p,u),g=new Float32Array(36);if(g.set(Tr.toArray(p),0),g.set(Tr.toArray(f),16),g.set([i,s,l],32),a.isNull(this.#t)){let v=Lt.createUniform(r,g,Ve+"view-buffer");this.#t={buffer:v,value:g,version:performance.now().roundoff()}}else this.#t.value=g,this.#t.version=performance.now().roundoff()}_destroyView(){this.#e.clear();let r=this.#t;this.#t=null,this.destroySafely(r)}dispose(){this._destroyView()}},Ud=class o extends Rc{#e={};#t={positions:!0,normals:!0,uv:!0,packed:!0};#r;constructor(r){super(r),r.flags??=[]}buffer(r,e){let t=this.item.flags??[];(a.isNull(this.#r)||t.includes("geometry"))&&(t.splice(0),this.#e={},this._rebuildGeometryBuffers(r));let n=this.#t,i=this.#r,{pipeline:s}=r,l=this.#e[e]??=new Map,p=!l.has(s),u=f=>(p&&l.set(s,f),f);switch(e){case"geometryPositions":let{positions:f}=i,g=n.positions;return n.positions=!1,a.extend(u(f),{fresh:g||p});case"geometryNormals":let{normals:v}=i,y=n.normals;return n.normals=!1,a.extend(u(v),{fresh:y||p});case"geometryTexCoords":let{uv:_}=i,x=n.uv;return n.uv=!1,a.extend({fresh:x||p},u(_));case"geometry":let{packed:w}=i,E=n.packed;return n.packed=!1,a.extend(u(w),{fresh:E||p});default:Pc(e,o)}}texture(r){throw new Error("Method not implemented.")}_rebuildGeometryBuffers({device:r}){this._destroyBuffers();let e=performance.now(),t=this.item,n=t.key;if(Ec(t)){let i=t,l=!a.isNullOrEmpty(i.triangleIndices)?i.triangleIndices.map(k=>i.positions[k]):i.positions,p=l.length*2,u=p+l.length,f=new Float32Array(u),g=new Float32Array(u),v=new Float32Array(p),y=new Float32Array(2*u+p);for(let k=0;k<l.length;k++){let N=2*k,T=3*k,{x:O,y:D,z:P}=l[k],{x:F,y:B,z:$}=i.normals[k],{x:U,y:I}=i.textureCoordinates[k];f.set([O,D,P],T),g.set([F,B,$],T),v.set([U,I],N),y.set([O,D,P,F,B,$,U,I],T*2+N)}let _=Lt.create(r,f,Ve+"meshgeometry-"+n+"-positions-buffer"),x=Lt.create(r,g,Ve+"meshgeometry-"+n+"-normals-buffer"),w=Lt.create(r,v,Ve+"meshgeometry-"+n+"-uvmap-buffer"),E=Lt.create(r,y,Ve+"meshgeometry-"+n+"-buffer");this.#r={packed:{buffer:E,value:y,version:e},positions:{buffer:_,value:f,version:e},normals:{buffer:x,value:g,version:e},uv:{buffer:w,value:v,version:e}},this.#t={positions:!0,normals:!0,uv:!0,packed:!0}}else{let i=new Float32Array(os.flattenVectorArray(t.positions)),s=Lt.createStorage(r,i,Ve+"nodegeometry-"+n+"-positions-buffer");this.#r={positions:{buffer:s,value:i,version:e},packed:{buffer:s,value:i,version:e}},this.#t={positions:!0,packed:!0}}}_destroyBuffers(){this.#e={};let r=this.#r;a.isNull(r)||this.destroySafely(r.positions,r.normals,r.uv)}dispose(){this._destroyBuffers()}},zd=class o extends Rc{#e={};#t={};#r;#n=new Map;#i=new Map;constructor(r){super(r),r.flags??=[],r.flags.indexOf("material")===-1&&r.flags.push("material")}buffer(r,e){let t=this.item.flags??[],n=a.isNull(this.#r);t.includes("material")&&(this.#e={},t.splice(0),n=!0,this.#i.clear(),this._resetMaterialBuffers());let{pipeline:i}=r,s=this.#e[e]??=new Map;switch(e){case"material":case"line":let l=this._ensureMaterialBuffer(r,e);return l?(s.has(i)||(n=!0,s.set(i,l)),a.extend(l,{fresh:n})):null;default:Pc(e,o)}}_ensureMaterialBuffer(r,e="material"){let t=this.#n,n=t.get(e);return n||(t.has(e)?null:(n=this.#r?.buffer(r,e),n&&t.set(e,n),n))}_resetMaterialBuffers(){this.#r=Bh.create(this.item),this._destroyBuffers()}texture(r,e="texture"){let t=this.#i,n=t.get(e),i=!1;if(!n){if(n=this.#r?.texture(r,e),!n)return null;t.set(e,n),i=!0,this.#t={}}let{pipeline:s}=r,l=this.#t[e]??=new Map;return l.has(s)||(i=!0,l.set(s,n)),a.extend(n,{fresh:i})}dispose(){this._destroyBuffers()}_destroyBuffers(){this.#e={},this.#t={};let r=this.#n.values();this.#n.clear(),this.destroySafely(...r);let e=this.#i.values();this.#i.clear(),e.forEach(t=>t.texture.destroy())}},Og=class o extends Rc{#e={time:0,cursor:{x:0,y:0},resolution:{width:0,height:0}};#t;#r=new Map;constructor(r){super(r),a.extend(this.#e,r)}buffer(r,e){if(e==="interaction")return this._ensureInteractionBuffer(r);Pc(e,o)}texture(r){throw new Error("Method not implemented.")}_ensureInteractionBuffer(r,e="interaction"){let t=this.#e,n=this.item,i=!this.#t||n.time!==t.time||n.resolution?.width!==t.resolution.width||n.resolution?.height!==t.resolution.height;if(!i&&!a.isNull(n.cursor)&&(i=n.cursor.x!==t.cursor.x||n.cursor.y!==t.cursor.y),i){let p=new Float32Array([n.cursor?.x??0,n.cursor?.y??0,n.resolution.width,n.resolution.height,n.time,0]),u=Lt.createUniform(r.device,p,Ve+"interaction-buffer");this.#t={buffer:u,value:p,version:performance.now()},this.#r.clear()}let{pipeline:s}=r,l=this.#r;return l.has(s)||(i=!0,l.set(s,this.#t)),a.extend(this.#t,{fresh:i})}_destroyBuffers(){this.#r.clear();let r=this.#t;a.isNull(r)||this.destroySafely(r)}dispose(){this._destroyBuffers()}},Pg=class o extends Oc{#e;#t;#r;#n;#i;#a={geometry:!0,material:!0,transform:!0};#s=new Map;constructor(r,e,t,n){super(r,e),r.flags??=[],r.flags.indexOf("geometry")===-1&&r.flags.push("geometry"),r.flags.indexOf("material")===-1&&r.flags.push("material"),r.flags.indexOf("position")===-1&&r.flags.indexOf("transform")===-1&&r.flags.push("transform"),this.#e=t,this.#r=n}texture(r,e){return this.#n?.texture(r,e)}specificBuffer(r,e){let t=this.#a,n=this.allFlags();(a.isNull(this.#i)||n.includes("position")||n.includes("transform"))&&(this.#s.clear(),t.transform=!0,this._rebuildWorldMatrices(r)),(a.isNull(this.#t)||n.includes("geometry"))&&(t.geometry=!0,this._ensureGeometryBuffer()),(a.isNull(this.#n)||n.includes("material"))&&(t.material=!0,this._ensureMaterialBuffer()),tt.clearFlags(this);let i=this.#t,s=this.#n;switch(e){case"geometryPositions":case"geometryNormals":case"geometryTexCoords":case"geometry":return i.buffer(r,e);case"material":case"line":return s.buffer(r,e);case"objectWorldTransform":let l=this.#i,p=t.transform;t.transform=!1;let u=this.#s,{pipeline:f}=r,g=!u.has(f);return g&&u.set(f,l),a.extend(l,{fresh:p||g});default:Pc(e,o)}}_ensureGeometryBuffer(){let r=this.#t,e=this.#e,n=this.item.geometry;if(a.isNull(e))r?.destroy(),this.#t=new Ud(n);else{let i=e?.get(n);i?.disposed!==!1&&(i=new Ud(n),e.set(n,i)),this.#t=i}}_ensureMaterialBuffer(){let r=this.#n,e=this.#r,n=this.item.material??FE;if(a.isNull(e))r?.destroy(),this.#n=new zd(n);else{let i=e?.get(n);i?.disposed!==!1&&(i=new zd(n),e.set(n,i)),this.#n=i}}_rebuildWorldMatrices({device:r}){let e=this.item,t=this.buildWorldTransform(),n=Tr.transpose(Tr.invert(t)),i=new Float32Array(28);if(i.set(Tr.toArray(t),0),i.set([n.m11,n.m12,n.m13,0,n.m21,n.m22,n.m23,0,n.m31,n.m32,n.m33,0],16),a.isNull(this.#i)){let s=Lt.createUniform(r,i,Ve+"mesh-"+e.key+"-worldmatrix-buffer");this.#i={buffer:s,value:i,version:performance.now().roundoff()}}else this.#i.value=i,this.#i.version=performance.now().roundoff()}dispose(){this.#s.clear();let r=this.#i;this.#i=null,this.destroySafely(r);let e=this.#n;this.#n=null,e?.destroy();let t=this.#t;this.#t=null,t?.destroy()}},Ig=class o extends Oc{#e;#t=new Map;constructor(r){super(r),r.flags.push("light")}_rebuildAmbientLightBuffer({device:r}){let e=this.item,t=4,n=1,i=0,s=4,l=24,p=new Float32Array(l),{r:u,g:f,b:g,a:v}=Be.parse(e.color??"#fff");p.set([u,f,g,v],i),p.set([e.intensity],s),this.#e={value:p,buffer:Lt.createUniform(r,p,Ve+"ambient-light-buffer"),version:performance.now()}}_rebuildDirectionalLightBuffer({device:r}){let e=this.item,t=1,n=4,i=3,s=0,l=4,p=7,u=p+t,f=new Float32Array(u),{r:g,g:v,b:y,a:_}=Be.parse(e.color??"#fff");f.set([g,v,y,_],s),f.set([e.intensity],p);let x=Ag.subtract(e.position,e.target);f.set([x.x,x.y,x.z],l),this.#e={value:f,buffer:Lt.createUniform(r,f,Ve+"directional-light-buffer"),version:performance.now()}}_rebuildOmniLightBuffer({device:r}){let e=this.item,t=1,n=4,i=3,s=0,l=4,p=7,u=p+t,f=new Float32Array(u),{r:g,g:v,b:y,a:_}=Be.parse(e.color??"#fff");f.set([g,v,y,_],s),f.set([e.intensity],p),f.set([e.position.x,e.position.y,e.position.z],l),this.#e={value:f,buffer:Lt.createUniform(r,f,Ve+"omni-light-buffer"),version:performance.now()}}_rebuildLight(r){this.destroySafely(this.#e);let e=this.item;switch(e.type){case"direction":this._rebuildDirectionalLightBuffer(r);break;case"omni":this._rebuildOmniLightBuffer(r);break;case"ambient":this._rebuildAmbientLightBuffer(r);break;default:throw new Error(`Light '${e.type}' is not supported.`)}}texture(r){throw new Error("Method not implemented.")}specificBuffer(r,e){let t=this.#t,n=a.isNull(this.#e)||this.allFlags().length>0;n&&(t.clear(),this._rebuildLight(r)),tt.clearFlags(this);let{pipeline:i}=r;if(t.has(i)||(n=!0,t.set(i,this.#e)),e==="light")return a.extend(this.#e,{fresh:n});Pc(e,o)}dispose(){this.#t.clear();let r=this.#e;this.#e=null,this.destroySafely(r)}};var Ae=Ve,Ey={multisample:!0,packedVertices:!0,primitive:{topology:"triangle-list",frontFace:"ccw",cullMode:"back"}},zt=o=>{},ol=class o{static{this._memoizer=new WeakMap}static dispose(r){let e=this._memoizer,t=e.get(r);a.isNull(t)||(t.clear(),e.delete(r))}static createColorPicking(r,e){let t=o.create(r,e);return t instanceof Kh||t instanceof Jh?{frame:t.raycast}:null}static create(r,[e,t,...n],i){let s=o._memoizer,l=s.get(r);if(a.isNull(l)&&s.set(r,l=new Map),a.isNull(e))throw new Error("Pipeline not implemented, given the provided arguments.");if(wr(e.item)){let p=Ec(e.item.geometry),u=!p&&va(e.item.material);if(!p&&!u)throw new Error("Pipeline not implemented, given the provided mesh argument.");let f=p?new $g(e,t,...n):new Hg(e,t),g=f.key+(i?.modifiers?.version??""),v=l.get(g);if(v)return v;let y=p?new Kh(r,f):new Jh(r,f);y.build(i);let _=y;return a.extend(_,{id:g+"-"+r.canvas.width+"x"+r.canvas.height+"-"+a.Dates.now().toISOString()}),l.set(g,_),_}else throw new ReferenceError("Pipeline not implemented, given thst the first argument is not a mesh.")}},qh=class{constructor(){this.#e=new Map}#e;ensureBindGroup({device:r},e,t,n,i,s,l=()=>{}){let p=this.#e,u=typeof e=="string"?e:e.key,f=p.get(u);if(a.isNull(f)&&p.set(u,f=new Map),n||!f.has(s)){let g=t.map((_,x)=>({binding:x,resource:{buffer:_}})),v={label:s,layout:i,entries:g};l(v);let y=r.createBindGroup(v);return f.set(s,y),y}else return f.get(s)}},$g=class o{#e=[];#t;#r;#n=new Map;#i={shader:"basic",lights:""};constructor(...r){this.add(...r)}reset(){this.#e.splice(0),this.#t=null,this.#n.clear(),this.#i={shader:"basic",lights:""}}add(...r){for(let e of r??[])if(wr(e.item))if(a.isNull(this.#t)){this.#t=e;let t=e.item.material??{shader:"basic"};this.#i.shader=t.shader+"-"+(t.map?"map":"nomap")}else throw new Error("Mesh already added.");else if(ui(e.item))this.#e.push(e),this.#i.lights+="-"+e.item.type;else if(Vt(e.item))this.#r??=e;else throw new Error("Unknown object type.")}build(r){let e=this._computeBasicData(),t=this.key,n=this.vertex({inputModifier:r?.vertexInput,outputModifier:r?.vertexOutput}),i=this.fragment(e,{modifier:r?.fragment}),s=(...p)=>o.prototype.bindgroup.apply(this,p),l={lightCount:this.#e.length,mapCount:this.#t.item.material?.map?1:0};return{vertex:n,fragment:i,key:t,bindings:s,metadata:l}}get key(){let{shader:r,lights:e}=this.#i;return"mesh-"+r+e}bindgroup(r,e,t){let i=this.#n.get(r);if(a.isNull(i))return null;if(a.isNullOrEmpty(e))return i;let s=i.filter(l=>l.key===e);return isNaN(t)?s:t>=0&&t<i.length?s[t]:s}vertex(r){return cy(r)}_computeBasicData(){let r=this.#t.item,e=this.#e,t=r.material,n=!a.isNull(t?.texture),i=!a.isNullOrEmpty(e),s=a.isNull(r)?"basic":r.material?.shader??"basic";return{hasTexture:n,hasLighting:i,shader:s,materialBindGroupIndex:2,lightingBindGroupIndex:3}}_computeBindGroupsAndReferences(r=this._computeBasicData()){let{hasTexture:e,materialBindGroupIndex:t,lightingBindGroupIndex:n}=r,i=this.#n,s=this.#e,l={key:"objectWorldTransform",group:1,binding:0,type:"buffer"},p={key:"material",group:t,binding:0,type:"buffer"};e?i.set("mesh",[l,p,{key:"texture",group:t,type:"texture"}]):i.set("mesh",[l,p]),i.set("camera",[{key:"cameraViewTransform",group:0,binding:0,type:"buffer"}]);let u=s.map((f,g)=>({key:"light",group:n,binding:g,type:"buffer"}));u.push(...u),i.set("interaction",[{key:"interaction",group:0,type:"buffer",binding:1}])}fragment(r=this._computeBasicData(),e){this._computeBindGroupsAndReferences(r);let t={definitions:[],bindings:[],modifiers:[]},n=i=>{for(let s of i.definitions??[])t.definitions.indexOf(s)===-1&&t.definitions.push(s);a.isNullOrEmpty(i.bindings)||t.bindings.push(...i.bindings),a.isNullOrEmpty(i.modifiers)||t.modifiers.push(...i.modifiers)};switch(r.shader){case"basic":if(r.hasTexture){let l=r.materialBindGroupIndex,p=my({inputColor:sl,outputColors:[sl],uv:"uv"},l);n(p)}let i=0,s=this.#e;for(let l of s){switch(l.item.type){case"direction":let u=fy({outputColor:Id,normal:"normal"},r.lightingBindGroupIndex,i);n(u);break;case"omni":let f=gy({outputColor:Id,normal:"normal",position:"vertex"},r.lightingBindGroupIndex,i);n(f);break;case"ambient":let g=vy({inputColor:sl,outputColor:Hh},r.lightingBindGroupIndex,i);n(g);break}i++}return Hd.fragment(t,e)}}},Zr={writeBufferConditionally:(o,r)=>{r.fresh&&o.queue.writeBuffer(r.buffer,0,r.value)}},Kh=class{constructor(r,e,t=new qh){this._context=r;this._builder=e;this._cache=t;this._ensureU32idBindGroup=(r,e,t)=>this._cache.ensureBindGroup(this._context,r,[e],t,this._pickBindGroupLayout,Ae+"mesh-colorpick-bind-group");this._ensureMaterialBindGroup=(r,e,t,n,i=2)=>{let s=this._bindGroupLayouts[i],l=Ae+"material-bind-group";if(s.label!==Ae+"material-bind-group-layout")throw new Error("BindGroupLayout mismatch!");return this._cache.ensureBindGroup(this._context,r,[e],n,s,l,p=>{let{device:u}=this.context,f=p.entries;t&&f.push({binding:1,resource:u.createSampler({addressModeU:"repeat",addressModeV:"repeat",magFilter:"linear",minFilter:"linear"})},{binding:2,resource:t.createView()})})};this._ensureWorldTransformBindGroup=(r,e,t,n=1,i=!1)=>{let s=this._bindGroupLayouts[n];if(s.label!==Ae+"mesh-transforms-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let l=r.key+"-"+(i?1:0),p=`${Ae}${i?"colorpick":"mesh"}-transforms-bind-group`;return this._cache.ensureBindGroup(this._context,l,[e],t,s,p)};this._ensureCameraProjectionAndInteractionDataBindGroup=(r,e,t,n,i=0,s=!1)=>{let l=this._bindGroupLayouts[i],p=r.key+"-"+(s?1:0),u=`${Ae}${s?"colorpick":"mesh"}-view-bind-group`;return this._cache.ensureBindGroup(this._context,p,[e,t],n,l,u)};this._ensureLightingBindGroup=(r,e,t=3)=>{let n=this._bindGroupLayouts[t],i=r.map(l=>l.id).join(":"),s=r.map(l=>l.buffer.buffer);return this._cache.ensureBindGroup(this._context,i,s,e,n,Ae+"mesh-lighting-bind-group")};this._bindGroupLayouts=[];this._bindVertex=zt;this._bindPicker=zt;this._bindWorldTransform=zt;this._bindRaycastWorldTransform=zt;this._bindCameraProjectionAndInteractionData=zt;this._bindRaycastCameraProjectionAndInteractionData=zt;this._bindLighting=zt;this._bindMaterial=zt;this.set=r=>{throw new Error("Deprecated.")};this.bind=(r,...e)=>{throw new Error("Deprecated.")};this.draw=(r,...e)=>{throw new Error("Deprecated.")};this.frame=(r,e,t,n,...i)=>{r.setPipeline(this._pipeline);try{this._bindVertex(r,t),this._bindWorldTransform(r,t),this._bindMaterial(r,t),this._bindCameraProjectionAndInteractionData(r,n,e),this._bindLighting(r,...i);let s=t.item,l=s.geometry;r.draw(l.triangleIndices?.length||l.positions.length)}catch(s){console.error("Pacem.Drawing3D.FrameException",s)}};this.raycast=(r,e,t,n)=>{r.setPipeline(this._pickPipeline);try{this._bindVertex(r,t),this._bindRaycastWorldTransform(r,t),this._bindRaycastCameraProjectionAndInteractionData(r,n,e),this._bindPicker(r,t);let i=t.item,s=i.geometry;r.draw(s.triangleIndices.length)}catch{}};this._key=e.key}get context(){return this._context}get key(){return this._key}build(r){let e=a.extend({},Ey,r??{}),t=this._builder,n=t.build(e.modifiers),i=a.extend({pipeline:this},this._context),s=i.device,l={module:s.createShaderModule({code:n.vertex}),buffers:e.packedVertices?[al.createVertex(0,3,3,2)]:[al.createVertex(0,3),al.createVertex(1,3),al.createVertex(2,2)]},p=s.createBindGroupLayout({entries:[{binding:0,visibility:3,buffer:{type:"uniform"}},{binding:1,visibility:3,buffer:{type:"uniform"}}],label:Ae+"mesh-view-bind-group-layout"}),u=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"mesh-transforms-bind-group-layout"}),f=[p,u],g={module:s.createShaderModule({code:n.fragment}),targets:[{format:i.format,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{}}}]},v=f.length,y=[{binding:0,visibility:2,buffer:{type:"read-only-storage"}}],{mapCount:_}=n.metadata,x=_>0;x&&y.push({visibility:2,binding:1,sampler:{}},...Array(_).keys().map(I=>({visibility:2,binding:2+I,texture:{}})));let w={label:Ae+"material-bind-group-layout",entries:y},E=s.createBindGroupLayout(w);f.push(E);let k=f.length,{lightCount:N}=n.metadata,T=N>0;if(T){let I=s.createBindGroupLayout({entries:[...Array(N).keys()].map((G,Y)=>({visibility:2,binding:Y,buffer:{type:"uniform"}})),label:Ae+"lighting-bind-group-layout"});f.push(I)}let O={label:Ae+"mesh-render-pipeline",vertex:l,fragment:g,layout:s.createPipelineLayout({label:Ae+"mesh-render-pipeline-layout",bindGroupLayouts:this._bindGroupLayouts=f}),primitive:e.primitive};e.multisample&&(O.multisample={count:4},O.depthStencil={depthCompare:"less",format:"depth24plus",depthWriteEnabled:!0}),this._pipeline=s.createRenderPipeline(O);let D=this._pickBindGroupLayout=s.createBindGroupLayout({label:Ae+"mesh-colorpick-bind-group-layout",entries:[{visibility:2,binding:0,buffer:{type:"uniform"}}]}),P={label:Ae+"mesh-colorpick-pipeline",vertex:l,fragment:{module:s.createShaderModule({code:Sg(2)}),targets:[{format:"r32uint"}]},layout:s.createPipelineLayout({label:Ae+"mesh-colorpick-pipeline-layout",bindGroupLayouts:[p,u,D]}),primitive:e.primitive,depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};this._pickPipeline=s.createRenderPipeline(P);let F=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided.`);let{buffer:W}=Y.buffer(i,"geometryPositions"),{buffer:V}=Y.buffer(i,"geometryNormals"),{buffer:X}=Y.buffer(i,"geometryTexCoords");I.setVertexBuffer(0,W),I.setVertexBuffer(1,V),I.setVertexBuffer(2,X)},B=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided.`);let{buffer:W}=Y.buffer(i,"geometry");I.setVertexBuffer(0,W)};this._bindVertex=e.packedVertices?B:F;let $=(I,G,Y)=>{if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let W=G.buffer(i,"objectWorldTransform"),V=W.buffer;Zr.writeBufferConditionally(s,W);let{group:X}=n.bindings("mesh","objectWorldTransform",0),q=this._ensureWorldTransformBindGroup(G.item,V,W.fresh,X,Y);I.setBindGroup(X,q)};this._bindWorldTransform=(I,...G)=>{let Y=G.at(0);$(I,Y,!1)},this._bindRaycastWorldTransform=(I,...G)=>{let Y=G.at(0);$(I,Y,!0)};let U=(I,G,Y,W)=>{if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing view projection buffers was provided.`);let V=G.buffer(i,"cameraViewTransform"),X=V.buffer;if(Zr.writeBufferConditionally(s,V),a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing interaction buffers was provided.`);let q=Y.buffer(i,"interaction"),Z=q.buffer;Zr.writeBufferConditionally(s,q);let{group:ne}=n.bindings("camera","cameraViewTransform",0),{group:te}=n.bindings("interaction","interaction",0);if(ne!==te)throw new ReferenceError(`Layout bind group mismatch: ${ne} vs ${te}.`);let ae=this._ensureCameraProjectionAndInteractionDataBindGroup(G.item,X,Z,V.fresh||q.fresh,ne,W);I.setBindGroup(ne,ae)};this._bindCameraProjectionAndInteractionData=(I,...G)=>{let Y=G.at(0),W=G.at(1);U(I,Y,W,!1)},this._bindRaycastCameraProjectionAndInteractionData=(I,...G)=>{let Y=G.at(0),W=G.at(1);U(I,Y,W,!0)},this._bindMaterial=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex colors was provided.`);let W=Y.buffer(i,"material"),V=W.buffer;Zr.writeBufferConditionally(s,W);let X=Y.texture(i),q=X?.texture,Z=this._ensureMaterialBindGroup(Y.item,V,q,W.fresh,v);I.setBindGroup(v,Z),x&&s.queue.copyExternalImageToTexture({source:X.source,flipY:!0},{texture:q},{width:q.width,height:q.height})},this._bindLighting=(I,...G)=>{if(T){let W=Array.from(G).map(q=>({buffer:q.buffer(i,"light"),id:q.item.key})),V=W.some(q=>q.buffer.fresh),X=this._ensureLightingBindGroup(W,V,k);for(let q of W)Zr.writeBufferConditionally(s,q.buffer);I.setBindGroup(k,X)}},this._bindPicker=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let W=Y.buffer(i,"u32id"),V=W.buffer;Zr.writeBufferConditionally(s,W);let X=2,q=W.fresh,Z=this._ensureU32idBindGroup(Y.item,V,q);I.setBindGroup(X,Z)}}},Hg=class o{#e;#t;#r=new Map;constructor(...r){this.add(...r)}reset(){this.#e=null,this.#r.clear()}add(...r){for(let e of r??[])if(wr(e.item))if(a.isNull(this.#e))this.#e=e;else throw new Error("Line already added.");else if(Vt(e.item))this.#t??=e;else if(!ui(e.item))throw new Error("Unknown object type.")}build(){let r=this._computeBasicData(),e=this.key,t=this.vertex(r),n=this.fragment(r);return{vertex:t,fragment:n,key:e,bindings:(...s)=>o.prototype.bindgroup.apply(this,s),metadata:{thickness:r.thickness,dashPattern:r.dashPattern}}}get key(){let r=(this.#e?.item).material?.lineWidth>1;return"line"+(r?"-fat":"")}bindgroup(r,e,t){let i=this.#r.get(r);if(a.isNull(i))return null;if(a.isNullOrEmpty(e))return i;let s=i.filter(l=>l.key===e);return isNaN(t)?s:t>=0&&t<i.length?s[t]:s}vertex(r=this._computeBasicData()){return r.thickness>1?uy():dy()}_computeBasicData(){let r=this.#e.item,e=a.isNull(r)?"line":r.material?.shader??"line",t=r.material,n=t?.lineWidth??1,i=t?.dashArray;return{shader:e,thickness:n,dashPattern:i}}_computeBindGroupsAndReferences(r=this._computeBasicData()){let e=this.#r,t={key:"objectWorldTransform",group:1,binding:0,type:"buffer"},n={key:"material",group:3,binding:0,type:"buffer"},i={key:"geometryPositions",group:2,binding:0,type:"buffer"},s={key:"line",group:2,binding:1,type:"buffer"};e.set("mesh",[t,n,i,s]),e.set("camera",[{key:"cameraViewTransform",group:0,binding:0,type:"buffer"}])}fragment(r=this._computeBasicData()){this._computeBindGroupsAndReferences(r);let e={definitions:[],bindings:[],modifiers:[]};if(r.shader==="line")return Bd.fragment(e)}},Jh=class{constructor(r,e,t=new qh){this._lineBuilder=e;this._cache=t;this._ensureLineU32idBindGroup=(r,e,t)=>{let n=this.context;return this._cache.ensureBindGroup(n,r,[e],t,this._pickLineBindGroupLayout,Ae+"line-colorpick-bind-group")};this._ensureLineMaterialBindGroup=(r,e,t,n=2)=>{let i=this._bindLineGroupLayouts[n];if(i.label!==Ae+"line-material-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let s=this.context;return this._cache.ensureBindGroup(s,r,[e],t,i,Ae+"line-material-bind-group")};this._ensureLinePositionsBindGroup=(r,e,t,n)=>{let i=this._bindLineGroupLayouts[n];if(i.label!==Ae+"line-positions-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let s=this.context;return this._cache.ensureBindGroup(s,r,e,t,i,Ae+"line-positions-bind-group")};this._ensureLineWorldTransformBindGroup=(r,e,t,n=1,i=!1)=>{let s=this._bindLineGroupLayouts[n];if(s.label!==Ae+"line-transforms-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let l=r.key+"-line-"+(i?1:0),p=`${Ae}${i?"colorpick":""}-line-transforms-bind-group`,u=this.context;return this._cache.ensureBindGroup(u,l,[e],t,s,p)};this._ensureLineCameraProjectionBindGroup=(r,e,t,n=0,i=!1)=>{let s=this._bindLineGroupLayouts[n],l=r.key+"-line-"+(i?1:0),p=`${Ae}${i?"colorpick":""}-line-view-bind-group`,u=this.context;return this._cache.ensureBindGroup(u,l,[e],t,s,p)};this._bindLineGroupLayouts=[];this._bindLinePositions=zt;this._bindLinePicker=zt;this._bindLineWorldTransform=zt;this._bindLineRaycastWorldTransform=zt;this._bindLineCameraProjection=zt;this._bindLineRaycastCameraProjection=zt;this._bindLineMaterial=zt;this._drawLine=zt;this.set=r=>{throw new Error("Deprecated.")};this.bind=(r,...e)=>{throw new Error("Deprecated.")};this.draw=(r,...e)=>{throw new Error("Deprecated.")};this.frame=(r,e,t,n)=>{r.setPipeline(this._linePipeline);try{this._bindLineWorldTransform(r,t),this._bindLineCameraProjection(r,n),this._bindLinePositions(r,t),this._bindLineMaterial(r,t),this._drawLine(r,t)}catch(i){console.error("Pacem.Drawing3D.FrameException",i)}};this.raycast=(r,e,t,n)=>{r.setPipeline(this._pickLinePipeline);try{this._bindLineRaycastWorldTransform(r,t),this._bindLineRaycastCameraProjection(r,n),this._bindLinePositions(r,t),this._bindLinePicker(r,t),this._drawLine(r,t)}catch{}};this.#e=r,this._lineKey=e.key}#e;get context(){return this.#e}get key(){return this._lineKey}build(r){let e=a.extend({},Ey,r??{}),t=this._lineBuilder,n=t.build(),i=a.extend({pipeline:this},this.#e),s=i.device,l=n.metadata.thickness>1,p={module:s.createShaderModule({code:n.vertex}),buffers:[]},u=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"line-transforms-bind-group-layout"}),f=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"line-view-bind-group-layout"}),g=[{binding:0,visibility:1,buffer:{type:"read-only-storage"}}];l&&g.push({binding:1,visibility:1,buffer:{type:"uniform"}});let v=s.createBindGroupLayout({entries:g,label:Ae+"line-positions-bind-group-layout"}),y=[f,u,v],_=y.length,x=y.slice(),w={module:s.createShaderModule({code:n.fragment}),targets:[{format:i.format,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{}}}]},E=x.length,k=[{binding:0,visibility:2,buffer:{type:"read-only-storage"}}],N={label:Ae+"line-material-bind-group-layout",entries:k},T=s.createBindGroupLayout(N);x.push(T);let O=l?e.primitive.topology:"line-list",D={label:Ae+"line-render-pipeline",vertex:p,fragment:w,layout:s.createPipelineLayout({label:Ae+"line-render-pipeline-layout",bindGroupLayouts:this._bindLineGroupLayouts=x}),primitive:a.extend({},e.primitive,{topology:O})};e.multisample&&(D.multisample={count:4},D.depthStencil={depthCompare:"less",format:"depth24plus",depthWriteEnabled:!0}),this._linePipeline=s.createRenderPipeline(D);let P=this._pickLineBindGroupLayout=s.createBindGroupLayout({label:Ae+"line-colorpick-bind-group-layout",entries:[{visibility:2,binding:0,buffer:{type:"uniform"}}]}),F={label:Ae+"line-colorpick-pipeline",vertex:p,fragment:{module:s.createShaderModule({code:Sg(_)}),targets:[{format:"r32uint"}]},layout:s.createPipelineLayout({label:Ae+"line-colorpick-pipeline-layout",bindGroupLayouts:y.concat(P)}),primitive:a.extend({},e.primitive,{topology:O}),depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};this._pickLinePipeline=s.createRenderPipeline(F);let B=(U,I,G)=>{if(a.isNull(I))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let Y=I.buffer(i,"objectWorldTransform"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let{group:V}=n.bindings("mesh","objectWorldTransform",0),X=this._ensureLineWorldTransformBindGroup(I.item,W,!1,V,G);U.setBindGroup(V,X)};this._bindLineWorldTransform=(U,...I)=>{let G=I.at(0);B(U,G,!1)},this._bindLineRaycastWorldTransform=(U,...I)=>{let G=I.at(0);B(U,G,!0)};let $=(U,I,G)=>{if(a.isNull(I))throw new ReferenceError(`Null ${tt.name} bringing view projection buffers was provided.`);let Y=I.buffer(i,"cameraViewTransform"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let{group:V}=n.bindings("camera","cameraViewTransform",0),X=this._ensureLineCameraProjectionBindGroup(I.item,W,!1,V,G);U.setBindGroup(V,X)};this._bindLineCameraProjection=(U,...I)=>{let G=I.at(0);$(U,G,!1)},this._bindLineRaycastCameraProjection=(U,...I)=>{let G=I.at(0);$(U,G,!0)},this._bindLinePositions=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided as index 0.`);let Y=G.buffer(i,"geometryPositions"),W=Y.buffer,V=Y.fresh,X=[W];if(Zr.writeBufferConditionally(s,Y),l){let ne=G.buffer(i,"line"),te=ne.buffer;V||=ne.fresh,X.push(te),Zr.writeBufferConditionally(s,ne)}let{group:q}=n.bindings("mesh","line",0),Z=this._ensureLinePositionsBindGroup(G.item,X,V,q);U.setBindGroup(q,Z)},this._bindLineMaterial=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing vertex colors was provided.`);let Y=G.buffer(i,"material"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let V=this._ensureLineMaterialBindGroup(G.item,W,Y.fresh,E);U.setBindGroup(E,V)},this._bindLinePicker=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let Y=G.buffer(i,"u32id"),W=Y.buffer,V=Y.value;Zr.writeBufferConditionally(s,Y);let X=this._ensureLineU32idBindGroup(G.item,W,!1);U.setBindGroup(_,X)},this._drawLine=(U,...I)=>{let Y=I.at(0).item,W=Y.geometry;l?U.draw(6,W.positions.length-1,0,0):U.draw(W.positions.length)}}};var Fd=class{static{this._memoizer=new WeakMap}static dispose(r){let e=this._memoizer;if(e.has(r)){let t=e.get(r);for(let n of t.values())n.destroy();t.clear(),e.delete(r)}}static createColorPicking(r){let e=this._memoizer;e.has(r)||e.set(r,new Map);let t=e.get(r),n="colorpick";if(t.has(n))return t.get(n);let i=new Bg(r);return t.set(n,i),i}},Gd=1,Bg=class{constructor(r){this._context=r;this._objects=new Map;this.frame=(r,...e)=>{if(a.isNull(this._encoder))throw new Error("Null encoder. Maybe you missed to call the 'begin' method first.");let t=Array.from(e);ol.createColorPicking(this._context,t)?.frame(this._pass,r,...e);for(let i of t)i.item.inert||this._objects.set(i.id,i)};this.end=r=>{if(!a.isNull(this._handle))return this._handle;let e=this._pass,t=this._encoder,{device:n}=this._context,{render:i}=this._textures,s=i.texture,l=this._ensureBuffer();e.end(),t.copyTextureToBuffer({texture:s,origin:{x:r.x,y:r.y}},{buffer:l,bytesPerRow:(Gd*4+255|0)*256,rowsPerImage:1},{width:Gd}),n.queue.submit([t.finish()]),this._encoder=null;let p=this,u=p._objects,f=()=>{p._handle=null};return this._handle=new Promise((g,v)=>{l.mapAsync(1,0,4*Gd).then(y=>{let x=new Uint32Array(l.getMappedRange(0,4*Gd))[0];l.unmap(),f();let w=u.get(x);g(w?[w.item]:[])})})}}_createTexture(r){let{device:e,canvas:t}=this._context,n=Math.min(e.limits.maxTextureDimension2D,t.clientWidth),i=Math.min(e.limits.maxTextureDimension2D,t.clientHeight);return e.createTexture({size:[n,i,1],format:r,usage:17})}_ensureBuffer(){let r=this._buffer;if(!a.isNull(r))return r;let{device:e}=this._context;return this._buffer=e.createBuffer({label:Ve+"colorpick-output-buffer",size:Gd*4,usage:9})}_ensureTextures(){let r=this._textures;if(!a.isNull(r))return r;let e=this._createTexture("r32uint"),t=this._createTexture("depth24plus"),n={texture:e,view:e.createView()},i={texture:t,view:t.createView()};return this._textures={render:n,depth:i}}_destroyTexture(r){a.isNull(r)||r.texture?.destroy()}destroy(){let r=this._textures,e=this._buffer;if(!a.isNullOrEmpty(r)){let{render:t,depth:n}=r;this._destroyTexture(t),this._destroyTexture(n),this._textures=null}a.isNull(e)||(e.destroy(),this._buffer=null)}begin(){let{device:r}=this._context;this._encoder=r.createCommandEncoder({label:Ve+"colorpick-raycaster"});let{render:e,depth:t}=this._ensureTextures(),n={label:Ve+"colorpick-raycaster-pass",colorAttachments:[{view:e.view,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:t.view,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}};this._pass=this._encoder.beginRenderPass(n),this._objects.clear()}};var Vg=we.LinearAlgebra.Vector3D;var Zh=class{static create(r,e){return new Promise((t,n)=>{if(!navigator.gpu)n({message:"WebGPU not supported.",cause:0});else{let i=new Ug(r);i.init(e).then(s=>t(i),s=>{let p={message:typeof s=="string"?s:s.message,cause:1};n(p)})}})}};function jE(o){return{bottom:-1,top:1,left:-1,right:1,near:.1,far:200,lookAt:Vg.from(0,0,0),up:Vg.j(),position:Vg.from(0,0,1),type:"orthographic",flags:[],stage:o}}function YE(...o){for(let r of o||[])r?.destroy()}var Ug=class{constructor(r){this.#n=new WeakMap;this.#i=new WeakMap;this.#a=new WeakMap;this.#l={enableValidation:!1};this.#h=!1;this._logError=r=>{let e=this.#e,t=e.logger;if(!a.isNull(t)){let n="error"in r?r.error:r;t.log(ce.LogLevel.Error,n.message,"WebGPU")}};this.#c=!0;this.#u=!1;let e=(this.#e=r).stage,t=document.createElement("canvas");t.id=d+"_3d_stage_"+a.uniqueCode(),e.innerHTML="",e.appendChild(this.#t=t),this.#p=Dc.create(this.#d={time:performance.now(),cursor:{x:0,y:0},resolution:{width:0,height:0}})}#e;#t;#r;#n;#i;#a;#s;#o;#l;#h;#p;#d;_buildPassDescriptor({multisample:r,format:e}){let{context:t,device:n}=this.#r,i=t.getCurrentTexture(),s=this.#o;if(a.isNull(s)){if(s={},r){let _=n.createTexture({label:Ve+"render-texture",format:e??i.format,usage:16,size:[i.width,i.height],sampleCount:4});s.render={texture:_,view:_.createView({label:Ve+"render-texture-view"})};let x=n.createTexture({label:Ve+"depth-texture",format:"depth24plus",usage:16,size:[i.width,i.height],sampleCount:4});s.depth={texture:x,view:x.createView({label:Ve+"depth-texture-view"})}}this.#o=s}let{transparent:l,background:p}=this.#e,u=l?{r:0,g:0,b:0,a:0}:p?typeof p=="string"?Be.parse(p):p:{r:0,g:0,b:0,a:1},f=os.flattenVectorArray([u]),g=i.createView({label:Ve+"canvas-texture-view"}),v={view:g,clearValue:f,loadOp:"clear",storeOp:"store"},y={colorAttachments:[v]};if(r){let _=s.render.view,x=s.depth.view;y.depthStencilAttachment={view:x,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:0,stencilReadOnly:!0},v.view=_,v.resolveTarget=g}return y}_buildContext(r=this.#t,e=this.#e.size){e??=r;let t=e.width,n=e.height,i=1;r.width=t*i,r.height=n*i;let s=r.getContext("webgpu"),l=navigator.gpu.getPreferredCanvasFormat();return{context:s,textureFormat:l}}_buildUpContext(r,e,t,n){let{transparent:i}=this.#e;t.configure({alphaMode:i?"premultiplied":"opaque",device:r,format:n}),this.#r={device:r,adapter:e,canvas:this.#t,context:t,format:n},this.#c=!1}async init(r){this.#l=r;let e=await navigator.gpu.requestAdapter();if(a.isNull(e))throw new Error("WebGPU adapter unavalable or disabled.");let t=await e.requestDevice();if(a.isNull(e))throw new Error("WebGPU device unavalable or disabled.");t.addEventListener("uncapturederror",this._logError),this.#u=!a.isNull(r.modifiers?.version)&&!a.isNull(r.modifiers)&&(!a.isNull(r.modifiers.vertexInput)||!a.isNull(r.modifiers.vertexOutput)||!a.isNull(r.modifiers.fragment));let{context:n,textureFormat:i}=this._buildContext();this._buildUpContext(t,e,n,i)}#c;#u;render(r){if(this.#c||a.isNull(this.#s)||!(this.#t.width>0)||!(this.#t.height>0))return;let e=this.#r,t=e.device,n=this.#s,i=this.#l?.enableValidation??!1;this.#u&&a.extend(this.#d,r);let l=this._buildPassDescriptor({multisample:!0}),p=t.createCommandEncoder({label:Ve+"renderer"}),u=p.beginRenderPass(l);n.loop((f,g,v)=>{if(f.item.hide)return!1;i&&t.pushErrorScope("validation");let y=[f,g,...v];return ol.create(e,y,{multisample:!0,modifiers:this.#l.modifiers}).frame(u,this.#p,...y),i&&t.popErrorScope().then(x=>{x&&this._logError(x)}),!0}),u.end(),t.queue.submit([p.finish()])}set disabled(r){this.#h=r}get disabled(){return this.#h}raycast(r){if(this.#c||a.isNull(this.#s))return Promise.resolve([]);let e=this.#r,t=e.device,n=this.#s,i=this.#l?.enableValidation??!1,s=Fd.createColorPicking(e);return s.begin(),n.loop((l,p)=>l.item.hide?!1:(i&&t.pushErrorScope("validation"),s.frame(this.#p,l,p),i&&t.popErrorScope().then(u=>{u&&this._logError(u)}),!0)),s.end(r)}_disposeRenderableJustInCase(r){let e=this.#n;e.has(r)&&(e.get(r)?.destroy(),e.delete(r))}_createOrYieldRenderable(r,e=this.#i,t=this.#a){r.stage??=this.#e;let n=this.#n,i=n.get(r);return a.isNull(i)&&n.set(r,i=tt.create(r,e)),i}_createOrYieldGeometry(r){let e=this.#i,t=e.get(r);return a.isNull(t)&&e.set(r,t=Dc.create(r)),t}_createOrYieldMaterial(r){let e=this.#a,t=e.get(r);return a.isNull(t)&&e.set(r,t=Dc.create(r)),t}_unwrapBuffers(r,e){e??={meshes:[],lights:[],cameras:[],groups:[]};for(let t of r.children)t.item.stage??=this.#e,wr(t.item)&&e.meshes.push(t),Vt(t.item)&&e.cameras.push(t),ui(t.item)&&e.lights.push(t),Wo(t.item)&&(e.groups.push(t),this._unwrapBuffers(t,e));return e}_update(r){let e=[],t=[],n=[],i=u=>this._createOrYieldRenderable(u),s;for(let u of r){if(u.hide){this._disposeRenderableJustInCase(u);continue}if(u.stage??=this.#e,Wo(u)){let f=u;f.flags.includes("children")&&this.#n.delete(f),e.push(i(f))}wr(u)&&u.geometry&&(this._createOrYieldGeometry(u.geometry),a.isNull(u.material)||this._createOrYieldMaterial(u.material),t.push(i(u))),ui(u)&&n.push(i(u)),Vt(u)&&(s??=u)}s??=jE(this.#e);let l=i(s),p={meshes:t,lights:n,cameras:[l],groups:e};for(let u of e)p=this._unwrapBuffers(u,p);this.#s?.items.meshes.forEach(u=>{t.includes(u)||u.destroy()}),this.#s=new Xh(p)}update(...r){this._update(Array.from(r))}dispose(){if(this.#s=null,this._disposeContext()){let{device:r}=this.#r;r.removeEventListener("uncapturederror",this._logError),r.destroy}}_disposeContext(){let r=this.#r;if(a.isNull(r))return!1;Fd.dispose(r),ol.dispose(r);let e=this.#o;if(this.#o=null,!a.isNull(e)){let{render:t,depth:n}=e;YE(t?.texture,n?.texture)}return r.context.unconfigure(),!0}resize(r){if(this.#c=!0,this._disposeContext()){let{device:e,adapter:t}=this.#r,{context:n,textureFormat:i}=this._buildContext(this.canvas,r);this._buildUpContext(e,t,n,i),this.#u&&a.extend(this.#d,{resolution:r})}}get canvas(){return this.#t}};var wy="WebGPURaycastCallback",zg="WebGPURaycastPixel",ky=A.getAttachedPropertyValue,My=A.setAttachedPropertyValue,XE=A.deleteAttachedPropertyValue,ll,Wd,Da=class extends R.PacemItemElement{constructor(){super(...arguments);z(this,ll,"");z(this,Wd,new MutationObserver(()=>{this.wgsl=this.textContent}))}findContainer(){return A.findAncestor(this,e=>e instanceof ls)}get version(){return M(this,ll)}viewActivatedCallback(){super.viewActivatedCallback(),this.wgsl=this.textContent,M(this,Wd).observe(this,{characterData:!0})}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="wgsl"&&this._computeVersion(n)}_computeVersion(e=this.wgsl){gn.hash(e).then(t=>{if(t!==M(this,ll)){let n=M(this,ll),i=t;H(this,ll,i);let s=new ue({propertyName:"version",oldValue:n,currentValue:i,firstChange:a.isNullOrEmpty(n)});this.dispatchEvent(s)}})}disconnectedCallback(){M(this,Wd).disconnect(),super.disconnectedCallback()}};ll=new WeakMap,Wd=new WeakMap,c([h({emit:!1,converter:m.String})],Da.prototype,"type",2),c([h({emit:!1,converter:m.String})],Da.prototype,"wgsl",2),Da=c([C({tagName:d+"-3d-wgsl-script"})],Da);var cl,pl,Ra,Ic,$c,Hc,ls=class extends fa{constructor(){super(...arguments);z(this,cl,[]);this._scriptVersionChangeHandler=e=>{let{propertyName:t}=e.detail;t==="version"&&this._parseWgslModifiers(e.detail.currentValue)};z(this,pl,new Set);z(this,Ra,new Map);z(this,Ic,!0);z(this,$c,!0);z(this,Hc,new WeakMap)}invalidateSize(e,t=e.size){this._ensureRenderer(e)?.resize(t)}get items(){return M(this,cl)}register(e){let t=M(this,cl);return e instanceof Da&&!t.includes(e)?(e.addEventListener(ee,this._scriptVersionChangeHandler,!1),t.push(e),this._parseWgslModifiers(this.modifiers?.version),!0):!1}unregister(e){let t=M(this,cl),n=t.indexOf(e);return n>=0?(e.removeEventListener(ee,this._scriptVersionChangeHandler,!1),t.splice(n,1),this._parseWgslModifiers(this.modifiers?.version),!0):!1}get supported(){return M(this,Ic)}get active(){return M(this,$c)}_webGPUNotSupported(e){M(this,Ic)&&e.cause===0&&(H(this,Ic,!1),this.dispatchEvent(new ue({propertyName:"supported",oldValue:null,currentValue:!1}))),M(this,$c)&&(H(this,$c,!1),this.dispatchEvent(new ue({propertyName:"active",oldValue:null,currentValue:!1})))}initialize(e){let t=M(this,Ra),n=M(this,pl);return n.has(e)||n.add(e),Zh.create(e,{enableValidation:this.enableValidation??!1,modifiers:this.modifiers}).then(i=>(t.get(e)?.update(),t.set(e,i),this._updatePipeline(e),i.canvas),i=>(this.log(ce.LogLevel.Error,i.message),this._webGPUNotSupported(i),null))}_parseWgslModifiers(e){let t=M(this,cl),n=t.find(f=>f.type=="vertex-input"),i=t.find(f=>f.type=="vertex-output"),s=t.find(f=>f.type=="fragment"),l=n?.wgsl,p=i?.wgsl,u=s?.wgsl;this.modifiers={vertexInput:l,vertexOutput:p,fragment:u,version:e}}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"modifiers":case"enableValidation":this._reinitialize();break}}disconnectedCallback(){let e=M(this,Ra);for(let[t,n]of e)n?.dispose();e.clear(),M(this,pl).clear(),super.disconnectedCallback()}dispose(e){let t=M(this,Ra),n=M(this,pl);t.has(e)&&(t.get(e)?.dispose(),t.delete(e)),n.has(e)&&n.delete(e)}_reinitialize(){for(let e of M(this,pl).values())this.initialize(e)}_ensureRenderer(e){return M(this,Ra).get(e)}_updatePipeline(e){this._ensureRenderer(e)?.update(...e.datasource)}render(e){let t=e.size?.width,n=e.size?.height;if(!(t>0)||!(n>0))return;let i=this._ensureRenderer(e);if(a.isNull(i))return;M(this,Hc).has(e)&&(M(this,Hc).delete(e),this._itemsChangedExec(e));let s=ky(e,zg);if(i.render({cursor:s,time:performance.now(),resolution:{width:t,height:n}}),!e.interactive)return;let l=ky(e,wy);if(!a.isNullOrEmpty(l)){if(a.isNullOrEmpty(s)){l(null);return}i.raycast(s).then(p=>{if(a.isNullOrEmpty(p))l(null);else{let u={object:p[0],point:null};l(u)}})}}snapshot(e,t,n,i){let s=M(this,Ra);if(!s.has(e))return Promise.resolve(null);let{canvas:l}=s.get(e),p=!a.isNullOrEmpty(t),u=n??(p?"image/jpeg":null),f=i??(p?.9:null);return new Promise((g,v)=>{this.render(e),a.snapshotElement(l,t,u,f).then(g)})}raycast(e,t,n,i){My(e,wy,i),t.x<0||t.y<0||t.x>=n.width||t.y>=n.height?XE(e,zg):My(e,zg,t)}_itemsChangedExec(e){this._updatePipeline(e)}_itemsChanged(e,t){M(this,Hc).set(e,!0)}addItem(e,t){this._itemsChanged(e,t)}removeItem(e,t){this._itemsChanged(e,t)}updateItem(e,t){(a.isNull(t)||t.flags.indexOf("visibility")>=0||t.flags.indexOf("children")>=0)&&this._itemsChanged(e,t)}zoomFit(e,...t){return Promise.resolve()}project(e,t){return{x:0,y:0}}getScene(e){return e}};cl=new WeakMap,pl=new WeakMap,Ra=new WeakMap,Ic=new WeakMap,$c=new WeakMap,Hc=new WeakMap,c([me(100)],ls.prototype,"_parseWgslModifiers",1),c([h({emit:!1})],ls.prototype,"modifiers",2),c([h({emit:!1,converter:m.Boolean})],ls.prototype,"enableValidation",2),ls=c([C({tagName:d+"-3d-webgpu-adapter"})],ls);var Pt=we.LinearAlgebra.Vector3D,Oa=we.LinearAlgebra.Matrix3D,Qh=we.LinearAlgebra.Quaternion,Ez=we.LinearAlgebra.Spherical;function qE(o){return Vt(o)?o.stage:null}var KE=1,JE=1,ZE=.05,jd=.001,Yd={maxAzimuth:180,minAzimuth:-180,inertia:!1,maxPolar:1/0,minPolar:-1/0,zoom:{enabled:!0},pan:{enabled:!0,button:2},rotation:{enabled:!0,button:0}},em=class o{constructor(r,e){this._config=e;this._input={rho:0,theta:0,phi:0,x:0,y:0};this._progress={rho:0,theta:0,phi:0,x:0,y:0};this._startHandler=r=>{let{rotation:e,pan:t}=this._config,n=r.pointerType==="mouse",i=e.enabled&&n&&r.button===e.button&&de.matchModifiers(r,e.modifiers),s=t.enabled&&n&&r.button===t.button&&de.matchModifiers(r,t.modifiers);!i&&!s||(this.#t=i,(this.#e=s)&&(this._currentState=o._buildState(this._camera),a.extend(this._input,Pt.zero()),this._progress.x=this._progress.y=0),Q(r),window.clearTimeout(this.#r),window.addEventListener("pointerup",this._endHandler,!1),window.addEventListener("pointermove",this._moveHandler,!1),window.addEventListener("contextmenu",this._avoidHandler,!1))};this._avoidHandler=r=>Q(r);this._endHandler=r=>{Q(r),this.#r=window.setTimeout(()=>{window.removeEventListener("pointerup",this._endHandler),window.removeEventListener("pointermove",this._moveHandler),window.removeEventListener("contextmenu",this._avoidHandler)},20)};this._zoomHandler=r=>{let{zoom:e}=this._config;if(!(e.enabled&&de.matchModifiers(r,e.modifiers)))return;Q(r);let n=this._input;n.rho-=Math.sign(r.deltaY)};this._moveHandler=r=>{Q(r);let{height:e,width:t}=this._scene.size,n=this._input,i=Math.min(e,t);if(this.#t){let s=-KE*360/i,{phi:l,theta:p}=n,{maxPolar:u,minPolar:f,maxAzimuth:g,minAzimuth:v}=this._config;n.phi=(l+r.movementX*s).clamp(f,u),n.theta=(p+r.movementY*s).clamp(v,g)}else if(this.#e){let s=this._currentState.radius/i;n.x+=-r.movementX*s,n.y+=r.movementY*s}};this._renderHandler=r=>{this._update()};let t=this._scene=(this._camera=r).stage;this._initialState=this._currentState=o._buildState(r);let n=this._canvas=t.stage;n.addEventListener("pointerdown",this._startHandler,!1),n.addEventListener("wheel",this._zoomHandler,{passive:!1}),t.addEventListener("render",this._renderHandler,!1)}static _buildState(r){let e=Pt.subtract(r.position,r.lookAt),t=Pt.mag(e);return{target:r.lookAt,versor:Pt.unit(e),up:r.up,radius:t,position:r.position}}static tryAttach(r,e){e??=Yd;let t=qE(r)?.stage;if(a.isNull(t))return null;{let{position:n,lookAt:i}=r;return a.isNull(n)||a.isNull(i)||Pt.areClose(n,i)?null:new o(r,e)}}get configuration(){return this._config}set configuration(r){this._config=r}#e;#t;#r;_getSafeAzimuth({theta:r}){return o._modAngle(r)}_getSafePolar({phi:r}){return o._modAngle(r)}static _modAngle(r){for(;r<0;)r+=360;return r%360}static _getViewXYZ(r){let{versor:e,up:t}=r,n=Pt.cross(e,t),i=Pt.cross(n,e);return Pt.normalize(n),Pt.normalize(i),{right:n,up:i,versor:e}}#n;_update(){if(this.#n)return;this.#n=!0;let r=this._camera,{radius:e,versor:t,target:n,up:i}=this._initialState,{target:s}=this._currentState,{theta:l,phi:p,rho:u,x:f,y:g}=this._input,v=this._progress,{theta:y,phi:_,rho:x,x:w,y:E}=v,k=Math.abs(_-p)>jd||Math.abs(y-l)>jd,N=Math.abs(x-u)>jd,T=Math.abs(f-w)>jd||Math.abs(g-E)>jd;if(N||k||T){let O=typeof this._config.inertia=="boolean"?this._config.inertia?ZE:0:this._config.inertia,D=O>0&&O<1,{right:P,up:F}=o._getViewXYZ(this._initialState),B=n,$=i,U=s,I=x;D?I+=(u-x)*O:I=u,v.rho=I;let G=Math.pow(.95,I*JE),Y=Pt.scale(t,-G*e);B=Pt.add(B,Y);let W=_,V=y;D?(W+=(p-_)*O,V+=(l-y)*O):(W=p,V=l);let X=this._getSafePolar({phi:v.phi=W}),q=this._getSafeAzimuth({theta:v.theta=V}),Z=Pt.negate(n),ne=Oa.translate(Oa.identity(),Z),te=Qh.fromAxisAngle(F,X),ae=Qh.fromAxisAngle(P,q),Se=Oa.multiply(Qh.toRotationMatrix(ae),Qh.toRotationMatrix(te));ne=Oa.multiply(ne,Se),ne=Oa.translate(ne,Pt.negate(Z)),B=Oa.transform(B,ne),$=Oa.transform($,Oa.clone(ne,Wt=>{Wt.offsetX=Wt.offsetY=Wt.offsetZ=0}));let he=w,fe=E,le=he,re=fe;D?(le+=(f-he)*O,re+=(g-fe)*O):(le=f,re=g),v.x=le,v.y=re;let{right:Oe,up:ge}=o._getViewXYZ(this._currentState),Ne=Pt.scale(Oe,le),Pe=Pt.scale(ge,re),He=Pt.add(Ne,Pe);U=Pt.add(s,He),r.lookAt=U,r.position=B,r.up=$,r.flags.push("camera")}this.#n=!1}dispose(){let r=this._canvas,e=this._scene;a.isNull(r)||(r.removeEventListener("pointerdown",this._startHandler),r.removeEventListener("wheel",this._zoomHandler)),e.removeEventListener("render",this._renderHandler,!1)}},dl,Ar=class extends nh.PacemBehavior{constructor(){super(...arguments);z(this,dl,new Map);this._readyHandler=e=>{if(e.detail.propertyName==="isReady"&&e.detail.currentValue===!0){let t=e.currentTarget;t.removeEventListener(ee,this._readyHandler),this._decorateCore(t)}}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"maxAzimuth":case"minAzimuth":case"inertia":case"zoomControl":case"panControl":case"rotationControl":let s=this._buildConfig(),l=M(this,dl);for(let p of l.values())p.configuration=s;break}}disconnectedCallback(){let e=M(this,dl);for(let t of e.values())t.dispose();e.clear(),super.disconnectedCallback()}_buildConfig(){return a.extend({},Yd,{maxAzimuth:this.maxAzimuth??1/0,minAzimuth:this.minAzimuth??-1/0,minPolar:this.minPolar??-1/0,maxPolar:this.maxPolar??1/0,inertia:this.inertia??!1,zoom:this.zoomControl??Yd.zoom,pan:this.panControl??Yd.pan,rotation:this.rotationControl??Yd.rotation})}_decorateCore(e){let t=em.tryAttach(e,this._buildConfig());a.isNull(t)||M(this,dl).set(e,t)}decorate(e){e.isConnected?this._decorateCore(e):e.addEventListener(ee,this._readyHandler,!1)}undecorate(e){let t=M(this,dl);t.has(e)&&(t.get(e).dispose(),t.delete(e))}};dl=new WeakMap,c([h({emit:!1,converter:m.Number})],Ar.prototype,"maxAzimuth",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"maxPolar",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"minAzimuth",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"minPolar",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"zoomControl",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"rotationControl",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"panControl",2),c([h({emit:!1,converter:ig})],Ar.prototype,"inertia",2),Ar=c([C({tagName:d+"-"+"3d"+"-orbit-camera"})],Ar);var jg={};Le(jg,{ChartEvent:()=>rm,MANAGED_EVENTS:()=>Bc,PacemChartElement:()=>ul,PacemChartSeriesElement:()=>Qr,PacemColumnChartElement:()=>hl,PacemPieChartElement:()=>Nn,PacemPieSliceElement:()=>Ci,PacemSeriesChartElement:()=>Nt});var Bc=["keydown","keyup","click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"],Sy=1e3*60*60*24,QE=10,ew=10,tm="pacem:chart-series:dataitem",Fg="pacem:chart-series:series";function tw(o,r,e,t,n,i=QE){let s=r==="number"||r==="date"?t-e:Math.max(1,o.length-1),l=i-1;for(var p=[],u=1,f=l;f>1;f--)if(s%f===0){u=s/f;break}u===1&&s>i&&(u=s);let g=typeof n=="function"?n:u>=Sy?(x=>x.toLocaleDateString(n)):(x=>x.toLocaleTimeString(n)),v=typeof n=="function"?n:u<Sy?(x=>x.toLocaleString(n)):g,y=typeof n=="function"?n:x=>x.toLocaleString(n);for(var _=0;_<=s;_+=u){let x;switch(r){case"string":if(_>=o.length)continue;x=o[_].label;break;case"number":x=y(e+_);break;case"date":let w=a.parseDate(e+_);x=(_==0?v:g)(w);break;default:throw"Not supported."}p.push(x)}return p}function rw(o,r,e){e??=Math.min(Ly(o,r),ew);let t=(r-o)/e,n=Math.pow(10,Math.floor(Math.log10(t))),i=[1,2,5,10].map(s=>s*n).filter(s=>s>=t).reduce((s,l)=>Math.min(s,l),Number.POSITIVE_INFINITY);return{min:Math.floor(o/i)*i,max:Math.ceil(r/i)*i,round:i}}function Ly(o,r){let e=r-o;if(!(e>0))return 2;let t=Math.floor(Math.log10(e)),n=Math.pow(10,-t);if(t!=0)return Ly(o*n,r*n);let i=u=>{let f=Math.floor(Math.abs(u)*10);return(f+10-f%10).roundoff()},s=i(e),l=10;o!==0&&(l=i(Math.abs(r)));let p=Ny(l,s);return p===1?s:Math.max(p,10-p)}function Ny(o,r){return o<=0?r:Ny(r%o,o)}var rm=class extends ht{constructor(r,e,t){super(r,e,t)}},Qr=class extends R.PacemItemElement{get values(){return this.datasource}};c([h({emit:!0,converter:m.Json})],Qr.prototype,"datasource",2),c([h({emit:!0,converter:m.String})],Qr.prototype,"label",2),c([h({emit:!0,converter:m.String})],Qr.prototype,"color",2),c([h({emit:!0,converter:m.Boolean})],Qr.prototype,"datapoints",2),c([h()],Qr.prototype,"_uiElements",2),Qr=c([C({tagName:d+"-chart-series"})],Qr);var xi="http://www.w3.org/2000/svg",Nt=class extends R.PacemItemsContainerElement{constructor(){super();this._itemPropertyChangedCallback=e=>{let t=e.detail.propertyName;(t==="datasource"||t==="label"||t==="datapoints"||t==="cssClass"||t==="color")&&this.draw()};this._series=[];this._resizeHandler=e=>{this._size=e.detail,this.draw()};this._broadcastHandler=e=>{let t=e.currentTarget,n=A.getAttachedPropertyValue(t,tm);if(a.isNull(n))return;let i=this,s=i.getAnchorPoint(t),l=new rm("item"+e.type,{detail:{dataItem:n,anchorPoint:s}},e),p=A.getAttachedPropertyValue(t,Fg);p instanceof Qr&&p.dispatchEvent(l),i.dispatchEvent(l)};this._key=a.uniqueCode()}validate(e){return e instanceof Qr}register(e){return super.register(e)?(e.addEventListener(ee,this._itemPropertyChangedCallback,!1),!0):!1}unregister(e){return super.unregister(e)?(e.removeEventListener(ee,this._itemPropertyChangedCallback,!1),!0):!1}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e==="target"){this._div!=t&&this._div&&this._div.remove(),this._div=null,this._body=null;let s=t;s&&(s.classList.remove(b+"-chart-area"),s.innerHTML=""),this._ensureResizer(),this.draw()}else if(!i)switch(e){case"items":this._databindAndDrawDebounced();break;case"datasource":this._databind();case"yAxisDensity":case"xAxisDensity":case"xAxisType":case"yAxisMax":case"xAxisPosition":case"yAxisFormat":this.draw();break}}_databindAndDrawDebounced(){cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this._databind(),this.draw()})}_databind(){this._datasource=a.isNullOrEmpty(this.datasource)?this.items:this.datasource}disconnectedCallback(){this._div&&this._div.remove();let e=this._resizer;a.isNull(e)||(e.removeEventListener(R.ResizeEventName,this._resizeHandler,!1),e.remove(),this._resizer=null),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureResizer(),this._databind(),this.draw()}_ensureResizer(e=this.target||this._div){if(a.isNull(this._resizer)){let t=A.findAncestorShell(this);(this._resizer=t.appendChild(new R.PacemResizeElement)).addEventListener(R.ResizeEventName,this._resizeHandler,!1)}this._resizer.target=e}get chartSize(){return this._size}get chartSeries(){return this._series}get chartBody(){return this._body}get chartGrid(){return this._grid}get chartMask(){return this._mask}get chartKey(){return this._key}get chartContainer(){return this._div}assignUiBehaviors(e,t,n,i){let s=!a.isNull(A.getAttachedPropertyValue(e,tm)),l=a.extend({series:t.label,color:i||t.color},n);A.setAttachedPropertyValue(e,tm,l),A.setAttachedPropertyValue(e,Fg,t),s||Bc.forEach(p=>{e.addEventListener(p,this._broadcastHandler)})}disposeUiBehaviors(e){A.deleteAttachedPropertyValue(e,tm),A.deleteAttachedPropertyValue(e,Fg),Bc.forEach(t=>{e.removeEventListener(t,this._broadcastHandler)})}ensureChartContainer(){if(a.isNull(this._div)){let e=this._div=this.target||document.createElement("div");e.classList.add(b+"-chart-area"),e!=this.target&&this.parentElement.insertBefore(e,this)}return this._div}ensureChartBody(e,t,n){if(a.isNull(this._body)){let i=this._body=document.createElementNS(xi,"svg");i.setAttribute("pacem",""),i.setAttribute("class",b+"-"+e+"-chart"),i.setAttribute("preserveAspectRatio","xMinYMax slice");let s=this._grid=document.createElementNS(xi,"svg");s.setAttribute("pacem",""),s.setAttribute("class","chart-grid");let l=document.createElementNS(xi,"defs"),p=this._mask=document.createElementNS(xi,"mask"),u=document.createElementNS(xi,"rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width","100%"),u.setAttribute("height","100%");let f=document.createElementNS(xi,"rect");f.setAttribute("y","0"),f.setAttribute("width","100%"),f.setAttribute("fill","#fff"),p.id="gnrc_mask_"+this._key,p.appendChild(u),p.appendChild(f),l.appendChild(p),i.appendChild(l),i.appendChild(s),this._div.appendChild(i)}return this._body}chartDataItemToPoint(e,t){switch(this.xAxisType||"string"){case"number":return{x:parseFloat(e.label),y:e.value};case"date":return{x:a.parseDate(e.label).valueOf(),y:e.value};case"string":return{x:t.findIndex(n=>n.label==e.label),y:e.value};default:throw"Not supported."}}getVirtualGrid(e,t,n,i,s,l=this.xAxisType,p,u){let f=rw(i,s,p),g=f.round;var v=[];for(let E=f.min;E<=f.max;E+=g)v.push(E.roundoff());let y=a.lang(this),_=null,x=this.xAxisFormat;if(!a.isNullOrEmpty(x))switch(l){case"number":_=E=>Intl.NumberFormat(y,x).format(E);break;case"date":_=E=>Intl.DateTimeFormat(y,x).format(a.parseDate(E));break}return{x:tw(e,l,t,n,_??y,u),y:v}}wipeOut(e=this._series,t=0){for(var n=e.length-1;n>=t;n--)e[n].remove();e.splice(t)}buildLinearGradient(e,t=!1){let n=document.createElementNS(xi,"linearGradient");n.id=this.chartKey+"_grad"+e+(t?"_inverted":""),t&&a.addClass(n,"bottom-up"),n.setAttribute("x1","0%"),n.setAttribute("x2","0%"),n.setAttribute("y1","0%"),n.setAttribute("y2","100%"),n.setAttribute("spreadMethod","pad");let i=document.createElementNS(xi,"stop");i.setAttribute("offset","0%");let s=document.createElementNS(xi,"stop");return s.setAttribute("offset","100%"),n.appendChild(i),n.appendChild(s),n}setGradientColor(e,t){for(let n=0;n<e.children.length;n++){let i=e.children.item(n);i instanceof SVGStopElement&&(i.style.stopColor=t)}}estimateYAxisLabelWidth(e){let t=this.formatYAxisLabel(e);return this.estimateLabelWidth(t)}estimateLabelWidth(e){let t=this._grid;if(a.isNull(t))throw new Error("Unable to estimate label without an underlying grid available.");let n=document.createElementNS(xi,"text");n.textContent=e,t.appendChild(n);let i=a.offset(n);return n.remove(),i.width}formatYAxisLabel(e){let t=this.yAxisFormat;return a.isNullOrEmpty(t)?e.toString():Intl.NumberFormat(a.lang(this),t).format(e)}estimateXAxisLabelWidth(e){let t=this.formatXAxisLabel(e);return this.estimateLabelWidth(t)}formatXAxisLabel(e){let t=this.xAxisFormat,n=a.lang(this);switch(this.xAxisType){case"date":let i=a.Dates.parse(e);return a.isNullOrEmpty(t)?i.toLocaleString(n):Intl.DateTimeFormat(n,t).format(i);case"number":let s=e;return a.isNullOrEmpty(t)?s.toLocaleString(n):Intl.NumberFormat(n,t).format(s);default:return e}}draw(){this.drawSeries(this._datasource)}getAnchorPoint(e){let t=a.offset(e);return{x:t.left+t.width*.5,y:t.top+t.height*.5}}};c([h({converter:m.Element})],Nt.prototype,"target",2),c([h({emit:!1,converter:m.String})],Nt.prototype,"xAxisType",2),c([h({emit:!1,converter:m.String})],Nt.prototype,"xAxisPosition",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"datasource",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisDensity",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"xAxisDensity",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisMin",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisMax",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"yAxisFormat",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"xAxisFormat",2),c([Wp(!0)],Nt.prototype,"draw",1);function nw(o,r,e){let t=o,n=o,i=a.isNull(r),s=a.isNull(e);if(!(i&&s)){let p,u;i||(p=(o.y-r.y)/(o.x-r.x)),s||(u=(e.y-o.y)/(e.x-o.x));let f=((u||p||0)+(p||u||0))/2,g=i?0:(o.x-r.x)/3,v=s?0:(e.x-o.x)/3;t={x:o.x-g,y:o.y-g*f},n={x:o.x+v,y:o.y+v*f}}return{c0:t,c1:n}}var Ty=A.getAttachedPropertyValue,Ay=A.setAttachedPropertyValue,iG=A.deleteAttachedPropertyValue,iw=24,nm="pacem:chart-series:area",Pa="http://www.w3.org/2000/svg",Vc,ul=class extends Nt{constructor(){super(...arguments);z(this,Vc,!1);this._enterHandler=e=>{H(this,Vc,!0)};this._leaveHandler=e=>{H(this,Vc,!1)};this._moveHandler=e=>{M(this,Vc)};this._chartFillSeries=[]}_getVirtualGrid(e,t,n,i,s,l=this.xAxisType,p,u){return super.getVirtualGrid(e,t,n,i,s,l,p,u)}_wipe(e=this.chartSeries,t=0){super.wipeOut(e,t)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupBehavior()}disconnectedCallback(){this._dismantleBehavior(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"type":case"aspectRatio":this.draw();break}}_setupBehavior(){this.addEventListener("mouseenter",this._enterHandler,!1),this.addEventListener("mouseleave",this._enterHandler,!1),this.addEventListener("mousemove",this._moveHandler,!1)}_dismantleBehavior(){this.removeEventListener("mouseenter",this._enterHandler,!1),this.removeEventListener("mouseleave",this._leaveHandler,!1),this.removeEventListener("mousemove",this._moveHandler,!1)}_buildLinearGradient(e){return super.buildLinearGradient(e)}_setGradientColor(e,t){super.setGradientColor(e,t)}drawSeries(e){if(!this.isReady||a.isNull(this.chartSize))return;this.ensureChartContainer();let t=this.type||"line",n=iw;var i=this.chartSize;if(i.height<=n||i.width<=n)return;if(a.isNullOrEmpty(e)||e.every(pe=>a.isNullOrEmpty(pe.values))){this._wipe();return}let s=this.ensureChartBody("line",i.width,i.height);this.log(ce.LogLevel.Debug,`Drawing ${t} chart.`);let l=this.xAxisType||"string",p=this.yAxisMin??Number.NaN,u=this.yAxisMax??Number.NaN,f=Number.NaN,g=Number.NaN,v=1;for(let pe of e){let xe=pe.values;if(xe&&xe.length){let je=0;for(let mn of xe){let Ht=this.chartDataItemToPoint(mn,xe);a.isNull(this.yAxisMin)&&(p=isNaN(p)?Ht.y:Math.min(p,Ht.y)),a.isNull(this.yAxisMax)&&(u=isNaN(u)?Ht.y:Math.max(u,Ht.y)),je===0?f=isNaN(f)?Ht.x:Math.min(f,Ht.x):je===xe.length-1&&(g=isNaN(g)?Ht.x:Math.max(g,Ht.x)),je++}}}let y=e.find(pe=>!a.isNullOrEmpty(pe.values)),_=this._getVirtualGrid(y.values,f,g,p,u,l,this.yAxisDensity,this.xAxisDensity),x=_.y[_.y.length-1],w=_.y[0];if(x===w)return;let E=n*.5,k=_.y.reduce((pe,xe)=>Math.max(pe,this.estimateYAxisLabelWidth(xe)+E),n),N=_.x.reduce((pe,xe)=>Math.max(pe,this.estimateXAxisLabelWidth(xe)),n)*.5,T=Math.max(N,k),O=N,D=i.width-T-O,P=i.height-2*n,F=P*(1-(x-w-(u-p))/(x-w)),B=P*(x-u)/(x-w);(l!=="number"||this.aspectRatio!=="monometric"&&this.aspectRatio!=="logaritmic")&&(v=D/F,s.setAttribute("height",i.height.toString()),s.setAttribute("width",i.width.toString())),s.setAttribute("viewBox",`0 0 ${i.width} ${i.height}`);let $=0,U=g-f,I=u-p,G=100*v/U,Y=100/I,W=100*n/F,V=(pe,xe)=>{let je=this.chartDataItemToPoint(pe,xe);return je.y*=Y,je.x=(je.x-f)*G,je},X=this.chartSeries,q=this._chartFillSeries,Z=this.chartGrid,ne=t==="spline"||t==="splinearea";for(let pe of e){let xe,je,mn;if(X.length>$)xe=X[$],je=q[$],mn=je.firstElementChild.firstElementChild;else{xe=document.createElementNS(Pa,"svg"),xe.setAttribute("pacem",""),s.appendChild(xe),je=document.createElementNS(Pa,"svg"),je.setAttribute("pacem",""),s.insertBefore(je,s.children.item($+2));let De=document.createElementNS(Pa,"defs");De.appendChild(mn=this._buildLinearGradient($)),je.appendChild(De),je.appendChild(document.createElementNS(Pa,"path")),q.push(je),xe.appendChild(document.createElementNS(Pa,"path")),X.push(xe)}let Ht="chart-series",ve=t==="area"||t==="splinearea";a.isNullOrEmpty(pe.className)||(Ht+=" "+pe.className),[xe,je].forEach(De=>{De.setAttribute("class",Ht),De.setAttribute("x",T.toString()),De.setAttribute("y",B.toString()),De.setAttribute("width",D.toString()),De.setAttribute("height",(F+2*n).toString())}),a.addClass(je,b+"-inert");let Ce=je.children.item(1),Ue=xe.firstElementChild;Ue.style.stroke=pe.color,Ce.style.stroke=Ue.style.fill="none",this._setGradientColor(mn,pe.color),Ce.style.fill=`url(#${mn.id})`,Ce.style.display=ve?"":"none";let or="",Ie=pe.values;if(Ie&&Ie.length){let De=(wt,nt,Me,Ge,kt)=>{let Mt=nt+1,Fe;xe.children.length>Mt?Fe=xe.children.item(Mt):(Fe=document.createElementNS(Pa,"line"),Fe.setAttribute("class","circle"),xe.appendChild(Fe));let Vr=wt.x.toString(),fn=(-wt.y).toString();Fe.setAttribute("x1",Vr),Fe.setAttribute("y1",fn),Fe.setAttribute("x2",Vr),Fe.setAttribute("y2",fn),Fe.style.stroke=kt,this.assignUiBehaviors(Fe,Me,Ge,kt)},Iu=()=>{let wt=pe.datapoints?Ie.length+1:1;for(let Me=xe.children.length-1;Me>=wt;Me--){var nt=xe.children.item(Me);this.disposeUiBehaviors(nt),nt.remove()}};if(ne){let wt,nt,Me;for(let Ge=0;Ge<Ie.length;Ge++){let kt=Ie[Ge];if(isNaN(kt.value))continue;nt||(nt=V(kt,Ie));let Mt;ne&&Ge<Ie.length-1&&(Mt=V(Ie[Ge+1],Ie));let Fe=Ty(pe,nm,0);Fe+=kt.value,Ay(pe,nm,Fe);var te=nw(nt,wt,Mt);or+=a.isNullOrEmpty(or)?`M${nt.x},${-nt.y} `:`C${Me.x},${-Me.y} ${te.c0.x},${-te.c0.y} ${nt.x},${-nt.y} `,pe.datapoints&&De(nt,Ge,pe,kt,pe.color),wt=nt,nt=Mt,Me=te.c1}}else{let wt=0;for(let nt of Ie){if(isNaN(nt.value))continue;let Me=V(nt,Ie),Ge=Ty(pe,nm,0);Ge+=nt.value,Ay(pe,nm,Ge),or+=a.isNullOrEmpty(or)?`M${Me.x},${-Me.y} `:`L${Me.x},${-Me.y} `,pe.datapoints&&De(Me,wt,pe,nt,pe.color),wt++}}Iu()}Ue.setAttribute("d",or),Ce.setAttribute("d",or+`V${-p*Y} H0 Z`),$++}this._wipe(q,$),this._wipe(X,$);let ae=100*v,Se=100+2*W,he=0,fe=u*Y+W,le=`${he} ${-fe} ${ae} ${Se}`;for(var re of X.concat(q))re.setAttribute("viewBox",le);let ge=this.chartMask.children.item(1);if(ge.setAttribute("x",he.toString()),ge.setAttribute("height",(i.height-n).toString()),Z.setAttribute("viewBox",`0 0 ${i.width} ${i.height}`),_.x.length<=1||_.y.length<=1){for(let pe=Z.children.length-1;pe>=0;pe--)Z.children.item(pe).remove();return}let Ne;Z.children.length>0?Ne=Z.children.item(0):(Ne=document.createElementNS(Pa,"path"),Z.appendChild(Ne));let Pe=n*.25,He=0,Wt=(pe,xe,je,mn)=>{let Ht=pe+1,ve;return Z.children.length<=Ht?(ve=document.createElementNS(Pa,"text"),Z.appendChild(ve)):ve=Z.children.item(Ht),ve.textContent=mn,ve.setAttribute("x",xe.toString()),ve.setAttribute("y",je.toString()),ve},Gn=`M${T},${n} v${P}`,vr=0,qs=D/(_.x.length-1),Vi=P/(_.y.length-1);if(this.xAxisPosition!=="none")for(var Ks of _.x){let pe=T+vr*qs;if(this.xAxisPosition==="top"){Gn+=` M${pe},${n} v${-Pe}`;let xe=Wt(He++,pe,0,Ks);xe.setAttribute("text-anchor","middle"),xe.setAttribute("alignment-baseline","hanging")}else{let xe=P+n;Gn+=` M${pe},${xe} v${Pe}`,Wt(He++,pe,xe+n,Ks).setAttribute("text-anchor","middle")}vr++}vr=0;for(var Gl of _.y){let pe=P+n-vr*Vi,xe=T-Pe;Gn+=` M${xe},${pe} H${D+T}`;let je=this.formatYAxisLabel(Gl);Wt(He++,xe-Pe,pe,je).setAttribute("text-anchor","end"),vr++}Ne.setAttribute("d",Gn);for(let pe=Z.children.length-1;pe>He;pe--)Z.children.item(pe).remove()}};Vc=new WeakMap,c([h({emit:!1,converter:m.String})],ul.prototype,"type",2),c([h({converter:m.String})],ul.prototype,"aspectRatio",2),ul=c([C({tagName:d+"-chart"})],ul);var Uc="http://www.w3.org/2000/svg",Wg=24,hl=class extends Nt{constructor(){super(...arguments);this.groupWidth=0}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="type"||e==="groupWidth")&&this.draw()}_safen(e=this.groupWidth){return Math.min(1,Math.max(e||.75,0))}drawSeries(e){if(!this.isReady||a.isNull(this.chartSize))return;let t=this.ensureChartContainer(),n=this.type||"cluster",i=Wg;var s=this.chartSize;if(s.height<=i||s.width<=i)return;if(a.isNullOrEmpty(e)||e.every(ve=>a.isNullOrEmpty(ve.values))){this.wipeOut();return}let l=this.ensureChartBody("column",s.width,s.height);this.log(ce.LogLevel.Debug,`Drawing ${n} chart.`);let p=this.xAxisType||"string",u=this.yAxisMin??0,f=this.yAxisMax??0,g=0,v=0,y=0,_=1,x={negative:[],positive:[]};for(let ve of e){let Ce=ve.values;if(!a.isNullOrEmpty(Ce)){let Ue=0;for(let or of Ce){x.positive[Ue]=x.positive[Ue]||0,x.negative[Ue]=x.negative[Ue]||0;let Ie=this.chartDataItemToPoint(or,Ce);a.isNull(this.yAxisMin)&&(u=Math.min(u,Ie.y)),a.isNull(this.yAxisMax)&&(f=Math.max(f,Ie.y)),g=Math.min(g,Ie.x),v=Math.max(v,Ie.x),Ie.y>0?x.positive[Ue]+=Ie.y:Ie.y<0&&(x.negative[Ue]+=Ie.y),Ue++}y=Math.max(y,Ce.length)}}let w=n==="stack";w&&(a.isNull(this.yAxisMin)&&(u=Math.min.apply(null,x.negative)),a.isNull(this.yAxisMax)&&(f=Math.max.apply(null,x.positive))),v===0&&v===g&&(v=1);let E=(v-g)/y,k=E*.5,N=E*this._safen(this.groupWidth),T=N*.5,O=e.find(ve=>!a.isNullOrEmpty(ve.values)),D=this.getVirtualGrid(O.values,g-k,v+k,u,f,p,this.yAxisDensity,this.xAxisDensity),P=D.y[D.y.length-1],F=D.y[0];if(P===F)return;let B=Wg*.5,$=D.y.reduce((ve,Ce)=>Math.max(ve,this.estimateYAxisLabelWidth(Ce)+B),i),U=s.width-$-i,I=s.height-2*i,G=I*(1-(P-F-(f-u))/(P-F)),Y=I*(P-f)/(P-F);_=U/G,l.setAttribute("height",s.height.toString()),l.setAttribute("width",s.width.toString()),l.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`);let W=0,V=v-g,X=f-u,q=100*_/V,Z=100/X,ne=100*i/G,te=this.chartSeries,ae=this.chartGrid,Se=(k-g)*q,he=(ve,Ce)=>{let Ue=this.chartDataItemToPoint(ve,Ce);return{x:Se+Ue.x*2*Se,y:Ue.y*Z}};var fe=new Array(y);for(let ve of e){let Ce,Ue,or,Ie;if(te.length>W)Ce=te[W],Ue=Ce.firstElementChild.firstElementChild,or=Ce.firstElementChild.lastElementChild,Ie=Ce.lastElementChild;else{Ce=document.createElementNS(Uc,"svg"),Ce.setAttribute("pacem",""),ae.insertAdjacentElement("afterend",Ce);let Me=document.createElementNS(Uc,"defs");Me.appendChild(Ue=this.buildLinearGradient(W)),Me.appendChild(or=this.buildLinearGradient(W,!0)),Ce.appendChild(Me),Ce.appendChild(Ie=document.createElementNS(Uc,"g")),te.push(Ce)}var le="chart-series series-fill";a.isNullOrEmpty(ve.className)||(le+=" "+ve.className),Ce.setAttribute("class",le),Ce.setAttribute("x",$.toString()),Ce.setAttribute("y",Y.toString()),Ce.setAttribute("width",U.toString()),Ce.setAttribute("height",(G+2*i).toString());let De=ve.values,Iu=Me=>{for(;Me>=Ie.children.length;)Ie.appendChild(document.createElementNS(Uc,"rect"));let Ge=Ie.children.item(Me);Ge.style.stroke=ve.color;let kt=De[Me].value<0?or:Ue;return this.setGradientColor(kt,ve.color),Ge.style.fill=`url(#${kt.id})`,Ge},wt=10,nt=(Me,Ge,kt,Mt=Ge)=>{let Fe=-Math.max(Ge.y,kt.y),Vr=Math.abs(kt.y-Ge.y),fn=()=>{Me.setAttribute("y",Fe.toFixed(wt)),Me.setAttribute("height",Vr.toFixed(wt))};Me.hasAttribute("y")?fn():(Me.setAttribute("y","-"+Mt.y.toFixed(wt)),Me.setAttribute("height","0"),requestAnimationFrame(fn))};if(!a.isNullOrEmpty(De)){let Me=he({value:0,label:De[0].label},De);if(w){let Ge=T*q,kt=(N*q).toFixed(wt);for(let Mt=0;Mt<De.length;Mt++){let Fe=De[Mt];a.isNullOrEmpty(fe[Mt])&&(fe[Mt]={positive:0,negative:0});let Vr=fe[Mt],fn=Vr.positive,$u=Vr.negative,Js=Fe.value<0,Ov=Js?$u:fn+Fe.value,Pv=Js?$u+Fe.value:fn,Iv=he({label:Fe.label,value:Ov},De),px=he({label:Fe.label,value:Pv},De),dx=Iv.x-Ge,Hu=Iu(Mt);this.assignUiBehaviors(Hu,ve,Fe),Hu.setAttribute("x",dx.toFixed(wt)),Hu.setAttribute("width",kt),nt(Hu,px,Iv,Me),Js?Vr.negative=Pv:Vr.positive=Ov}}else{let Ge=T*q,kt=Ge*2/e.length,Mt=kt.toFixed(wt);for(let Fe=0;Fe<De.length;Fe++){let Vr=De[Fe],fn=he(Vr,De),$u=fn.x-Ge+kt*W,Js=Iu(Fe);this.assignUiBehaviors(Js,ve,Vr),Js.setAttribute("x",$u.toFixed(wt)),Js.setAttribute("width",Mt),nt(Js,Me,fn)}}}for(let Me=Ie.children.length-1;Me>=De?.length;Me--){let Ge=Ie.children.item(Me);this.disposeUiBehaviors(Ge),Ge.remove()}W++}this.wipeOut(te,W);let re=100*_,Oe=100+2*ne,ge=0,Ne=f*Z+ne,Pe=`${ge} ${-Ne} ${re} ${Oe}`;for(var He of te)He.setAttribute("viewBox",Pe);let Gn=this.chartMask.children.item(1);if(Gn.setAttribute("x",ge.toString()),Gn.setAttribute("height",(s.height-i).toString()),ae.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`),D.x.length<1||D.y.length<=1){for(let ve=ae.children.length-1;ve>=0;ve--)ae.children.item(ve).remove();return}let vr;ae.children.length>0?vr=ae.children.item(0):(vr=document.createElementNS(Uc,"path"),ae.appendChild(vr));let qs=Wg*.25,Vi=0,Ks=(ve,Ce,Ue,or)=>{let Ie=ve+1,De;return ae.children.length<=Ie?(De=document.createElementNS(Uc,"text"),ae.appendChild(De)):De=ae.children.item(Ie),De.textContent=or,De.setAttribute("x",Ce.toString()),De.setAttribute("y",Ue.toString()),De},Gl=`M${$},${i} v${I}`,pe=0,xe=U/D.x.length,je=I/(D.y.length-1);if(this.xAxisPosition!=="none"){let ve=xe*.5+$;for(var mn of D.x){let Ce=ve+pe*xe;if(this.xAxisPosition==="top"){Gl+=` M${Ce},${i} v${-qs}`;let Ue=Ks(Vi++,Ce,0,mn);Ue.setAttribute("text-anchor","middle"),Ue.setAttribute("alignment-baseline","hanging")}else{let Ue=I+i;Gl+=` M${Ce},${Ue} v${qs}`,Ks(Vi++,Ce,Ue+i,mn).setAttribute("text-anchor","middle")}pe++}}pe=0;for(var Ht of D.y){let ve=I+i-pe*je,Ce=$-qs;Gl+=` M${Ce},${ve} H${U+$}`;let Ue=this.formatYAxisLabel(Ht);Ks(Vi++,Ce-qs,ve,Ue).setAttribute("text-anchor","end"),pe++}vr.setAttribute("d",Gl);for(let ve=ae.children.length-1;ve>Vi;ve--)ae.children.item(ve).remove()}};c([h({converter:m.String})],hl.prototype,"type",2),c([h({converter:m.Number})],hl.prototype,"groupWidth",2),hl=c([C({tagName:d+"-column-chart"})],hl);var Ci=class extends R.PacemItemElement{constructor(){super(...arguments);this._broadcastHandler=e=>{this.emit(e)}}findContainer(){return A.findAncestorOfType(this,Nn)}get chart(){return this.container}getCenterOfMass(){let e=this.chart&&this.chart.area;if(a.isNull(e))return null;let t=a.offset(e),n={x:t.width/2+t.left,y:t.top+t.height/2},i=Math.min(t.width,t.height)*.5,s=this.normalizedPolarCoords,l=aw-s.angle;return{y:n.y-i*s.radius*Math.sin(l),x:n.x+i*s.radius*Math.cos(l)}}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&this.chart&&e!="normalizedPolarCoords"&&this.chart.draw()}_assignUi(e){let t=this._ui=e;Bc.forEach(n=>{t.addEventListener(n,this._broadcastHandler)})}_disposeUi(){a.isNull(this._ui)||Bc.forEach(e=>{this._ui.removeEventListener(e,this._broadcastHandler)})}};c([h({converter:m.Number})],Ci.prototype,"value",2),c([h({converter:m.String})],Ci.prototype,"label",2),c([h({converter:m.String})],Ci.prototype,"color",2),c([h({converter:m.Json})],Ci.prototype,"normalizedPolarCoords",2),Ci=c([C({tagName:d+"-pie-slice"})],Ci);var sw=Math.PI*2,aw=Math.PI*.5,Nn=class extends R.PacemItemsContainerElement{constructor(){super();this.cutout=0;this.slicePadding=0;this._slices=new WeakMap;this._key=a.uniqueCode()}validate(e){return e instanceof Ci}viewActivatedCallback(){super.viewActivatedCallback(),this.draw()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e==="target"){this._g=null,this._div&&this._div.remove();let s=t;s&&(s.classList.remove(b+"-chart-area"),s.innerHTML=""),this.draw()}else!i&&(e==="cutout"||e==="items"||e==="slicePadding")&&this.draw()}get area(){return this._svg}disconnectedCallback(){this._div&&this._div.remove(),super.disconnectedCallback()}_ensureArea(){if(a.isNull(this._g)){let t=this.target||(this._div=document.createElement("div"));t.classList.add(b+"-chart-area");let n=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("pacem",""),n.setAttribute("preserveAspectRatio","xMidYMid meet"),n.setAttribute("viewBox","0 0 100 100"),n.classList.add(b+"-pie-chart");let i=document.createElementNS("http://www.w3.org/2000/svg","defs"),s=this._g=document.createElementNS("http://www.w3.org/2000/svg","g");n.appendChild(i),n.appendChild(s),t.appendChild(n),this._div&&this.parentElement.insertBefore(t,this)}if(this.maskBasedRendering){if(a.isNull(this._mask)){let n=document.createElementNS("http://www.w3.org/2000/svg","mask");n.id="pie_mask_"+this._key;let i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("width","100"),i.setAttribute("height","100"),i.setAttribute("fill","#fff");let s=this._mask=document.createElementNS("http://www.w3.org/2000/svg","circle");s.setAttribute("cx","50"),s.setAttribute("cy","50");let l=this._svg.firstElementChild;n.appendChild(i),n.appendChild(s),l.appendChild(n),this._g.setAttribute("mask",`url(#${n.id})`)}let t=50*this._safeCutout;this._mask.setAttribute("r",`${t}`)}else a.isNull(this._mask)||(this._svg.firstElementChild.innerHTML="",this._mask=null,this._g.removeAttribute("mask"));let e=this._safeSlicePaddingPixels;if(e>0){let t=this._svg.getCTM(),n=(e/t.a).roundoff(),i=this._sliceMaskId,s=this._svg.firstElementChild,l=s.querySelector(`#${i}`);a.isNull(l)?(l=document.createElementNS("http://www.w3.org/2000/svg","mask"),l.id=i,s.appendChild(l)):l.innerHTML="";let p=document.createElementNS("http://www.w3.org/2000/svg","path"),u=`M${50+n},0 H100 V100 H0 V0 H50 V50 h${n} Z`;p.setAttribute("d",u),p.setAttribute("fill","#fff"),l.appendChild(p)}return this._g}get _sliceMaskId(){return"pieslice_mask_"+this._key}get _safeCutout(){return Math.min(1,Math.max(0,this.cutout))||0}get _safeSlicePaddingPixels(){return Math.max(0,this.slicePadding??0)}_drawSlice(e,t,n,i){let s=t.value>.5*n?1:0,l=sw*t.value/n,p=360*i/n,u=t.value>=n?49.9:50*(1+Math.sin(l)),f=50*(1-Math.cos(l)),g=this._safeCutout,v=g*50;e.style.fill=t.color,e.style.transform=`rotate(${p}deg)`,e.style.transformOrigin="50% 50%";let y=this.maskBasedRendering?`M50,50 V0 A50,50 0 ${s} 1 ${u} ${f} L50,50 Z`:`M50,0 A50,50 0 ${s} 1 ${u} ${f} l${(50-u)*(1-g)},${(50-f)*(1-g)} A${v},${v} 0 ${s} 0 50,${50-v} Z`;e.setAttribute("d",y),t.normalizedPolarCoords={radius:g+Math.SQRT1_2*(1-g),angle:Math.PI*p/180+l/2}}_isSliceOk(e){return!e.disabled}_padSlice(e){this._safeSlicePaddingPixels>0?e.setAttribute("mask",`url(#${this._sliceMaskId})`):e.removeAttribute("mask")}draw(){let e=this._ensureArea(),t=e.children.length,n=this._svg.parentElement,i=0,s=0,l=0;if(a.isNullOrEmpty(this.items))e.innerHTML="",a.removeClass(n,"chart-has-data");else{a.addClass(n,"chart-has-data");for(let p of this.items)this._isSliceOk(p)&&(s+=p.value);if(s<=0)e.innerHTML="",a.removeClass(n,"chart-has-data");else for(let p of this.items){if(!this._isSliceOk(p))continue;let u;if(i>=t){let f=document.createElementNS("http://www.w3.org/2000/svg","g");f.setAttribute("class","chart-series "+b+"-pie-slice"+(a.isNullOrEmpty(p.className)?"":" "+p.className)),u=document.createElementNS("http://www.w3.org/2000/svg","path"),f.appendChild(u),e.appendChild(f),p._assignUi(f),this._slices.set(f,p)}else u=e.children.item(i).firstElementChild;p.value>0?(this._drawSlice(u,p,s,l),this._padSlice(u),l+=p.value,u.removeAttribute("display")):u.setAttribute("display","none"),i++}}for(;i<e.children.length;){let p=this._slices,u=e.children.item(i);p.has(u)&&(p.get(u)._disposeUi(),p.delete(u)),e.removeChild(u)}}};c([h({converter:m.Number})],Nn.prototype,"cutout",2),c([h({converter:m.Element})],Nn.prototype,"target",2),c([h({converter:m.Boolean})],Nn.prototype,"maskBasedRendering",2),c([h({converter:m.Number})],Nn.prototype,"slicePadding",2),c([me(!0)],Nn.prototype,"draw",1),Nn=c([C({tagName:d+"-pie-chart"})],Nn);var Yg={};Le(Yg,{PacemFxElement:()=>pr,PacemFxFancyElement:()=>Ha,PacemFxGradientElement:()=>$a,PacemFxGradientItemElement:()=>ml,PacemFxGradientStopElement:()=>ds,PacemFxHeroElement:()=>ps,PacemFxLinearGradientElement:()=>Wc,PacemFxListElement:()=>Xd,PacemFxPulseElement:()=>cs,PacemFxRadialGradientElement:()=>Ia,PacemFxRippleElement:()=>zc});var pr=class extends K{};c([h({converter:m.Element})],pr.prototype,"target",2);var Dy="ripple",zc=class extends pr{constructor(){super(...arguments);this._lock=!1;this._remove=!1;this._rippleHandler=e=>{if(this.disabled||this.target instanceof K&&this.target.disabled||e instanceof MouseEvent&&e.button!==0)return;let t=a.offset(this.target),n=getComputedStyle(this.target),i=this.style;i.top=t.top+"px",i.left=t.left+"px",i.width=t.width+"px",i.height=t.height+"px",i.borderRadius=n.borderRadius;let s=e.type==="touchstart"?e.touches[0]:e,l={x:s.pageX,y:s.pageY},p={x:t.left,y:t.top},u={x:t.left+t.width,y:t.top},f={x:t.left,y:t.top+t.height},g={x:u.x,y:f.y},v=Math.max(se.distance(l,p),se.distance(l,u),se.distance(l,g),se.distance(l,f)),y=this._wave;y.style.left=l.x-t.left-v+"px",y.style.top=l.y-t.top-v+"px",y.style.width=y.style.height=2*v+"px",a.addAnimationEndCallback(y,()=>{this._lock=!1,this._tryRemove()}),this._lock=!0,a.addClass(y,"ripple-go")};this._unrippleHandler=e=>{this._remove=!0,this._tryRemove()}}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&(a.isNull(t)||this._reset(t),a.isNull(n)||this._set(n))}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.target)||this._set()}disconnectedCallback(){a.isNull(this.target)||this._reset(),super.disconnectedCallback()}_tryRemove(){!this._lock&&this._remove&&(this._remove=!1,a.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)}};c([S("."+Dy)],zc.prototype,"_wave",2),zc=c([C({tagName:d+"-fx-ripple",shadow:j.USE_SHADOW_ROOT,template:`<div class="${Dy}"></div>`})],zc);var ow="pulse",lw="http://www.w3.org/2000/svg";function Ry(o){return`${b}-fx-pulse-${o}`}function cw(o,r,e="0",t=e){let n="style#"+o,i=document.querySelector(n);if(a.isNull(i)){let v=document.createElement("style");v.id=o,document.head.appendChild(v)}let s=document.querySelector(n),l=r.width,p=r.height,u=Math.max(l,p),f=.5*(u-l),g=.5*(u-p);s.sheet.insertRule(`@keyframes ${Ry(o)} {
|
|
361
|
+
}`],bindings:[`@group(${r}) @binding(${e}) var<uniform> ${n}: AmbientLight;`],modifiers:[`${s} = computeAmbient(${i}, ${n});`]}}var Jr=we.LinearAlgebra.Vector3D,Tg=we.LinearAlgebra.Matrix3D,yy={width:1,height:1},Yh=class{static create(r){if(Ch(r))return new Ng(r);if(Eh(r))return new Lg(r);throw new TypeError(`Camera type '${r.type}' not supported.`)}};function _y(o,r,e){let t=Jr.subtract(r,o),n=Jr.cross(e,t),i=Jr.cross(t,n);Jr.normalize(n),Jr.normalize(t),Jr.normalize(i);let s=-Jr.dot(n,o),l=-Jr.dot(i,o),p=-Jr.dot(t,o);return Tg.from(n.x,i.x,t.x,0,n.y,i.y,t.y,0,n.z,i.z,t.z,0,s,l,p,1)}function xy(o,r){if(o<=0)throw new RangeError("Near plane distance must be positive.");if(r<=o)throw new RangeError("Far plane distance must be greater than near plane distance.")}function zE(o=120,r=1,e=.1,t=1e3){xy(e,t);let n=Math.tan(.5*Math.PI*(1-o/180)),i=n/r,s=Number.isFinite(t),l=s?t/(e-t):-1,p=s?t*e/(e-t):-e;return Tg.from(i,0,0,0,0,n,0,0,0,0,l,-1,0,0,p,0)}function GE(o,r,e,t,n=.1,i=1e3){return xy(n,i),Tg.from(2/(r-o),0,0,0,0,2/(e-t),0,0,0,0,1/(n-i),0,(o+r)/(o-r),(e+t)/(t-e),n/(n-i),1)}var Lg=class o{constructor(r){this._camera=r}static view(r){return _y(r.position,r.lookAt,r.up)}static projection(r,e=yy){let t=r.position,n=r.lookAt,i=Jr.subtract(n,t);Jr.normalize(i);let s=Jr.dot(i,t),{height:l,width:p}=e,u=p/l,f=.5*s,g=f*u,v=f,y=r.top*v,_=r.bottom*v,x=r.right*g,w=r.left*g;return GE(w,x,y,_,r.near,r.far)}view(){return o.view(this._camera)}projection(r){return o.projection(this._camera,r)}},Ng=class o{constructor(r){this._camera=r}static view(r){return _y(r.position,r.lookAt,r.up)}static projection(r,e=yy){let t=e.width/e.height/r.aspectRatio;return zE(r.fov,t,r.near,r.far)}view(){return o.view(this._camera)}projection(r){return o.projection(this._camera,r)}};var Ag=we.LinearAlgebra.Vector3D,Tr=we.LinearAlgebra.Matrix3D;function Pc(o,r){throw typeof r=="function"&&(r=r.name),new RangeError(`Buffer '${o}' not available for ${r}.`)}function Cy(o,r,...e){if(o.stage??=r?.item.stage,Wo(o))return o.key??="group_"+a.uniqueCode(),new Dg(o,r,...e);if(wr(o))return o.key??="mesh_"+a.uniqueCode(),new Pg(o,r,...e);if(Vt(o))return o.key??="camera_"+a.uniqueCode(),new Rg(o);if(ui(o))return o.key??="light_"+o.type+"_"+a.uniqueCode(),new Ig(o);throw new Error("Renderable is not supported.")}var Xh=class{constructor(r){this._set=r}get items(){return this._set}loop(r){let{meshes:e,cameras:t,groups:n,lights:i}=this._set,s=t[0],l=!1,p=!1;for(let u of e)u.disposed||!r(u,s,i)||(tt.clearFlags(u),l||(tt.clearFlags(s),l=!0),p||(i.forEach(g=>tt.clearFlags(g)),p=!0));for(let u of n)tt.clearFlags(u)}},Dc=class{static create(r){if(_d(r))return r.key??="geometry_"+a.uniqueCode(),new Ud(r);if(Yr(r))return new zd(r);if(wh(r))return new Og(r);throw new Error("Object is not supported.")}},tt=class o{static create(r,...e){return Cy(r,null,...e)}static clearFlags(r,e=!1){if(r.item.flags.splice(0),e){let t=r;a.isNull(t.parent)||o.clearFlags(t.parent,!0)}}static allFlags(r){let e=r,t=e.parent,n=a.isNull(t)?[]:o.allFlags(t);return e.item.flags.union(n)}},Rc=class{#e;constructor(r){this.#e=r}get item(){return this.#e}#t=!1;lock(){this.#t=!0}unlock(){this.#t=!1;let r=this.#r;for(;r.length>0;){let e=r.shift();this._destroyUnsafe(e)}}#r=[];_destroyUnsafe(r){"texture"in r?r.texture.destroy():"buffer"in r&&r.buffer.destroy()}destroySafely(...r){for(let e of Array.from(r).concat(...this.#r.splice(0)))e&&(this.#t?this.#r.push(e):this._destroyUnsafe(e))}#n=!1;destroy(){this.dispose(),this.#n=!0}get disposed(){return this.#n}},Oc=class extends Rc{constructor(r,e){super(r),this.#t=e,this.#e=a.uniqueId()%4294967295}#e;#t;#r=new Map;get parent(){return this.#t}get id(){return this.#e}allFlags(){let r=this.parent;return this.item.flags.union(r?.allFlags()??[])}buildParentWorldTransform(){let r=Tr.identity(),e=this;for(;!a.isNull(e.parent);){let t=e.parent.item,n=Tr.translate(t.transformMatrix??Tr.identity(),t.position??Ag.zero());r=Tr.multiply(r,n),e=e.parent}return r}buildWorldTransform(){let r=Tr.translate(this.item.transformMatrix??Tr.identity(),this.item.position??Ag.zero()),e=this.buildParentWorldTransform();return Tr.multiply(r,e)}#n=new Map;version(r){return this.#n.get(r)??0}buffer(r,e){if(e==="u32id"){let n=this.#r,{pipeline:i,device:s}=r;if(n.has(i))return a.extend({fresh:!1},n.get(i));let l=new Uint32Array([this.id]),p=Lt.createUniform(s,l,Ve+"u32id-buffer"),u=a.extend({buffer:p,value:l,version:performance.now()},{fresh:!0});return this.#r.set(i,u),u}let t=this.specificBuffer(r,e);return this.#n.set(e,t.version),t}},WE={shader:"basic",color:"#c0c0c0",flags:[]},Dg=class extends Oc{#e;constructor(r,e,...t){super(r,e),this.#e=r.childRenderables.map(n=>Cy(n,this,...t))}get children(){return this.#e}specificBuffer(r,e){return null}texture(r){throw new Error("Method not implemented.")}dispose(){this.#e.forEach(r=>r.destroy())}},Rg=class o extends Oc{#e=new Map;#t;constructor(r){super(r)}texture(r){throw new Error("Method not implemented.")}specificBuffer(r,e){let t=!1;(this.allFlags().length>0||a.isNull(this.#t))&&(t=!0,this.#e.clear(),this._rebuildMatrices(r));let{pipeline:n}=r;if(this.#e.has(n)||(t=!0,this.#e.set(n,this.#t)),tt.clearFlags(this),e==="cameraViewTransform")return a.extend(this.#t,{fresh:t});Pc(e,o)}_rebuildMatrices({device:r,canvas:e}){let t=this.item,n=Yh.create(t),{x:i,y:s,z:l}=t.position,p=n.view(),u=n.projection(e),f=Tr.multiply(p,u),g=new Float32Array(36);if(g.set(Tr.toArray(p),0),g.set(Tr.toArray(f),16),g.set([i,s,l],32),a.isNull(this.#t)){let v=Lt.createUniform(r,g,Ve+"view-buffer");this.#t={buffer:v,value:g,version:performance.now().roundoff()}}else this.#t.value=g,this.#t.version=performance.now().roundoff()}_destroyView(){this.#e.clear();let r=this.#t;this.#t=null,this.destroySafely(r)}dispose(){this._destroyView()}},Ud=class o extends Rc{#e={};#t={positions:!0,normals:!0,uv:!0,packed:!0};#r;constructor(r){super(r),r.flags??=[]}buffer(r,e){let t=this.item.flags??[];(a.isNull(this.#r)||t.includes("geometry"))&&(t.splice(0),this.#e={},this._rebuildGeometryBuffers(r));let n=this.#t,i=this.#r,{pipeline:s}=r,l=this.#e[e]??=new Map,p=!l.has(s),u=f=>(p&&l.set(s,f),f);switch(e){case"geometryPositions":let{positions:f}=i,g=n.positions;return n.positions=!1,a.extend(u(f),{fresh:g||p});case"geometryNormals":let{normals:v}=i,y=n.normals;return n.normals=!1,a.extend(u(v),{fresh:y||p});case"geometryTexCoords":let{uv:_}=i,x=n.uv;return n.uv=!1,a.extend({fresh:x||p},u(_));case"geometry":let{packed:w}=i,E=n.packed;return n.packed=!1,a.extend(u(w),{fresh:E||p});default:Pc(e,o)}}texture(r){throw new Error("Method not implemented.")}_rebuildGeometryBuffers({device:r}){this._destroyBuffers();let e=performance.now(),t=this.item,n=t.key;if(Ec(t)){let i=t,l=!a.isNullOrEmpty(i.triangleIndices)?i.triangleIndices.map(k=>i.positions[k]):i.positions,p=l.length*2,u=p+l.length,f=new Float32Array(u),g=new Float32Array(u),v=new Float32Array(p),y=new Float32Array(2*u+p);for(let k=0;k<l.length;k++){let N=2*k,T=3*k,{x:O,y:D,z:P}=l[k],{x:F,y:B,z:$}=i.normals[k],{x:U,y:I}=i.textureCoordinates[k];f.set([O,D,P],T),g.set([F,B,$],T),v.set([U,I],N),y.set([O,D,P,F,B,$,U,I],T*2+N)}let _=Lt.create(r,f,Ve+"meshgeometry-"+n+"-positions-buffer"),x=Lt.create(r,g,Ve+"meshgeometry-"+n+"-normals-buffer"),w=Lt.create(r,v,Ve+"meshgeometry-"+n+"-uvmap-buffer"),E=Lt.create(r,y,Ve+"meshgeometry-"+n+"-buffer");this.#r={packed:{buffer:E,value:y,version:e},positions:{buffer:_,value:f,version:e},normals:{buffer:x,value:g,version:e},uv:{buffer:w,value:v,version:e}},this.#t={positions:!0,normals:!0,uv:!0,packed:!0}}else{let i=new Float32Array(os.flattenVectorArray(t.positions)),s=Lt.createStorage(r,i,Ve+"nodegeometry-"+n+"-positions-buffer");this.#r={positions:{buffer:s,value:i,version:e},packed:{buffer:s,value:i,version:e}},this.#t={positions:!0,packed:!0}}}_destroyBuffers(){this.#e={};let r=this.#r;a.isNull(r)||this.destroySafely(r.positions,r.normals,r.uv)}dispose(){this._destroyBuffers()}},zd=class o extends Rc{#e={};#t={};#r;#n=new Map;#i=new Map;constructor(r){super(r),r.flags??=[],r.flags.indexOf("material")===-1&&r.flags.push("material")}buffer(r,e){let t=this.item.flags??[],n=a.isNull(this.#r);t.includes("material")&&(this.#e={},t.splice(0),n=!0,this.#i.clear(),this._resetMaterialBuffers());let{pipeline:i}=r,s=this.#e[e]??=new Map;switch(e){case"material":case"line":let l=this._ensureMaterialBuffer(r,e);return l?(s.has(i)||(n=!0,s.set(i,l)),a.extend(l,{fresh:n})):null;default:Pc(e,o)}}_ensureMaterialBuffer(r,e="material"){let t=this.#n,n=t.get(e);return n||(t.has(e)?null:(n=this.#r?.buffer(r,e),n&&t.set(e,n),n))}_resetMaterialBuffers(){this.#r=Bh.create(this.item),this._destroyBuffers()}texture(r,e="texture"){let t=this.#i,n=t.get(e),i=!1;if(!n){if(n=this.#r?.texture(r,e),!n)return null;t.set(e,n),i=!0,this.#t={}}let{pipeline:s}=r,l=this.#t[e]??=new Map;return l.has(s)||(i=!0,l.set(s,n)),a.extend(n,{fresh:i})}dispose(){this._destroyBuffers()}_destroyBuffers(){this.#e={},this.#t={};let r=this.#n.values();this.#n.clear(),this.destroySafely(...r);let e=this.#i.values();this.#i.clear(),e.forEach(t=>t.texture.destroy())}},Og=class o extends Rc{#e={time:0,cursor:{x:0,y:0},resolution:{width:0,height:0}};#t;#r=new Map;constructor(r){super(r),a.extend(this.#e,r)}buffer(r,e){if(e==="interaction")return this._ensureInteractionBuffer(r);Pc(e,o)}texture(r){throw new Error("Method not implemented.")}_ensureInteractionBuffer(r,e="interaction"){let t=this.#e,n=this.item,i=!this.#t||n.time!==t.time||n.resolution?.width!==t.resolution.width||n.resolution?.height!==t.resolution.height;if(!i&&!a.isNull(n.cursor)&&(i=n.cursor.x!==t.cursor.x||n.cursor.y!==t.cursor.y),i){let p=new Float32Array([n.cursor?.x??0,n.cursor?.y??0,n.resolution.width,n.resolution.height,n.time,0]),u=Lt.createUniform(r.device,p,Ve+"interaction-buffer");this.#t={buffer:u,value:p,version:performance.now()},this.#r.clear()}let{pipeline:s}=r,l=this.#r;return l.has(s)||(i=!0,l.set(s,this.#t)),a.extend(this.#t,{fresh:i})}_destroyBuffers(){this.#r.clear();let r=this.#t;a.isNull(r)||this.destroySafely(r)}dispose(){this._destroyBuffers()}},Pg=class o extends Oc{#e;#t;#r;#n;#i;#a={geometry:!0,material:!0,transform:!0};#s=new Map;constructor(r,e,t,n){super(r,e),r.flags??=[],r.flags.indexOf("geometry")===-1&&r.flags.push("geometry"),r.flags.indexOf("material")===-1&&r.flags.push("material"),r.flags.indexOf("position")===-1&&r.flags.indexOf("transform")===-1&&r.flags.push("transform"),this.#e=t,this.#r=n}texture(r,e){return this.#n?.texture(r,e)}specificBuffer(r,e){let t=this.#a,n=this.allFlags();(a.isNull(this.#i)||n.includes("position")||n.includes("transform"))&&(this.#s.clear(),t.transform=!0,this._rebuildWorldMatrices(r)),(a.isNull(this.#t)||n.includes("geometry"))&&(t.geometry=!0,this._ensureGeometryBuffer()),(a.isNull(this.#n)||n.includes("material"))&&(t.material=!0,this._ensureMaterialBuffer()),tt.clearFlags(this);let i=this.#t,s=this.#n;switch(e){case"geometryPositions":case"geometryNormals":case"geometryTexCoords":case"geometry":return i.buffer(r,e);case"material":case"line":return s.buffer(r,e);case"objectWorldTransform":let l=this.#i,p=t.transform;t.transform=!1;let u=this.#s,{pipeline:f}=r,g=!u.has(f);return g&&u.set(f,l),a.extend(l,{fresh:p||g});default:Pc(e,o)}}_ensureGeometryBuffer(){let r=this.#t,e=this.#e,n=this.item.geometry;if(a.isNull(e))r?.destroy(),this.#t=new Ud(n);else{let i=e?.get(n);i?.disposed!==!1&&(i=new Ud(n),e.set(n,i)),this.#t=i}}_ensureMaterialBuffer(){let r=this.#n,e=this.#r,n=this.item.material??WE;if(a.isNull(e))r?.destroy(),this.#n=new zd(n);else{let i=e?.get(n);i?.disposed!==!1&&(i=new zd(n),e.set(n,i)),this.#n=i}}_rebuildWorldMatrices({device:r}){let e=this.item,t=this.buildWorldTransform(),n=Tr.transpose(Tr.invert(t)),i=new Float32Array(28);if(i.set(Tr.toArray(t),0),i.set([n.m11,n.m12,n.m13,0,n.m21,n.m22,n.m23,0,n.m31,n.m32,n.m33,0],16),a.isNull(this.#i)){let s=Lt.createUniform(r,i,Ve+"mesh-"+e.key+"-worldmatrix-buffer");this.#i={buffer:s,value:i,version:performance.now().roundoff()}}else this.#i.value=i,this.#i.version=performance.now().roundoff()}dispose(){this.#s.clear();let r=this.#i;this.#i=null,this.destroySafely(r);let e=this.#n;this.#n=null,e?.destroy();let t=this.#t;this.#t=null,t?.destroy()}},Ig=class o extends Oc{#e;#t=new Map;constructor(r){super(r),r.flags.push("light")}_rebuildAmbientLightBuffer({device:r}){let e=this.item,t=4,n=1,i=0,s=4,l=24,p=new Float32Array(l),{r:u,g:f,b:g,a:v}=Be.parse(e.color??"#fff");p.set([u,f,g,v],i),p.set([e.intensity],s),this.#e={value:p,buffer:Lt.createUniform(r,p,Ve+"ambient-light-buffer"),version:performance.now()}}_rebuildDirectionalLightBuffer({device:r}){let e=this.item,t=1,n=4,i=3,s=0,l=4,p=7,u=p+t,f=new Float32Array(u),{r:g,g:v,b:y,a:_}=Be.parse(e.color??"#fff");f.set([g,v,y,_],s),f.set([e.intensity],p);let x=Ag.subtract(e.position,e.target);f.set([x.x,x.y,x.z],l),this.#e={value:f,buffer:Lt.createUniform(r,f,Ve+"directional-light-buffer"),version:performance.now()}}_rebuildOmniLightBuffer({device:r}){let e=this.item,t=1,n=4,i=3,s=0,l=4,p=7,u=p+t,f=new Float32Array(u),{r:g,g:v,b:y,a:_}=Be.parse(e.color??"#fff");f.set([g,v,y,_],s),f.set([e.intensity],p),f.set([e.position.x,e.position.y,e.position.z],l),this.#e={value:f,buffer:Lt.createUniform(r,f,Ve+"omni-light-buffer"),version:performance.now()}}_rebuildLight(r){this.destroySafely(this.#e);let e=this.item;switch(e.type){case"direction":this._rebuildDirectionalLightBuffer(r);break;case"omni":this._rebuildOmniLightBuffer(r);break;case"ambient":this._rebuildAmbientLightBuffer(r);break;default:throw new Error(`Light '${e.type}' is not supported.`)}}texture(r){throw new Error("Method not implemented.")}specificBuffer(r,e){let t=this.#t,n=a.isNull(this.#e)||this.allFlags().length>0;n&&(t.clear(),this._rebuildLight(r)),tt.clearFlags(this);let{pipeline:i}=r;if(t.has(i)||(n=!0,t.set(i,this.#e)),e==="light")return a.extend(this.#e,{fresh:n});Pc(e,o)}dispose(){this.#t.clear();let r=this.#e;this.#e=null,this.destroySafely(r)}};var Ae=Ve,wy={multisample:!0,packedVertices:!0,primitive:{topology:"triangle-list",frontFace:"ccw",cullMode:"back"}},zt=o=>{},ol=class o{static{this._memoizer=new WeakMap}static dispose(r){let e=this._memoizer,t=e.get(r);a.isNull(t)||(t.clear(),e.delete(r))}static createColorPicking(r,e){let t=o.create(r,e);return t instanceof Kh||t instanceof Jh?{frame:t.raycast}:null}static create(r,[e,t,...n],i){let s=o._memoizer,l=s.get(r);if(a.isNull(l)&&s.set(r,l=new Map),a.isNull(e))throw new Error("Pipeline not implemented, given the provided arguments.");if(wr(e.item)){let p=Ec(e.item.geometry),u=!p&&va(e.item.material);if(!p&&!u)throw new Error("Pipeline not implemented, given the provided mesh argument.");let f=p?new $g(e,t,...n):new Hg(e,t),g=f.key+(i?.modifiers?.version??""),v=l.get(g);if(v)return v;let y=p?new Kh(r,f):new Jh(r,f);y.build(i);let _=y;return a.extend(_,{id:g+"-"+r.canvas.width+"x"+r.canvas.height+"-"+a.Dates.now().toISOString()}),l.set(g,_),_}else throw new ReferenceError("Pipeline not implemented, given thst the first argument is not a mesh.")}},qh=class{constructor(){this.#e=new Map}#e;ensureBindGroup({device:r},e,t,n,i,s,l=()=>{}){let p=this.#e,u=typeof e=="string"?e:e.key,f=p.get(u);if(a.isNull(f)&&p.set(u,f=new Map),n||!f.has(s)){let g=t.map((_,x)=>({binding:x,resource:{buffer:_}})),v={label:s,layout:i,entries:g};l(v);let y=r.createBindGroup(v);return f.set(s,y),y}else return f.get(s)}},$g=class o{#e=[];#t;#r;#n=new Map;#i={shader:"basic",lights:""};constructor(...r){this.add(...r)}reset(){this.#e.splice(0),this.#t=null,this.#n.clear(),this.#i={shader:"basic",lights:""}}add(...r){for(let e of r??[])if(wr(e.item))if(a.isNull(this.#t)){this.#t=e;let t=e.item.material??{shader:"basic"};this.#i.shader=t.shader+"-"+(t.map?"map":"nomap")}else throw new Error("Mesh already added.");else if(ui(e.item))this.#e.push(e),this.#i.lights+="-"+e.item.type;else if(Vt(e.item))this.#r??=e;else throw new Error("Unknown object type.")}build(r){let e=this._computeBasicData(),t=this.key,n=this.vertex({inputModifier:r?.vertexInput,outputModifier:r?.vertexOutput}),i=this.fragment(e,{modifier:r?.fragment}),s=(...p)=>o.prototype.bindgroup.apply(this,p),l={lightCount:this.#e.length,mapCount:this.#t.item.material?.map?1:0};return{vertex:n,fragment:i,key:t,bindings:s,metadata:l}}get key(){let{shader:r,lights:e}=this.#i;return"mesh-"+r+e}bindgroup(r,e,t){let i=this.#n.get(r);if(a.isNull(i))return null;if(a.isNullOrEmpty(e))return i;let s=i.filter(l=>l.key===e);return isNaN(t)?s:t>=0&&t<i.length?s[t]:s}vertex(r){return py(r)}_computeBasicData(){let r=this.#t.item,e=this.#e,t=r.material,n=!a.isNull(t?.texture),i=!a.isNullOrEmpty(e),s=a.isNull(r)?"basic":r.material?.shader??"basic";return{hasTexture:n,hasLighting:i,shader:s,materialBindGroupIndex:2,lightingBindGroupIndex:3}}_computeBindGroupsAndReferences(r=this._computeBasicData()){let{hasTexture:e,materialBindGroupIndex:t,lightingBindGroupIndex:n}=r,i=this.#n,s=this.#e,l={key:"objectWorldTransform",group:1,binding:0,type:"buffer"},p={key:"material",group:t,binding:0,type:"buffer"};e?i.set("mesh",[l,p,{key:"texture",group:t,type:"texture"}]):i.set("mesh",[l,p]),i.set("camera",[{key:"cameraViewTransform",group:0,binding:0,type:"buffer"}]);let u=s.map((f,g)=>({key:"light",group:n,binding:g,type:"buffer"}));u.push(...u),i.set("interaction",[{key:"interaction",group:0,type:"buffer",binding:1}])}fragment(r=this._computeBasicData(),e){this._computeBindGroupsAndReferences(r);let t={definitions:[],bindings:[],modifiers:[]},n=i=>{for(let s of i.definitions??[])t.definitions.indexOf(s)===-1&&t.definitions.push(s);a.isNullOrEmpty(i.bindings)||t.bindings.push(...i.bindings),a.isNullOrEmpty(i.modifiers)||t.modifiers.push(...i.modifiers)};switch(r.shader){case"basic":if(r.hasTexture){let l=r.materialBindGroupIndex,p=fy({inputColor:sl,outputColors:[sl],uv:"uv"},l);n(p)}let i=0,s=this.#e;for(let l of s){switch(l.item.type){case"direction":let u=gy({outputColor:Id,normal:"normal"},r.lightingBindGroupIndex,i);n(u);break;case"omni":let f=vy({outputColor:Id,normal:"normal",position:"vertex"},r.lightingBindGroupIndex,i);n(f);break;case"ambient":let g=by({inputColor:sl,outputColor:Hh},r.lightingBindGroupIndex,i);n(g);break}i++}return Hd.fragment(t,e)}}},Zr={writeBufferConditionally:(o,r)=>{r.fresh&&o.queue.writeBuffer(r.buffer,0,r.value)}},Kh=class{constructor(r,e,t=new qh){this._context=r;this._builder=e;this._cache=t;this._ensureU32idBindGroup=(r,e,t)=>this._cache.ensureBindGroup(this._context,r,[e],t,this._pickBindGroupLayout,Ae+"mesh-colorpick-bind-group");this._ensureMaterialBindGroup=(r,e,t,n,i=2)=>{let s=this._bindGroupLayouts[i],l=Ae+"material-bind-group";if(s.label!==Ae+"material-bind-group-layout")throw new Error("BindGroupLayout mismatch!");return this._cache.ensureBindGroup(this._context,r,[e],n,s,l,p=>{let{device:u}=this.context,f=p.entries;t&&f.push({binding:1,resource:u.createSampler({addressModeU:"repeat",addressModeV:"repeat",magFilter:"linear",minFilter:"linear"})},{binding:2,resource:t.createView()})})};this._ensureWorldTransformBindGroup=(r,e,t,n=1,i=!1)=>{let s=this._bindGroupLayouts[n];if(s.label!==Ae+"mesh-transforms-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let l=r.key+"-"+(i?1:0),p=`${Ae}${i?"colorpick":"mesh"}-transforms-bind-group`;return this._cache.ensureBindGroup(this._context,l,[e],t,s,p)};this._ensureCameraProjectionAndInteractionDataBindGroup=(r,e,t,n,i=0,s=!1)=>{let l=this._bindGroupLayouts[i],p=r.key+"-"+(s?1:0),u=`${Ae}${s?"colorpick":"mesh"}-view-bind-group`;return this._cache.ensureBindGroup(this._context,p,[e,t],n,l,u)};this._ensureLightingBindGroup=(r,e,t=3)=>{let n=this._bindGroupLayouts[t],i=r.map(l=>l.id).join(":"),s=r.map(l=>l.buffer.buffer);return this._cache.ensureBindGroup(this._context,i,s,e,n,Ae+"mesh-lighting-bind-group")};this._bindGroupLayouts=[];this._bindVertex=zt;this._bindPicker=zt;this._bindWorldTransform=zt;this._bindRaycastWorldTransform=zt;this._bindCameraProjectionAndInteractionData=zt;this._bindRaycastCameraProjectionAndInteractionData=zt;this._bindLighting=zt;this._bindMaterial=zt;this.set=r=>{throw new Error("Deprecated.")};this.bind=(r,...e)=>{throw new Error("Deprecated.")};this.draw=(r,...e)=>{throw new Error("Deprecated.")};this.frame=(r,e,t,n,...i)=>{r.setPipeline(this._pipeline);try{this._bindVertex(r,t),this._bindWorldTransform(r,t),this._bindMaterial(r,t),this._bindCameraProjectionAndInteractionData(r,n,e),this._bindLighting(r,...i);let s=t.item,l=s.geometry;r.draw(l.triangleIndices?.length||l.positions.length)}catch(s){console.error("Pacem.Drawing3D.FrameException",s)}};this.raycast=(r,e,t,n)=>{r.setPipeline(this._pickPipeline);try{this._bindVertex(r,t),this._bindRaycastWorldTransform(r,t),this._bindRaycastCameraProjectionAndInteractionData(r,n,e),this._bindPicker(r,t);let i=t.item,s=i.geometry;r.draw(s.triangleIndices.length)}catch{}};this._key=e.key}get context(){return this._context}get key(){return this._key}build(r){let e=a.extend({},wy,r??{}),t=this._builder,n=t.build(e.modifiers),i=a.extend({pipeline:this},this._context),s=i.device,l={module:s.createShaderModule({code:n.vertex}),buffers:e.packedVertices?[al.createVertex(0,3,3,2)]:[al.createVertex(0,3),al.createVertex(1,3),al.createVertex(2,2)]},p=s.createBindGroupLayout({entries:[{binding:0,visibility:3,buffer:{type:"uniform"}},{binding:1,visibility:3,buffer:{type:"uniform"}}],label:Ae+"mesh-view-bind-group-layout"}),u=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"mesh-transforms-bind-group-layout"}),f=[p,u],g={module:s.createShaderModule({code:n.fragment}),targets:[{format:i.format,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{}}}]},v=f.length,y=[{binding:0,visibility:2,buffer:{type:"read-only-storage"}}],{mapCount:_}=n.metadata,x=_>0;x&&y.push({visibility:2,binding:1,sampler:{}},...Array(_).keys().map(I=>({visibility:2,binding:2+I,texture:{}})));let w={label:Ae+"material-bind-group-layout",entries:y},E=s.createBindGroupLayout(w);f.push(E);let k=f.length,{lightCount:N}=n.metadata,T=N>0;if(T){let I=s.createBindGroupLayout({entries:[...Array(N).keys()].map((G,Y)=>({visibility:2,binding:Y,buffer:{type:"uniform"}})),label:Ae+"lighting-bind-group-layout"});f.push(I)}let O={label:Ae+"mesh-render-pipeline",vertex:l,fragment:g,layout:s.createPipelineLayout({label:Ae+"mesh-render-pipeline-layout",bindGroupLayouts:this._bindGroupLayouts=f}),primitive:e.primitive};e.multisample&&(O.multisample={count:4},O.depthStencil={depthCompare:"less",format:"depth24plus",depthWriteEnabled:!0}),this._pipeline=s.createRenderPipeline(O);let D=this._pickBindGroupLayout=s.createBindGroupLayout({label:Ae+"mesh-colorpick-bind-group-layout",entries:[{visibility:2,binding:0,buffer:{type:"uniform"}}]}),P={label:Ae+"mesh-colorpick-pipeline",vertex:l,fragment:{module:s.createShaderModule({code:Sg(2)}),targets:[{format:"r32uint"}]},layout:s.createPipelineLayout({label:Ae+"mesh-colorpick-pipeline-layout",bindGroupLayouts:[p,u,D]}),primitive:e.primitive,depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};this._pickPipeline=s.createRenderPipeline(P);let F=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided.`);let{buffer:W}=Y.buffer(i,"geometryPositions"),{buffer:V}=Y.buffer(i,"geometryNormals"),{buffer:X}=Y.buffer(i,"geometryTexCoords");I.setVertexBuffer(0,W),I.setVertexBuffer(1,V),I.setVertexBuffer(2,X)},B=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided.`);let{buffer:W}=Y.buffer(i,"geometry");I.setVertexBuffer(0,W)};this._bindVertex=e.packedVertices?B:F;let $=(I,G,Y)=>{if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let W=G.buffer(i,"objectWorldTransform"),V=W.buffer;Zr.writeBufferConditionally(s,W);let{group:X}=n.bindings("mesh","objectWorldTransform",0),q=this._ensureWorldTransformBindGroup(G.item,V,W.fresh,X,Y);I.setBindGroup(X,q)};this._bindWorldTransform=(I,...G)=>{let Y=G.at(0);$(I,Y,!1)},this._bindRaycastWorldTransform=(I,...G)=>{let Y=G.at(0);$(I,Y,!0)};let U=(I,G,Y,W)=>{if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing view projection buffers was provided.`);let V=G.buffer(i,"cameraViewTransform"),X=V.buffer;if(Zr.writeBufferConditionally(s,V),a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing interaction buffers was provided.`);let q=Y.buffer(i,"interaction"),Z=q.buffer;Zr.writeBufferConditionally(s,q);let{group:ne}=n.bindings("camera","cameraViewTransform",0),{group:te}=n.bindings("interaction","interaction",0);if(ne!==te)throw new ReferenceError(`Layout bind group mismatch: ${ne} vs ${te}.`);let ae=this._ensureCameraProjectionAndInteractionDataBindGroup(G.item,X,Z,V.fresh||q.fresh,ne,W);I.setBindGroup(ne,ae)};this._bindCameraProjectionAndInteractionData=(I,...G)=>{let Y=G.at(0),W=G.at(1);U(I,Y,W,!1)},this._bindRaycastCameraProjectionAndInteractionData=(I,...G)=>{let Y=G.at(0),W=G.at(1);U(I,Y,W,!0)},this._bindMaterial=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing vertex colors was provided.`);let W=Y.buffer(i,"material"),V=W.buffer;Zr.writeBufferConditionally(s,W);let X=Y.texture(i),q=X?.texture,Z=this._ensureMaterialBindGroup(Y.item,V,q,W.fresh,v);I.setBindGroup(v,Z),x&&s.queue.copyExternalImageToTexture({source:X.source,flipY:!0},{texture:q},{width:q.width,height:q.height})},this._bindLighting=(I,...G)=>{if(T){let W=Array.from(G).map(q=>({buffer:q.buffer(i,"light"),id:q.item.key})),V=W.some(q=>q.buffer.fresh),X=this._ensureLightingBindGroup(W,V,k);for(let q of W)Zr.writeBufferConditionally(s,q.buffer);I.setBindGroup(k,X)}},this._bindPicker=(I,...G)=>{let Y=G.at(0);if(a.isNull(Y))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let W=Y.buffer(i,"u32id"),V=W.buffer;Zr.writeBufferConditionally(s,W);let X=2,q=W.fresh,Z=this._ensureU32idBindGroup(Y.item,V,q);I.setBindGroup(X,Z)}}},Hg=class o{#e;#t;#r=new Map;constructor(...r){this.add(...r)}reset(){this.#e=null,this.#r.clear()}add(...r){for(let e of r??[])if(wr(e.item))if(a.isNull(this.#e))this.#e=e;else throw new Error("Line already added.");else if(Vt(e.item))this.#t??=e;else if(!ui(e.item))throw new Error("Unknown object type.")}build(){let r=this._computeBasicData(),e=this.key,t=this.vertex(r),n=this.fragment(r);return{vertex:t,fragment:n,key:e,bindings:(...s)=>o.prototype.bindgroup.apply(this,s),metadata:{thickness:r.thickness,dashPattern:r.dashPattern}}}get key(){let r=(this.#e?.item).material?.lineWidth>1;return"line"+(r?"-fat":"")}bindgroup(r,e,t){let i=this.#r.get(r);if(a.isNull(i))return null;if(a.isNullOrEmpty(e))return i;let s=i.filter(l=>l.key===e);return isNaN(t)?s:t>=0&&t<i.length?s[t]:s}vertex(r=this._computeBasicData()){return r.thickness>1?hy():uy()}_computeBasicData(){let r=this.#e.item,e=a.isNull(r)?"line":r.material?.shader??"line",t=r.material,n=t?.lineWidth??1,i=t?.dashArray;return{shader:e,thickness:n,dashPattern:i}}_computeBindGroupsAndReferences(r=this._computeBasicData()){let e=this.#r,t={key:"objectWorldTransform",group:1,binding:0,type:"buffer"},n={key:"material",group:3,binding:0,type:"buffer"},i={key:"geometryPositions",group:2,binding:0,type:"buffer"},s={key:"line",group:2,binding:1,type:"buffer"};e.set("mesh",[t,n,i,s]),e.set("camera",[{key:"cameraViewTransform",group:0,binding:0,type:"buffer"}])}fragment(r=this._computeBasicData()){this._computeBindGroupsAndReferences(r);let e={definitions:[],bindings:[],modifiers:[]};if(r.shader==="line")return Bd.fragment(e)}},Jh=class{constructor(r,e,t=new qh){this._lineBuilder=e;this._cache=t;this._ensureLineU32idBindGroup=(r,e,t)=>{let n=this.context;return this._cache.ensureBindGroup(n,r,[e],t,this._pickLineBindGroupLayout,Ae+"line-colorpick-bind-group")};this._ensureLineMaterialBindGroup=(r,e,t,n=2)=>{let i=this._bindLineGroupLayouts[n];if(i.label!==Ae+"line-material-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let s=this.context;return this._cache.ensureBindGroup(s,r,[e],t,i,Ae+"line-material-bind-group")};this._ensureLinePositionsBindGroup=(r,e,t,n)=>{let i=this._bindLineGroupLayouts[n];if(i.label!==Ae+"line-positions-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let s=this.context;return this._cache.ensureBindGroup(s,r,e,t,i,Ae+"line-positions-bind-group")};this._ensureLineWorldTransformBindGroup=(r,e,t,n=1,i=!1)=>{let s=this._bindLineGroupLayouts[n];if(s.label!==Ae+"line-transforms-bind-group-layout")throw new Error("BindGroupLayout mismatch!");let l=r.key+"-line-"+(i?1:0),p=`${Ae}${i?"colorpick":""}-line-transforms-bind-group`,u=this.context;return this._cache.ensureBindGroup(u,l,[e],t,s,p)};this._ensureLineCameraProjectionBindGroup=(r,e,t,n=0,i=!1)=>{let s=this._bindLineGroupLayouts[n],l=r.key+"-line-"+(i?1:0),p=`${Ae}${i?"colorpick":""}-line-view-bind-group`,u=this.context;return this._cache.ensureBindGroup(u,l,[e],t,s,p)};this._bindLineGroupLayouts=[];this._bindLinePositions=zt;this._bindLinePicker=zt;this._bindLineWorldTransform=zt;this._bindLineRaycastWorldTransform=zt;this._bindLineCameraProjection=zt;this._bindLineRaycastCameraProjection=zt;this._bindLineMaterial=zt;this._drawLine=zt;this.set=r=>{throw new Error("Deprecated.")};this.bind=(r,...e)=>{throw new Error("Deprecated.")};this.draw=(r,...e)=>{throw new Error("Deprecated.")};this.frame=(r,e,t,n)=>{r.setPipeline(this._linePipeline);try{this._bindLineWorldTransform(r,t),this._bindLineCameraProjection(r,n),this._bindLinePositions(r,t),this._bindLineMaterial(r,t),this._drawLine(r,t)}catch(i){console.error("Pacem.Drawing3D.FrameException",i)}};this.raycast=(r,e,t,n)=>{r.setPipeline(this._pickLinePipeline);try{this._bindLineRaycastWorldTransform(r,t),this._bindLineRaycastCameraProjection(r,n),this._bindLinePositions(r,t),this._bindLinePicker(r,t),this._drawLine(r,t)}catch{}};this.#e=r,this._lineKey=e.key}#e;get context(){return this.#e}get key(){return this._lineKey}build(r){let e=a.extend({},wy,r??{}),t=this._lineBuilder,n=t.build(),i=a.extend({pipeline:this},this.#e),s=i.device,l=n.metadata.thickness>1,p={module:s.createShaderModule({code:n.vertex}),buffers:[]},u=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"line-transforms-bind-group-layout"}),f=s.createBindGroupLayout({entries:[{binding:0,visibility:1,buffer:{type:"uniform"}}],label:Ae+"line-view-bind-group-layout"}),g=[{binding:0,visibility:1,buffer:{type:"read-only-storage"}}];l&&g.push({binding:1,visibility:1,buffer:{type:"uniform"}});let v=s.createBindGroupLayout({entries:g,label:Ae+"line-positions-bind-group-layout"}),y=[f,u,v],_=y.length,x=y.slice(),w={module:s.createShaderModule({code:n.fragment}),targets:[{format:i.format,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{}}}]},E=x.length,k=[{binding:0,visibility:2,buffer:{type:"read-only-storage"}}],N={label:Ae+"line-material-bind-group-layout",entries:k},T=s.createBindGroupLayout(N);x.push(T);let O=l?e.primitive.topology:"line-list",D={label:Ae+"line-render-pipeline",vertex:p,fragment:w,layout:s.createPipelineLayout({label:Ae+"line-render-pipeline-layout",bindGroupLayouts:this._bindLineGroupLayouts=x}),primitive:a.extend({},e.primitive,{topology:O})};e.multisample&&(D.multisample={count:4},D.depthStencil={depthCompare:"less",format:"depth24plus",depthWriteEnabled:!0}),this._linePipeline=s.createRenderPipeline(D);let P=this._pickLineBindGroupLayout=s.createBindGroupLayout({label:Ae+"line-colorpick-bind-group-layout",entries:[{visibility:2,binding:0,buffer:{type:"uniform"}}]}),F={label:Ae+"line-colorpick-pipeline",vertex:p,fragment:{module:s.createShaderModule({code:Sg(_)}),targets:[{format:"r32uint"}]},layout:s.createPipelineLayout({label:Ae+"line-colorpick-pipeline-layout",bindGroupLayouts:y.concat(P)}),primitive:a.extend({},e.primitive,{topology:O}),depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};this._pickLinePipeline=s.createRenderPipeline(F);let B=(U,I,G)=>{if(a.isNull(I))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let Y=I.buffer(i,"objectWorldTransform"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let{group:V}=n.bindings("mesh","objectWorldTransform",0),X=this._ensureLineWorldTransformBindGroup(I.item,W,!1,V,G);U.setBindGroup(V,X)};this._bindLineWorldTransform=(U,...I)=>{let G=I.at(0);B(U,G,!1)},this._bindLineRaycastWorldTransform=(U,...I)=>{let G=I.at(0);B(U,G,!0)};let $=(U,I,G)=>{if(a.isNull(I))throw new ReferenceError(`Null ${tt.name} bringing view projection buffers was provided.`);let Y=I.buffer(i,"cameraViewTransform"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let{group:V}=n.bindings("camera","cameraViewTransform",0),X=this._ensureLineCameraProjectionBindGroup(I.item,W,!1,V,G);U.setBindGroup(V,X)};this._bindLineCameraProjection=(U,...I)=>{let G=I.at(0);$(U,G,!1)},this._bindLineRaycastCameraProjection=(U,...I)=>{let G=I.at(0);$(U,G,!0)},this._bindLinePositions=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing vertex buffers was provided as index 0.`);let Y=G.buffer(i,"geometryPositions"),W=Y.buffer,V=Y.fresh,X=[W];if(Zr.writeBufferConditionally(s,Y),l){let ne=G.buffer(i,"line"),te=ne.buffer;V||=ne.fresh,X.push(te),Zr.writeBufferConditionally(s,ne)}let{group:q}=n.bindings("mesh","line",0),Z=this._ensureLinePositionsBindGroup(G.item,X,V,q);U.setBindGroup(q,Z)},this._bindLineMaterial=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing vertex colors was provided.`);let Y=G.buffer(i,"material"),W=Y.buffer;Zr.writeBufferConditionally(s,Y);let V=this._ensureLineMaterialBindGroup(G.item,W,Y.fresh,E);U.setBindGroup(E,V)},this._bindLinePicker=(U,...I)=>{let G=I.at(0);if(a.isNull(G))throw new ReferenceError(`Null ${tt.name} bringing world transform buffer was provided.`);let Y=G.buffer(i,"u32id"),W=Y.buffer,V=Y.value;Zr.writeBufferConditionally(s,Y);let X=this._ensureLineU32idBindGroup(G.item,W,!1);U.setBindGroup(_,X)},this._drawLine=(U,...I)=>{let Y=I.at(0).item,W=Y.geometry;l?U.draw(6,W.positions.length-1,0,0):U.draw(W.positions.length)}}};var Fd=class{static{this._memoizer=new WeakMap}static dispose(r){let e=this._memoizer;if(e.has(r)){let t=e.get(r);for(let n of t.values())n.destroy();t.clear(),e.delete(r)}}static createColorPicking(r){let e=this._memoizer;e.has(r)||e.set(r,new Map);let t=e.get(r),n="colorpick";if(t.has(n))return t.get(n);let i=new Bg(r);return t.set(n,i),i}},Gd=1,Bg=class{constructor(r){this._context=r;this._objects=new Map;this.frame=(r,...e)=>{if(a.isNull(this._encoder))throw new Error("Null encoder. Maybe you missed to call the 'begin' method first.");let t=Array.from(e);ol.createColorPicking(this._context,t)?.frame(this._pass,r,...e);for(let i of t)i.item.inert||this._objects.set(i.id,i)};this.end=r=>{if(!a.isNull(this._handle))return this._handle;let e=this._pass,t=this._encoder,{device:n}=this._context,{render:i}=this._textures,s=i.texture,l=this._ensureBuffer();e.end(),t.copyTextureToBuffer({texture:s,origin:{x:r.x,y:r.y}},{buffer:l,bytesPerRow:(Gd*4+255|0)*256,rowsPerImage:1},{width:Gd}),n.queue.submit([t.finish()]),this._encoder=null;let p=this,u=p._objects,f=()=>{p._handle=null};return this._handle=new Promise((g,v)=>{l.mapAsync(1,0,4*Gd).then(y=>{let x=new Uint32Array(l.getMappedRange(0,4*Gd))[0];l.unmap(),f();let w=u.get(x);g(w?[w.item]:[])})})}}_createTexture(r){let{device:e,canvas:t}=this._context,n=Math.min(e.limits.maxTextureDimension2D,t.clientWidth),i=Math.min(e.limits.maxTextureDimension2D,t.clientHeight);return e.createTexture({size:[n,i,1],format:r,usage:17})}_ensureBuffer(){let r=this._buffer;if(!a.isNull(r))return r;let{device:e}=this._context;return this._buffer=e.createBuffer({label:Ve+"colorpick-output-buffer",size:Gd*4,usage:9})}_ensureTextures(){let r=this._textures;if(!a.isNull(r))return r;let e=this._createTexture("r32uint"),t=this._createTexture("depth24plus"),n={texture:e,view:e.createView()},i={texture:t,view:t.createView()};return this._textures={render:n,depth:i}}_destroyTexture(r){a.isNull(r)||r.texture?.destroy()}destroy(){let r=this._textures,e=this._buffer;if(!a.isNullOrEmpty(r)){let{render:t,depth:n}=r;this._destroyTexture(t),this._destroyTexture(n),this._textures=null}a.isNull(e)||(e.destroy(),this._buffer=null)}begin(){let{device:r}=this._context;this._encoder=r.createCommandEncoder({label:Ve+"colorpick-raycaster"});let{render:e,depth:t}=this._ensureTextures(),n={label:Ve+"colorpick-raycaster-pass",colorAttachments:[{view:e.view,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:t.view,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}};this._pass=this._encoder.beginRenderPass(n),this._objects.clear()}};var Vg=we.LinearAlgebra.Vector3D;var Zh=class{static create(r,e){return new Promise((t,n)=>{if(!navigator.gpu)n({message:"WebGPU not supported.",cause:0});else{let i=new Ug(r);i.init(e).then(s=>t(i),s=>{let p={message:typeof s=="string"?s:s.message,cause:1};n(p)})}})}};function YE(o){return{bottom:-1,top:1,left:-1,right:1,near:.1,far:200,lookAt:Vg.from(0,0,0),up:Vg.j(),position:Vg.from(0,0,1),type:"orthographic",flags:[],stage:o}}function XE(...o){for(let r of o||[])r?.destroy()}var Ug=class{constructor(r){this.#n=new WeakMap;this.#i=new WeakMap;this.#a=new WeakMap;this.#l={enableValidation:!1};this.#h=!1;this._logError=r=>{let e=this.#e,t=e.logger;if(!a.isNull(t)){let n="error"in r?r.error:r;t.log(ce.LogLevel.Error,n.message,"WebGPU")}};this.#c=!0;this.#u=!1;let e=(this.#e=r).stage,t=document.createElement("canvas");t.id=d+"_3d_stage_"+a.uniqueCode(),e.innerHTML="",e.appendChild(this.#t=t),this.#p=Dc.create(this.#d={time:performance.now(),cursor:{x:0,y:0},resolution:{width:0,height:0}})}#e;#t;#r;#n;#i;#a;#s;#o;#l;#h;#p;#d;_buildPassDescriptor({multisample:r,format:e}){let{context:t,device:n}=this.#r,i=t.getCurrentTexture(),s=this.#o;if(a.isNull(s)){if(s={},r){let _=n.createTexture({label:Ve+"render-texture",format:e??i.format,usage:16,size:[i.width,i.height],sampleCount:4});s.render={texture:_,view:_.createView({label:Ve+"render-texture-view"})};let x=n.createTexture({label:Ve+"depth-texture",format:"depth24plus",usage:16,size:[i.width,i.height],sampleCount:4});s.depth={texture:x,view:x.createView({label:Ve+"depth-texture-view"})}}this.#o=s}let{transparent:l,background:p}=this.#e,u=l?{r:0,g:0,b:0,a:0}:p?typeof p=="string"?Be.parse(p):p:{r:0,g:0,b:0,a:1},f=os.flattenVectorArray([u]),g=i.createView({label:Ve+"canvas-texture-view"}),v={view:g,clearValue:f,loadOp:"clear",storeOp:"store"},y={colorAttachments:[v]};if(r){let _=s.render.view,x=s.depth.view;y.depthStencilAttachment={view:x,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:0,stencilReadOnly:!0},v.view=_,v.resolveTarget=g}return y}_buildContext(r=this.#t,e=this.#e.size){e??=r;let t=e.width,n=e.height,i=1;r.width=t*i,r.height=n*i;let s=r.getContext("webgpu"),l=navigator.gpu.getPreferredCanvasFormat();return{context:s,textureFormat:l}}_buildUpContext(r,e,t,n){let{transparent:i}=this.#e;t.configure({alphaMode:i?"premultiplied":"opaque",device:r,format:n}),this.#r={device:r,adapter:e,canvas:this.#t,context:t,format:n},this.#c=!1}async init(r){this.#l=r;let e=await navigator.gpu.requestAdapter();if(a.isNull(e))throw new Error("WebGPU adapter unavalable or disabled.");let t=await e.requestDevice();if(a.isNull(e))throw new Error("WebGPU device unavalable or disabled.");t.addEventListener("uncapturederror",this._logError),this.#u=!a.isNull(r.modifiers?.version)&&!a.isNull(r.modifiers)&&(!a.isNull(r.modifiers.vertexInput)||!a.isNull(r.modifiers.vertexOutput)||!a.isNull(r.modifiers.fragment));let{context:n,textureFormat:i}=this._buildContext();this._buildUpContext(t,e,n,i)}#c;#u;render(r){if(this.#c||a.isNull(this.#s)||!(this.#t.width>0)||!(this.#t.height>0))return;let e=this.#r,t=e.device,n=this.#s,i=this.#l?.enableValidation??!1;this.#u&&a.extend(this.#d,r);let l=this._buildPassDescriptor({multisample:!0}),p=t.createCommandEncoder({label:Ve+"renderer"}),u=p.beginRenderPass(l);n.loop((f,g,v)=>{if(f.item.hide)return!1;i&&t.pushErrorScope("validation");let y=[f,g,...v];return ol.create(e,y,{multisample:!0,modifiers:this.#l.modifiers}).frame(u,this.#p,...y),i&&t.popErrorScope().then(x=>{x&&this._logError(x)}),!0}),u.end(),t.queue.submit([p.finish()])}set disabled(r){this.#h=r}get disabled(){return this.#h}raycast(r){if(this.#c||a.isNull(this.#s))return Promise.resolve([]);let e=this.#r,t=e.device,n=this.#s,i=this.#l?.enableValidation??!1,s=Fd.createColorPicking(e);return s.begin(),n.loop((l,p)=>l.item.hide?!1:(i&&t.pushErrorScope("validation"),s.frame(this.#p,l,p),i&&t.popErrorScope().then(u=>{u&&this._logError(u)}),!0)),s.end(r)}_disposeRenderableJustInCase(r){let e=this.#n;e.has(r)&&(e.get(r)?.destroy(),e.delete(r))}_createOrYieldRenderable(r,e=this.#i,t=this.#a){r.stage??=this.#e;let n=this.#n,i=n.get(r);return a.isNull(i)&&n.set(r,i=tt.create(r,e)),i}_createOrYieldGeometry(r){let e=this.#i,t=e.get(r);return a.isNull(t)&&e.set(r,t=Dc.create(r)),t}_createOrYieldMaterial(r){let e=this.#a,t=e.get(r);return a.isNull(t)&&e.set(r,t=Dc.create(r)),t}_unwrapBuffers(r,e){e??={meshes:[],lights:[],cameras:[],groups:[]};for(let t of r.children)t.item.stage??=this.#e,wr(t.item)&&e.meshes.push(t),Vt(t.item)&&e.cameras.push(t),ui(t.item)&&e.lights.push(t),Wo(t.item)&&(e.groups.push(t),this._unwrapBuffers(t,e));return e}_update(r){let e=[],t=[],n=[],i=u=>this._createOrYieldRenderable(u),s;for(let u of r){if(u.hide){this._disposeRenderableJustInCase(u);continue}if(u.stage??=this.#e,Wo(u)){let f=u;f.flags.includes("children")&&this.#n.delete(f),e.push(i(f))}wr(u)&&u.geometry&&(this._createOrYieldGeometry(u.geometry),a.isNull(u.material)||this._createOrYieldMaterial(u.material),t.push(i(u))),ui(u)&&n.push(i(u)),Vt(u)&&(s??=u)}s??=YE(this.#e);let l=i(s),p={meshes:t,lights:n,cameras:[l],groups:e};for(let u of e)p=this._unwrapBuffers(u,p);this.#s?.items.meshes.forEach(u=>{t.includes(u)||u.destroy()}),this.#s=new Xh(p)}update(...r){this._update(Array.from(r))}dispose(){if(this.#s=null,this._disposeContext()){let{device:r}=this.#r;r.removeEventListener("uncapturederror",this._logError),r.destroy}}_disposeContext(){let r=this.#r;if(a.isNull(r))return!1;Fd.dispose(r),ol.dispose(r);let e=this.#o;if(this.#o=null,!a.isNull(e)){let{render:t,depth:n}=e;XE(t?.texture,n?.texture)}return r.context.unconfigure(),!0}resize(r){if(this.#c=!0,this._disposeContext()){let{device:e,adapter:t}=this.#r,{context:n,textureFormat:i}=this._buildContext(this.canvas,r);this._buildUpContext(e,t,n,i),this.#u&&a.extend(this.#d,{resolution:r})}}get canvas(){return this.#t}};var ky="WebGPURaycastCallback",zg="WebGPURaycastPixel",My=A.getAttachedPropertyValue,Sy=A.setAttachedPropertyValue,qE=A.deleteAttachedPropertyValue,ll,Wd,Da=class extends R.PacemItemElement{constructor(){super(...arguments);z(this,ll,"");z(this,Wd,new MutationObserver(()=>{this.wgsl=this.textContent}))}findContainer(){return A.findAncestor(this,e=>e instanceof ls)}get version(){return M(this,ll)}viewActivatedCallback(){super.viewActivatedCallback(),this.wgsl=this.textContent,M(this,Wd).observe(this,{characterData:!0})}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="wgsl"&&this._computeVersion(n)}_computeVersion(e=this.wgsl){gn.hash(e).then(t=>{if(t!==M(this,ll)){let n=M(this,ll),i=t;H(this,ll,i);let s=new ue({propertyName:"version",oldValue:n,currentValue:i,firstChange:a.isNullOrEmpty(n)});this.dispatchEvent(s)}})}disconnectedCallback(){M(this,Wd).disconnect(),super.disconnectedCallback()}};ll=new WeakMap,Wd=new WeakMap,c([h({emit:!1,converter:m.String})],Da.prototype,"type",2),c([h({emit:!1,converter:m.String})],Da.prototype,"wgsl",2),Da=c([C({tagName:d+"-3d-wgsl-script"})],Da);var cl,pl,Ra,Ic,$c,Hc,ls=class extends fa{constructor(){super(...arguments);z(this,cl,[]);this._scriptVersionChangeHandler=e=>{let{propertyName:t}=e.detail;t==="version"&&this._parseWgslModifiers(e.detail.currentValue)};z(this,pl,new Set);z(this,Ra,new Map);z(this,Ic,!0);z(this,$c,!0);z(this,Hc,new WeakMap)}invalidateSize(e,t=e.size){this._ensureRenderer(e)?.resize(t)}get items(){return M(this,cl)}register(e){let t=M(this,cl);return e instanceof Da&&!t.includes(e)?(e.addEventListener(ee,this._scriptVersionChangeHandler,!1),t.push(e),this._parseWgslModifiers(this.modifiers?.version),!0):!1}unregister(e){let t=M(this,cl),n=t.indexOf(e);return n>=0?(e.removeEventListener(ee,this._scriptVersionChangeHandler,!1),t.splice(n,1),this._parseWgslModifiers(this.modifiers?.version),!0):!1}get supported(){return M(this,Ic)}get active(){return M(this,$c)}_webGPUNotSupported(e){M(this,Ic)&&e.cause===0&&(H(this,Ic,!1),this.dispatchEvent(new ue({propertyName:"supported",oldValue:null,currentValue:!1}))),M(this,$c)&&(H(this,$c,!1),this.dispatchEvent(new ue({propertyName:"active",oldValue:null,currentValue:!1})))}initialize(e){let t=M(this,Ra),n=M(this,pl);return n.has(e)||n.add(e),Zh.create(e,{enableValidation:this.enableValidation??!1,modifiers:this.modifiers}).then(i=>(t.get(e)?.update(),t.set(e,i),this._updatePipeline(e),i.canvas),i=>(this.log(ce.LogLevel.Error,i.message),this._webGPUNotSupported(i),null))}_parseWgslModifiers(e){let t=M(this,cl),n=t.find(f=>f.type=="vertex-input"),i=t.find(f=>f.type=="vertex-output"),s=t.find(f=>f.type=="fragment"),l=n?.wgsl,p=i?.wgsl,u=s?.wgsl;this.modifiers={vertexInput:l,vertexOutput:p,fragment:u,version:e}}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"modifiers":case"enableValidation":this._reinitialize();break}}disconnectedCallback(){let e=M(this,Ra);for(let[t,n]of e)n?.dispose();e.clear(),M(this,pl).clear(),super.disconnectedCallback()}dispose(e){let t=M(this,Ra),n=M(this,pl);t.has(e)&&(t.get(e)?.dispose(),t.delete(e)),n.has(e)&&n.delete(e)}_reinitialize(){for(let e of M(this,pl).values())this.initialize(e)}_ensureRenderer(e){return M(this,Ra).get(e)}_updatePipeline(e){this._ensureRenderer(e)?.update(...e.datasource)}render(e){let t=e.size?.width,n=e.size?.height;if(!(t>0)||!(n>0))return;let i=this._ensureRenderer(e);if(a.isNull(i))return;M(this,Hc).has(e)&&(M(this,Hc).delete(e),this._itemsChangedExec(e));let s=My(e,zg);if(i.render({cursor:s,time:performance.now(),resolution:{width:t,height:n}}),!e.interactive)return;let l=My(e,ky);if(!a.isNullOrEmpty(l)){if(a.isNullOrEmpty(s)){l(null);return}i.raycast(s).then(p=>{if(a.isNullOrEmpty(p))l(null);else{let u={object:p[0],point:null};l(u)}})}}snapshot(e,t,n,i){let s=M(this,Ra);if(!s.has(e))return Promise.resolve(null);let{canvas:l}=s.get(e),p=!a.isNullOrEmpty(t),u=n??(p?"image/jpeg":null),f=i??(p?.9:null);return new Promise((g,v)=>{this.render(e),a.snapshotElement(l,t,u,f).then(g)})}raycast(e,t,n,i){Sy(e,ky,i),t.x<0||t.y<0||t.x>=n.width||t.y>=n.height?qE(e,zg):Sy(e,zg,t)}_itemsChangedExec(e){this._updatePipeline(e)}_itemsChanged(e,t){M(this,Hc).set(e,!0)}addItem(e,t){this._itemsChanged(e,t)}removeItem(e,t){this._itemsChanged(e,t)}updateItem(e,t){(a.isNull(t)||t.flags.indexOf("visibility")>=0||t.flags.indexOf("children")>=0)&&this._itemsChanged(e,t)}zoomFit(e,...t){return Promise.resolve()}project(e,t){return{x:0,y:0}}getScene(e){return e}};cl=new WeakMap,pl=new WeakMap,Ra=new WeakMap,Ic=new WeakMap,$c=new WeakMap,Hc=new WeakMap,c([me(100)],ls.prototype,"_parseWgslModifiers",1),c([h({emit:!1})],ls.prototype,"modifiers",2),c([h({emit:!1,converter:m.Boolean})],ls.prototype,"enableValidation",2),ls=c([C({tagName:d+"-3d-webgpu-adapter"})],ls);var Pt=we.LinearAlgebra.Vector3D,Oa=we.LinearAlgebra.Matrix3D,Qh=we.LinearAlgebra.Quaternion,wz=we.LinearAlgebra.Spherical;function KE(o){return Vt(o)?o.stage:null}var JE=1,ZE=1,QE=.05,jd=.001,Yd={maxAzimuth:180,minAzimuth:-180,inertia:!1,maxPolar:1/0,minPolar:-1/0,zoom:{enabled:!0},pan:{enabled:!0,button:2},rotation:{enabled:!0,button:0}},em=class o{constructor(r,e){this._config=e;this._input={rho:0,theta:0,phi:0,x:0,y:0};this._progress={rho:0,theta:0,phi:0,x:0,y:0};this._startHandler=r=>{let{rotation:e,pan:t}=this._config,n=r.pointerType==="mouse",i=e.enabled&&n&&r.button===e.button&&de.matchModifiers(r,e.modifiers),s=t.enabled&&n&&r.button===t.button&&de.matchModifiers(r,t.modifiers);!i&&!s||(this.#t=i,(this.#e=s)&&(this._currentState=o._buildState(this._camera),a.extend(this._input,Pt.zero()),this._progress.x=this._progress.y=0),Q(r),window.clearTimeout(this.#r),window.addEventListener("pointerup",this._endHandler,!1),window.addEventListener("pointermove",this._moveHandler,!1),window.addEventListener("contextmenu",this._avoidHandler,!1))};this._avoidHandler=r=>Q(r);this._endHandler=r=>{Q(r),this.#r=window.setTimeout(()=>{window.removeEventListener("pointerup",this._endHandler),window.removeEventListener("pointermove",this._moveHandler),window.removeEventListener("contextmenu",this._avoidHandler)},20)};this._zoomHandler=r=>{let{zoom:e}=this._config;if(!(e.enabled&&de.matchModifiers(r,e.modifiers)))return;Q(r);let n=this._input;n.rho-=Math.sign(r.deltaY)};this._moveHandler=r=>{Q(r);let{height:e,width:t}=this._scene.size,n=this._input,i=Math.min(e,t);if(this.#t){let s=-JE*360/i,{phi:l,theta:p}=n,{maxPolar:u,minPolar:f,maxAzimuth:g,minAzimuth:v}=this._config;n.phi=(l+r.movementX*s).clamp(f,u),n.theta=(p+r.movementY*s).clamp(v,g)}else if(this.#e){let s=this._currentState.radius/i;n.x+=-r.movementX*s,n.y+=r.movementY*s}};this._renderHandler=r=>{this._update()};let t=this._scene=(this._camera=r).stage;this._initialState=this._currentState=o._buildState(r);let n=this._canvas=t.stage;n.addEventListener("pointerdown",this._startHandler,!1),n.addEventListener("wheel",this._zoomHandler,{passive:!1}),t.addEventListener("render",this._renderHandler,!1)}static _buildState(r){let e=Pt.subtract(r.position,r.lookAt),t=Pt.mag(e);return{target:r.lookAt,versor:Pt.unit(e),up:r.up,radius:t,position:r.position}}static tryAttach(r,e){e??=Yd;let t=KE(r)?.stage;if(a.isNull(t))return null;{let{position:n,lookAt:i}=r;return a.isNull(n)||a.isNull(i)||Pt.areClose(n,i)?null:new o(r,e)}}get configuration(){return this._config}set configuration(r){this._config=r}#e;#t;#r;_getSafeAzimuth({theta:r}){return o._modAngle(r)}_getSafePolar({phi:r}){return o._modAngle(r)}static _modAngle(r){for(;r<0;)r+=360;return r%360}static _getViewXYZ(r){let{versor:e,up:t}=r,n=Pt.cross(e,t),i=Pt.cross(n,e);return Pt.normalize(n),Pt.normalize(i),{right:n,up:i,versor:e}}#n;_update(){if(this.#n)return;this.#n=!0;let r=this._camera,{radius:e,versor:t,target:n,up:i}=this._initialState,{target:s}=this._currentState,{theta:l,phi:p,rho:u,x:f,y:g}=this._input,v=this._progress,{theta:y,phi:_,rho:x,x:w,y:E}=v,k=Math.abs(_-p)>jd||Math.abs(y-l)>jd,N=Math.abs(x-u)>jd,T=Math.abs(f-w)>jd||Math.abs(g-E)>jd;if(N||k||T){let O=typeof this._config.inertia=="boolean"?this._config.inertia?QE:0:this._config.inertia,D=O>0&&O<1,{right:P,up:F}=o._getViewXYZ(this._initialState),B=n,$=i,U=s,I=x;D?I+=(u-x)*O:I=u,v.rho=I;let G=Math.pow(.95,I*ZE),Y=Pt.scale(t,-G*e);B=Pt.add(B,Y);let W=_,V=y;D?(W+=(p-_)*O,V+=(l-y)*O):(W=p,V=l);let X=this._getSafePolar({phi:v.phi=W}),q=this._getSafeAzimuth({theta:v.theta=V}),Z=Pt.negate(n),ne=Oa.translate(Oa.identity(),Z),te=Qh.fromAxisAngle(F,X),ae=Qh.fromAxisAngle(P,q),Le=Oa.multiply(Qh.toRotationMatrix(ae),Qh.toRotationMatrix(te));ne=Oa.multiply(ne,Le),ne=Oa.translate(ne,Pt.negate(Z)),B=Oa.transform(B,ne),$=Oa.transform($,Oa.clone(ne,Wt=>{Wt.offsetX=Wt.offsetY=Wt.offsetZ=0}));let he=w,fe=E,le=he,re=fe;D?(le+=(f-he)*O,re+=(g-fe)*O):(le=f,re=g),v.x=le,v.y=re;let{right:Oe,up:ge}=o._getViewXYZ(this._currentState),Ne=Pt.scale(Oe,le),Pe=Pt.scale(ge,re),He=Pt.add(Ne,Pe);U=Pt.add(s,He),r.lookAt=U,r.position=B,r.up=$,r.flags.push("camera")}this.#n=!1}dispose(){let r=this._canvas,e=this._scene;a.isNull(r)||(r.removeEventListener("pointerdown",this._startHandler),r.removeEventListener("wheel",this._zoomHandler)),e.removeEventListener("render",this._renderHandler,!1)}},dl,Ar=class extends nh.PacemBehavior{constructor(){super(...arguments);z(this,dl,new Map);this._readyHandler=e=>{if(e.detail.propertyName==="isReady"&&e.detail.currentValue===!0){let t=e.currentTarget;t.removeEventListener(ee,this._readyHandler),this._decorateCore(t)}}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"maxAzimuth":case"minAzimuth":case"inertia":case"zoomControl":case"panControl":case"rotationControl":let s=this._buildConfig(),l=M(this,dl);for(let p of l.values())p.configuration=s;break}}disconnectedCallback(){let e=M(this,dl);for(let t of e.values())t.dispose();e.clear(),super.disconnectedCallback()}_buildConfig(){return a.extend({},Yd,{maxAzimuth:this.maxAzimuth??1/0,minAzimuth:this.minAzimuth??-1/0,minPolar:this.minPolar??-1/0,maxPolar:this.maxPolar??1/0,inertia:this.inertia??!1,zoom:this.zoomControl??Yd.zoom,pan:this.panControl??Yd.pan,rotation:this.rotationControl??Yd.rotation})}_decorateCore(e){let t=em.tryAttach(e,this._buildConfig());a.isNull(t)||M(this,dl).set(e,t)}decorate(e){e.isConnected?this._decorateCore(e):e.addEventListener(ee,this._readyHandler,!1)}undecorate(e){let t=M(this,dl);t.has(e)&&(t.get(e).dispose(),t.delete(e))}};dl=new WeakMap,c([h({emit:!1,converter:m.Number})],Ar.prototype,"maxAzimuth",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"maxPolar",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"minAzimuth",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"minPolar",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"zoomControl",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"rotationControl",2),c([h({emit:!1,converter:m.Number})],Ar.prototype,"panControl",2),c([h({emit:!1,converter:ig})],Ar.prototype,"inertia",2),Ar=c([C({tagName:d+"-"+"3d"+"-orbit-camera"})],Ar);var jg={};Se(jg,{ChartEvent:()=>rm,MANAGED_EVENTS:()=>Bc,PacemChartElement:()=>ul,PacemChartSeriesElement:()=>Qr,PacemColumnChartElement:()=>hl,PacemPieChartElement:()=>Nn,PacemPieSliceElement:()=>Ci,PacemSeriesChartElement:()=>Nt});var Bc=["keydown","keyup","click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"],Ly=1e3*60*60*24,ew=10,tw=10,tm="pacem:chart-series:dataitem",Fg="pacem:chart-series:series";function rw(o,r,e,t,n,i=ew){let s=r==="number"||r==="date"?t-e:Math.max(1,o.length-1),l=i-1;for(var p=[],u=1,f=l;f>1;f--)if(s%f===0){u=s/f;break}u===1&&s>i&&(u=s);let g=typeof n=="function"?n:u>=Ly?(x=>x.toLocaleDateString(n)):(x=>x.toLocaleTimeString(n)),v=typeof n=="function"?n:u<Ly?(x=>x.toLocaleString(n)):g,y=typeof n=="function"?n:x=>x.toLocaleString(n);for(var _=0;_<=s;_+=u){let x;switch(r){case"string":if(_>=o.length)continue;x=o[_].label;break;case"number":x=y(e+_);break;case"date":let w=a.parseDate(e+_);x=(_==0?v:g)(w);break;default:throw"Not supported."}p.push(x)}return p}function nw(o,r,e){e??=Math.min(Ny(o,r),tw);let t=(r-o)/e,n=Math.pow(10,Math.floor(Math.log10(t))),i=[1,2,5,10].map(s=>s*n).filter(s=>s>=t).reduce((s,l)=>Math.min(s,l),Number.POSITIVE_INFINITY);return{min:Math.floor(o/i)*i,max:Math.ceil(r/i)*i,round:i}}function Ny(o,r){let e=r-o;if(!(e>0))return 2;let t=Math.floor(Math.log10(e)),n=Math.pow(10,-t);if(t!=0)return Ny(o*n,r*n);let i=u=>{let f=Math.floor(Math.abs(u)*10);return(f+10-f%10).roundoff()},s=i(e),l=10;o!==0&&(l=i(Math.abs(r)));let p=Ty(l,s);return p===1?s:Math.max(p,10-p)}function Ty(o,r){return o<=0?r:Ty(r%o,o)}var rm=class extends ht{constructor(r,e,t){super(r,e,t)}},Qr=class extends R.PacemItemElement{get values(){return this.datasource}};c([h({emit:!0,converter:m.Json})],Qr.prototype,"datasource",2),c([h({emit:!0,converter:m.String})],Qr.prototype,"label",2),c([h({emit:!0,converter:m.String})],Qr.prototype,"color",2),c([h({emit:!0,converter:m.Boolean})],Qr.prototype,"datapoints",2),c([h()],Qr.prototype,"_uiElements",2),Qr=c([C({tagName:d+"-chart-series"})],Qr);var xi="http://www.w3.org/2000/svg",Nt=class extends R.PacemItemsContainerElement{constructor(){super();this._itemPropertyChangedCallback=e=>{let t=e.detail.propertyName;(t==="datasource"||t==="label"||t==="datapoints"||t==="cssClass"||t==="color")&&this.draw()};this._series=[];this._resizeHandler=e=>{this._size=e.detail,this.draw()};this._broadcastHandler=e=>{let t=e.currentTarget,n=A.getAttachedPropertyValue(t,tm);if(a.isNull(n))return;let i=this,s=i.getAnchorPoint(t),l=new rm("item"+e.type,{detail:{dataItem:n,anchorPoint:s}},e),p=A.getAttachedPropertyValue(t,Fg);p instanceof Qr&&p.dispatchEvent(l),i.dispatchEvent(l)};this._key=a.uniqueCode()}validate(e){return e instanceof Qr}register(e){return super.register(e)?(e.addEventListener(ee,this._itemPropertyChangedCallback,!1),!0):!1}unregister(e){return super.unregister(e)?(e.removeEventListener(ee,this._itemPropertyChangedCallback,!1),!0):!1}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e==="target"){this._div!=t&&this._div&&this._div.remove(),this._div=null,this._body=null;let s=t;s&&(s.classList.remove(b+"-chart-area"),s.innerHTML=""),this._ensureResizer(),this.draw()}else if(!i)switch(e){case"items":this._databindAndDrawDebounced();break;case"datasource":this._databind();case"yAxisDensity":case"xAxisDensity":case"xAxisType":case"yAxisMax":case"xAxisPosition":case"yAxisFormat":this.draw();break}}_databindAndDrawDebounced(){cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this._databind(),this.draw()})}_databind(){this._datasource=a.isNullOrEmpty(this.datasource)?this.items:this.datasource}disconnectedCallback(){this._div&&this._div.remove();let e=this._resizer;a.isNull(e)||(e.removeEventListener(R.ResizeEventName,this._resizeHandler,!1),e.remove(),this._resizer=null),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureResizer(),this._databind(),this.draw()}_ensureResizer(e=this.target||this._div){if(a.isNull(this._resizer)){let t=A.findAncestorShell(this);(this._resizer=t.appendChild(new R.PacemResizeElement)).addEventListener(R.ResizeEventName,this._resizeHandler,!1)}this._resizer.target=e}get chartSize(){return this._size}get chartSeries(){return this._series}get chartBody(){return this._body}get chartGrid(){return this._grid}get chartMask(){return this._mask}get chartKey(){return this._key}get chartContainer(){return this._div}assignUiBehaviors(e,t,n,i){let s=!a.isNull(A.getAttachedPropertyValue(e,tm)),l=a.extend({series:t.label,color:i||t.color},n);A.setAttachedPropertyValue(e,tm,l),A.setAttachedPropertyValue(e,Fg,t),s||Bc.forEach(p=>{e.addEventListener(p,this._broadcastHandler)})}disposeUiBehaviors(e){A.deleteAttachedPropertyValue(e,tm),A.deleteAttachedPropertyValue(e,Fg),Bc.forEach(t=>{e.removeEventListener(t,this._broadcastHandler)})}ensureChartContainer(){if(a.isNull(this._div)){let e=this._div=this.target||document.createElement("div");e.classList.add(b+"-chart-area"),e!=this.target&&this.parentElement.insertBefore(e,this)}return this._div}ensureChartBody(e,t,n){if(a.isNull(this._body)){let i=this._body=document.createElementNS(xi,"svg");i.setAttribute("pacem",""),i.setAttribute("class",b+"-"+e+"-chart"),i.setAttribute("preserveAspectRatio","xMinYMax slice");let s=this._grid=document.createElementNS(xi,"svg");s.setAttribute("pacem",""),s.setAttribute("class","chart-grid");let l=document.createElementNS(xi,"defs"),p=this._mask=document.createElementNS(xi,"mask"),u=document.createElementNS(xi,"rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width","100%"),u.setAttribute("height","100%");let f=document.createElementNS(xi,"rect");f.setAttribute("y","0"),f.setAttribute("width","100%"),f.setAttribute("fill","#fff"),p.id="gnrc_mask_"+this._key,p.appendChild(u),p.appendChild(f),l.appendChild(p),i.appendChild(l),i.appendChild(s),this._div.appendChild(i)}return this._body}chartDataItemToPoint(e,t){switch(this.xAxisType||"string"){case"number":return{x:parseFloat(e.label),y:e.value};case"date":return{x:a.parseDate(e.label).valueOf(),y:e.value};case"string":return{x:t.findIndex(n=>n.label==e.label),y:e.value};default:throw"Not supported."}}getVirtualGrid(e,t,n,i,s,l=this.xAxisType,p,u){let f=nw(i,s,p),g=f.round;var v=[];for(let E=f.min;E<=f.max;E+=g)v.push(E.roundoff());let y=a.lang(this),_=null,x=this.xAxisFormat;if(!a.isNullOrEmpty(x))switch(l){case"number":_=E=>Intl.NumberFormat(y,x).format(E);break;case"date":_=E=>Intl.DateTimeFormat(y,x).format(a.parseDate(E));break}return{x:rw(e,l,t,n,_??y,u),y:v}}wipeOut(e=this._series,t=0){for(var n=e.length-1;n>=t;n--)e[n].remove();e.splice(t)}buildLinearGradient(e,t=!1){let n=document.createElementNS(xi,"linearGradient");n.id=this.chartKey+"_grad"+e+(t?"_inverted":""),t&&a.addClass(n,"bottom-up"),n.setAttribute("x1","0%"),n.setAttribute("x2","0%"),n.setAttribute("y1","0%"),n.setAttribute("y2","100%"),n.setAttribute("spreadMethod","pad");let i=document.createElementNS(xi,"stop");i.setAttribute("offset","0%");let s=document.createElementNS(xi,"stop");return s.setAttribute("offset","100%"),n.appendChild(i),n.appendChild(s),n}setGradientColor(e,t){for(let n=0;n<e.children.length;n++){let i=e.children.item(n);i instanceof SVGStopElement&&(i.style.stopColor=t)}}estimateYAxisLabelWidth(e){let t=this.formatYAxisLabel(e);return this.estimateLabelWidth(t)}estimateLabelWidth(e){let t=this._grid;if(a.isNull(t))throw new Error("Unable to estimate label without an underlying grid available.");let n=document.createElementNS(xi,"text");n.textContent=e,t.appendChild(n);let i=a.offset(n);return n.remove(),i.width}formatYAxisLabel(e){let t=this.yAxisFormat;return a.isNullOrEmpty(t)?e.toString():Intl.NumberFormat(a.lang(this),t).format(e)}estimateXAxisLabelWidth(e){let t=this.formatXAxisLabel(e);return this.estimateLabelWidth(t)}formatXAxisLabel(e){let t=this.xAxisFormat,n=a.lang(this);switch(this.xAxisType){case"date":let i=a.Dates.parse(e);return a.isNullOrEmpty(t)?i.toLocaleString(n):Intl.DateTimeFormat(n,t).format(i);case"number":let s=e;return a.isNullOrEmpty(t)?s.toLocaleString(n):Intl.NumberFormat(n,t).format(s);default:return e}}draw(){this.drawSeries(this._datasource)}getAnchorPoint(e){let t=a.offset(e);return{x:t.left+t.width*.5,y:t.top+t.height*.5}}};c([h({converter:m.Element})],Nt.prototype,"target",2),c([h({emit:!1,converter:m.String})],Nt.prototype,"xAxisType",2),c([h({emit:!1,converter:m.String})],Nt.prototype,"xAxisPosition",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"datasource",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisDensity",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"xAxisDensity",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisMin",2),c([h({emit:!1,converter:m.Number})],Nt.prototype,"yAxisMax",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"yAxisFormat",2),c([h({emit:!1,converter:m.Json})],Nt.prototype,"xAxisFormat",2),c([Wp(!0)],Nt.prototype,"draw",1);function iw(o,r,e){let t=o,n=o,i=a.isNull(r),s=a.isNull(e);if(!(i&&s)){let p,u;i||(p=(o.y-r.y)/(o.x-r.x)),s||(u=(e.y-o.y)/(e.x-o.x));let f=((u||p||0)+(p||u||0))/2,g=i?0:(o.x-r.x)/3,v=s?0:(e.x-o.x)/3;t={x:o.x-g,y:o.y-g*f},n={x:o.x+v,y:o.y+v*f}}return{c0:t,c1:n}}var Ay=A.getAttachedPropertyValue,Dy=A.setAttachedPropertyValue,sG=A.deleteAttachedPropertyValue,sw=24,nm="pacem:chart-series:area",Pa="http://www.w3.org/2000/svg",Vc,ul=class extends Nt{constructor(){super(...arguments);z(this,Vc,!1);this._enterHandler=e=>{H(this,Vc,!0)};this._leaveHandler=e=>{H(this,Vc,!1)};this._moveHandler=e=>{M(this,Vc)};this._chartFillSeries=[]}_getVirtualGrid(e,t,n,i,s,l=this.xAxisType,p,u){return super.getVirtualGrid(e,t,n,i,s,l,p,u)}_wipe(e=this.chartSeries,t=0){super.wipeOut(e,t)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupBehavior()}disconnectedCallback(){this._dismantleBehavior(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"type":case"aspectRatio":this.draw();break}}_setupBehavior(){this.addEventListener("mouseenter",this._enterHandler,!1),this.addEventListener("mouseleave",this._enterHandler,!1),this.addEventListener("mousemove",this._moveHandler,!1)}_dismantleBehavior(){this.removeEventListener("mouseenter",this._enterHandler,!1),this.removeEventListener("mouseleave",this._leaveHandler,!1),this.removeEventListener("mousemove",this._moveHandler,!1)}_buildLinearGradient(e){return super.buildLinearGradient(e)}_setGradientColor(e,t){super.setGradientColor(e,t)}drawSeries(e){if(!this.isReady||a.isNull(this.chartSize))return;this.ensureChartContainer();let t=this.type||"line",n=sw;var i=this.chartSize;if(i.height<=n||i.width<=n)return;if(a.isNullOrEmpty(e)||e.every(pe=>a.isNullOrEmpty(pe.values))){this._wipe();return}let s=this.ensureChartBody("line",i.width,i.height);this.log(ce.LogLevel.Debug,`Drawing ${t} chart.`);let l=this.xAxisType||"string",p=this.yAxisMin??Number.NaN,u=this.yAxisMax??Number.NaN,f=Number.NaN,g=Number.NaN,v=1;for(let pe of e){let xe=pe.values;if(xe&&xe.length){let je=0;for(let mn of xe){let Ht=this.chartDataItemToPoint(mn,xe);a.isNull(this.yAxisMin)&&(p=isNaN(p)?Ht.y:Math.min(p,Ht.y)),a.isNull(this.yAxisMax)&&(u=isNaN(u)?Ht.y:Math.max(u,Ht.y)),je===0?f=isNaN(f)?Ht.x:Math.min(f,Ht.x):je===xe.length-1&&(g=isNaN(g)?Ht.x:Math.max(g,Ht.x)),je++}}}let y=e.find(pe=>!a.isNullOrEmpty(pe.values)),_=this._getVirtualGrid(y.values,f,g,p,u,l,this.yAxisDensity,this.xAxisDensity),x=_.y[_.y.length-1],w=_.y[0];if(x===w)return;let E=n*.5,k=_.y.reduce((pe,xe)=>Math.max(pe,this.estimateYAxisLabelWidth(xe)+E),n),N=_.x.reduce((pe,xe)=>Math.max(pe,this.estimateXAxisLabelWidth(xe)),n)*.5,T=Math.max(N,k),O=N,D=i.width-T-O,P=i.height-2*n,F=P*(1-(x-w-(u-p))/(x-w)),B=P*(x-u)/(x-w);(l!=="number"||this.aspectRatio!=="monometric"&&this.aspectRatio!=="logaritmic")&&(v=D/F,s.setAttribute("height",i.height.toString()),s.setAttribute("width",i.width.toString())),s.setAttribute("viewBox",`0 0 ${i.width} ${i.height}`);let $=0,U=g-f,I=u-p,G=100*v/U,Y=100/I,W=100*n/F,V=(pe,xe)=>{let je=this.chartDataItemToPoint(pe,xe);return je.y*=Y,je.x=(je.x-f)*G,je},X=this.chartSeries,q=this._chartFillSeries,Z=this.chartGrid,ne=t==="spline"||t==="splinearea";for(let pe of e){let xe,je,mn;if(X.length>$)xe=X[$],je=q[$],mn=je.firstElementChild.firstElementChild;else{xe=document.createElementNS(Pa,"svg"),xe.setAttribute("pacem",""),s.appendChild(xe),je=document.createElementNS(Pa,"svg"),je.setAttribute("pacem",""),s.insertBefore(je,s.children.item($+2));let De=document.createElementNS(Pa,"defs");De.appendChild(mn=this._buildLinearGradient($)),je.appendChild(De),je.appendChild(document.createElementNS(Pa,"path")),q.push(je),xe.appendChild(document.createElementNS(Pa,"path")),X.push(xe)}let Ht="chart-series",ve=t==="area"||t==="splinearea";a.isNullOrEmpty(pe.className)||(Ht+=" "+pe.className),[xe,je].forEach(De=>{De.setAttribute("class",Ht),De.setAttribute("x",T.toString()),De.setAttribute("y",B.toString()),De.setAttribute("width",D.toString()),De.setAttribute("height",(F+2*n).toString())}),a.addClass(je,b+"-inert");let Ce=je.children.item(1),Ue=xe.firstElementChild;Ue.style.stroke=pe.color,Ce.style.stroke=Ue.style.fill="none",this._setGradientColor(mn,pe.color),Ce.style.fill=`url(#${mn.id})`,Ce.style.display=ve?"":"none";let or="",Ie=pe.values;if(Ie&&Ie.length){let De=(wt,nt,Me,Ge,kt)=>{let Mt=nt+1,Fe;xe.children.length>Mt?Fe=xe.children.item(Mt):(Fe=document.createElementNS(Pa,"line"),Fe.setAttribute("class","circle"),xe.appendChild(Fe));let Vr=wt.x.toString(),fn=(-wt.y).toString();Fe.setAttribute("x1",Vr),Fe.setAttribute("y1",fn),Fe.setAttribute("x2",Vr),Fe.setAttribute("y2",fn),Fe.style.stroke=kt,this.assignUiBehaviors(Fe,Me,Ge,kt)},Iu=()=>{let wt=pe.datapoints?Ie.length+1:1;for(let Me=xe.children.length-1;Me>=wt;Me--){var nt=xe.children.item(Me);this.disposeUiBehaviors(nt),nt.remove()}};if(ne){let wt,nt,Me;for(let Ge=0;Ge<Ie.length;Ge++){let kt=Ie[Ge];if(isNaN(kt.value))continue;nt||(nt=V(kt,Ie));let Mt;ne&&Ge<Ie.length-1&&(Mt=V(Ie[Ge+1],Ie));let Fe=Ay(pe,nm,0);Fe+=kt.value,Dy(pe,nm,Fe);var te=iw(nt,wt,Mt);or+=a.isNullOrEmpty(or)?`M${nt.x},${-nt.y} `:`C${Me.x},${-Me.y} ${te.c0.x},${-te.c0.y} ${nt.x},${-nt.y} `,pe.datapoints&&De(nt,Ge,pe,kt,pe.color),wt=nt,nt=Mt,Me=te.c1}}else{let wt=0;for(let nt of Ie){if(isNaN(nt.value))continue;let Me=V(nt,Ie),Ge=Ay(pe,nm,0);Ge+=nt.value,Dy(pe,nm,Ge),or+=a.isNullOrEmpty(or)?`M${Me.x},${-Me.y} `:`L${Me.x},${-Me.y} `,pe.datapoints&&De(Me,wt,pe,nt,pe.color),wt++}}Iu()}Ue.setAttribute("d",or),Ce.setAttribute("d",or+`V${-p*Y} H0 Z`),$++}this._wipe(q,$),this._wipe(X,$);let ae=100*v,Le=100+2*W,he=0,fe=u*Y+W,le=`${he} ${-fe} ${ae} ${Le}`;for(var re of X.concat(q))re.setAttribute("viewBox",le);let ge=this.chartMask.children.item(1);if(ge.setAttribute("x",he.toString()),ge.setAttribute("height",(i.height-n).toString()),Z.setAttribute("viewBox",`0 0 ${i.width} ${i.height}`),_.x.length<=1||_.y.length<=1){for(let pe=Z.children.length-1;pe>=0;pe--)Z.children.item(pe).remove();return}let Ne;Z.children.length>0?Ne=Z.children.item(0):(Ne=document.createElementNS(Pa,"path"),Z.appendChild(Ne));let Pe=n*.25,He=0,Wt=(pe,xe,je,mn)=>{let Ht=pe+1,ve;return Z.children.length<=Ht?(ve=document.createElementNS(Pa,"text"),Z.appendChild(ve)):ve=Z.children.item(Ht),ve.textContent=mn,ve.setAttribute("x",xe.toString()),ve.setAttribute("y",je.toString()),ve},Gn=`M${T},${n} v${P}`,vr=0,qs=D/(_.x.length-1),Vi=P/(_.y.length-1);if(this.xAxisPosition!=="none")for(var Ks of _.x){let pe=T+vr*qs;if(this.xAxisPosition==="top"){Gn+=` M${pe},${n} v${-Pe}`;let xe=Wt(He++,pe,0,Ks);xe.setAttribute("text-anchor","middle"),xe.setAttribute("alignment-baseline","hanging")}else{let xe=P+n;Gn+=` M${pe},${xe} v${Pe}`,Wt(He++,pe,xe+n,Ks).setAttribute("text-anchor","middle")}vr++}vr=0;for(var Gl of _.y){let pe=P+n-vr*Vi,xe=T-Pe;Gn+=` M${xe},${pe} H${D+T}`;let je=this.formatYAxisLabel(Gl);Wt(He++,xe-Pe,pe,je).setAttribute("text-anchor","end"),vr++}Ne.setAttribute("d",Gn);for(let pe=Z.children.length-1;pe>He;pe--)Z.children.item(pe).remove()}};Vc=new WeakMap,c([h({emit:!1,converter:m.String})],ul.prototype,"type",2),c([h({converter:m.String})],ul.prototype,"aspectRatio",2),ul=c([C({tagName:d+"-chart"})],ul);var Uc="http://www.w3.org/2000/svg",Wg=24,hl=class extends Nt{constructor(){super(...arguments);this.groupWidth=0}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="type"||e==="groupWidth")&&this.draw()}_safen(e=this.groupWidth){return Math.min(1,Math.max(e||.75,0))}drawSeries(e){if(!this.isReady||a.isNull(this.chartSize))return;let t=this.ensureChartContainer(),n=this.type||"cluster",i=Wg;var s=this.chartSize;if(s.height<=i||s.width<=i)return;if(a.isNullOrEmpty(e)||e.every(ve=>a.isNullOrEmpty(ve.values))){this.wipeOut();return}let l=this.ensureChartBody("column",s.width,s.height);this.log(ce.LogLevel.Debug,`Drawing ${n} chart.`);let p=this.xAxisType||"string",u=this.yAxisMin??0,f=this.yAxisMax??0,g=0,v=0,y=0,_=1,x={negative:[],positive:[]};for(let ve of e){let Ce=ve.values;if(!a.isNullOrEmpty(Ce)){let Ue=0;for(let or of Ce){x.positive[Ue]=x.positive[Ue]||0,x.negative[Ue]=x.negative[Ue]||0;let Ie=this.chartDataItemToPoint(or,Ce);a.isNull(this.yAxisMin)&&(u=Math.min(u,Ie.y)),a.isNull(this.yAxisMax)&&(f=Math.max(f,Ie.y)),g=Math.min(g,Ie.x),v=Math.max(v,Ie.x),Ie.y>0?x.positive[Ue]+=Ie.y:Ie.y<0&&(x.negative[Ue]+=Ie.y),Ue++}y=Math.max(y,Ce.length)}}let w=n==="stack";w&&(a.isNull(this.yAxisMin)&&(u=Math.min.apply(null,x.negative)),a.isNull(this.yAxisMax)&&(f=Math.max.apply(null,x.positive))),v===0&&v===g&&(v=1);let E=(v-g)/y,k=E*.5,N=E*this._safen(this.groupWidth),T=N*.5,O=e.find(ve=>!a.isNullOrEmpty(ve.values)),D=this.getVirtualGrid(O.values,g-k,v+k,u,f,p,this.yAxisDensity,this.xAxisDensity),P=D.y[D.y.length-1],F=D.y[0];if(P===F)return;let B=Wg*.5,$=D.y.reduce((ve,Ce)=>Math.max(ve,this.estimateYAxisLabelWidth(Ce)+B),i),U=s.width-$-i,I=s.height-2*i,G=I*(1-(P-F-(f-u))/(P-F)),Y=I*(P-f)/(P-F);_=U/G,l.setAttribute("height",s.height.toString()),l.setAttribute("width",s.width.toString()),l.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`);let W=0,V=v-g,X=f-u,q=100*_/V,Z=100/X,ne=100*i/G,te=this.chartSeries,ae=this.chartGrid,Le=(k-g)*q,he=(ve,Ce)=>{let Ue=this.chartDataItemToPoint(ve,Ce);return{x:Le+Ue.x*2*Le,y:Ue.y*Z}};var fe=new Array(y);for(let ve of e){let Ce,Ue,or,Ie;if(te.length>W)Ce=te[W],Ue=Ce.firstElementChild.firstElementChild,or=Ce.firstElementChild.lastElementChild,Ie=Ce.lastElementChild;else{Ce=document.createElementNS(Uc,"svg"),Ce.setAttribute("pacem",""),ae.insertAdjacentElement("afterend",Ce);let Me=document.createElementNS(Uc,"defs");Me.appendChild(Ue=this.buildLinearGradient(W)),Me.appendChild(or=this.buildLinearGradient(W,!0)),Ce.appendChild(Me),Ce.appendChild(Ie=document.createElementNS(Uc,"g")),te.push(Ce)}var le="chart-series series-fill";a.isNullOrEmpty(ve.className)||(le+=" "+ve.className),Ce.setAttribute("class",le),Ce.setAttribute("x",$.toString()),Ce.setAttribute("y",Y.toString()),Ce.setAttribute("width",U.toString()),Ce.setAttribute("height",(G+2*i).toString());let De=ve.values,Iu=Me=>{for(;Me>=Ie.children.length;)Ie.appendChild(document.createElementNS(Uc,"rect"));let Ge=Ie.children.item(Me);Ge.style.stroke=ve.color;let kt=De[Me].value<0?or:Ue;return this.setGradientColor(kt,ve.color),Ge.style.fill=`url(#${kt.id})`,Ge},wt=10,nt=(Me,Ge,kt,Mt=Ge)=>{let Fe=-Math.max(Ge.y,kt.y),Vr=Math.abs(kt.y-Ge.y),fn=()=>{Me.setAttribute("y",Fe.toFixed(wt)),Me.setAttribute("height",Vr.toFixed(wt))};Me.hasAttribute("y")?fn():(Me.setAttribute("y","-"+Mt.y.toFixed(wt)),Me.setAttribute("height","0"),requestAnimationFrame(fn))};if(!a.isNullOrEmpty(De)){let Me=he({value:0,label:De[0].label},De);if(w){let Ge=T*q,kt=(N*q).toFixed(wt);for(let Mt=0;Mt<De.length;Mt++){let Fe=De[Mt];a.isNullOrEmpty(fe[Mt])&&(fe[Mt]={positive:0,negative:0});let Vr=fe[Mt],fn=Vr.positive,$u=Vr.negative,Js=Fe.value<0,Pv=Js?$u:fn+Fe.value,Iv=Js?$u+Fe.value:fn,$v=he({label:Fe.label,value:Pv},De),dx=he({label:Fe.label,value:Iv},De),ux=$v.x-Ge,Hu=Iu(Mt);this.assignUiBehaviors(Hu,ve,Fe),Hu.setAttribute("x",ux.toFixed(wt)),Hu.setAttribute("width",kt),nt(Hu,dx,$v,Me),Js?Vr.negative=Iv:Vr.positive=Pv}}else{let Ge=T*q,kt=Ge*2/e.length,Mt=kt.toFixed(wt);for(let Fe=0;Fe<De.length;Fe++){let Vr=De[Fe],fn=he(Vr,De),$u=fn.x-Ge+kt*W,Js=Iu(Fe);this.assignUiBehaviors(Js,ve,Vr),Js.setAttribute("x",$u.toFixed(wt)),Js.setAttribute("width",Mt),nt(Js,Me,fn)}}}for(let Me=Ie.children.length-1;Me>=De?.length;Me--){let Ge=Ie.children.item(Me);this.disposeUiBehaviors(Ge),Ge.remove()}W++}this.wipeOut(te,W);let re=100*_,Oe=100+2*ne,ge=0,Ne=f*Z+ne,Pe=`${ge} ${-Ne} ${re} ${Oe}`;for(var He of te)He.setAttribute("viewBox",Pe);let Gn=this.chartMask.children.item(1);if(Gn.setAttribute("x",ge.toString()),Gn.setAttribute("height",(s.height-i).toString()),ae.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`),D.x.length<1||D.y.length<=1){for(let ve=ae.children.length-1;ve>=0;ve--)ae.children.item(ve).remove();return}let vr;ae.children.length>0?vr=ae.children.item(0):(vr=document.createElementNS(Uc,"path"),ae.appendChild(vr));let qs=Wg*.25,Vi=0,Ks=(ve,Ce,Ue,or)=>{let Ie=ve+1,De;return ae.children.length<=Ie?(De=document.createElementNS(Uc,"text"),ae.appendChild(De)):De=ae.children.item(Ie),De.textContent=or,De.setAttribute("x",Ce.toString()),De.setAttribute("y",Ue.toString()),De},Gl=`M${$},${i} v${I}`,pe=0,xe=U/D.x.length,je=I/(D.y.length-1);if(this.xAxisPosition!=="none"){let ve=xe*.5+$;for(var mn of D.x){let Ce=ve+pe*xe;if(this.xAxisPosition==="top"){Gl+=` M${Ce},${i} v${-qs}`;let Ue=Ks(Vi++,Ce,0,mn);Ue.setAttribute("text-anchor","middle"),Ue.setAttribute("alignment-baseline","hanging")}else{let Ue=I+i;Gl+=` M${Ce},${Ue} v${qs}`,Ks(Vi++,Ce,Ue+i,mn).setAttribute("text-anchor","middle")}pe++}}pe=0;for(var Ht of D.y){let ve=I+i-pe*je,Ce=$-qs;Gl+=` M${Ce},${ve} H${U+$}`;let Ue=this.formatYAxisLabel(Ht);Ks(Vi++,Ce-qs,ve,Ue).setAttribute("text-anchor","end"),pe++}vr.setAttribute("d",Gl);for(let ve=ae.children.length-1;ve>Vi;ve--)ae.children.item(ve).remove()}};c([h({converter:m.String})],hl.prototype,"type",2),c([h({converter:m.Number})],hl.prototype,"groupWidth",2),hl=c([C({tagName:d+"-column-chart"})],hl);var Ci=class extends R.PacemItemElement{constructor(){super(...arguments);this._broadcastHandler=e=>{this.emit(e)}}findContainer(){return A.findAncestorOfType(this,Nn)}get chart(){return this.container}getCenterOfMass(){let e=this.chart&&this.chart.area;if(a.isNull(e))return null;let t=a.offset(e),n={x:t.width/2+t.left,y:t.top+t.height/2},i=Math.min(t.width,t.height)*.5,s=this.normalizedPolarCoords,l=ow-s.angle;return{y:n.y-i*s.radius*Math.sin(l),x:n.x+i*s.radius*Math.cos(l)}}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&this.chart&&e!="normalizedPolarCoords"&&this.chart.draw()}_assignUi(e){let t=this._ui=e;Bc.forEach(n=>{t.addEventListener(n,this._broadcastHandler)})}_disposeUi(){a.isNull(this._ui)||Bc.forEach(e=>{this._ui.removeEventListener(e,this._broadcastHandler)})}};c([h({converter:m.Number})],Ci.prototype,"value",2),c([h({converter:m.String})],Ci.prototype,"label",2),c([h({converter:m.String})],Ci.prototype,"color",2),c([h({converter:m.Json})],Ci.prototype,"normalizedPolarCoords",2),Ci=c([C({tagName:d+"-pie-slice"})],Ci);var aw=Math.PI*2,ow=Math.PI*.5,Nn=class extends R.PacemItemsContainerElement{constructor(){super();this.cutout=0;this.slicePadding=0;this._slices=new WeakMap;this._key=a.uniqueCode()}validate(e){return e instanceof Ci}viewActivatedCallback(){super.viewActivatedCallback(),this.draw()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e==="target"){this._g=null,this._div&&this._div.remove();let s=t;s&&(s.classList.remove(b+"-chart-area"),s.innerHTML=""),this.draw()}else!i&&(e==="cutout"||e==="items"||e==="slicePadding")&&this.draw()}get area(){return this._svg}disconnectedCallback(){this._div&&this._div.remove(),super.disconnectedCallback()}_ensureArea(){if(a.isNull(this._g)){let t=this.target||(this._div=document.createElement("div"));t.classList.add(b+"-chart-area");let n=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("pacem",""),n.setAttribute("preserveAspectRatio","xMidYMid meet"),n.setAttribute("viewBox","0 0 100 100"),n.classList.add(b+"-pie-chart");let i=document.createElementNS("http://www.w3.org/2000/svg","defs"),s=this._g=document.createElementNS("http://www.w3.org/2000/svg","g");n.appendChild(i),n.appendChild(s),t.appendChild(n),this._div&&this.parentElement.insertBefore(t,this)}if(this.maskBasedRendering){if(a.isNull(this._mask)){let n=document.createElementNS("http://www.w3.org/2000/svg","mask");n.id="pie_mask_"+this._key;let i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("width","100"),i.setAttribute("height","100"),i.setAttribute("fill","#fff");let s=this._mask=document.createElementNS("http://www.w3.org/2000/svg","circle");s.setAttribute("cx","50"),s.setAttribute("cy","50");let l=this._svg.firstElementChild;n.appendChild(i),n.appendChild(s),l.appendChild(n),this._g.setAttribute("mask",`url(#${n.id})`)}let t=50*this._safeCutout;this._mask.setAttribute("r",`${t}`)}else a.isNull(this._mask)||(this._svg.firstElementChild.innerHTML="",this._mask=null,this._g.removeAttribute("mask"));let e=this._safeSlicePaddingPixels;if(e>0){let t=this._svg.getCTM(),n=(e/t.a).roundoff(),i=this._sliceMaskId,s=this._svg.firstElementChild,l=s.querySelector(`#${i}`);a.isNull(l)?(l=document.createElementNS("http://www.w3.org/2000/svg","mask"),l.id=i,s.appendChild(l)):l.innerHTML="";let p=document.createElementNS("http://www.w3.org/2000/svg","path"),u=`M${50+n},0 H100 V100 H0 V0 H50 V50 h${n} Z`;p.setAttribute("d",u),p.setAttribute("fill","#fff"),l.appendChild(p)}return this._g}get _sliceMaskId(){return"pieslice_mask_"+this._key}get _safeCutout(){return Math.min(1,Math.max(0,this.cutout))||0}get _safeSlicePaddingPixels(){return Math.max(0,this.slicePadding??0)}_drawSlice(e,t,n,i){let s=t.value>.5*n?1:0,l=aw*t.value/n,p=360*i/n,u=t.value>=n?49.9:50*(1+Math.sin(l)),f=50*(1-Math.cos(l)),g=this._safeCutout,v=g*50;e.style.fill=t.color,e.style.transform=`rotate(${p}deg)`,e.style.transformOrigin="50% 50%";let y=this.maskBasedRendering?`M50,50 V0 A50,50 0 ${s} 1 ${u} ${f} L50,50 Z`:`M50,0 A50,50 0 ${s} 1 ${u} ${f} l${(50-u)*(1-g)},${(50-f)*(1-g)} A${v},${v} 0 ${s} 0 50,${50-v} Z`;e.setAttribute("d",y),t.normalizedPolarCoords={radius:g+Math.SQRT1_2*(1-g),angle:Math.PI*p/180+l/2}}_isSliceOk(e){return!e.disabled}_padSlice(e){this._safeSlicePaddingPixels>0?e.setAttribute("mask",`url(#${this._sliceMaskId})`):e.removeAttribute("mask")}draw(){let e=this._ensureArea(),t=e.children.length,n=this._svg.parentElement,i=0,s=0,l=0;if(a.isNullOrEmpty(this.items))e.innerHTML="",a.removeClass(n,"chart-has-data");else{a.addClass(n,"chart-has-data");for(let p of this.items)this._isSliceOk(p)&&(s+=p.value);if(s<=0)e.innerHTML="",a.removeClass(n,"chart-has-data");else for(let p of this.items){if(!this._isSliceOk(p))continue;let u;if(i>=t){let f=document.createElementNS("http://www.w3.org/2000/svg","g");f.setAttribute("class","chart-series "+b+"-pie-slice"+(a.isNullOrEmpty(p.className)?"":" "+p.className)),u=document.createElementNS("http://www.w3.org/2000/svg","path"),f.appendChild(u),e.appendChild(f),p._assignUi(f),this._slices.set(f,p)}else u=e.children.item(i).firstElementChild;p.value>0?(this._drawSlice(u,p,s,l),this._padSlice(u),l+=p.value,u.removeAttribute("display")):u.setAttribute("display","none"),i++}}for(;i<e.children.length;){let p=this._slices,u=e.children.item(i);p.has(u)&&(p.get(u)._disposeUi(),p.delete(u)),e.removeChild(u)}}};c([h({converter:m.Number})],Nn.prototype,"cutout",2),c([h({converter:m.Element})],Nn.prototype,"target",2),c([h({converter:m.Boolean})],Nn.prototype,"maskBasedRendering",2),c([h({converter:m.Number})],Nn.prototype,"slicePadding",2),c([me(!0)],Nn.prototype,"draw",1),Nn=c([C({tagName:d+"-pie-chart"})],Nn);var Yg={};Se(Yg,{PacemFxElement:()=>pr,PacemFxFancyElement:()=>Ha,PacemFxGradientElement:()=>$a,PacemFxGradientItemElement:()=>ml,PacemFxGradientStopElement:()=>ds,PacemFxHeroElement:()=>ps,PacemFxLinearGradientElement:()=>Wc,PacemFxListElement:()=>Xd,PacemFxPulseElement:()=>cs,PacemFxRadialGradientElement:()=>Ia,PacemFxRippleElement:()=>zc});var pr=class extends K{};c([h({converter:m.Element})],pr.prototype,"target",2);var Ry="ripple",zc=class extends pr{constructor(){super(...arguments);this._lock=!1;this._remove=!1;this._rippleHandler=e=>{if(this.disabled||this.target instanceof K&&this.target.disabled||e instanceof MouseEvent&&e.button!==0)return;let t=a.offset(this.target),n=getComputedStyle(this.target),i=this.style;i.top=t.top+"px",i.left=t.left+"px",i.width=t.width+"px",i.height=t.height+"px",i.borderRadius=n.borderRadius;let s=e.type==="touchstart"?e.touches[0]:e,l={x:s.pageX,y:s.pageY},p={x:t.left,y:t.top},u={x:t.left+t.width,y:t.top},f={x:t.left,y:t.top+t.height},g={x:u.x,y:f.y},v=Math.max(se.distance(l,p),se.distance(l,u),se.distance(l,g),se.distance(l,f)),y=this._wave;y.style.left=l.x-t.left-v+"px",y.style.top=l.y-t.top-v+"px",y.style.width=y.style.height=2*v+"px",a.addAnimationEndCallback(y,()=>{this._lock=!1,this._tryRemove()}),this._lock=!0,a.addClass(y,"ripple-go")};this._unrippleHandler=e=>{this._remove=!0,this._tryRemove()}}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&(a.isNull(t)||this._reset(t),a.isNull(n)||this._set(n))}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.target)||this._set()}disconnectedCallback(){a.isNull(this.target)||this._reset(),super.disconnectedCallback()}_tryRemove(){!this._lock&&this._remove&&(this._remove=!1,a.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)}};c([S("."+Ry)],zc.prototype,"_wave",2),zc=c([C({tagName:d+"-fx-ripple",shadow:j.USE_SHADOW_ROOT,template:`<div class="${Ry}"></div>`})],zc);var lw="pulse",cw="http://www.w3.org/2000/svg";function Oy(o){return`${b}-fx-pulse-${o}`}function pw(o,r,e="0",t=e){let n="style#"+o,i=document.querySelector(n);if(a.isNull(i)){let v=document.createElement("style");v.id=o,document.head.appendChild(v)}let s=document.querySelector(n),l=r.width,p=r.height,u=Math.max(l,p),f=.5*(u-l),g=.5*(u-p);s.sheet.insertRule(`@keyframes ${Oy(o)} {
|
|
362
362
|
0%{
|
|
363
363
|
opacity: .25; stroke-thickness: 0; rx: ${e}; ry: ${t}; x: ${f}px; y: ${g}px; width: ${r.width}px; height: ${r.height}px;
|
|
364
364
|
}
|
|
@@ -371,13 +371,13 @@ fn computeOffsetPosition(p0: vec4f, p1: vec4f, index: u32) -> vec4f {
|
|
|
371
371
|
100%{
|
|
372
372
|
opacity: 0; rx: 50%; ry: 50%; transform: scale(2); stroke-width: 0; width: ${u}px; height: ${u}px; x: 0; y: 0
|
|
373
373
|
}
|
|
374
|
-
}`,0);for(let v=s.sheet.rules.length-1;v>0;v--)s.sheet.deleteRule(v);return s}var Gc,cs=class extends pr{constructor(){super();z(this,Gc);this._resizeHandler=e=>{this._pulse(e.detail)};H(this,Gc,a.uniqueCode())}viewActivatedCallback(){super.viewActivatedCallback(),this._pulse()}disconnectedCallback(){a.isNull(this._sheet)||(this._sheet.remove(),this._sheet=null),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="disabled"&&!i&&this._pulse()}_pulse(e=this._resize.currentSize){let t=a.isNull(this.target)||a.isNull(e)||!(e.height>0)||!(e.width>0);if(this._resize.disabled=this.disabled,this.disabled||t){a.addClass(this,"pulse-off");return}a.removeClass(this,"pulse-off");let n=e,i=getComputedStyle(this.target),s=this.style,l=Math.max(n.width,n.height);s.width=l+"px",s.height=l+"px",s.top=n.top+.5*(n.height-l)+"px",s.left=n.left+.5*(n.width-l)+"px";let p=this._rect1,u=this._rect2,f=p.style,g=u.style;this._sheet=
|
|
375
|
-
<svg class="${
|
|
374
|
+
}`,0);for(let v=s.sheet.rules.length-1;v>0;v--)s.sheet.deleteRule(v);return s}var Gc,cs=class extends pr{constructor(){super();z(this,Gc);this._resizeHandler=e=>{this._pulse(e.detail)};H(this,Gc,a.uniqueCode())}viewActivatedCallback(){super.viewActivatedCallback(),this._pulse()}disconnectedCallback(){a.isNull(this._sheet)||(this._sheet.remove(),this._sheet=null),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="disabled"&&!i&&this._pulse()}_pulse(e=this._resize.currentSize){let t=a.isNull(this.target)||a.isNull(e)||!(e.height>0)||!(e.width>0);if(this._resize.disabled=this.disabled,this.disabled||t){a.addClass(this,"pulse-off");return}a.removeClass(this,"pulse-off");let n=e,i=getComputedStyle(this.target),s=this.style,l=Math.max(n.width,n.height);s.width=l+"px",s.height=l+"px",s.top=n.top+.5*(n.height-l)+"px",s.left=n.left+.5*(n.width-l)+"px";let p=this._rect1,u=this._rect2,f=p.style,g=u.style;this._sheet=pw(M(this,Gc),e,i.borderTopLeftRadius);let v=Oy(M(this,Gc));f.animation=g.animation=`${v} both cubic-bezier(0.37, 0, 0.63, 1) 1.25s infinite`,g.animationDelay=".175s"}};Gc=new WeakMap,c([S(d+"-resize")],cs.prototype,"_resize",2),c([S("svg")],cs.prototype,"_svg",2),c([S("svg > rect[rect1]")],cs.prototype,"_rect1",2),c([S("svg > rect[rect2]")],cs.prototype,"_rect2",2),cs=c([C({tagName:d+"-fx-pulse",shadow:j.USE_SHADOW_ROOT,template:`<${d}-resize target="{{ :host.target }}" watch-position="true" on-${R.ResizeEventName}=":host._resizeHandler($event)"></${d}-resize>
|
|
375
|
+
<svg class="${lw}" xmlns="${cw}">
|
|
376
376
|
<rect rect1 /><rect rect2 />
|
|
377
|
-
</svg>`})],cs);var Oy=b+"-hero",Py=200,pw="entering",dw="exiting",uw="entered",hw="exited",Iy={convert:o=>o.trim().startsWith("#")?m.Element.convert(o):m.Json.convert(o)},ps=class extends pr{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="target"&&!a.isNull(e)&&this._resetTarget(e),r==="from"&&this.hero&&!a.isNull(t)&&(this._originalState=this._computeFromState()),(r==="hero"||r==="target"||r==="goal")&&(a.isNull(this.target)||(this.hero?this.start():this.reset()))}viewActivatedCallback(){super.viewActivatedCallback(),this.hero&&!a.isNull(this.target)&&this.start()}disconnectedCallback(){a.isNull(this.target)||this.reset(),super.disconnectedCallback()}_computeFromState(){let r=this.target,e=a.offset(r);if(this.from instanceof Element){let t=a.offset(this.from);return{x:t.left,y:t.top,width:t.width,height:t.height}}else return{x:e.left,y:e.top,width:e.width,height:e.height}}_resetTarget(r=this.target){let e=r.style;e.top=e.left=e.height=e.width="";for(let t=0;t<e.length;t++){let n=e.item(t);e[n]=""}for(let t in this._originalStyle)e[t]=this._originalStyle[t];a.removeClass(r,Oy)}reset(){if(!(a.isNull(this._originalState)||a.isNull(this._targetState)))return this.dispatchEvent(new Event(dw)),this._animate(this._targetState,this._originalState).then(()=>{this._resetTarget(),this.dispatchEvent(new Event(hw))})}start(){if(!this.disabled&&!a.isNull(this.target)){let r;if(this.to instanceof Element){let l=a.offset(this.to);r={x:l.left,y:l.top,width:l.width,height:l.height}}else r=this.to;let e=this.target,t=a.windowSize,n=r||{x:0,y:0,width:t.width,height:t.height},i=e.style;this._targetState=n;let s=this._originalState=this._computeFromState();this._originalStyle={};for(let l=0;l<i.length;l++){let p=i.item(l);this._originalStyle[p]=i[p]}return a.addClass(e,Oy),this.dispatchEvent(new Event(pw)),this._animate(s,n).then(()=>{this.dispatchEvent(new Event(uw))})}return Promise.resolve()}_animate(r,e){let t=this.target,n=t.style,i=r.width/e.width,s=r.height/e.height,l=r.x-e.x+"px",p=r.y-e.y+"px";return n.transformOrigin="0 0",n.transition="none",n.transform=`translate(${l}, ${p}) scale(${i}, ${s})`,n.width=e.width+"px",n.height=e.height+"px",n.top=e.y+"px",n.left=e.x+"px",requestAnimationFrame(()=>{let u=this.duration||Py;n.transition=`transform cubic-bezier(0.445, 0.05, 0.55, 0.95) ${u}ms, opacity ${u}ms`,n.transform="translate(0, 0) scale(1)"}),a.waitForAnimationEnd(t,Py+10)}};c([h({converter:m.Boolean})],ps.prototype,"hero",2),c([h({converter:Iy,emit:!1})],ps.prototype,"to",2),c([h({converter:Iy,emit:!1})],ps.prototype,"from",2),c([h({converter:m.Number,emit:!1})],ps.prototype,"duration",2),ps=c([C({tagName:d+"-fx-hero"})],ps);var $y=b+"-fx-list",Xd=class extends pr{constructor(){super(...arguments);this._observed=e=>{let t=Array.from(this.target.children);for(let n of e)n.removedNodes.forEach(i=>{i instanceof Element&&this.dispatchEvent(new CustomEvent("itemremoved",{detail:i}))}),n.addedNodes.forEach((i,s)=>{i instanceof Element&&this.dispatchEvent(new CustomEvent("itemadded",{detail:{item:i,index:t.indexOf(i)}}))})}}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.target)||this._setup()}disconnectedCallback(){a.isNull(this._observer)||this._observer.disconnect(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&(t?this._reset(t):this._setup())}_reset(e){a.removeClass(e,$y),this._observer.disconnect()}_setup(){let e=this.target;a.addClass(e,$y),(this._observer=new MutationObserver(this._observed)).observe(e,{childList:!0})}};Xd=c([C({tagName:d+"-fx-list"})],Xd);var qd="gradientchange",im=class extends Event{constructor(){super(qd,{cancelable:!1,bubbles:!1})}},mw={convert:(o,r)=>{try{return Zs.parse(o)}catch{return m.Number.convert(o,r)}}};function Fc(o){return Math.round(o*1e3)/10+"%"}var ds=class extends R.PacemItemElement{findContainer(){return A.findAncestor(this,r=>r instanceof ml)}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="offset"||r==="color"||r==="opacity"||r==="disabled"||r==="hide")&&this.dispatchEvent(new im)}};c([h({emit:!1,converter:m.Number})],ds.prototype,"offset",2),c([h({emit:!1,converter:m.String})],ds.prototype,"color",2),c([h({emit:!1,converter:m.Number})],ds.prototype,"opacity",2),ds=c([C({tagName:d+"-fx-gradient-stop"})],ds);var ml=class extends R.PacemCrossItemsContainerElement{constructor(){super(...arguments);this._dispatchGradientChangeHandler=e=>{this._dispatchGradientChange()}}validate(e){return e instanceof ds}register(e){let t=super.register(e);return t&&e.addEventListener(qd,this._dispatchGradientChangeHandler,!1),t}unregister(e){let t=super.unregister(e);return t&&e.removeEventListener(qd,this._dispatchGradientChangeHandler,!1),t}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&this.doesPropertyTriggerGradientChange(e)&&this._dispatchGradientChange()}_dispatchGradientChange(){this.dispatchEvent(new im)}buildColor(e,t){if(t>=0&&t<=1){let n=Be.parse(e);return Be.stringify(a.extend(n,{a:t}))}return e}},Ia=class extends ml{doesPropertyTriggerGradientChange(r){return["shape","size","center","items","hide","disabled"].indexOf(r)>=0}buildGradient(){let r=this.items;if(a.isNullOrEmpty(r))return"";let e=this.shape==="circle"?"circle":"ellipse",t=this.center??{x:.5,y:.5},n=this.size,i="";a.isNullOrEmpty(n)||(typeof n=="number"?i=`${n}px`:i=`${Fc(n.width/2)} ${Fc(n.height/2)}`);let s=[];for(let{offset:l,color:p,hide:u,disabled:f,opacity:g}of r){if(u||f)continue;let v=this.buildColor(p,g);s.push(`${v} ${Fc(l)}`)}return`radial-gradient(${e} ${i} at ${Fc(t.x)} ${Fc(t.y)} in oklab, ${s.join(", ")})`}};c([h({emit:!1,converter:m.String})],Ia.prototype,"shape",2),c([h({emit:!1,converter:m.Point})],Ia.prototype,"center",2),c([h({emit:!1,converter:mw})],Ia.prototype,"size",2),Ia=c([C({tagName:d+"-fx-gradient-radial"})],Ia);var Wc=class extends ml{doesPropertyTriggerGradientChange(r){return["angle","items","hide","disabled"].indexOf(r)>=0}buildGradient(){let r=this.items;if(a.isNullOrEmpty(r))return"";let e=this.angle??0,t=[];for(let{offset:n,color:i,hide:s,disabled:l,opacity:p}of r){if(s||l)continue;let u=this.buildColor(i,p);t.push(`${u} ${Fc(n)}`)}return`linear-gradient(${e}deg in oklab, ${t.join(", ")})`}};c([h({emit:!1,converter:m.Number})],Wc.prototype,"angle",2),Wc=c([C({tagName:d+"-fx-gradient-linear"})],Wc);var $a=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._gradientChangeHandler=e=>{this._buildGradient()}}validate(e){return e instanceof ml}register(e){let t=super.register(e);return t&&e.addEventListener(qd,this._gradientChangeHandler,!1),t}unregister(e){let t=super.unregister(e);return t&&e.removeEventListener(qd,this._gradientChangeHandler,!1),t}viewActivatedCallback(){super.viewActivatedCallback(),this._buildGradient()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"target":t&&this._removeGradient(t);case"mode":case"disabled":this._buildGradient();break}}_removeGradient(e){a.removeClass(e,b+"-fx-gradient-text"),a.removeClass(e,b+"-fx-gradient-fill"),e.style.backgroundImage=""}_buildGradient(){let e=this.target;if(a.isNull(e))return;let t="",n=this.disabled?[]:this.items??[];for(let i of n){if(i.hide||i.disabled)continue;let s=i.buildGradient();a.isNullOrEmpty(s)||(t+=s,t.trim().endsWith(",")||(t+=","))}if(a.isNullOrEmpty(t))this._removeGradient(e);else{let i=b+"-fx-gradient-text",s=b+"-fx-gradient-fill",l=this.mode==="text";a.removeClass(e,l?s:i),a.addClass(e,l?i:s),e.style.backgroundImage=t.substring(0,t.length-1)}}};c([h({converter:m.Element})],$a.prototype,"target",2),c([h({converter:m.String})],$a.prototype,"mode",2),c([me(!0)],$a.prototype,"_buildGradient",1),$a=c([C({tagName:d+"-fx-gradient"})],$a);var Hy=b+"-fancy",fw=b+"-fancify",gw=20,Ha=class extends pr{constructor(){super(...arguments);this._progress=0;this._started=!1}get progress(){return this._progress}get started(){return this._started}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="fancify"||e==="target")&&(a.isNull(this.target)||(this.fancify?this.start():this._reset()))}viewActivatedCallback(){super.viewActivatedCallback(),this.fancify&&!a.isNull(this.target)&&this.start()}disconnectedCallback(){cancelAnimationFrame(this._handle),clearTimeout(this._handle1),a.isNull(this.target)||this._reset(),super.disconnectedCallback()}_reset(){a.removeClass(this.target,Hy),this._started&&this.dispatchEvent(new ue({propertyName:"started",oldValue:this._started,currentValue:this._started=!1})),this.dispatchEvent(new ue({propertyName:"progress",oldValue:this._progress,currentValue:this._progress=0})),a.isNull(this._originalContent)?this._originalContent=this.target.innerHTML:this.target.innerHTML=this._originalContent}_parse(){let e,t=[],n=document.createTreeWalker(this.target,NodeFilter.SHOW_TEXT);for(;e=n.nextNode();)e.textContent&&t.push(e);this._textNodes=t}start(){this.disabled||(this._reset(),this._parse(),this._startShow(),this._handle1=setTimeout(()=>{this.dispatchEvent(new ue({propertyName:"started",oldValue:this._started,currentValue:this._started=!0}))},this.delay||0))}_startShow(e=0){a.addClass(this.target,Hy);let t=this._textNodes,n=t.length;this._fancify(t[e]);let i=this._progress;e++;let s=this._progress=e/n;this.dispatchEvent(new ue({propertyName:"progress",oldValue:i,currentValue:s})),e<n&&(this._handle=requestAnimationFrame(()=>{this._startShow(e)}))}_fancify(e){let t=e.textContent;if(a.isNullOrEmpty(t)||!/[^\s]/.test(t))return;let n=/^\s/.test(t),i=/\s$/.test(t);e.textContent="";let s=t.trim().split(" "),l=this.gap||gw,p=this.delay||0,u=0;for(let g of s){var f=document.createElement("span");f.className=fw,f.style.animationDelay=`${p+u*l}ms`,(n||u>0)&&e.parentElement.insertBefore(document.createTextNode(" "),e),f.textContent=g,e.parentElement.insertBefore(f,e),u++}i&&e.parentElement.insertBefore(document.createTextNode(" "),e)}};c([h({converter:m.Boolean})],Ha.prototype,"fancify",2),c([h({converter:m.Number})],Ha.prototype,"delay",2),c([h({converter:m.Number})],Ha.prototype,"gap",2),Ha=c([C({tagName:d+"-fx-fancy"})],Ha);var Xg={};Le(Xg,{PacemConsoleElement:()=>jc,PacemFpsElement:()=>Kd,PacemTrackerElement:()=>Ba});var By={current:0,count:0,average:0,max:Number.MIN_VALUE,min:Number.MAX_VALUE},Ba=class extends K{constructor(){super();this.data=By}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="entry"&&this._update(n).then(s=>this.data=s)}_update(e){let t=()=>{let n=this.data,i=Math.min(e,n.min),s=Math.max(e,n.max),l=n.count+1,p=(n.count*n.average+e)/l;return{count:l,min:i,max:s,average:p,current:e}};return a.fromResultAsync(t)}reset(){this.data=By}};c([h({converter:m.Json})],Ba.prototype,"data",2),c([h({emit:!1,converter:m.Number})],Ba.prototype,"entry",2),c([db()],Ba.prototype,"_update",1);var Vy={error:!0,info:!0,warn:!0},jc=class extends K{constructor(){super(...arguments);this._config=Vy}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="configuration"&&(this._config=a.extend({},Vy,n??{}))}log(e,t,n){try{this._log(e,t,n)}catch{}}_log(e,t,n){if(!this.disabled&&this._config[e]===!0){n!==this._category&&(a.isNullOrEmpty(this._category)||console.groupEnd(),a.isNullOrEmpty(n)||console.group(n),this._category=n);var i=s=>{};switch(e){case ce.LogLevel.Debug:i=console.debug;break;case ce.LogLevel.Error:i=console.error;break;case ce.LogLevel.Info:i=console.info;break;case ce.LogLevel.Trace:i=console.trace;break;case ce.LogLevel.Warn:i=console.warn;break;case ce.LogLevel.Log:i=console.log;break}i(new Date().toISOString()+": "+t)}}};c([h({emit:!1,converter:m.Json})],jc.prototype,"configuration",2),jc=c([C({tagName:d+"-console"})],jc);var Kd=class extends Ba{constructor(){super()}_start(r=Date.now()){this._handle=requestAnimationFrame(()=>{let e=Date.now(),t=e-r;this.entry=Math.min(60,1e3/t),this._start(e)})}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){cancelAnimationFrame(this._handle),super.disconnectedCallback()}};Kd=c([C({tagName:d+"-fps"})],Kd);var Qc={};Le(Qc,{Maps:()=>dm});var dm={};Le(dm,{LatLngBoundsConverter:()=>zy,LatLngConverter:()=>bl,LayerLoadEventName:()=>jy,MapColorScheme:()=>am,MapConsts:()=>vw,MapEvent:()=>Qt,MapItemAdapter:()=>vl,MapRelevantElement:()=>ki,MapType:()=>sm,MapUtils:()=>Rr,PacemAzureMapAdapterElement:()=>Mi,PacemGoogleMapAdapterElement:()=>nn,PacemLayerAdapter:()=>hs,PacemLeafletMapAdapterElement:()=>Ua,PacemMapAdapterElement:()=>Dn,PacemMapCircleElement:()=>An,PacemMapElement:()=>qe,PacemMapGeocodeElement:()=>Tn,PacemMapGeolocateElement:()=>gs,PacemMapLayerElement:()=>en,PacemMapMarkerElement:()=>Dr,PacemMapOverlayElement:()=>gl,PacemMapOverlayImageElement:()=>Va,PacemMapPolygonElement:()=>wi,PacemMapPolylineElement:()=>Ei,PacemMapShapeElement:()=>tn,PacemMarkerAdapter:()=>ms,PacemOverlayAdapter:()=>us,PacemShapeAdapter:()=>fs,isLatLng:()=>bw,isLatLngBounds:()=>yw});var sm=(i=>(i.ROAD="road",i.SATELLITE="satellite",i.HYBRID="hybrid",i.TERRAIN="terrain",i.HIGH_CONTRAST="high_contrast",i))(sm||{}),am=(t=>(t.LIGHT="light",t.DARK="dark",t.SYSTEM="system",t))(am||{}),rn={MAP_SELECTOR:d+"-map",LINK_SELECTOR:d+"-map-link",MARKER_SELECTOR:d+"-map-marker",POLYLINE_SELECTOR:d+"-map-polyline",CIRCLE_SELECTOR:d+"-map-circle",POLYGON_SELECTOR:d+"-map-polygon",RECTANGLE_SELECTOR:d+"-map-rectangle",LAYER_SELECTOR:d+"-map-layer",OVERLAY_IMAGE_SELECTOR:d+"-map-overlay-image",OVERLAY_PANEL_SELECTOR:d+"-map-overlay-panel",GEOCODER_SELECTOR:d+"-map-geocode",DEFAULT_COORDS:{lat:44.71418802507798,lng:10.296516444873811}},vw={DEFAULT_COORDS:rn.DEFAULT_COORDS};function bw(o){return it.isLatLng(o)}function yw(o){return st.isLatLngBounds(o)}var Uy="defaultMapTarget",bl={convert:o=>{let r=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(o);return r&&r.length>2?{lat:parseFloat(r[1]),lng:parseFloat(r[2])}:JSON.parse(o)},convertBack:o=>JSON.stringify(o)},zy={convert:o=>{let r=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(o);return r&&r.length>4?{sw:{lat:parseFloat(r[3]),lng:parseFloat(r[4])},ne:{lat:parseFloat(r[1]),lng:parseFloat(r[2])}}:JSON.parse(o)},convertBack:o=>JSON.stringify(o)},Rr=class{static parseCoords(r){if(r&&!isNaN(r.lat)&&!isNaN(r.lng))return[r.lat,r.lng];if(a.isArray(r)&&r.length>1)return[r[0],r[1]];if(/^\s*(\+|-)?[\d]+(.[\d]+)?\s*,\s*(\+|-)?[\d]+(.[\d]+)?\s*$/.test(r)){var e=r.split(",");return[parseFloat(e[0]),parseFloat(e[1])]}return[rn.DEFAULT_COORDS.lat,rn.DEFAULT_COORDS.lng]}static expandBounds(r,e){e&&(Array.isArray(e)||(e=[e.lat,e.lng]),r.push(e))}static isContentEmpty(r){return r.children.length==0}},ki=class extends K{get map(){return this._map=this._map||A.findAncestorOfType(this,qe)}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n&&r==="hide"){let i=this.map;i?.adapter?.fitBounds(i,!0)}}viewActivatedCallback(){super.viewActivatedCallback(),this.map&&this.map.register(this)}disconnectedCallback(){this.map&&this.map.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Boolean})],ki.prototype,"hide",2),c([h({converter:m.Boolean})],ki.prototype,"inactive",2);var Qt=class extends oe{constructor(r,e){super(r,e)}},Yc,Xc,qc,Tn=class extends K{constructor(){super(...arguments);this.debounce=1e3;z(this,Yc,!1);z(this,Xc);z(this,qc)}get fetching(){return M(this,Yc)}_guards(){let e=this.results;if(!a.isNullOrEmpty(e)){let n=e[0];if(!a.isNull(this.position)&&it.equals(this.position,n.position)&&this.search===n.fullAddress)return Promise.resolve(e)}let t=this.adapter;return a.isNull(t)||t.disabled||!t.active?Promise.resolve([]):null}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"search":this.geocode(n);break;case"position":this.reverseGeocode(n);break;case"results":if(a.isNullOrEmpty(n))this.search="",this.position=null;else{let s=n[0];this.search=s.fullAddress,this.position=s.position}break}}_broadcastFetchingUpdate(e){e!==M(this,Yc)&&(H(this,Yc,e),this.dispatchEvent(new ue({propertyName:"fetching",oldValue:!e,currentValue:e})))}_fetch(e){let{promise:t,search:n,position:i,key:s}=e,l=M(this,qc);!a.isNull(l)&&it.equals(l.position,i)&&(l.search||"")===(n||"")||(H(this,qc,{key:s,promise:t,position:i,search:n}),this._broadcastFetchingUpdate(!0),t.then(p=>{s===M(this,qc).key&&(this._broadcastFetchingUpdate(!1),this._successCallback(p))},p=>this._errorCallback(p)))}_debounce(e,t=this.debounce){M(this,Xc)&&clearTimeout(M(this,Xc)),H(this,Xc,window.setTimeout(()=>{e()},t||0))}reverseGeocode(e=this.position,t=this.maxResults){this.disabled||this._debounce(()=>{let n=this._guards()??this.adapter.reverseGeocode(e,t||1);this._fetch({promise:n,position:e,key:a.uniqueCode()})})}geocode(e=this.search,t=this.maxResults){this.disabled||this._debounce(()=>{let n=this._guards()??this.adapter.geocode(e,t||10);this._fetch({promise:n,search:e,position:it.Empty,key:a.uniqueCode()})})}_successCallback(e){let t=!a.isNullOrEmpty(e);(t||!a.isNullOrEmpty(this.results))&&e!==this.results&&(this.results=e,t&&this.dispatchEvent(new CustomEvent("success",{detail:e,bubbles:!1,cancelable:!1})))}_errorCallback(e){a.isNullOrEmpty(this.results)||(this.results=[]),this.dispatchEvent(new CustomEvent("error",{detail:e,bubbles:!1,cancelable:!1}))}};Yc=new WeakMap,Xc=new WeakMap,qc=new WeakMap,c([h({emit:!1,converter:m.Element})],Tn.prototype,"adapter",2),c([h({emit:!1,converter:m.Number})],Tn.prototype,"maxResults",2),c([h({emit:!1,converter:m.Number})],Tn.prototype,"debounce",2),c([h({emit:!0,converter:m.Json})],Tn.prototype,"results",2),c([h({emit:!0,converter:m.String})],Tn.prototype,"search",2),c([h({emit:!0,converter:bl})],Tn.prototype,"position",2),Tn=c([C({tagName:rn.GEOCODER_SELECTOR})],Tn);var Dn=class extends K{constructor(){super(...arguments);this.active=!0;this.#e=new Map;this.#t=new WeakMap;this.#r=new WeakMap;this.#n=new WeakMap;this.#i=new WeakMap}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||(this.active=!this.disabled&&this.isActive())}#e;#t;#r;#n;#i;get layerAdapters(){return this.#n}get overlayAdapters(){return this.#i}get markerAdapters(){return this.#t}get shapeAdapters(){return this.#r}hasMap(e){return this.#e.has(e)}enrolledMaps(){return this.#e.keys()}tryGetMap(e){let t=this.#e;return t.has(e)?t.get(e):null}getMap(e){return this.tryGetMap(e)?.map}async initialize(e){let t=this.#e;if(!t.has(e)){let n=await this.init(e);t.set(e,n);let i=this.#n;i.has(e)||i.set(e,this.buildLayerAdapterFor(e));let s=this.#i;s.has(e)||s.set(e,this.buildOverlayAdapterFor(e));let l=this.#t;l.has(e)||l.set(e,this.buildMarkerAdapterFor(e));let p=this.#r;return p.has(e)||p.set(e,this.buildShapeAdapterFor(e)),n.container}return t.get(e).container}destroy(e){let t=this.#n;t.has(e)&&t.delete(e);let n=this.#i;n.has(e)&&n.delete(e);let i=this.#t;i.has(e)&&i.delete(e);let s=this.#r;s.has(e)&&s.delete(e);let l=this.#e;l.has(e)&&(this.dispose(e),l.delete(e))}removeItem(e){let t=e.map;if(e instanceof en){let n=this.layerAdapters;n.has(t)&&n.get(t).removeLayer(e)}else if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).removeMarker(e)}else if(e instanceof tn){let n=this.shapeAdapters;n.has(t)&&n.get(t).removeShape(e)}else if(e instanceof gl){let n=this.overlayAdapters;n.has(t)&&n.get(t).removeOverlay(e)}e.inactive||this.fitBounds(t,!0)}drawItem(e){let t=e.map;if(e instanceof en){let n=this.layerAdapters;n.has(t)&&n.get(t).drawLayer(e)}else if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).drawMarker(e)}else if(e instanceof tn){let n=this.shapeAdapters;n.has(t)&&n.get(t).drawShape(e)}else if(e instanceof gl){let n=this.overlayAdapters;n.has(t)&&n.get(t).drawOverlay(e)}e.inactive||this.fitBounds(t,!0)}popupInfoWindow(e){let t=e.map;if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).openInfoWindow(e)}}popoutInfoWindow(e){let t=e.map;if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).closeInfoWindow(e)}}setView(e,t,n){if(!this.hasMap(e))return;let i={};typeof t=="number"?i=a.extend({},{zoom:t}):it.isLatLng(t)?i=a.extend({},{center:t,zoom:n}):i=t,this.setViewNative(e,i)}fitBounds(e,t){if(!a.isNull(e))this._fitBounds(e,t);else for(let n of this.enrolledMaps()||[])this._fitBounds(n,t)}_fitBounds(e,t){if(!this.hasMap(e)||!e.autofit&&t===!0)return;if(st.isLatLngBounds(t)&&!st.isEmpty(t)){this.fitBoundsNative(e,t);return}let n=this.markerAdapters.get(e)?.getBounds(),i=this.shapeAdapters.get(e)?.getBounds(),s=a.isNull(n)||st.isEmpty(n),l=a.isNull(i)||st.isEmpty(i);if(s&&l){this.setView(e,{center:e.center,zoom:e.zoom});return}let p=st.Empty;s||(p=st.union(p,n)),l||(p=st.union(p,i)),st.isPoint(p)?this.setView(e,{zoom:e.zoom,center:p.ne}):this.fitBoundsNative(e,p)}updateMapElement(e,t,n){["type","tilt","heading"].forEach(l=>{l in t&&(e[l]=t[l])});let i="zoom"in t?t.zoom:n;!a.isNullOrEmpty(i)&&i!==e.zoom&&(e.zoom=i);let s=it.isLatLng(t)?t:t.center;!a.isNullOrEmpty(s)&&(s.lat!=e.center?.lat||s.lng!=e.center?.lng)&&(e.center=s),e.updateBounds(this.getBounds(e))}};c([h({emit:!0,converter:m.Boolean})],Dn.prototype,"active",2),c([me(1e3,(e,t)=>`pacem:debounce:${e}:${t.id}`)],Dn.prototype,"_fitBounds",1);var vl=class{constructor(r,e=r.adapter){this._map=r;this._adapter=e}get adapter(){return this._adapter}get map(){return this._map}getMap(r){return this._adapter.getMap(r.map)}},us=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;get layers(){return this.#e}onOverlayLoad(r,e){r.dispatchEvent(new Event("overlayload"))}ensureOverlay(r,e){let t=this,n=t.#e,i;return n.has(r)?i=n.get(r):(i=this.buildOverlay(r,e),a.isNull(i)||n.set(r,i)),i}removeOverlay(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r);e.deleteOverlay(i,t),n.delete(r)}}drawOverlay(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r)||r.hide){e.removeOverlay(r);return}let n=this.ensureOverlay(r,t);this.setBounds(n,t,r.bounds),this.updateOverlay(n,t,r)}},gl=class extends ki{};c([h({emit:!1,converter:zy})],gl.prototype,"bounds",2);var Va=class extends gl{};c([h({emit:!1,converter:m.String})],Va.prototype,"src",2),Va=c([C({tagName:rn.OVERLAY_IMAGE_SELECTOR})],Va);var hs=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;#t=new Map;get layers(){return this.#e}onTileLoad(r,e){r.dispatchEvent(new Event("tileload"))}ensureLayer(r,e){let t=this,n=t.#e,i;if(n.has(r))i=n.get(r);else if(i=this.buildLayer(r,e),i!=null){let s=l=>{t.onTileLoad(r,l)};this.#t.set(r,s),this.addLoadEventListener(i,e,s),n.set(r,i)}return i}removeLayer(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r),s=this.#t;if(s.has(r)){let l=s.get(r);this.removeLoadEventListener(i,t,l),s.delete(r)}e.deleteLayer(i,t),n.delete(r)}}drawLayer(r){let e=this,t=e.getMap(r);if(!a.isNull(t)){if(a.isNullOrEmpty(r)||r.hide){e.removeLayer(r);return}this.ensureLayer(r,t)}}},en=class extends ki{};c([h({emit:!1,converter:m.String})],en.prototype,"url",2),c([h({emit:!1,converter:m.Json})],en.prototype,"include",2),c([h({emit:!1,converter:m.String})],en.prototype,"mode",2),c([h({emit:!1,converter:m.Number})],en.prototype,"minZoom",2),c([h({emit:!1,converter:m.Number})],en.prototype,"maxZoom",2),en=c([C({tagName:rn.LAYER_SELECTOR})],en);var ms=class extends vl{constructor(r,e=r.adapter){super(r,e)}get mapAutomaticallyScrollsOnDrag(){return!1}#e=new Map;#t=new Map;getBounds(r=e=>!0){let e=this.markers,t=st.Empty;for(var n of e.keys()){if(!r(n)||n.inactive)continue;let i=e.get(n);a.isNull(i)||(t=st.union(t,this.getMarkerPosition(i)))}return t}get markers(){return this.#e}get infoWindows(){return this.#t}onDragEnd(r,e){let t=this.markers.get(r),n=this.getMarkerPosition(t);r.onDragEnd(n)}onClick(r,e){let t=this.markers.get(r),n=this.getMarkerPosition(t);r.onClick(n)}onInfoOpen(r){r.onInfoOpen()}onInfoClose(r){r.onInfoClose()}ensureMarker(r,e){let t=this,n;return t.markers.has(r)?n=t.markers.get(r):(n=this.buildMarker(r,e),n!=null&&(this.addClickEventListener(n,e,i=>{t.onClick(r,i),t.openInfoWindow(r,i)}),this.addDragEventListener(n,e,i=>{this.mapAutomaticallyScrollsOnDrag||t.adapter.fitBounds(r.map,!0)}),this.addDragEndEventListener(n,e,i=>t.onDragEnd(r,i)),t.markers.set(r,n))),n}removeMarker(r){let e=this,t=e.getMap(r),n=this.#t,i=this.#e;if(n.has(r)&&n.delete(r),i.has(r)){let s=i.get(r);e.deleteMarker(s,t),i.delete(r)}}drawMarker(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r&&r.position)||r.hide){e.removeMarker(r);return}let n=this.ensureMarker(r,t);this.setPosition(n,r.position),this.setIcon(n,r.icon),this.setLabel(n,r.caption),this.setDraggable(n,r.draggable)}closeInfoWindow(r,e){let t=this;if(t.infoWindows.has(r)){let n=t.infoWindows.get(r);this.closeInfo(n)}}ensureInfoWindow(r,e){var t=this;let n;return t.infoWindows.has(r)?n=t.infoWindows.get(r):(n=this.buildInfoWindow(r),this.addCloseClickEventListener(n,e,i=>{t.deleteInfoWindow(n,e),t.onInfoClose(r)}),t.infoWindows.set(r,n)),n}openInfoWindow(r,e){var t=this,n=t.markers.get(r),i=r.caption,s=t.getMap(r);if(Rr.isContentEmpty(r)||(i=r.innerHTML),!a.isNullOrEmpty(i)){let l=this.ensureInfoWindow(r,s);this.setContent(l,i),this.openInfo(l,i,s,n),t.onInfoOpen(r)}}},Dr=class extends ki{onDragEnd(r){this.position=r,this.dispatchEvent(new Qt("dragend",{position:r}))}onClick(r){this.position=r,this.dispatchEvent(new Qt("click",{position:r}))}onInfoOpen(){this.dispatchEvent(new Qt("openinfo"))}onInfoClose(){this.dispatchEvent(new Qt("closeinfo"))}};c([h({converter:bl})],Dr.prototype,"position",2),c([h({converter:m.Json})],Dr.prototype,"icon",2),c([h({converter:m.String})],Dr.prototype,"caption",2),c([h({converter:m.Boolean})],Dr.prototype,"draggable",2),Dr=c([C({tagName:rn.MARKER_SELECTOR})],Dr);var fs=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;get shapes(){return this.#e}getBounds(r=e=>!0){let e=this.shapes,t=st.Empty;for(var n of e.keys()){if(!r(n)||n.inactive)continue;let i=e.get(n);a.isNull(i)||(t=st.union(t,this.getShapeBounds(i)))}return t}removeShape(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r);e.deleteShape(i,t),n.delete(r)}}_dispatchEvent(r,e,t){let n=this.shapes.get(r),i=this.getShapePosition(t??n);r.dispatchEvent(new Qt(e,{position:i}))}#t=new Map;onDragStart(r,e){let t=this.shapes.get(r),n=this.getShapeBounds(t);this.#t.set(r,n.ne),this._dispatchEvent(r,"dragstart",e)}onDragEnd(r,e){let t=this.shapes.get(r),n=this.getShapeBounds(t),i=this.#t.get(r),s=n.ne,l={lat:s.lat-i.lat,lng:s.lng-i.lng};this._translateShape(r,l),this._dispatchEvent(r,"dragend",e)}_translateShape(r,e){if(r instanceof An){r.center=it.translate(r.center,e);return}if(r instanceof Ei){let t=r.vertices.map(n=>it.translate(n,e));r.vertices=t;return}if(r instanceof wi){let t=r.vertices.map(n=>it.translate(n,e));r.vertices=t;return}}onDrag(r,e){this._dispatchEvent(r,"drag",e)}onClick(r,e){this._dispatchEvent(r,"click",e)}ensureShape(r,e){let t=this,n;return t.shapes.has(r)?n=t.shapes.get(r):(n=this.buildShape(r,e),n!=null&&(this.addClickEventListener(n,i=>t.onClick(r,i)),this.addDragEventListener(n,i=>{t.onDrag(r,i),t.adapter.fitBounds(r.map,!0)}),this.addDragEndEventListener(n,i=>t.onDragEnd(r,i)),this.addDragStartEventListener(n,i=>t.onDragStart(r,i)),t.shapes.set(r,n))),n}drawShape(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r)||r.hide){e.removeShape(r);return}let n=this.ensureShape(r,t);this.setShape(n,r),this.setEditable(n,r.editable),this.setDraggable(n,r.draggable)}},tn=class extends ki{};c([h({emit:!0,converter:m.Boolean})],tn.prototype,"draggable",2),c([h({emit:!0,converter:m.Boolean})],tn.prototype,"editable",2),c([h({emit:!0,converter:m.Json})],tn.prototype,"stroke",2),c([h({emit:!0,converter:m.Json})],tn.prototype,"fill",2);var Ei=class extends tn{};c([h({emit:!0,converter:m.Json})],Ei.prototype,"vertices",2),Ei=c([C({tagName:rn.POLYLINE_SELECTOR})],Ei);var wi=class extends tn{};c([h({emit:!0,converter:m.Json})],wi.prototype,"vertices",2),wi=c([C({tagName:rn.POLYGON_SELECTOR})],wi);var An=class extends tn{};c([h({emit:!0,converter:bl})],An.prototype,"center",2),c([h({emit:!0,converter:m.Json})],An.prototype,"radius",2),An=c([C({tagName:rn.CIRCLE_SELECTOR})],An);var fl,qe=class extends K{constructor(){super(...arguments);this.zoom=12;this.center=rn.DEFAULT_COORDS;z(this,fl,st.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=>{let t=e.target;e.detail.propertyName==="active"&&e.detail.currentValue&&(t.removeEventListener(ee,this._listenToActiveAdapter,!1),this._switchAdapter(t))};this._initialized=!1;this._afterInit=(e,t)=>{this._initialized=!0;for(var n of A.findDescendants(this,i=>i instanceof ki))this._erase(n,t),this._draw(n);t&&t?.destroy(this)};this._resizeHandler=e=>{this.onResize(e)}}updateBounds(e){if(!st.equals(e,M(this,fl))){let t=M(this,fl),n=H(this,fl,e);this.dispatchEvent(new ue({propertyName:"bounds",oldValue:t,currentValue:n}))}}get bounds(){return M(this,fl)}get container(){return this._container}register(e){e.addEventListener(ee,this._drawHandler,!1),this._draw(e)}unregister(e){this._erase(e),e.removeEventListener(ee,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,t){e.active?e.initialize(this).then(n=>this._afterInit(n,t)):(t&&this._afterInit(null,t),e.addEventListener(ee,this._listenToActiveAdapter,!1))}viewActivatedCallback(){super.viewActivatedCallback(),this._setupContainer(),this.adapter&&this._switchAdapter(this.adapter)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e!=="bounds")if(e==="adapter")a.isNull(this._container)||(this._initialized=!1,n?this._switchAdapter(n,t):t&&this._afterInit(null,t));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":n&&this.adapter?.fitBounds(this);break;case"target":t&&this._dismissContainer(t),n?(this._setupContainer(n),this._setupResizer()):this._dismissResizer();break}this.adapter&&this.adapter.invalidateSize(this)}}_dismissContainer(e=this._container){e.dataset[Uy]==="true"?e.remove():a.removeClass(e,b+"-map"),e===this._container&&(this._container=null)}_dismissResizer(){let e=this._resizer;e.removeEventListener("resize",this._resizeHandler,!1),e.remove(),this._resizer=null}_setupContainer(e=this.target){a.isNull(e)&&(e=document.createElement("div"),e.dataset[Uy]="true",this.insertAdjacentElement("afterend",e));let t=this._container=e;return a.addClass(t,b+"-map"),t}_setupResizer(){let e=this._container;if(a.isNull(e))throw new Error("You must set up the map container before its resizing listener.");if(a.isNull(this._resizer)){let t=this._resizer=document.createElement(d+"-resize");t.addEventListener("resize",this._resizeHandler,!1),e.insertAdjacentElement("afterend",t)}return this._resizer.target=e,this._resizer}_detach(){a.isNull(this._container)||this._dismissContainer(),a.isNull(this._resizer)||this._dismissResizer()}disconnectedCallback(){this._detach(),super.disconnectedCallback()}onResize(e){this.adapter&&this.adapter.invalidateSize(this)}};fl=new WeakMap,c([h({emit:!0,converter:m.Number})],qe.prototype,"zoom",2),c([h({emit:!0,converter:bl})],qe.prototype,"center",2),c([h({emit:!1,converter:m.String})],qe.prototype,"type",2),c([h({emit:!1,converter:m.String})],qe.prototype,"theme",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"scale",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"mousewheel",2),c([h({emit:!1,converter:m.String})],qe.prototype,"zoomControl",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"draggable",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"doubleClickZoom",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"keyboardShortcuts",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"autofit",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingTop",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingLeft",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingRight",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingBottom",2),c([h({emit:!1,converter:m.Element})],qe.prototype,"adapter",2),c([h({emit:!1,converter:m.Element})],qe.prototype,"target",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"tilt",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"heading",2),qe=c([C({tagName:rn.MAP_SELECTOR})],qe);var Jd={GEOLOCATION_UNAVAILABLE:"geolocation_unavailable",POSITION_UNAVAILABLE:"position_unavailable",PERMISSION_DENIED:"permission_denied",TIMEOUT:"timeout",UNKNOWN_ERROR:"unknown_error"},Zd,gs=class extends K{constructor(){super(...arguments);this.permission="prompt";this.maximumAge=15e3;this.timeout=3e4;z(this,Zd,!1);this._successCallback=e=>{this.permission="granted",this._setFetching(!1);let 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);let t=typeof e=="string"?e:this._errToString(e);this.dispatchEvent(new CustomEvent("error",{detail:t}))}}_checkPermission(){return new Promise(e=>{let t=navigator.permissions;a.isNull(t)?e("prompt"):t.query({name:"geolocation"}).then(n=>{e(this.permission=n.state)})})}get fetching(){return M(this,Zd)}_setFetching(e){e!==this.fetching&&(H(this,Zd,e),this.dispatchEvent(new ue({propertyName:"fetching",currentValue:e,oldValue:!e})))}fetch(){if(!this.disabled){if(!navigator.geolocation){this._errorCallback(Jd.GEOLOCATION_UNAVAILABLE);return}this._checkPermission().then(e=>{this._setFetching(!0),navigator.geolocation.getCurrentPosition(this._successCallback,this._errorCallback,{enableHighAccuracy:!0,maximumAge:this.maximumAge})})}}viewActivatedCallback(){super.viewActivatedCallback(),this._checkPermission()}_errToString(e){switch(e.code){case GeolocationPositionError.PERMISSION_DENIED:return Jd.PERMISSION_DENIED;case GeolocationPositionError.POSITION_UNAVAILABLE:return Jd.POSITION_UNAVAILABLE;case GeolocationPositionError.TIMEOUT:return Jd.TIMEOUT;default:return Jd.UNKNOWN_ERROR}}};Zd=new WeakMap,c([h({emit:!0,converter:bl})],gs.prototype,"position",2),c([h({emit:!0,converter:m.String})],gs.prototype,"permission",2),c([h({emit:!1,converter:m.Number})],gs.prototype,"maximumAge",2),c([h({emit:!1,converter:m.Number})],gs.prototype,"timeout",2),gs=c([C({tagName:d+"-map-geolocate"})],gs);var Gy={TIMEOUT:1e3,API_JS:"https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js",API_CSS:"https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css"};function Fy(o){return{city:o.municipality,state:o.countrySubdivision,province:o.countrySecondarySubdivision,village:o.municipalitySubdivision??o.localName,zipCode:o.postalCode,streetName:o.street??o.streetName,houseNumber:o.buildingNumber??o.streetNumber,countryCode:o.countryCode,country:o.country}}var Rn=class o{static getPosition(r){return Array.isArray(r)&&(r={lat:r[0],lng:r[1]}),atlas.data.Position.fromLatLng(r)}static getBounds(r){if(a.isArray(r))return atlas.data.BoundingBox.fromPositions(r.map(n=>[n[1],n[0]]));let e=o.getPosition(r.ne),t=o.getPosition(r.sw);return atlas.data.BoundingBox.fromPositions([e,t])}static getLatLng(r){return{lat:r[1],lng:r[0]}}static getLatLngBounds(r){let e=atlas.data.BoundingBox.getNorthEast(r),t=atlas.data.BoundingBox.getSouthWest(r);return{ne:o.getLatLng(e),sw:o.getLatLng(t)}}static parseGeocoding(r){return a.isNullOrEmpty(r.results)?[]:r.results.map(e=>({fullAddress:e.address.freeformAddress,address:Fy(e.address),position:{lat:e.position.lat,lng:e.position.lon,altitude:null}}))}static parseReverseGeocoding(r,e){if(r.summary.numResults<1)return{fullAddress:"",address:{},position:null};let t=r.addresses[0],n=(e??t.position).split(",").map(l=>parseFloat(l)),i=t.address;return{fullAddress:i.freeformAddress,address:Fy(i),position:{lat:n[0],lng:n[1],altitude:n.length>2?n[2]:null}}}},qg=class extends us{deleteOverlay(r,e){throw new Error("Method not implemented.")}buildOverlay(r,e){throw new Error("Method not implemented.")}setBounds(r,e,t){throw new Error("Method not implemented.")}updateOverlay(r,e,t){throw new Error("Method not implemented.")}},Kg=class extends hs{addLoadEventListener(r,e,t){throw new Error("Method not implemented.")}removeLoadEventListener(r,e,t){throw new Error("Method not implemented.")}deleteLayer(r,e){throw new Error("Method not implemented.")}buildLayer(r,e){throw new Error("Method not implemented.")}},Jg=class extends ms{getMarkerPosition(r){let e=r.getOptions().position;return Rn.getLatLng(e)}buildMarker(r,e){let t=new atlas.HtmlMarker;return e.markers.add(t),t.setOptions({popup:new atlas.Popup}),t}addClickEventListener(r,e,t){e.events.add("click",r,t)}addDragEventListener(r,e,t){e.events.add("drag",r,t)}addDragEndEventListener(r,e,t){e.events.add("dragend",r,t)}_setPopupPosition(r,e){let t=this._getPopup(r);a.isNull(t)||t.setOptions({position:e})}setPosition(r,e){let t=Rn.getPosition(e);r.setOptions({position:t}),this._setPopupPosition(r,t)}setIcon(r,e){let t={pixelOffset:[0,-36]},n={popup:new atlas.Popup},i=(s,l,p)=>`<img width="${l||"auto"}" height="${p||"auto"}" style="pointer-events: none" src="${s}" />`;if(typeof e=="string")n.htmlContent=i(e);else if(!a.isNull(e)){let s=e.size,l=e.anchor;n.htmlContent=i(e.url,s&&s.width,s&&s.height),l?(n.anchor="top-left",n.pixelOffset=[-l.x,-l.y],t.pixelOffset=[0,-l.y]):s&&s.height&&(t.pixelOffset=[0,-s.height/2])}n.popup.setOptions(t),r.setOptions(n)}setLabel(r,e){let t={text:e};r.setOptions(t)}setDraggable(r,e){let t={draggable:e};r.setOptions(t)}deleteMarker(r,e){e.markers.remove(r)}deleteInfoWindow(r,e){this._getPopup(r).remove()}closeInfo(r){let e=this._getPopup(r);e?.isOpen()===!0&&e.close()}openInfo(r,e,t,n){let{popup:i,position:s}=r.getOptions();this._setContent(i,e,s),n.togglePopup(),t.events.addOnce("close",i,l=>{i.setOptions({content:""})})}buildInfoWindow(r){return this.markers.get(r)}addCloseClickEventListener(r,e,t){let n=this._getPopup(r);e.events.add("close",n,t)}setContent(r,e){let{popup:t,position:n}=r.getOptions();this._setContent(t,e,n)}_getPopup(r){return r.getOptions().popup}_setContent(r,e,t){r.setOptions({content:`<div style="padding: 8px 24px 8px 8px;">${e}</div>`,position:t})}},Zg=class extends fs{addDragStartEventListener(r,e){throw new Error("Method not implemented.")}deleteShape(r,e){throw new Error("Method not implemented.")}getShapeBounds(r){throw new Error("Method not implemented.")}getShapePosition(r){throw new Error("Method not implemented.")}buildShape(r,e){throw new Error("Method not implemented.")}addClickEventListener(r,e){throw new Error("Method not implemented.")}addDragEventListener(r,e){throw new Error("Method not implemented.")}addDragEndEventListener(r,e){throw new Error("Method not implemented.")}setShape(r,e){throw new Error("Method not implemented.")}setEditable(r,e){throw new Error("Method not implemented.")}setDraggable(r,e){throw new Error("Method not implemented.")}},om=class{_buildGeocodeRequest(r,e,t=10,n=""){let i="https://atlas.microsoft.com/search/address/json?api-version=1.0",s={"subscription-key":r,query:e,limit:""+t,language:n};return{uri:a.URIs.appendQuery(i,s),options:{mode:"cors"}}}parseGeocodeResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=Rn.parseGeocoding(n);e(i)},n=>t(n))})}geocode(r,e,t=10,n=""){return new Promise((i,s)=>{let l=this._buildGeocodeRequest(r,e,t,n);return fetch(l.uri,l.options).then(p=>{p.ok?this.parseGeocodeResponse(p).then(i,s):s(p)},p=>s(p))})}reverseGeocode(r,e,t=""){return new Promise((n,i)=>{let s=this._buildReverseRequest(r,e,t);return fetch(s.uri,s.options).then(l=>{l.ok?this._parseReverseResponse(l).then(n,i):i(l)},l=>i(l))})}_buildReverseRequest(r,e,t=""){let n="https://atlas.microsoft.com/search/address/reverse/json?api-version=1.0",i=Rr.parseCoords(e),s={"subscription-key":r,query:i[0]+","+i[1],language:t};return{uri:a.URIs.appendQuery(n,s),options:{mode:"cors"}}}_parseReverseResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=Rn.parseReverseGeocoding(n);e([i])},n=>t(n))})}},_w=["moveend","dragend","zoomend","rotateend"];function xw(o){let r=o.theme=="dark"||o.theme!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;switch(o.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 o.type;case"hybrid":return"satellite_road_labels";case"satellite":return"satellite";case"terrain":return"road_shaded_relief";case"high_contrast":return r?"high_constrast_dark":"high_constrast_light";default:return r?"night":"road"}}var Kc,Qd,Mi=class extends Dn{constructor(){super(...arguments);z(this,Kc,new WeakMap);z(this,Qd,new WeakMap)}geocode(e,t){return new om().geocode(this.subscriptionKey,e,t,a.lang(this))}reverseGeocode(e,t){return new om().reverseGeocode(this.subscriptionKey,e,a.lang(this))}getBounds(e){let t=this.getMap(e),{bounds:n}=t.getCamera();return Rn.getLatLngBounds(n)}isActive(){return!a.isNullOrEmpty(this.subscriptionKey)}buildOverlayAdapterFor(e){return new qg(e,this)}buildMarkerAdapterFor(e){return new Jg(e,this)}buildShapeAdapterFor(e){return new Zg(e,this)}buildLayerAdapterFor(e){return new Kg(e,this)}setViewNative(e,t){let n=this.getMap(e);t=a.extend({type:e.type,theme:e.theme},t);let i=xw(t);n.setStyle({style:i});let s=t.center&&Rn.getPosition(t.center)||n.getCamera().center,l=t.zoom||n.getCamera().zoom;n.setCamera({center:s,zoom:l})}snapshot(e,t="image/png",n){if(!this.hasMap(e))return Promise.reject();let{map:i}=this.tryGetMap(e);return new Promise((s,l)=>{a.blobToDataURL(M(this,Qd).get(e)).then(p=>{let u=i.getCanvasContainer();u.style.backgroundImage=`url(${p})`,u.style.backgroundSize="contain",a.snapshotElement(u,null,t,n).then(s)})})}dispose(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);M(this,Kc).get(e).forEach(i=>{t.events.remove(i.eventName,i.handler)}),M(this,Kc).delete(e),t.dispose()}async init(e){await Promise.all([A.importjs(Gy.API_JS),A.importcss(Gy.API_CSS,void 0,!0)]);let t=e,n=t.scale,i=t.draggable,s=t.doubleClickZoom,l=t.keyboardShortcuts,u={center:Rn.getPosition(t.center),zoom:t.zoom,subscriptionKey:this.subscriptionKey,dragPanInteraction:i,scrollZoomInteraction:t.mousewheel,dblClickZoomInteraction:!s,keyboardInteraction:l,language:this.language||a.lang(e)},f=t.container,g=document.createElement("div");g.id=`azure-maps-${a.uniqueCode()}`,g.style.width="100%",g.style.height="100%",f.innerHTML="",f.appendChild(g);let v=new atlas.Map(g.id,u),y=[];return M(this,Kc).set(t,y),_w.forEach(_=>{let x=this._spinMapUpdateHandler(t,v);v.events.add(_,x),y.push({eventName:_,handler:x})}),n&&t.zoomControl&&v.events.addOnce("ready",_=>{let x=atlas.ControlPosition.NonFixed;switch(t.zoomControl){case"topleft":x=atlas.ControlPosition.TopLeft;break;case"topright":x=atlas.ControlPosition.TopRight;break;case"bottomright":x=atlas.ControlPosition.BottomRight;break;case"bottomleft":x=atlas.ControlPosition.BottomLeft;break}v.controls.add(new atlas.control.ZoomControl,{position:x})}),v.events.add("idle",_=>{v.getCanvas().toBlob(x=>{M(this,Qd).set(e,x)})}),v.events.addOnce("ready",()=>{e.dispatchEvent(new Qt("maploaded"))}),{map:v,container:g}}invalidateSize(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);t&&t.resize()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i&&e==="language")for(let s of this.enrolledMaps()){let{map:l}=this.tryGetMap(s);l.setStyle({language:n||a.lang(s)})}}_spinMapUpdateHandler(e,t){return()=>{this._updateMap(e,t)}}_updateMap(e,t){if(!a.isNull(t)&&!a.isNull(e)){let n=t.getCamera(),i=n.center,s=n.zoom;n.zoom===1?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,Rn.getLatLng(i),s)}}static _getBounds(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;return{top:t,bottom:s,left:n,right:i}}fitBoundsNative(e,t,n=Mi._getBounds(e)){this.getMap(e).setCamera({bounds:Rn.getBounds(t),padding:n})}};Kc=new WeakMap,Qd=new WeakMap,c([h({emit:!1,converter:m.String})],Mi.prototype,"subscriptionKey",2),c([h({emit:!1,converter:m.String})],Mi.prototype,"language",2),c([me(500)],Mi.prototype,"_updateMap",1),Mi=c([C({tagName:d+"-map-adapter-azure"})],Mi);var lm={API_JS:"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js",API_JS_INTEGRITY:null,API_CSS:"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css",API_CSS_INTEGRITY:null};function Cw(o){return{city:o.city,state:o.state,provinceCode:o["ISO3166-2-lvl6"]?.split("-")[1],province:o.county,village:o.village,zipCode:o.postcode,streetName:o.road,houseNumber:o.house_number,countryCode:o.country_code?.toUpperCase(),country:o.country}}function Wy(o){return{fullAddress:o.display_name,address:Cw(o.address),position:{lat:parseFloat(o.lat),lng:parseFloat(o.lon),altitude:null}}}var eu=class{static toLiteral(r){let e=r.getNorthEast(),t=r.getSouthWest();return{ne:e,sw:t}}static parseGeocoding(r){return a.isNullOrEmpty(r)?[]:r.map(Wy)}static parseReverseGeocoding(r){return a.isNullOrEmpty(r)?[]:[Wy(r)]}},jy="layerload",Qg=class extends oe{constructor(r){super(jy,r,{bubbles:!0})}},ev=class extends ms{deleteInfoWindow(r,e){r.unbindPopup()}deleteMarker(r,e){r.removeFrom(e)}getMarkerPosition(r){return r.getLatLng()}buildMarker(r,e){return L.marker(r.position).addTo(e)}addClickEventListener(r,e,t){r.on("click",t)}addDragEventListener(r,e,t){r.on("drag",t)}addDragEndEventListener(r,e,t){r.on("dragend",t)}setPosition(r,e){r.setLatLng(e)}setIcon(r,e){let t=this;if(typeof e=="string")t._setIcon(r,e);else if(!a.isNull(e)){let n={iconUrl:e.url};a.isNullOrEmpty(e.size)||a.extend(n,{iconSize:[e.size.width,e.size.height],iconAnchor:[e.size.width/2,e.size.height],popupAnchor:[0,-e.size.height]}),a.isNullOrEmpty(e.anchor)||a.extend(n,{iconAnchor:[e.anchor.x,e.anchor.y]}),t._setIcon(r,new L.Icon(n))}}setLabel(r,e){}setDraggable(r,e){e===!0?r.dragging.enable():r.dragging.disable()}closeInfo(r){r.closePopup()}openInfo(r,e,t,n){r.bindPopup(e).openPopup()}buildInfoWindow(r){return this.markers.get(r)}addCloseClickEventListener(r,e,t){r.on("popupclose",t)}setContent(r,e){let t=r.getPopup();t&&t.getContent()!=e&&r.setPopupContent(e)}_setIcon(r,e){if(typeof e=="string"){var t={iconUrl:e},n,i,s;if((n=this.size)&&/[\d]+,[\d]+/.test(n)){var l=-1,p=[parseInt(n.substring(0,l=n.indexOf(","))),parseInt(n.substring(l+1))];Object.assign(t,{iconSize:p})}if((i=this.anchor)&&/[\d]+,[\d]+/.test(i)){var l=-1,u=[parseInt(i.substring(0,l=i.indexOf(","))),parseInt(i.substring(l+1))];Object.assign(t,{iconAnchor:u,popupAnchor:[0,-u[1]]})}if((s=this.popupAnchor)&&/[\d]+,[\d]+/.test(s)){var l=-1,u=[parseInt(i.substring(0,l=i.indexOf(","))),parseInt(i.substring(l+1))];Object.assign(t,{popupAnchor:u})}r.setIcon(L.icon(t))}else e&&r.setIcon(e)}},tv=class extends fs{addDragStartEventListener(r,e){throw new Error("Method not implemented.")}deleteShape(r,e){throw new Error("Method not implemented.")}getShapeBounds(r){throw new Error("Method not implemented.")}getShapePosition(r){throw new Error("Method not implemented.")}buildShape(r,e){throw new Error("Method not implemented.")}addClickEventListener(r,e){throw new Error("Method not implemented.")}addDragEventListener(r,e){throw new Error("Method not implemented.")}addDragEndEventListener(r,e){throw new Error("Method not implemented.")}setShape(r,e){throw new Error("Method not implemented.")}setEditable(r,e){throw new Error("Method not implemented.")}setDraggable(r,e){throw new Error("Method not implemented.")}},rv=class extends hs{addLoadEventListener(r,e,t){r.on("load",t)}removeLoadEventListener(r,e,t){r.off("load",t)}deleteLayer(r,e){r.remove()}buildLayer(r,e){let t=(r.mode||"").toLowerCase();return t==="wms"?L.tileLayer.wms(r.url,{layers:(r.include||[]).join(","),minZoom:r.minZoom,maxZoom:r.maxZoom,transparent:!0,format:"image/png"}).addTo(e):L.tileLayer(r.url,{tms:t==="tms",minZoom:r.minZoom,maxZoom:r.maxZoom}).addTo(e)}},nv=class extends us{deleteOverlay(r,e){throw new Error("Method not implemented.")}buildOverlay(r,e){throw new Error("Method not implemented.")}setBounds(r,e,t){throw new Error("Method not implemented.")}updateOverlay(r,e,t){throw new Error("Method not implemented.")}},yl,Ua=class extends Dn{constructor(){super(...arguments);z(this,yl,new WeakMap);this.tiles="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";this.attribution='Map data \xA9 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';this._tileLayerLoadHandler=e=>{this.dispatchLayerLoadEvent(e.sourceTarget)};this._mapUpdateHandler=e=>{let t=this.getMap(e);!a.isNull(t)&&!a.isNull(e)&&this.updateMapElement(e,t.getCenter(),t.getZoom())}}buildOverlayAdapterFor(e){return new nv(e,this)}geocode(e,t){return new cm().geocode(e,t,a.lang(this))}reverseGeocode(e,t){return new cm().reverseGeocode(e,a.lang(this))}getBounds(e){let n=this.getMap(e).getBounds();return eu.toLiteral(n)}isActive(){return!0}setViewNative(e,t){let n=this.getMap(e);t.center?n.setView(t.center,t.zoom??n.getZoom(),{animate:!0}):typeof t.zoom=="number"&&n.setZoom(t.zoom,{animate:!0})}buildMarkerAdapterFor(e){return new ev(e,this)}buildShapeAdapterFor(e){return new tv(e,this)}buildLayerAdapterFor(e){return new rv(e,this)}snapshot(e,t="image/png",n){return a.snapshotElement(e.container.firstElementChild,null,t,n)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"tiles":for(let s of this.enrolledMaps())this._redrawMap(s);default:for(let s of this.enrolledMaps())this.invalidateSize(s);break}}dispose(e){let{map:t}=this.tryGetMap(e),n=M(this,yl).get(e);n&&n.off("load",this._tileLayerLoadHandler),t.clearAllEventListeners(),M(this,yl).delete(e)}async init(e){await Promise.all([A.importjs(lm.API_JS,lm.API_JS_INTEGRITY,!0),A.importcss(lm.API_CSS,lm.API_CSS_INTEGRITY,!0)]);let t=e;var n=t.scale,i=t.draggable,s=t.doubleClickZoom,l=t.keyboardShortcuts,p=L.latLng(Rr.parseCoords(t.center)),u={zoomControl:n&&!a.isNullOrEmpty(t.zoomControl),scrollWheelZoom:t.mousewheel,dragging:i,doubleClickZoom:!s,keyboard:l};let f=t.container,g=document.createElement("div");g.style.width="100%",g.style.height="100%",f.innerHTML="",f.appendChild(g);let v=L.map(g,u);["zoomend","moveend"].forEach(w=>{v.on(w,E=>{this._idleFiller(t),this._mapUpdateHandler(t)})}),v.on("load",()=>{n&&t.zoomControl&&v.zoomControl.setPosition(t.zoomControl),this._idleFiller(t)});let y=L.tileLayer(this.tiles,{attribution:this.attribution}).addTo(v);y.on("load",this._tileLayerLoadHandler),M(this,yl).set(t,y),v.setView(p,t.zoom),v.once("idle",function(){v.fire("resize"),e.dispatchEvent(new Qt("maploaded"))});let _=Rr.parseCoords(t.center),x=[_[0],_[1]];return v.setView(x,t.zoom),{map:v,container:g}}dispatchLayerLoadEvent(e){this.dispatchEvent(new Qg(e))}invalidateSize(e){this.hasMap(e)&&this.getMap(e).invalidateSize()}_idleFiller(e){this.hasMap(e)&&this.getMap(e).fire("idle")}fitBoundsNative(e,t,n={top:e.paddingTop||0,left:e.paddingLeft||0,right:e.paddingRight||0,bottom:e.paddingBottom||0}){let i=this.getMap(e),s={paddingTopLeft:new L.Point(n.left,n.top),paddingBottomRight:new L.Point(n.right,n.bottom)},l=t.ne,p=t.sw;try{i.fitBounds([[l.lat,l.lng],[p.lat,p.lng]],s)}catch(u){throw u}}_redrawMap(e){var t=this,n=M(t,yl).get(e);a.isNull(t.tiles&&n)||n.setUrl(t.tiles)}};yl=new WeakMap,c([h({emit:!1,converter:m.String})],Ua.prototype,"tiles",2),c([h({emit:!1,converter:m.String})],Ua.prototype,"attribution",2),c([me(500)],Ua.prototype,"_idleFiller",1),Ua=c([C({tagName:d+"-map-adapter-leaflet"})],Ua);var cm=class{_buildGeocodeRequest(r,e=10,t=""){let n="https://nominatim.openstreetmap.org/search?addressdetails=1&format=json",i={q:r,limit:""+e,"accept-language":t};return{uri:a.URIs.appendQuery(n,i),options:{mode:"cors"}}}parseGeocodeResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=eu.parseGeocoding(n);e(i)},n=>t(n))})}geocode(r,e=10,t=""){return new Promise((n,i)=>{let s=this._buildGeocodeRequest(r,e,t);return fetch(s.uri,s.options).then(l=>{l.ok?this.parseGeocodeResponse(l).then(n,i):i(l)},l=>i(l))})}reverseGeocode(r,e=""){return new Promise((t,n)=>{let i=this._buildReverseRequest(r,e);return fetch(i.uri,i.options).then(s=>{s.ok?this._parseReverseResponse(s).then(t,n):n(s)},s=>n(s))})}_buildReverseRequest(r,e=""){let t="https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json",n=Rr.parseCoords(r),i={lat:""+n[0],lon:""+n[1],"accept-language":e};return{uri:a.URIs.appendQuery(t,i),options:{mode:"cors"}}}_parseReverseResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=eu.parseReverseGeocoding(n);e(i)},n=>t(n))})}};var tu={DETACH_TIMEOUT:200,API_URI:"https://maps.googleapis.com/maps/api/js",MAX_ROADMAP_ZOOM:22,BOOTSTRAP_SNIPPET:(o,r,e,t)=>`(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))})({
|
|
377
|
+
</svg>`})],cs);var Py=b+"-hero",Iy=200,dw="entering",uw="exiting",hw="entered",mw="exited",$y={convert:o=>o.trim().startsWith("#")?m.Element.convert(o):m.Json.convert(o)},ps=class extends pr{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="target"&&!a.isNull(e)&&this._resetTarget(e),r==="from"&&this.hero&&!a.isNull(t)&&(this._originalState=this._computeFromState()),(r==="hero"||r==="target"||r==="goal")&&(a.isNull(this.target)||(this.hero?this.start():this.reset()))}viewActivatedCallback(){super.viewActivatedCallback(),this.hero&&!a.isNull(this.target)&&this.start()}disconnectedCallback(){a.isNull(this.target)||this.reset(),super.disconnectedCallback()}_computeFromState(){let r=this.target,e=a.offset(r);if(this.from instanceof Element){let t=a.offset(this.from);return{x:t.left,y:t.top,width:t.width,height:t.height}}else return{x:e.left,y:e.top,width:e.width,height:e.height}}_resetTarget(r=this.target){let e=r.style;e.top=e.left=e.height=e.width="";for(let t=0;t<e.length;t++){let n=e.item(t);e[n]=""}for(let t in this._originalStyle)e[t]=this._originalStyle[t];a.removeClass(r,Py)}reset(){if(!(a.isNull(this._originalState)||a.isNull(this._targetState)))return this.dispatchEvent(new Event(uw)),this._animate(this._targetState,this._originalState).then(()=>{this._resetTarget(),this.dispatchEvent(new Event(mw))})}start(){if(!this.disabled&&!a.isNull(this.target)){let r;if(this.to instanceof Element){let l=a.offset(this.to);r={x:l.left,y:l.top,width:l.width,height:l.height}}else r=this.to;let e=this.target,t=a.windowSize,n=r||{x:0,y:0,width:t.width,height:t.height},i=e.style;this._targetState=n;let s=this._originalState=this._computeFromState();this._originalStyle={};for(let l=0;l<i.length;l++){let p=i.item(l);this._originalStyle[p]=i[p]}return a.addClass(e,Py),this.dispatchEvent(new Event(dw)),this._animate(s,n).then(()=>{this.dispatchEvent(new Event(hw))})}return Promise.resolve()}_animate(r,e){let t=this.target,n=t.style,i=r.width/e.width,s=r.height/e.height,l=r.x-e.x+"px",p=r.y-e.y+"px";return n.transformOrigin="0 0",n.transition="none",n.transform=`translate(${l}, ${p}) scale(${i}, ${s})`,n.width=e.width+"px",n.height=e.height+"px",n.top=e.y+"px",n.left=e.x+"px",requestAnimationFrame(()=>{let u=this.duration||Iy;n.transition=`transform cubic-bezier(0.445, 0.05, 0.55, 0.95) ${u}ms, opacity ${u}ms`,n.transform="translate(0, 0) scale(1)"}),a.waitForAnimationEnd(t,Iy+10)}};c([h({converter:m.Boolean})],ps.prototype,"hero",2),c([h({converter:$y,emit:!1})],ps.prototype,"to",2),c([h({converter:$y,emit:!1})],ps.prototype,"from",2),c([h({converter:m.Number,emit:!1})],ps.prototype,"duration",2),ps=c([C({tagName:d+"-fx-hero"})],ps);var Hy=b+"-fx-list",Xd=class extends pr{constructor(){super(...arguments);this._observed=e=>{let t=Array.from(this.target.children);for(let n of e)n.removedNodes.forEach(i=>{i instanceof Element&&this.dispatchEvent(new CustomEvent("itemremoved",{detail:i}))}),n.addedNodes.forEach((i,s)=>{i instanceof Element&&this.dispatchEvent(new CustomEvent("itemadded",{detail:{item:i,index:t.indexOf(i)}}))})}}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.target)||this._setup()}disconnectedCallback(){a.isNull(this._observer)||this._observer.disconnect(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"&&(t?this._reset(t):this._setup())}_reset(e){a.removeClass(e,Hy),this._observer.disconnect()}_setup(){let e=this.target;a.addClass(e,Hy),(this._observer=new MutationObserver(this._observed)).observe(e,{childList:!0})}};Xd=c([C({tagName:d+"-fx-list"})],Xd);var qd="gradientchange",im=class extends Event{constructor(){super(qd,{cancelable:!1,bubbles:!1})}},fw={convert:(o,r)=>{try{return Zs.parse(o)}catch{return m.Number.convert(o,r)}}};function Fc(o){return Math.round(o*1e3)/10+"%"}var ds=class extends R.PacemItemElement{findContainer(){return A.findAncestor(this,r=>r instanceof ml)}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="offset"||r==="color"||r==="opacity"||r==="disabled"||r==="hide")&&this.dispatchEvent(new im)}};c([h({emit:!1,converter:m.Number})],ds.prototype,"offset",2),c([h({emit:!1,converter:m.String})],ds.prototype,"color",2),c([h({emit:!1,converter:m.Number})],ds.prototype,"opacity",2),ds=c([C({tagName:d+"-fx-gradient-stop"})],ds);var ml=class extends R.PacemCrossItemsContainerElement{constructor(){super(...arguments);this._dispatchGradientChangeHandler=e=>{this._dispatchGradientChange()}}validate(e){return e instanceof ds}register(e){let t=super.register(e);return t&&e.addEventListener(qd,this._dispatchGradientChangeHandler,!1),t}unregister(e){let t=super.unregister(e);return t&&e.removeEventListener(qd,this._dispatchGradientChangeHandler,!1),t}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&this.doesPropertyTriggerGradientChange(e)&&this._dispatchGradientChange()}_dispatchGradientChange(){this.dispatchEvent(new im)}buildColor(e,t){if(t>=0&&t<=1){let n=Be.parse(e);return Be.stringify(a.extend(n,{a:t}))}return e}},Ia=class extends ml{doesPropertyTriggerGradientChange(r){return["shape","size","center","items","hide","disabled"].indexOf(r)>=0}buildGradient(){let r=this.items;if(a.isNullOrEmpty(r))return"";let e=this.shape==="circle"?"circle":"ellipse",t=this.center??{x:.5,y:.5},n=this.size,i="";a.isNullOrEmpty(n)||(typeof n=="number"?i=`${n}px`:i=`${Fc(n.width/2)} ${Fc(n.height/2)}`);let s=[];for(let{offset:l,color:p,hide:u,disabled:f,opacity:g}of r){if(u||f)continue;let v=this.buildColor(p,g);s.push(`${v} ${Fc(l)}`)}return`radial-gradient(${e} ${i} at ${Fc(t.x)} ${Fc(t.y)} in oklab, ${s.join(", ")})`}};c([h({emit:!1,converter:m.String})],Ia.prototype,"shape",2),c([h({emit:!1,converter:m.Point})],Ia.prototype,"center",2),c([h({emit:!1,converter:fw})],Ia.prototype,"size",2),Ia=c([C({tagName:d+"-fx-gradient-radial"})],Ia);var Wc=class extends ml{doesPropertyTriggerGradientChange(r){return["angle","items","hide","disabled"].indexOf(r)>=0}buildGradient(){let r=this.items;if(a.isNullOrEmpty(r))return"";let e=this.angle??0,t=[];for(let{offset:n,color:i,hide:s,disabled:l,opacity:p}of r){if(s||l)continue;let u=this.buildColor(i,p);t.push(`${u} ${Fc(n)}`)}return`linear-gradient(${e}deg in oklab, ${t.join(", ")})`}};c([h({emit:!1,converter:m.Number})],Wc.prototype,"angle",2),Wc=c([C({tagName:d+"-fx-gradient-linear"})],Wc);var $a=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._gradientChangeHandler=e=>{this._buildGradient()}}validate(e){return e instanceof ml}register(e){let t=super.register(e);return t&&e.addEventListener(qd,this._gradientChangeHandler,!1),t}unregister(e){let t=super.unregister(e);return t&&e.removeEventListener(qd,this._gradientChangeHandler,!1),t}viewActivatedCallback(){super.viewActivatedCallback(),this._buildGradient()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"target":t&&this._removeGradient(t);case"mode":case"disabled":this._buildGradient();break}}_removeGradient(e){a.removeClass(e,b+"-fx-gradient-text"),a.removeClass(e,b+"-fx-gradient-fill"),e.style.backgroundImage=""}_buildGradient(){let e=this.target;if(a.isNull(e))return;let t="",n=this.disabled?[]:this.items??[];for(let i of n){if(i.hide||i.disabled)continue;let s=i.buildGradient();a.isNullOrEmpty(s)||(t+=s,t.trim().endsWith(",")||(t+=","))}if(a.isNullOrEmpty(t))this._removeGradient(e);else{let i=b+"-fx-gradient-text",s=b+"-fx-gradient-fill",l=this.mode==="text";a.removeClass(e,l?s:i),a.addClass(e,l?i:s),e.style.backgroundImage=t.substring(0,t.length-1)}}};c([h({converter:m.Element})],$a.prototype,"target",2),c([h({converter:m.String})],$a.prototype,"mode",2),c([me(!0)],$a.prototype,"_buildGradient",1),$a=c([C({tagName:d+"-fx-gradient"})],$a);var By=b+"-fancy",gw=b+"-fancify",vw=20,Ha=class extends pr{constructor(){super(...arguments);this._progress=0;this._started=!1}get progress(){return this._progress}get started(){return this._started}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="fancify"||e==="target")&&(a.isNull(this.target)||(this.fancify?this.start():this._reset()))}viewActivatedCallback(){super.viewActivatedCallback(),this.fancify&&!a.isNull(this.target)&&this.start()}disconnectedCallback(){cancelAnimationFrame(this._handle),clearTimeout(this._handle1),a.isNull(this.target)||this._reset(),super.disconnectedCallback()}_reset(){a.removeClass(this.target,By),this._started&&this.dispatchEvent(new ue({propertyName:"started",oldValue:this._started,currentValue:this._started=!1})),this.dispatchEvent(new ue({propertyName:"progress",oldValue:this._progress,currentValue:this._progress=0})),a.isNull(this._originalContent)?this._originalContent=this.target.innerHTML:this.target.innerHTML=this._originalContent}_parse(){let e,t=[],n=document.createTreeWalker(this.target,NodeFilter.SHOW_TEXT);for(;e=n.nextNode();)e.textContent&&t.push(e);this._textNodes=t}start(){this.disabled||(this._reset(),this._parse(),this._startShow(),this._handle1=setTimeout(()=>{this.dispatchEvent(new ue({propertyName:"started",oldValue:this._started,currentValue:this._started=!0}))},this.delay||0))}_startShow(e=0){a.addClass(this.target,By);let t=this._textNodes,n=t.length;this._fancify(t[e]);let i=this._progress;e++;let s=this._progress=e/n;this.dispatchEvent(new ue({propertyName:"progress",oldValue:i,currentValue:s})),e<n&&(this._handle=requestAnimationFrame(()=>{this._startShow(e)}))}_fancify(e){let t=e.textContent;if(a.isNullOrEmpty(t)||!/[^\s]/.test(t))return;let n=/^\s/.test(t),i=/\s$/.test(t);e.textContent="";let s=t.trim().split(" "),l=this.gap||vw,p=this.delay||0,u=0;for(let g of s){var f=document.createElement("span");f.className=gw,f.style.animationDelay=`${p+u*l}ms`,(n||u>0)&&e.parentElement.insertBefore(document.createTextNode(" "),e),f.textContent=g,e.parentElement.insertBefore(f,e),u++}i&&e.parentElement.insertBefore(document.createTextNode(" "),e)}};c([h({converter:m.Boolean})],Ha.prototype,"fancify",2),c([h({converter:m.Number})],Ha.prototype,"delay",2),c([h({converter:m.Number})],Ha.prototype,"gap",2),Ha=c([C({tagName:d+"-fx-fancy"})],Ha);var Xg={};Se(Xg,{PacemConsoleElement:()=>jc,PacemFpsElement:()=>Kd,PacemTrackerElement:()=>Ba});var Vy={current:0,count:0,average:0,max:Number.MIN_VALUE,min:Number.MAX_VALUE},Ba=class extends K{constructor(){super();this.data=Vy}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="entry"&&this._update(n).then(s=>this.data=s)}_update(e){let t=()=>{let n=this.data,i=Math.min(e,n.min),s=Math.max(e,n.max),l=n.count+1,p=(n.count*n.average+e)/l;return{count:l,min:i,max:s,average:p,current:e}};return a.fromResultAsync(t)}reset(){this.data=Vy}};c([h({converter:m.Json})],Ba.prototype,"data",2),c([h({emit:!1,converter:m.Number})],Ba.prototype,"entry",2),c([ub()],Ba.prototype,"_update",1);var Uy={error:!0,info:!0,warn:!0},jc=class extends K{constructor(){super(...arguments);this._config=Uy}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="configuration"&&(this._config=a.extend({},Uy,n??{}))}log(e,t,n){try{this._log(e,t,n)}catch{}}_log(e,t,n){if(!this.disabled&&this._config[e]===!0){n!==this._category&&(a.isNullOrEmpty(this._category)||console.groupEnd(),a.isNullOrEmpty(n)||console.group(n),this._category=n);var i=s=>{};switch(e){case ce.LogLevel.Debug:i=console.debug;break;case ce.LogLevel.Error:i=console.error;break;case ce.LogLevel.Info:i=console.info;break;case ce.LogLevel.Trace:i=console.trace;break;case ce.LogLevel.Warn:i=console.warn;break;case ce.LogLevel.Log:i=console.log;break}i(new Date().toISOString()+": "+t)}}};c([h({emit:!1,converter:m.Json})],jc.prototype,"configuration",2),jc=c([C({tagName:d+"-console"})],jc);var Kd=class extends Ba{constructor(){super()}_start(r=Date.now()){this._handle=requestAnimationFrame(()=>{let e=Date.now(),t=e-r;this.entry=Math.min(60,1e3/t),this._start(e)})}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){cancelAnimationFrame(this._handle),super.disconnectedCallback()}};Kd=c([C({tagName:d+"-fps"})],Kd);var Qc={};Se(Qc,{Maps:()=>dm});var dm={};Se(dm,{LatLngBoundsConverter:()=>Gy,LatLngConverter:()=>bl,LayerLoadEventName:()=>Yy,MapColorScheme:()=>am,MapConsts:()=>bw,MapEvent:()=>Qt,MapItemAdapter:()=>vl,MapRelevantElement:()=>ki,MapType:()=>sm,MapUtils:()=>Rr,PacemAzureMapAdapterElement:()=>Mi,PacemGoogleMapAdapterElement:()=>nn,PacemLayerAdapter:()=>hs,PacemLeafletMapAdapterElement:()=>Ua,PacemMapAdapterElement:()=>Dn,PacemMapCircleElement:()=>An,PacemMapElement:()=>qe,PacemMapGeocodeElement:()=>Tn,PacemMapGeolocateElement:()=>gs,PacemMapLayerElement:()=>en,PacemMapMarkerElement:()=>Dr,PacemMapOverlayElement:()=>gl,PacemMapOverlayImageElement:()=>Va,PacemMapPolygonElement:()=>wi,PacemMapPolylineElement:()=>Ei,PacemMapShapeElement:()=>tn,PacemMarkerAdapter:()=>ms,PacemOverlayAdapter:()=>us,PacemShapeAdapter:()=>fs,isLatLng:()=>yw,isLatLngBounds:()=>_w});var sm=(i=>(i.ROAD="road",i.SATELLITE="satellite",i.HYBRID="hybrid",i.TERRAIN="terrain",i.HIGH_CONTRAST="high_contrast",i))(sm||{}),am=(t=>(t.LIGHT="light",t.DARK="dark",t.SYSTEM="system",t))(am||{}),rn={MAP_SELECTOR:d+"-map",LINK_SELECTOR:d+"-map-link",MARKER_SELECTOR:d+"-map-marker",POLYLINE_SELECTOR:d+"-map-polyline",CIRCLE_SELECTOR:d+"-map-circle",POLYGON_SELECTOR:d+"-map-polygon",RECTANGLE_SELECTOR:d+"-map-rectangle",LAYER_SELECTOR:d+"-map-layer",OVERLAY_IMAGE_SELECTOR:d+"-map-overlay-image",OVERLAY_PANEL_SELECTOR:d+"-map-overlay-panel",GEOCODER_SELECTOR:d+"-map-geocode",DEFAULT_COORDS:{lat:44.71418802507798,lng:10.296516444873811}},bw={DEFAULT_COORDS:rn.DEFAULT_COORDS};function yw(o){return it.isLatLng(o)}function _w(o){return st.isLatLngBounds(o)}var zy="defaultMapTarget",bl={convert:o=>{let r=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(o);return r&&r.length>2?{lat:parseFloat(r[1]),lng:parseFloat(r[2])}:JSON.parse(o)},convertBack:o=>JSON.stringify(o)},Gy={convert:o=>{let r=/^\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*,?\s*([+\-\d\.]+)\s*$/.exec(o);return r&&r.length>4?{sw:{lat:parseFloat(r[3]),lng:parseFloat(r[4])},ne:{lat:parseFloat(r[1]),lng:parseFloat(r[2])}}:JSON.parse(o)},convertBack:o=>JSON.stringify(o)},Rr=class{static parseCoords(r){if(r&&!isNaN(r.lat)&&!isNaN(r.lng))return[r.lat,r.lng];if(a.isArray(r)&&r.length>1)return[r[0],r[1]];if(/^\s*(\+|-)?[\d]+(.[\d]+)?\s*,\s*(\+|-)?[\d]+(.[\d]+)?\s*$/.test(r)){var e=r.split(",");return[parseFloat(e[0]),parseFloat(e[1])]}return[rn.DEFAULT_COORDS.lat,rn.DEFAULT_COORDS.lng]}static expandBounds(r,e){e&&(Array.isArray(e)||(e=[e.lat,e.lng]),r.push(e))}static isContentEmpty(r){return r.children.length==0}},ki=class extends K{get map(){return this._map=this._map||A.findAncestorOfType(this,qe)}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n&&r==="hide"){let i=this.map;i?.adapter?.fitBounds(i,!0)}}viewActivatedCallback(){super.viewActivatedCallback(),this.map&&this.map.register(this)}disconnectedCallback(){this.map&&this.map.unregister(this),super.disconnectedCallback()}};c([h({converter:m.Boolean})],ki.prototype,"hide",2),c([h({converter:m.Boolean})],ki.prototype,"inactive",2);var Qt=class extends oe{constructor(r,e){super(r,e)}},Yc,Xc,qc,Tn=class extends K{constructor(){super(...arguments);this.debounce=1e3;z(this,Yc,!1);z(this,Xc);z(this,qc)}get fetching(){return M(this,Yc)}_guards(){let e=this.results;if(!a.isNullOrEmpty(e)){let n=e[0];if(!a.isNull(this.position)&&it.equals(this.position,n.position)&&this.search===n.fullAddress)return Promise.resolve(e)}let t=this.adapter;return a.isNull(t)||t.disabled||!t.active?Promise.resolve([]):null}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"search":this.geocode(n);break;case"position":this.reverseGeocode(n);break;case"results":if(a.isNullOrEmpty(n))this.search="",this.position=null;else{let s=n[0];this.search=s.fullAddress,this.position=s.position}break}}_broadcastFetchingUpdate(e){e!==M(this,Yc)&&(H(this,Yc,e),this.dispatchEvent(new ue({propertyName:"fetching",oldValue:!e,currentValue:e})))}_fetch(e){let{promise:t,search:n,position:i,key:s}=e,l=M(this,qc);!a.isNull(l)&&it.equals(l.position,i)&&(l.search||"")===(n||"")||(H(this,qc,{key:s,promise:t,position:i,search:n}),this._broadcastFetchingUpdate(!0),t.then(p=>{s===M(this,qc).key&&(this._broadcastFetchingUpdate(!1),this._successCallback(p))},p=>this._errorCallback(p)))}_debounce(e,t=this.debounce){M(this,Xc)&&clearTimeout(M(this,Xc)),H(this,Xc,window.setTimeout(()=>{e()},t||0))}reverseGeocode(e=this.position,t=this.maxResults){this.disabled||this._debounce(()=>{let n=this._guards()??this.adapter.reverseGeocode(e,t||1);this._fetch({promise:n,position:e,key:a.uniqueCode()})})}geocode(e=this.search,t=this.maxResults){this.disabled||this._debounce(()=>{let n=this._guards()??this.adapter.geocode(e,t||10);this._fetch({promise:n,search:e,position:it.Empty,key:a.uniqueCode()})})}_successCallback(e){let t=!a.isNullOrEmpty(e);(t||!a.isNullOrEmpty(this.results))&&e!==this.results&&(this.results=e,t&&this.dispatchEvent(new CustomEvent("success",{detail:e,bubbles:!1,cancelable:!1})))}_errorCallback(e){a.isNullOrEmpty(this.results)||(this.results=[]),this.dispatchEvent(new CustomEvent("error",{detail:e,bubbles:!1,cancelable:!1}))}};Yc=new WeakMap,Xc=new WeakMap,qc=new WeakMap,c([h({emit:!1,converter:m.Element})],Tn.prototype,"adapter",2),c([h({emit:!1,converter:m.Number})],Tn.prototype,"maxResults",2),c([h({emit:!1,converter:m.Number})],Tn.prototype,"debounce",2),c([h({emit:!0,converter:m.Json})],Tn.prototype,"results",2),c([h({emit:!0,converter:m.String})],Tn.prototype,"search",2),c([h({emit:!0,converter:bl})],Tn.prototype,"position",2),Tn=c([C({tagName:rn.GEOCODER_SELECTOR})],Tn);var Dn=class extends K{constructor(){super(...arguments);this.active=!0;this.#e=new Map;this.#t=new WeakMap;this.#r=new WeakMap;this.#n=new WeakMap;this.#i=new WeakMap}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||(this.active=!this.disabled&&this.isActive())}#e;#t;#r;#n;#i;get layerAdapters(){return this.#n}get overlayAdapters(){return this.#i}get markerAdapters(){return this.#t}get shapeAdapters(){return this.#r}hasMap(e){return this.#e.has(e)}enrolledMaps(){return this.#e.keys()}tryGetMap(e){let t=this.#e;return t.has(e)?t.get(e):null}getMap(e){return this.tryGetMap(e)?.map}async initialize(e){let t=this.#e;if(!t.has(e)){let n=await this.init(e);t.set(e,n);let i=this.#n;i.has(e)||i.set(e,this.buildLayerAdapterFor(e));let s=this.#i;s.has(e)||s.set(e,this.buildOverlayAdapterFor(e));let l=this.#t;l.has(e)||l.set(e,this.buildMarkerAdapterFor(e));let p=this.#r;return p.has(e)||p.set(e,this.buildShapeAdapterFor(e)),n.container}return t.get(e).container}destroy(e){let t=this.#n;t.has(e)&&t.delete(e);let n=this.#i;n.has(e)&&n.delete(e);let i=this.#t;i.has(e)&&i.delete(e);let s=this.#r;s.has(e)&&s.delete(e);let l=this.#e;l.has(e)&&(this.dispose(e),l.delete(e))}removeItem(e){let t=e.map;if(e instanceof en){let n=this.layerAdapters;n.has(t)&&n.get(t).removeLayer(e)}else if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).removeMarker(e)}else if(e instanceof tn){let n=this.shapeAdapters;n.has(t)&&n.get(t).removeShape(e)}else if(e instanceof gl){let n=this.overlayAdapters;n.has(t)&&n.get(t).removeOverlay(e)}e.inactive||this.fitBounds(t,!0)}drawItem(e){let t=e.map;if(e instanceof en){let n=this.layerAdapters;n.has(t)&&n.get(t).drawLayer(e)}else if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).drawMarker(e)}else if(e instanceof tn){let n=this.shapeAdapters;n.has(t)&&n.get(t).drawShape(e)}else if(e instanceof gl){let n=this.overlayAdapters;n.has(t)&&n.get(t).drawOverlay(e)}e.inactive||this.fitBounds(t,!0)}popupInfoWindow(e){let t=e.map;if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).openInfoWindow(e)}}popoutInfoWindow(e){let t=e.map;if(e instanceof Dr){let n=this.markerAdapters;n.has(t)&&n.get(t).closeInfoWindow(e)}}setView(e,t,n){if(!this.hasMap(e))return;let i={};typeof t=="number"?i=a.extend({},{zoom:t}):it.isLatLng(t)?i=a.extend({},{center:t,zoom:n}):i=t,this.setViewNative(e,i)}fitBounds(e,t){if(!a.isNull(e))this._fitBounds(e,t);else for(let n of this.enrolledMaps()||[])this._fitBounds(n,t)}_fitBounds(e,t){if(!this.hasMap(e)||!e.autofit&&t===!0)return;if(st.isLatLngBounds(t)&&!st.isEmpty(t)){this.fitBoundsNative(e,t);return}let n=this.markerAdapters.get(e)?.getBounds(),i=this.shapeAdapters.get(e)?.getBounds(),s=a.isNull(n)||st.isEmpty(n),l=a.isNull(i)||st.isEmpty(i);if(s&&l){this.setView(e,{center:e.center,zoom:e.zoom});return}let p=st.Empty;s||(p=st.union(p,n)),l||(p=st.union(p,i)),st.isPoint(p)?this.setView(e,{zoom:e.zoom,center:p.ne}):this.fitBoundsNative(e,p)}updateMapElement(e,t,n){["type","tilt","heading"].forEach(l=>{l in t&&(e[l]=t[l])});let i="zoom"in t?t.zoom:n;!a.isNullOrEmpty(i)&&i!==e.zoom&&(e.zoom=i);let s=it.isLatLng(t)?t:t.center;!a.isNullOrEmpty(s)&&(s.lat!=e.center?.lat||s.lng!=e.center?.lng)&&(e.center=s),e.updateBounds(this.getBounds(e))}};c([h({emit:!0,converter:m.Boolean})],Dn.prototype,"active",2),c([me(1e3,(e,t)=>`pacem:debounce:${e}:${t.id}`)],Dn.prototype,"_fitBounds",1);var vl=class{constructor(r,e=r.adapter){this._map=r;this._adapter=e}get adapter(){return this._adapter}get map(){return this._map}getMap(r){return this._adapter.getMap(r.map)}},us=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;get layers(){return this.#e}onOverlayLoad(r,e){r.dispatchEvent(new Event("overlayload"))}ensureOverlay(r,e){let t=this,n=t.#e,i;return n.has(r)?i=n.get(r):(i=this.buildOverlay(r,e),a.isNull(i)||n.set(r,i)),i}removeOverlay(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r);e.deleteOverlay(i,t),n.delete(r)}}drawOverlay(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r)||r.hide){e.removeOverlay(r);return}let n=this.ensureOverlay(r,t);this.setBounds(n,t,r.bounds),this.updateOverlay(n,t,r)}},gl=class extends ki{};c([h({emit:!1,converter:Gy})],gl.prototype,"bounds",2);var Va=class extends gl{};c([h({emit:!1,converter:m.String})],Va.prototype,"src",2),Va=c([C({tagName:rn.OVERLAY_IMAGE_SELECTOR})],Va);var hs=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;#t=new Map;get layers(){return this.#e}onTileLoad(r,e){r.dispatchEvent(new Event("tileload"))}ensureLayer(r,e){let t=this,n=t.#e,i;if(n.has(r))i=n.get(r);else if(i=this.buildLayer(r,e),i!=null){let s=l=>{t.onTileLoad(r,l)};this.#t.set(r,s),this.addLoadEventListener(i,e,s),n.set(r,i)}return i}removeLayer(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r),s=this.#t;if(s.has(r)){let l=s.get(r);this.removeLoadEventListener(i,t,l),s.delete(r)}e.deleteLayer(i,t),n.delete(r)}}drawLayer(r){let e=this,t=e.getMap(r);if(!a.isNull(t)){if(a.isNullOrEmpty(r)||r.hide){e.removeLayer(r);return}this.ensureLayer(r,t)}}},en=class extends ki{};c([h({emit:!1,converter:m.String})],en.prototype,"url",2),c([h({emit:!1,converter:m.Json})],en.prototype,"include",2),c([h({emit:!1,converter:m.String})],en.prototype,"mode",2),c([h({emit:!1,converter:m.Number})],en.prototype,"minZoom",2),c([h({emit:!1,converter:m.Number})],en.prototype,"maxZoom",2),en=c([C({tagName:rn.LAYER_SELECTOR})],en);var ms=class extends vl{constructor(r,e=r.adapter){super(r,e)}get mapAutomaticallyScrollsOnDrag(){return!1}#e=new Map;#t=new Map;getBounds(r=e=>!0){let e=this.markers,t=st.Empty;for(var n of e.keys()){if(!r(n)||n.inactive)continue;let i=e.get(n);a.isNull(i)||(t=st.union(t,this.getMarkerPosition(i)))}return t}get markers(){return this.#e}get infoWindows(){return this.#t}onDragEnd(r,e){let t=this.markers.get(r),n=this.getMarkerPosition(t);r.onDragEnd(n)}onClick(r,e){let t=this.markers.get(r),n=this.getMarkerPosition(t);r.onClick(n)}onInfoOpen(r){r.onInfoOpen()}onInfoClose(r){r.onInfoClose()}ensureMarker(r,e){let t=this,n;return t.markers.has(r)?n=t.markers.get(r):(n=this.buildMarker(r,e),n!=null&&(this.addClickEventListener(n,e,i=>{t.onClick(r,i),t.openInfoWindow(r,i)}),this.addDragEventListener(n,e,i=>{this.mapAutomaticallyScrollsOnDrag||t.adapter.fitBounds(r.map,!0)}),this.addDragEndEventListener(n,e,i=>t.onDragEnd(r,i)),t.markers.set(r,n))),n}removeMarker(r){let e=this,t=e.getMap(r),n=this.#t,i=this.#e;if(n.has(r)&&n.delete(r),i.has(r)){let s=i.get(r);e.deleteMarker(s,t),i.delete(r)}}drawMarker(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r&&r.position)||r.hide){e.removeMarker(r);return}let n=this.ensureMarker(r,t);this.setPosition(n,r.position),this.setIcon(n,r.icon),this.setLabel(n,r.caption),this.setDraggable(n,r.draggable)}closeInfoWindow(r,e){let t=this;if(t.infoWindows.has(r)){let n=t.infoWindows.get(r);this.closeInfo(n)}}ensureInfoWindow(r,e){var t=this;let n;return t.infoWindows.has(r)?n=t.infoWindows.get(r):(n=this.buildInfoWindow(r),this.addCloseClickEventListener(n,e,i=>{t.deleteInfoWindow(n,e),t.onInfoClose(r)}),t.infoWindows.set(r,n)),n}openInfoWindow(r,e){var t=this,n=t.markers.get(r),i=r.caption,s=t.getMap(r);if(Rr.isContentEmpty(r)||(i=r.innerHTML),!a.isNullOrEmpty(i)){let l=this.ensureInfoWindow(r,s);this.setContent(l,i),this.openInfo(l,i,s,n),t.onInfoOpen(r)}}},Dr=class extends ki{onDragEnd(r){this.position=r,this.dispatchEvent(new Qt("dragend",{position:r}))}onClick(r){this.position=r,this.dispatchEvent(new Qt("click",{position:r}))}onInfoOpen(){this.dispatchEvent(new Qt("openinfo"))}onInfoClose(){this.dispatchEvent(new Qt("closeinfo"))}};c([h({converter:bl})],Dr.prototype,"position",2),c([h({converter:m.Json})],Dr.prototype,"icon",2),c([h({converter:m.String})],Dr.prototype,"caption",2),c([h({converter:m.Boolean})],Dr.prototype,"draggable",2),Dr=c([C({tagName:rn.MARKER_SELECTOR})],Dr);var fs=class extends vl{constructor(r,e=r.adapter){super(r,e)}#e=new Map;get shapes(){return this.#e}getBounds(r=e=>!0){let e=this.shapes,t=st.Empty;for(var n of e.keys()){if(!r(n)||n.inactive)continue;let i=e.get(n);a.isNull(i)||(t=st.union(t,this.getShapeBounds(i)))}return t}removeShape(r){let e=this,t=e.getMap(r),n=this.#e;if(n.has(r)){let i=n.get(r);e.deleteShape(i,t),n.delete(r)}}_dispatchEvent(r,e,t){let n=this.shapes.get(r),i=this.getShapePosition(t??n);r.dispatchEvent(new Qt(e,{position:i}))}#t=new Map;onDragStart(r,e){let t=this.shapes.get(r),n=this.getShapeBounds(t);this.#t.set(r,n.ne),this._dispatchEvent(r,"dragstart",e)}onDragEnd(r,e){let t=this.shapes.get(r),n=this.getShapeBounds(t),i=this.#t.get(r),s=n.ne,l={lat:s.lat-i.lat,lng:s.lng-i.lng};this._translateShape(r,l),this._dispatchEvent(r,"dragend",e)}_translateShape(r,e){if(r instanceof An){r.center=it.translate(r.center,e);return}if(r instanceof Ei){let t=r.vertices.map(n=>it.translate(n,e));r.vertices=t;return}if(r instanceof wi){let t=r.vertices.map(n=>it.translate(n,e));r.vertices=t;return}}onDrag(r,e){this._dispatchEvent(r,"drag",e)}onClick(r,e){this._dispatchEvent(r,"click",e)}ensureShape(r,e){let t=this,n;return t.shapes.has(r)?n=t.shapes.get(r):(n=this.buildShape(r,e),n!=null&&(this.addClickEventListener(n,i=>t.onClick(r,i)),this.addDragEventListener(n,i=>{t.onDrag(r,i),t.adapter.fitBounds(r.map,!0)}),this.addDragEndEventListener(n,i=>t.onDragEnd(r,i)),this.addDragStartEventListener(n,i=>t.onDragStart(r,i)),t.shapes.set(r,n))),n}drawShape(r){let e=this,t=e.getMap(r);if(a.isNull(t))return;if(a.isNullOrEmpty(r)||r.hide){e.removeShape(r);return}let n=this.ensureShape(r,t);this.setShape(n,r),this.setEditable(n,r.editable),this.setDraggable(n,r.draggable)}},tn=class extends ki{};c([h({emit:!0,converter:m.Boolean})],tn.prototype,"draggable",2),c([h({emit:!0,converter:m.Boolean})],tn.prototype,"editable",2),c([h({emit:!0,converter:m.Json})],tn.prototype,"stroke",2),c([h({emit:!0,converter:m.Json})],tn.prototype,"fill",2);var Ei=class extends tn{};c([h({emit:!0,converter:m.Json})],Ei.prototype,"vertices",2),Ei=c([C({tagName:rn.POLYLINE_SELECTOR})],Ei);var wi=class extends tn{};c([h({emit:!0,converter:m.Json})],wi.prototype,"vertices",2),wi=c([C({tagName:rn.POLYGON_SELECTOR})],wi);var An=class extends tn{};c([h({emit:!0,converter:bl})],An.prototype,"center",2),c([h({emit:!0,converter:m.Json})],An.prototype,"radius",2),An=c([C({tagName:rn.CIRCLE_SELECTOR})],An);var fl,qe=class extends K{constructor(){super(...arguments);this.zoom=12;this.center=rn.DEFAULT_COORDS;z(this,fl,st.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=>{let t=e.target;e.detail.propertyName==="active"&&e.detail.currentValue&&(t.removeEventListener(ee,this._listenToActiveAdapter,!1),this._switchAdapter(t))};this._initialized=!1;this._afterInit=(e,t)=>{this._initialized=!0;for(var n of A.findDescendants(this,i=>i instanceof ki))this._erase(n,t),this._draw(n);t&&t?.destroy(this)};this._resizeHandler=e=>{this.onResize(e)}}updateBounds(e){if(!st.equals(e,M(this,fl))){let t=M(this,fl),n=H(this,fl,e);this.dispatchEvent(new ue({propertyName:"bounds",oldValue:t,currentValue:n}))}}get bounds(){return M(this,fl)}get container(){return this._container}register(e){e.addEventListener(ee,this._drawHandler,!1),this._draw(e)}unregister(e){this._erase(e),e.removeEventListener(ee,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,t){e.active?e.initialize(this).then(n=>this._afterInit(n,t)):(t&&this._afterInit(null,t),e.addEventListener(ee,this._listenToActiveAdapter,!1))}viewActivatedCallback(){super.viewActivatedCallback(),this._setupContainer(),this.adapter&&this._switchAdapter(this.adapter)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e!=="bounds")if(e==="adapter")a.isNull(this._container)||(this._initialized=!1,n?this._switchAdapter(n,t):t&&this._afterInit(null,t));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":n&&this.adapter?.fitBounds(this);break;case"target":t&&this._dismissContainer(t),n?(this._setupContainer(n),this._setupResizer()):this._dismissResizer();break}this.adapter&&this.adapter.invalidateSize(this)}}_dismissContainer(e=this._container){e.dataset[zy]==="true"?e.remove():a.removeClass(e,b+"-map"),e===this._container&&(this._container=null)}_dismissResizer(){let e=this._resizer;e.removeEventListener("resize",this._resizeHandler,!1),e.remove(),this._resizer=null}_setupContainer(e=this.target){a.isNull(e)&&(e=document.createElement("div"),e.dataset[zy]="true",this.insertAdjacentElement("afterend",e));let t=this._container=e;return a.addClass(t,b+"-map"),t}_setupResizer(){let e=this._container;if(a.isNull(e))throw new Error("You must set up the map container before its resizing listener.");if(a.isNull(this._resizer)){let t=this._resizer=document.createElement(d+"-resize");t.addEventListener("resize",this._resizeHandler,!1),e.insertAdjacentElement("afterend",t)}return this._resizer.target=e,this._resizer}_detach(){a.isNull(this._container)||this._dismissContainer(),a.isNull(this._resizer)||this._dismissResizer()}disconnectedCallback(){this._detach(),super.disconnectedCallback()}onResize(e){this.adapter&&this.adapter.invalidateSize(this)}};fl=new WeakMap,c([h({emit:!0,converter:m.Number})],qe.prototype,"zoom",2),c([h({emit:!0,converter:bl})],qe.prototype,"center",2),c([h({emit:!1,converter:m.String})],qe.prototype,"type",2),c([h({emit:!1,converter:m.String})],qe.prototype,"theme",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"scale",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"mousewheel",2),c([h({emit:!1,converter:m.String})],qe.prototype,"zoomControl",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"draggable",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"doubleClickZoom",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"keyboardShortcuts",2),c([h({emit:!1,converter:m.Boolean})],qe.prototype,"autofit",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingTop",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingLeft",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingRight",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"paddingBottom",2),c([h({emit:!1,converter:m.Element})],qe.prototype,"adapter",2),c([h({emit:!1,converter:m.Element})],qe.prototype,"target",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"tilt",2),c([h({emit:!1,converter:m.Number})],qe.prototype,"heading",2),qe=c([C({tagName:rn.MAP_SELECTOR})],qe);var Jd={GEOLOCATION_UNAVAILABLE:"geolocation_unavailable",POSITION_UNAVAILABLE:"position_unavailable",PERMISSION_DENIED:"permission_denied",TIMEOUT:"timeout",UNKNOWN_ERROR:"unknown_error"},Zd,gs=class extends K{constructor(){super(...arguments);this.permission="prompt";this.maximumAge=15e3;this.timeout=3e4;z(this,Zd,!1);this._successCallback=e=>{this.permission="granted",this._setFetching(!1);let 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);let t=typeof e=="string"?e:this._errToString(e);this.dispatchEvent(new CustomEvent("error",{detail:t}))}}_checkPermission(){return new Promise(e=>{let t=navigator.permissions;a.isNull(t)?e("prompt"):t.query({name:"geolocation"}).then(n=>{e(this.permission=n.state)})})}get fetching(){return M(this,Zd)}_setFetching(e){e!==this.fetching&&(H(this,Zd,e),this.dispatchEvent(new ue({propertyName:"fetching",currentValue:e,oldValue:!e})))}fetch(){if(!this.disabled){if(!navigator.geolocation){this._errorCallback(Jd.GEOLOCATION_UNAVAILABLE);return}this._checkPermission().then(e=>{this._setFetching(!0),navigator.geolocation.getCurrentPosition(this._successCallback,this._errorCallback,{enableHighAccuracy:!0,maximumAge:this.maximumAge})})}}viewActivatedCallback(){super.viewActivatedCallback(),this._checkPermission()}_errToString(e){switch(e.code){case GeolocationPositionError.PERMISSION_DENIED:return Jd.PERMISSION_DENIED;case GeolocationPositionError.POSITION_UNAVAILABLE:return Jd.POSITION_UNAVAILABLE;case GeolocationPositionError.TIMEOUT:return Jd.TIMEOUT;default:return Jd.UNKNOWN_ERROR}}};Zd=new WeakMap,c([h({emit:!0,converter:bl})],gs.prototype,"position",2),c([h({emit:!0,converter:m.String})],gs.prototype,"permission",2),c([h({emit:!1,converter:m.Number})],gs.prototype,"maximumAge",2),c([h({emit:!1,converter:m.Number})],gs.prototype,"timeout",2),gs=c([C({tagName:d+"-map-geolocate"})],gs);var Fy={TIMEOUT:1e3,API_JS:"https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js",API_CSS:"https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css"};function Wy(o){return{city:o.municipality,state:o.countrySubdivision,province:o.countrySecondarySubdivision,village:o.municipalitySubdivision??o.localName,zipCode:o.postalCode,streetName:o.street??o.streetName,houseNumber:o.buildingNumber??o.streetNumber,countryCode:o.countryCode,country:o.country}}var Rn=class o{static getPosition(r){return Array.isArray(r)&&(r={lat:r[0],lng:r[1]}),atlas.data.Position.fromLatLng(r)}static getBounds(r){if(a.isArray(r))return atlas.data.BoundingBox.fromPositions(r.map(n=>[n[1],n[0]]));let e=o.getPosition(r.ne),t=o.getPosition(r.sw);return atlas.data.BoundingBox.fromPositions([e,t])}static getLatLng(r){return{lat:r[1],lng:r[0]}}static getLatLngBounds(r){let e=atlas.data.BoundingBox.getNorthEast(r),t=atlas.data.BoundingBox.getSouthWest(r);return{ne:o.getLatLng(e),sw:o.getLatLng(t)}}static parseGeocoding(r){return a.isNullOrEmpty(r.results)?[]:r.results.map(e=>({fullAddress:e.address.freeformAddress,address:Wy(e.address),position:{lat:e.position.lat,lng:e.position.lon,altitude:null}}))}static parseReverseGeocoding(r,e){if(r.summary.numResults<1)return{fullAddress:"",address:{},position:null};let t=r.addresses[0],n=(e??t.position).split(",").map(l=>parseFloat(l)),i=t.address;return{fullAddress:i.freeformAddress,address:Wy(i),position:{lat:n[0],lng:n[1],altitude:n.length>2?n[2]:null}}}},qg=class extends us{deleteOverlay(r,e){throw new Error("Method not implemented.")}buildOverlay(r,e){throw new Error("Method not implemented.")}setBounds(r,e,t){throw new Error("Method not implemented.")}updateOverlay(r,e,t){throw new Error("Method not implemented.")}},Kg=class extends hs{addLoadEventListener(r,e,t){throw new Error("Method not implemented.")}removeLoadEventListener(r,e,t){throw new Error("Method not implemented.")}deleteLayer(r,e){throw new Error("Method not implemented.")}buildLayer(r,e){throw new Error("Method not implemented.")}},Jg=class extends ms{getMarkerPosition(r){let e=r.getOptions().position;return Rn.getLatLng(e)}buildMarker(r,e){let t=new atlas.HtmlMarker;return e.markers.add(t),t.setOptions({popup:new atlas.Popup}),t}addClickEventListener(r,e,t){e.events.add("click",r,t)}addDragEventListener(r,e,t){e.events.add("drag",r,t)}addDragEndEventListener(r,e,t){e.events.add("dragend",r,t)}_setPopupPosition(r,e){let t=this._getPopup(r);a.isNull(t)||t.setOptions({position:e})}setPosition(r,e){let t=Rn.getPosition(e);r.setOptions({position:t}),this._setPopupPosition(r,t)}setIcon(r,e){let t={pixelOffset:[0,-36]},n={popup:new atlas.Popup},i=(s,l,p)=>`<img width="${l||"auto"}" height="${p||"auto"}" style="pointer-events: none" src="${s}" />`;if(typeof e=="string")n.htmlContent=i(e);else if(!a.isNull(e)){let s=e.size,l=e.anchor;n.htmlContent=i(e.url,s&&s.width,s&&s.height),l?(n.anchor="top-left",n.pixelOffset=[-l.x,-l.y],t.pixelOffset=[0,-l.y]):s&&s.height&&(t.pixelOffset=[0,-s.height/2])}n.popup.setOptions(t),r.setOptions(n)}setLabel(r,e){let t={text:e};r.setOptions(t)}setDraggable(r,e){let t={draggable:e};r.setOptions(t)}deleteMarker(r,e){e.markers.remove(r)}deleteInfoWindow(r,e){this._getPopup(r).remove()}closeInfo(r){let e=this._getPopup(r);e?.isOpen()===!0&&e.close()}openInfo(r,e,t,n){let{popup:i,position:s}=r.getOptions();this._setContent(i,e,s),n.togglePopup(),t.events.addOnce("close",i,l=>{i.setOptions({content:""})})}buildInfoWindow(r){return this.markers.get(r)}addCloseClickEventListener(r,e,t){let n=this._getPopup(r);e.events.add("close",n,t)}setContent(r,e){let{popup:t,position:n}=r.getOptions();this._setContent(t,e,n)}_getPopup(r){return r.getOptions().popup}_setContent(r,e,t){r.setOptions({content:`<div style="padding: 8px 24px 8px 8px;">${e}</div>`,position:t})}},Zg=class extends fs{addDragStartEventListener(r,e){throw new Error("Method not implemented.")}deleteShape(r,e){throw new Error("Method not implemented.")}getShapeBounds(r){throw new Error("Method not implemented.")}getShapePosition(r){throw new Error("Method not implemented.")}buildShape(r,e){throw new Error("Method not implemented.")}addClickEventListener(r,e){throw new Error("Method not implemented.")}addDragEventListener(r,e){throw new Error("Method not implemented.")}addDragEndEventListener(r,e){throw new Error("Method not implemented.")}setShape(r,e){throw new Error("Method not implemented.")}setEditable(r,e){throw new Error("Method not implemented.")}setDraggable(r,e){throw new Error("Method not implemented.")}},om=class{_buildGeocodeRequest(r,e,t=10,n=""){let i="https://atlas.microsoft.com/search/address/json?api-version=1.0",s={"subscription-key":r,query:e,limit:""+t,language:n};return{uri:a.URIs.appendQuery(i,s),options:{mode:"cors"}}}parseGeocodeResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=Rn.parseGeocoding(n);e(i)},n=>t(n))})}geocode(r,e,t=10,n=""){return new Promise((i,s)=>{let l=this._buildGeocodeRequest(r,e,t,n);return fetch(l.uri,l.options).then(p=>{p.ok?this.parseGeocodeResponse(p).then(i,s):s(p)},p=>s(p))})}reverseGeocode(r,e,t=""){return new Promise((n,i)=>{let s=this._buildReverseRequest(r,e,t);return fetch(s.uri,s.options).then(l=>{l.ok?this._parseReverseResponse(l).then(n,i):i(l)},l=>i(l))})}_buildReverseRequest(r,e,t=""){let n="https://atlas.microsoft.com/search/address/reverse/json?api-version=1.0",i=Rr.parseCoords(e),s={"subscription-key":r,query:i[0]+","+i[1],language:t};return{uri:a.URIs.appendQuery(n,s),options:{mode:"cors"}}}_parseReverseResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=Rn.parseReverseGeocoding(n);e([i])},n=>t(n))})}},xw=["moveend","dragend","zoomend","rotateend"];function Cw(o){let r=o.theme=="dark"||o.theme!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;switch(o.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 o.type;case"hybrid":return"satellite_road_labels";case"satellite":return"satellite";case"terrain":return"road_shaded_relief";case"high_contrast":return r?"high_constrast_dark":"high_constrast_light";default:return r?"night":"road"}}var Kc,Qd,Mi=class extends Dn{constructor(){super(...arguments);z(this,Kc,new WeakMap);z(this,Qd,new WeakMap)}geocode(e,t){return new om().geocode(this.subscriptionKey,e,t,a.lang(this))}reverseGeocode(e,t){return new om().reverseGeocode(this.subscriptionKey,e,a.lang(this))}getBounds(e){let t=this.getMap(e),{bounds:n}=t.getCamera();return Rn.getLatLngBounds(n)}isActive(){return!a.isNullOrEmpty(this.subscriptionKey)}buildOverlayAdapterFor(e){return new qg(e,this)}buildMarkerAdapterFor(e){return new Jg(e,this)}buildShapeAdapterFor(e){return new Zg(e,this)}buildLayerAdapterFor(e){return new Kg(e,this)}setViewNative(e,t){let n=this.getMap(e);t=a.extend({type:e.type,theme:e.theme},t);let i=Cw(t);n.setStyle({style:i});let s=t.center&&Rn.getPosition(t.center)||n.getCamera().center,l=t.zoom||n.getCamera().zoom;n.setCamera({center:s,zoom:l})}snapshot(e,t="image/png",n){if(!this.hasMap(e))return Promise.reject();let{map:i}=this.tryGetMap(e);return new Promise((s,l)=>{a.blobToDataURL(M(this,Qd).get(e)).then(p=>{let u=i.getCanvasContainer();u.style.backgroundImage=`url(${p})`,u.style.backgroundSize="contain",a.snapshotElement(u,null,t,n).then(s)})})}dispose(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);M(this,Kc).get(e).forEach(i=>{t.events.remove(i.eventName,i.handler)}),M(this,Kc).delete(e),t.dispose()}async init(e){await Promise.all([A.importjs(Fy.API_JS),A.importcss(Fy.API_CSS,void 0,!0)]);let t=e,n=t.scale,i=t.draggable,s=t.doubleClickZoom,l=t.keyboardShortcuts,u={center:Rn.getPosition(t.center),zoom:t.zoom,subscriptionKey:this.subscriptionKey,dragPanInteraction:i,scrollZoomInteraction:t.mousewheel,dblClickZoomInteraction:!s,keyboardInteraction:l,language:this.language||a.lang(e)},f=t.container,g=document.createElement("div");g.id=`azure-maps-${a.uniqueCode()}`,g.style.width="100%",g.style.height="100%",f.innerHTML="",f.appendChild(g);let v=new atlas.Map(g.id,u),y=[];return M(this,Kc).set(t,y),xw.forEach(_=>{let x=this._spinMapUpdateHandler(t,v);v.events.add(_,x),y.push({eventName:_,handler:x})}),n&&t.zoomControl&&v.events.addOnce("ready",_=>{let x=atlas.ControlPosition.NonFixed;switch(t.zoomControl){case"topleft":x=atlas.ControlPosition.TopLeft;break;case"topright":x=atlas.ControlPosition.TopRight;break;case"bottomright":x=atlas.ControlPosition.BottomRight;break;case"bottomleft":x=atlas.ControlPosition.BottomLeft;break}v.controls.add(new atlas.control.ZoomControl,{position:x})}),v.events.add("idle",_=>{v.getCanvas().toBlob(x=>{M(this,Qd).set(e,x)})}),v.events.addOnce("ready",()=>{e.dispatchEvent(new Qt("maploaded"))}),{map:v,container:g}}invalidateSize(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);t&&t.resize()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i&&e==="language")for(let s of this.enrolledMaps()){let{map:l}=this.tryGetMap(s);l.setStyle({language:n||a.lang(s)})}}_spinMapUpdateHandler(e,t){return()=>{this._updateMap(e,t)}}_updateMap(e,t){if(!a.isNull(t)&&!a.isNull(e)){let n=t.getCamera(),i=n.center,s=n.zoom;n.zoom===1?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,Rn.getLatLng(i),s)}}static _getBounds(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;return{top:t,bottom:s,left:n,right:i}}fitBoundsNative(e,t,n=Mi._getBounds(e)){this.getMap(e).setCamera({bounds:Rn.getBounds(t),padding:n})}};Kc=new WeakMap,Qd=new WeakMap,c([h({emit:!1,converter:m.String})],Mi.prototype,"subscriptionKey",2),c([h({emit:!1,converter:m.String})],Mi.prototype,"language",2),c([me(500)],Mi.prototype,"_updateMap",1),Mi=c([C({tagName:d+"-map-adapter-azure"})],Mi);var lm={API_JS:"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js",API_JS_INTEGRITY:null,API_CSS:"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css",API_CSS_INTEGRITY:null};function Ew(o){return{city:o.city,state:o.state,provinceCode:o["ISO3166-2-lvl6"]?.split("-")[1],province:o.county,village:o.village,zipCode:o.postcode,streetName:o.road,houseNumber:o.house_number,countryCode:o.country_code?.toUpperCase(),country:o.country}}function jy(o){return{fullAddress:o.display_name,address:Ew(o.address),position:{lat:parseFloat(o.lat),lng:parseFloat(o.lon),altitude:null}}}var eu=class{static toLiteral(r){let e=r.getNorthEast(),t=r.getSouthWest();return{ne:e,sw:t}}static parseGeocoding(r){return a.isNullOrEmpty(r)?[]:r.map(jy)}static parseReverseGeocoding(r){return a.isNullOrEmpty(r)?[]:[jy(r)]}},Yy="layerload",Qg=class extends oe{constructor(r){super(Yy,r,{bubbles:!0})}},ev=class extends ms{deleteInfoWindow(r,e){r.unbindPopup()}deleteMarker(r,e){r.removeFrom(e)}getMarkerPosition(r){return r.getLatLng()}buildMarker(r,e){return L.marker(r.position).addTo(e)}addClickEventListener(r,e,t){r.on("click",t)}addDragEventListener(r,e,t){r.on("drag",t)}addDragEndEventListener(r,e,t){r.on("dragend",t)}setPosition(r,e){r.setLatLng(e)}setIcon(r,e){let t=this;if(typeof e=="string")t._setIcon(r,e);else if(!a.isNull(e)){let n={iconUrl:e.url};a.isNullOrEmpty(e.size)||a.extend(n,{iconSize:[e.size.width,e.size.height],iconAnchor:[e.size.width/2,e.size.height],popupAnchor:[0,-e.size.height]}),a.isNullOrEmpty(e.anchor)||a.extend(n,{iconAnchor:[e.anchor.x,e.anchor.y]}),t._setIcon(r,new L.Icon(n))}}setLabel(r,e){}setDraggable(r,e){e===!0?r.dragging.enable():r.dragging.disable()}closeInfo(r){r.closePopup()}openInfo(r,e,t,n){r.bindPopup(e).openPopup()}buildInfoWindow(r){return this.markers.get(r)}addCloseClickEventListener(r,e,t){r.on("popupclose",t)}setContent(r,e){let t=r.getPopup();t&&t.getContent()!=e&&r.setPopupContent(e)}_setIcon(r,e){if(typeof e=="string"){var t={iconUrl:e},n,i,s;if((n=this.size)&&/[\d]+,[\d]+/.test(n)){var l=-1,p=[parseInt(n.substring(0,l=n.indexOf(","))),parseInt(n.substring(l+1))];Object.assign(t,{iconSize:p})}if((i=this.anchor)&&/[\d]+,[\d]+/.test(i)){var l=-1,u=[parseInt(i.substring(0,l=i.indexOf(","))),parseInt(i.substring(l+1))];Object.assign(t,{iconAnchor:u,popupAnchor:[0,-u[1]]})}if((s=this.popupAnchor)&&/[\d]+,[\d]+/.test(s)){var l=-1,u=[parseInt(i.substring(0,l=i.indexOf(","))),parseInt(i.substring(l+1))];Object.assign(t,{popupAnchor:u})}r.setIcon(L.icon(t))}else e&&r.setIcon(e)}},tv=class extends fs{addDragStartEventListener(r,e){throw new Error("Method not implemented.")}deleteShape(r,e){throw new Error("Method not implemented.")}getShapeBounds(r){throw new Error("Method not implemented.")}getShapePosition(r){throw new Error("Method not implemented.")}buildShape(r,e){throw new Error("Method not implemented.")}addClickEventListener(r,e){throw new Error("Method not implemented.")}addDragEventListener(r,e){throw new Error("Method not implemented.")}addDragEndEventListener(r,e){throw new Error("Method not implemented.")}setShape(r,e){throw new Error("Method not implemented.")}setEditable(r,e){throw new Error("Method not implemented.")}setDraggable(r,e){throw new Error("Method not implemented.")}},rv=class extends hs{addLoadEventListener(r,e,t){r.on("load",t)}removeLoadEventListener(r,e,t){r.off("load",t)}deleteLayer(r,e){r.remove()}buildLayer(r,e){let t=(r.mode||"").toLowerCase();return t==="wms"?L.tileLayer.wms(r.url,{layers:(r.include||[]).join(","),minZoom:r.minZoom,maxZoom:r.maxZoom,transparent:!0,format:"image/png"}).addTo(e):L.tileLayer(r.url,{tms:t==="tms",minZoom:r.minZoom,maxZoom:r.maxZoom}).addTo(e)}},nv=class extends us{deleteOverlay(r,e){throw new Error("Method not implemented.")}buildOverlay(r,e){throw new Error("Method not implemented.")}setBounds(r,e,t){throw new Error("Method not implemented.")}updateOverlay(r,e,t){throw new Error("Method not implemented.")}},yl,Ua=class extends Dn{constructor(){super(...arguments);z(this,yl,new WeakMap);this.tiles="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";this.attribution='Map data \xA9 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';this._tileLayerLoadHandler=e=>{this.dispatchLayerLoadEvent(e.sourceTarget)};this._mapUpdateHandler=e=>{let t=this.getMap(e);!a.isNull(t)&&!a.isNull(e)&&this.updateMapElement(e,t.getCenter(),t.getZoom())}}buildOverlayAdapterFor(e){return new nv(e,this)}geocode(e,t){return new cm().geocode(e,t,a.lang(this))}reverseGeocode(e,t){return new cm().reverseGeocode(e,a.lang(this))}getBounds(e){let n=this.getMap(e).getBounds();return eu.toLiteral(n)}isActive(){return!0}setViewNative(e,t){let n=this.getMap(e);t.center?n.setView(t.center,t.zoom??n.getZoom(),{animate:!0}):typeof t.zoom=="number"&&n.setZoom(t.zoom,{animate:!0})}buildMarkerAdapterFor(e){return new ev(e,this)}buildShapeAdapterFor(e){return new tv(e,this)}buildLayerAdapterFor(e){return new rv(e,this)}snapshot(e,t="image/png",n){return a.snapshotElement(e.container.firstElementChild,null,t,n)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"tiles":for(let s of this.enrolledMaps())this._redrawMap(s);default:for(let s of this.enrolledMaps())this.invalidateSize(s);break}}dispose(e){let{map:t}=this.tryGetMap(e),n=M(this,yl).get(e);n&&n.off("load",this._tileLayerLoadHandler),t.clearAllEventListeners(),M(this,yl).delete(e)}async init(e){await Promise.all([A.importjs(lm.API_JS,lm.API_JS_INTEGRITY,!0),A.importcss(lm.API_CSS,lm.API_CSS_INTEGRITY,!0)]);let t=e;var n=t.scale,i=t.draggable,s=t.doubleClickZoom,l=t.keyboardShortcuts,p=L.latLng(Rr.parseCoords(t.center)),u={zoomControl:n&&!a.isNullOrEmpty(t.zoomControl),scrollWheelZoom:t.mousewheel,dragging:i,doubleClickZoom:!s,keyboard:l};let f=t.container,g=document.createElement("div");g.style.width="100%",g.style.height="100%",f.innerHTML="",f.appendChild(g);let v=L.map(g,u);["zoomend","moveend"].forEach(w=>{v.on(w,E=>{this._idleFiller(t),this._mapUpdateHandler(t)})}),v.on("load",()=>{n&&t.zoomControl&&v.zoomControl.setPosition(t.zoomControl),this._idleFiller(t)});let y=L.tileLayer(this.tiles,{attribution:this.attribution}).addTo(v);y.on("load",this._tileLayerLoadHandler),M(this,yl).set(t,y),v.setView(p,t.zoom),v.once("idle",function(){v.fire("resize"),e.dispatchEvent(new Qt("maploaded"))});let _=Rr.parseCoords(t.center),x=[_[0],_[1]];return v.setView(x,t.zoom),{map:v,container:g}}dispatchLayerLoadEvent(e){this.dispatchEvent(new Qg(e))}invalidateSize(e){this.hasMap(e)&&this.getMap(e).invalidateSize()}_idleFiller(e){this.hasMap(e)&&this.getMap(e).fire("idle")}fitBoundsNative(e,t,n={top:e.paddingTop||0,left:e.paddingLeft||0,right:e.paddingRight||0,bottom:e.paddingBottom||0}){let i=this.getMap(e),s={paddingTopLeft:new L.Point(n.left,n.top),paddingBottomRight:new L.Point(n.right,n.bottom)},l=t.ne,p=t.sw;try{i.fitBounds([[l.lat,l.lng],[p.lat,p.lng]],s)}catch(u){throw u}}_redrawMap(e){var t=this,n=M(t,yl).get(e);a.isNull(t.tiles&&n)||n.setUrl(t.tiles)}};yl=new WeakMap,c([h({emit:!1,converter:m.String})],Ua.prototype,"tiles",2),c([h({emit:!1,converter:m.String})],Ua.prototype,"attribution",2),c([me(500)],Ua.prototype,"_idleFiller",1),Ua=c([C({tagName:d+"-map-adapter-leaflet"})],Ua);var cm=class{_buildGeocodeRequest(r,e=10,t=""){let n="https://nominatim.openstreetmap.org/search?addressdetails=1&format=json",i={q:r,limit:""+e,"accept-language":t};return{uri:a.URIs.appendQuery(n,i),options:{mode:"cors"}}}parseGeocodeResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=eu.parseGeocoding(n);e(i)},n=>t(n))})}geocode(r,e=10,t=""){return new Promise((n,i)=>{let s=this._buildGeocodeRequest(r,e,t);return fetch(s.uri,s.options).then(l=>{l.ok?this.parseGeocodeResponse(l).then(n,i):i(l)},l=>i(l))})}reverseGeocode(r,e=""){return new Promise((t,n)=>{let i=this._buildReverseRequest(r,e);return fetch(i.uri,i.options).then(s=>{s.ok?this._parseReverseResponse(s).then(t,n):n(s)},s=>n(s))})}_buildReverseRequest(r,e=""){let t="https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json",n=Rr.parseCoords(r),i={lat:""+n[0],lon:""+n[1],"accept-language":e};return{uri:a.URIs.appendQuery(t,i),options:{mode:"cors"}}}_parseReverseResponse(r){return new Promise((e,t)=>{r.json().then(n=>{let i=eu.parseReverseGeocoding(n);e(i)},n=>t(n))})}};var tu={DETACH_TIMEOUT:200,API_URI:"https://maps.googleapis.com/maps/api/js",MAX_ROADMAP_ZOOM:22,BOOTSTRAP_SNIPPET:(o,r,e,t)=>`(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))})({
|
|
378
378
|
key: "${o}", v: "${t}", language: "${r}", region: "${e}",
|
|
379
379
|
// Add other bootstrap parameters as needed, using camel case.
|
|
380
|
-
});`,MAPS_NOT_FOUND:"google.maps not found.",GEOCODER_UNAVAILABLE:"google.maps geocoder unavailable.",INVALID_KEY:"invalid google.maps api key.",TILE_EXTENT:[-Math.PI*6378137,Math.PI*6378137]},iv=class o{#e;#t;_equivalent(r,e,t,n){let i=this.#t;return!a.isNull(i)&&i.key===r&&i.language===(e||i.language)&&i.region===(t||i.region)&&i.version===(n||i.version)}_spinFuture(r,e,t,n){return new Promise((i,s)=>{this._equivalent(r,e,t,n)||o._ensureBootstrapScript(r,e,t,n),this.#t={language:e,region:t,version:n,key:r},google.maps.importLibrary("maps").then(l=>{i(),this.#e=null},l=>{s(l),this.#e=null})})}boostrap(r,e,t,n="weekly"){return a.isNullOrEmpty(r)?Promise.reject(tu.INVALID_KEY):((a.isNull(this.#e)||!this._equivalent(r,e,t,n))&&(this.#e=this._spinFuture(r,e,t,n)),this.#e)}static _ensureBootstrapScript(r,e,t,n){let i="pacem-googlemaps",s=`v=${n},l=${e},r=${t}`,l=document.querySelector(`script[${i}]`);if(!a.isNull(l)){if(l.getAttribute(i)===s)return;l.remove(),document.querySelectorAll("script[src^='https://maps.googleapis.com/maps']").forEach(p=>p.remove()),delete window.google}a.isNullOrEmpty(r)||(l=document.createElement("script"),l.setAttribute(i,s),l.textContent=tu.BOOTSTRAP_SNIPPET(r,e,t,n),document.head.appendChild(l))}},sv=new iv,sn=class o{static getPosition(r){return Array.isArray(r)?{lat:r[0],lng:r[1]}:r}static getBounds(r){return a.isNullOrEmpty(r)?null:{north:r.ne.lat,east:r.ne.lng,south:r.sw.lat,west:r.sw.lng}}static mapGeocodeResults(r,e=[]){let t=[];r??=[];for(let n=0;n<r.length;n++){let i=e.length>n?e[n]:null,s=o.mapGeocodeResult(r[n],i);t.push(s)}return t}static mapGeocodeResult(r,e){let t=r?.address_components||[],n=t.find(_=>_.types.indexOf("street_number")>=0)?.long_name,i=t.find(_=>_.types.indexOf("route")>=0)?.long_name,s=t.find(_=>_.types.indexOf("locality")>=0)?.long_name,l=t.find(_=>_.types.indexOf("administrative_area_level_3")>=0)?.long_name,p=t.find(_=>_.types.indexOf("administrative_area_level_2")>=0),u=t.find(_=>_.types.indexOf("administrative_area_level_1")>=0)?.short_name,f=t.find(_=>_.types.indexOf("country")>=0),g=t.find(_=>_.types.indexOf("postal_code")>=0)?.short_name,v={houseNumber:n,city:l||s,provinceCode:p?.short_name,province:p?.long_name,countryCode:f?.short_name,country:f?.long_name,zipCode:g,streetName:i,state:u,village:s,type:r.geometry.location_type};return{fullAddress:r.formatted_address,position:o.toLiteral(r.geometry.location,e?.elevation),address:v}}static toLiteral(r,e){if(a.isNull(r))return null;if("lat"in r&&typeof r.lat=="function"&&"lng"in r&&typeof r.lng=="function")return{lat:r.lat(),lng:r.lng(),altitude:e};if("getNorthEast"in r&&typeof r.getNorthEast=="function"&&"getSouthWest"in r&&typeof r.getSouthWest=="function"){let t=r.getNorthEast(),n=r.getSouthWest();return{ne:o.toLiteral(t),sw:o.toLiteral(n)}}return"north"in r&&typeof r.north=="number"&&"south"in r&&typeof r.south=="number"&&"west"in r&&typeof r.west=="number"&&"east"in r&&typeof r.east=="number"?{ne:{lat:r.north,lng:r.east},sw:{lat:r.south,lng:r.west}}:a.extend({altitude:e},r)}static areEqual(r,e){if(a.isNull(r)||a.isNull(e))return!1;let t=o.toLiteral(r),n=o.toLiteral(e);return t.lat===n.lat&&t.lng===n.lng}static fitBounds(r,e,t){r?.fitBounds(e,t)}static setCenter(r,e){!a.isNull(r)&&!o.areEqual(r.getCenter(),e)&&r.panTo(e)}},av=class extends fs{getShapeBounds(r){let e=new google.maps.LatLngBounds;if(r instanceof google.maps.Circle){let t=r.getBounds();t&&(e.extend(t.getNorthEast()),e.extend(t.getSouthWest()))}else r instanceof google.maps.Polygon?r.getPath().forEach(t=>e.extend(t)):r instanceof google.maps.Polyline&&r.getPath().forEach(t=>e.extend(t));return e.isEmpty()!==!1?st.Empty:sn.toLiteral(e)}deleteShape(r,e){r.setMap(null)}getShapePosition(r){return"latLng"in r?r.latLng:null}buildShape(r,e){return r instanceof Ei?new google.maps.Polyline({path:r.vertices,clickable:!0,map:e}):r instanceof wi?new google.maps.Polygon({paths:[r.vertices],clickable:!0,map:e}):r instanceof An?new google.maps.Circle({center:r.center,radius:r.radius,clickable:!0,map:e}):null}addClickEventListener(r,e){r.addListener("click",e)}addDragEventListener(r,e){r.addListener("drag",e)}addDragStartEventListener(r,e){r.addListener("dragstart",e)}addDragEndEventListener(r,e){r.addListener("dragend",e)}setShape(r,e){e instanceof Ei&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,path:e.vertices}),e instanceof wi&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:e.fill?.color,fillOpacity:e.fill?.alpha,paths:[e.vertices]}),e instanceof An&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:e.fill?.color,fillOpacity:e.fill?.alpha,center:e.center,radius:e.radius})}setEditable(r,e){r.setOptions({editable:e})}setDraggable(r,e){r.setOptions({draggable:e})}},ov=class extends ms{deleteInfoWindow(r,e){r.unbindAll()}deleteMarker(r,e){r.setMap(null)}get mapAutomaticallyScrollsOnDrag(){return!0}getMarkerPosition(r){let e=r.getPosition();return{lat:e.lat(),lng:e.lng()}}buildMarker(r,e){return new google.maps.Marker({position:r.position,map:e})}addClickEventListener(r,e,t){r.addListener("click",t)}addDragEventListener(r,e,t){r.addListener("drag",t)}addDragEndEventListener(r,e,t){r.addListener("dragend",t)}setPosition(r,e){r.setPosition(e)}setIcon(r,e){if(typeof e=="string")r.setIcon(e);else if(!a.isNull(e)){let t={url:e.url};a.isNullOrEmpty(e.size)||(t.size=new google.maps.Size(e.size.width,e.size.height),t.anchor=new google.maps.Point(e.size.width/2,e.size.height)),a.isNullOrEmpty(e.anchor)||(t.anchor=new google.maps.Point(e.anchor.x,e.anchor.y)),r.setIcon(t)}}setLabel(r,e){r.setLabel(e)}setDraggable(r,e){r.setDraggable(e)}closeInfo(r){r.close()}openInfo(r,e,t,n){r.open(t,n)}buildInfoWindow(r){let e=0;return typeof r.icon!="string"&&!a.isNull(r.icon)&&(e=(r.icon.size?.width??0)/2-(r.icon.anchor?.x??0)),new google.maps.InfoWindow({pixelOffset:new google.maps.Size(-e,0)})}addCloseClickEventListener(r,e,t){r.addListener("closeclick",t)}setContent(r,e){r.setContent(e)}},lv=class extends hs{addLoadEventListener(r,e,t){r.addListener("tilesloaded",t)}removeLoadEventListener(r,e,t){}deleteLayer(r,e){let n=e.overlayMapTypes.getArray().findIndex(i=>i===r);n>=0&&e.overlayMapTypes.removeAt(n)}_getBounds(r,e,t){let n=tu.TILE_EXTENT;var i=n[1]*2/Math.pow(2,t),s=n[0]+r*i,l=n[0]+(r+1)*i,p=n[1]-(e+1)*i,u=n[1]-e*i;return[s,p,l,u]}_getWmsTileUrl(r,e){return(t,n)=>a.URIs.appendQuery(r,{service:"WMS",styles:"",transparent:"true",request:"GetMap",srs:"EPSG:3857",format:"image/png",version:"1.1.1",layers:e?.join(",")||"",width:"256",height:"256",bbox:this._getBounds(t.x,t.y,n).join(",")})}_getWmsLayer(r,e){let t=new google.maps.ImageMapType({getTileUrl:this._getWmsTileUrl(r.url,r.include),minZoom:r.minZoom,maxZoom:r.maxZoom,opacity:1});return e.overlayMapTypes.push(t),t}_getTmsTileUrl(r){function t(n){return"abc"[Math.abs(n.x+n.y)%3]}return(n,i)=>{let s={r:"",s:t(n),x:""+n.x,y:""+n.y,z:""+i},l=r;for(let p in s)l=l.replaceAll("{"+p+"}",s[p]);return l}}_getTmsLayer(r,e){let t=new google.maps.ImageMapType({getTileUrl:this._getTmsTileUrl(r.url),minZoom:r.minZoom,maxZoom:r.maxZoom,opacity:1});return e.overlayMapTypes.push(t),t}buildLayer(r,e){switch((r.mode||"").toLowerCase()){case"wms":return this._getWmsLayer(r,e);case"tms":return this._getTmsLayer(r,e);default:throw new Error(`"${r.mode}" overlays not supported for the Google Maps integration.`)}}};function Ew(o){class r extends google.maps.OverlayView{constructor(i){super();this._item=i}get element(){return this._item}get bounds(){let i=this._item.bounds;return a.isNull(i)?null:sn.getBounds(i)}getBoundingBox(){let i=this.getProjection(),s=this.bounds;if(a.isNullOrEmpty(s))return null;let l=i.fromLatLngToDivPixel({lat:s.south,lng:s.west}),p=i.fromLatLngToDivPixel({lat:s.north,lng:s.east});return{x:l.x,y:p.y,width:p.x-l.x,height:l.y-p.y}}}class e extends r{get src(){return this.element.src}#e;onAdd(){let n=this.#e=this.#e||document.createElement("div");n.style.position="absolute",this.getPanes().overlayLayer.appendChild(n)}onRemove(){let n=this.#e;a.isNull(n)||(n.remove(),this.#e=null)}draw(){let n=this.#e;if(a.isNull(n))return;let i=this.getBoundingBox();a.isNull(i)||(n.style.top=i.y+"px",n.style.left=i.x+"px",n.style.width=i.width+"px",n.style.height=i.height+"px",n.style.backgroundSize=`${i.width}px ${i.height}px`,n.style.backgroundImage=`url(${this.src})`)}}return o instanceof Va?new e(o):null}var cv=class extends us{updateOverlay(r,e,t){r.set,r.draw()}deleteOverlay(r,e){r.setMap(null)}buildOverlay(r,e){let t=Ew(r);return t.setMap(e),t}setBounds(r,e,t){r.draw()}},ww=["dragend","zoom_changed","center_changed","maptypeid_changed","tilt_changed","heading_changed","bounds_changed"];function Yy(o){let r=o.theme=="dark"?google.maps.ColorScheme.DARK:o.theme!="light"?google.maps.ColorScheme.FOLLOW_SYSTEM:google.maps.ColorScheme.LIGHT;switch(o.type){case google.maps.MapTypeId.HYBRID:case google.maps.MapTypeId.ROADMAP:case google.maps.MapTypeId.TERRAIN:case google.maps.MapTypeId.SATELLITE:return{type:o.type,theme:r};case"hybrid":return{type:google.maps.MapTypeId.HYBRID,theme:r};case"satellite":return{type:google.maps.MapTypeId.SATELLITE,theme:r};case"terrain":return{type:google.maps.MapTypeId.TERRAIN,theme:r};default:return{type:google.maps.MapTypeId.ROADMAP,theme:r}}}var Jc,Zc,nn=class extends Dn{constructor(){super(...arguments);z(this,Jc,new WeakMap);z(this,Zc,!1)}geocode(e,t){let n=this.language||"",i=this.region||"",s=this.version||"weekly";return new pm(this.apiKey,n,i,s).geocode(e,t)}reverseGeocode(e,t){let n=this.language||"",i=this.region||"",s=this.version||"weekly";return new pm(this.apiKey,n,i,s).reverseGeocode(e,t)}getBounds(e){if(!this.hasMap(e))return st.Empty;let n=this.getMap(e).getBounds();return sn.toLiteral(n)}isActive(){return!a.isNullOrEmpty(this.apiKey)}buildMarkerAdapterFor(e){return new ov(e,this)}buildOverlayAdapterFor(e){return new cv(e,this)}buildShapeAdapterFor(e){return new av(e,this)}buildLayerAdapterFor(e){return new lv(e,this)}getMaxAvailableZoom(e){return new Promise((t,n)=>{new google.maps.MaxZoomService().getMaxZoomAtLatLng(e,s=>{s.status===google.maps.MaxZoomStatus.OK?t(s.zoom):n()})})}snapshot(e,t="image/png",n){let{container:i}=this.tryGetMap(e);return a.snapshotElement(i,null,t,n)}setViewNative(e,t){let n=this.getMap(e);t=a.extend({type:e.type,theme:e.theme},t);let{type:i,theme:s}=Yy(t);if(M(this,Zc)&&s!==n.get("colorScheme")){this._bootstrapDebounced();return}n.setOptions({colorScheme:s,mapTypeId:i}),typeof t.tilt=="number"&&n.setTilt(t.tilt),typeof t.heading=="number"&&n.setHeading(t.heading);let l=()=>{t.center&&sn.setCenter(n,t.center)};if(typeof t.zoom=="number"&&t.zoom!==n.getZoom())switch(n.getMapTypeId()){case google.maps.MapTypeId.SATELLITE:case google.maps.MapTypeId.HYBRID:let u=sn.toLiteral(n.getCenter());this.getMaxAvailableZoom(u).then(g=>{let v=Math.min(g,t.zoom);n.setZoom(v),l()});break;default:let f=Math.min(tu.MAX_ROADMAP_ZOOM,t.zoom);n.setZoom(f),l();break}else l()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"libraries":case"apiKey":case"language":case"region":M(this,Zc)&&this._bootstrapDebounced();break;case"defaultOptions":for(let s of this.enrolledMaps())this._updateMapOptions(s);break;default:for(let s of this.enrolledMaps())this.invalidateSize(s);break}}dispose(e){let t=M(this,Jc).get(e);for(;t.length;)google.maps.event.removeListener(t.pop());M(this,Jc).delete(e)}_updateMapOptions(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);t.setOptions(this._buildMapOptions(e))}_buildMapOptions(e){let t=e.scale,n=e.draggable,i=e.doubleClickZoom,s=e.keyboardShortcuts,{type:l,theme:p}=Yy({type:e.type,theme:e.theme});return a.extend({},this.defaultOptions||{streetViewControl:!1,zoomControl:!1,mapTypeControl:!1,fullscreenControl:!1,cameraControl:!1},{zoomControl:t&&!a.isNullOrEmpty(e.zoomControl),zoomControlOptions:{position:(function(u){switch(u){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:i,keyboardShortcuts:s,draggable:n,mapTypeId:l,colorScheme:p,tilt:e.tilt,heading:e.heading})}_bootstrapDebounced(){this._bootstrap().then(e=>{for(let t of this.enrolledMaps())t.adapter=null,t.adapter=this})}_bootstrap(){return new Promise((e,t)=>{let n=this.apiKey,i=this.language||"",s=this.region||"",l=this.version||"weekly";sv.boostrap(n,i,s,l).then(p=>{let u=[];for(let f of this.libraries||[])u.push(google.maps.importLibrary(f));Promise.all(u).then(f=>{e(),H(this,Zc,!0)},t)},t)})}async init(e){await this._bootstrap();let t=e,n=Rr.parseCoords(t.center),i=new google.maps.LatLng(n[0],n[1]),s=this._buildMapOptions(t),l=t.container,p=document.createElement("div");p.style.width="100%",p.style.height="100%",l.innerHTML="",l.appendChild(p);let u=new google.maps.Map(p,s),f=[];M(this,Jc).set(t,f),ww.forEach(_=>{f.push(u.addListener(_,this._spinMapUpdateHandler(t,u)))}),u.setZoom(t.zoom),u.setCenter(i);var g=u.addListener("idle",function(x){g.remove(),e.dispatchEvent(new Qt("maploaded"))});f.push(u.addListener("tilesloaded",_=>{e.dispatchEvent(new Qt("tilesloaded"))}));let v=Rr.parseCoords(t.center),y=new google.maps.LatLng(v[0],v[1]);return u.setZoom(t.zoom),u.setCenter(y),{map:u,container:p}}invalidateSize(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);google.maps.event.trigger(t,"resize")}_spinMapUpdateHandler(e,t){return()=>{if(!a.isNull(t)&&!a.isNull(e)){let n=t.getCenter();if(a.isNull(n))return;this.updateMapElement(e,{center:{lat:n.lat(),lng:n.lng()},zoom:t.getZoom(),type:t.getMapTypeId(),tilt:t.getTilt(),heading:t.getHeading()})}}}fitBoundsNative(e,t,n=this._getPadding(e)){let i=this.tryGetMap(e)?.map;if(a.isNull(i))return;let s=sn.getBounds(t);sn.fitBounds(i,s,n)}_getPadding(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;return n||t||i||s?{top:t,bottom:s,left:n,right:i}:null}_padBounds(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;if(n||t||i||s){let l=this.tryGetMap(e).map,p=l.getBounds(),u=l.getDiv().clientWidth,f=l.getDiv().clientHeight,g=l.getProjection().fromPointToLatLng(new google.maps.Point(-n,-t)),v=l.getProjection().fromPointToLatLng(new google.maps.Point(u+i,f+s));p.extend(g),p.extend(v)}}_redrawMap(){}};Jc=new WeakMap,Zc=new WeakMap,c([h({emit:!1,converter:m.String})],nn.prototype,"apiKey",2),c([h({emit:!1,converter:m.String})],nn.prototype,"version",2),c([h({emit:!1,converter:m.String})],nn.prototype,"language",2),c([h({emit:!1,converter:m.String})],nn.prototype,"region",2),c([h({emit:!1,converter:m.Json})],nn.prototype,"defaultOptions",2),c([h({emit:!1,converter:m.StringArray})],nn.prototype,"libraries",2),c([me(tu.DETACH_TIMEOUT)],nn.prototype,"_bootstrapDebounced",1),nn=c([C({tagName:d+"-map-adapter-google"})],nn);var pm=class{constructor(r,e="",t="",n="weekly"){this.apiKey=r;this.language=e;this.region=t;this.version=n}_elevateResults(r){return new Promise((e,t)=>{new google.maps.ElevationService().getElevationForLocations({locations:r.map(i=>i.geometry.location)},(i,s)=>{if(s===google.maps.ElevationStatus.OK){let l=sn.mapGeocodeResults(r,i);e(l)}else{let l=sn.mapGeocodeResults(r);e(l)}})})}geocode(r,e=10){return new Promise((t,n)=>{sv.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(i=>{new google.maps.Geocoder().geocode({address:r},(l,p)=>{if(p===google.maps.GeocoderStatus.OK||p==google.maps.GeocoderStatus.ZERO_RESULTS){let u=(l||[]).filter((f,g)=>g<(e||10));this._elevateResults(u).then(t)}else n(p)})},n)})}_reverseGeocodeInternal(r,e){let t=sn.getPosition(r);return new Promise((n,i)=>{sv.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(s=>{new google.maps.Geocoder().geocode({location:t},(p,u)=>{if(u===google.maps.GeocoderStatus.OK||u==google.maps.GeocoderStatus.ZERO_RESULTS){let f=(p||[]).filter((g,v)=>v<(e||10));this._elevateResults(f).then(n)}else i(u)})},i)})}reverseGeocode(r,e=1){return this._reverseGeocodeInternal(r,e)}};var pv={};Le(pv,{PacemAudioElement:()=>za,PacemMediaRecorderElement:()=>an});var vs,ep,tp,za=class extends K{constructor(){super(...arguments);z(this,vs);z(this,ep);z(this,tp);this._endedHandler=e=>{this.dispatchEvent(new Event("end"))};this._canPlayHandler=e=>{H(this,ep,!0),this._autoplay()};this._canPlayThroughHandler=e=>{H(this,tp,!0),this._autoplay()}}connectedCallback(){super.connectedCallback();let e=H(this,vs,new Audio);e.addEventListener("canplay",this._canPlayHandler,!1),e.addEventListener("ended",this._endedHandler,!1),e.addEventListener("canplaythrough",this._canPlayThroughHandler,!1)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||e==="src"&&this._init()}viewActivatedCallback(){super.viewActivatedCallback(),this._init()}disconnectedCallback(){let e=M(this,vs);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"):M(this,vs).play().then(e=>{this.dispatchEvent(new Event("start"))},e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))})}pause(){M(this,vs).pause()}reset(){M(this,vs).load()}get _canPlay(){return this.stream&&M(this,ep)||M(this,tp)}_autoplay(){this.autoplay&&this._canPlay&&this.play()}_init(e=this.src){let t=M(this,vs);H(this,ep,H(this,tp,!1)),t.src=e}};vs=new WeakMap,ep=new WeakMap,tp=new WeakMap,c([h({emit:!1,converter:m.String})],za.prototype,"src",2),c([h({emit:!1,converter:m.Boolean})],za.prototype,"stream",2),c([h({emit:!1,converter:m.Boolean})],za.prototype,"autoplay",2),za=c([C({tagName:d+"-audio"})],za);var kw=25,Xy="video/mp4",Mw=128e3,Sw=25e5,qy=["start","stop","dataavailable","pause","resume","error","warning"];function Lw(o){return o instanceof HTMLCanvasElement?!0:"captureStream"in o&&typeof o.captureStream=="function"}var on,rp,an=class extends K{constructor(){super(...arguments);this._recorderLifecycleHandler=e=>{switch(this.state=M(this,on).state,e.type){case"start":this.output=null;break;case"stop":this.flush();break;case"dataavailable":var t=e;M(this,rp).push(t.data);break}};z(this,on,null);z(this,rp,[])}viewActivatedCallback(){super.viewActivatedCallback(),this._setupMediaRecorder()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"source":case"fps":case"mimeType":case"audioBitsPerSecond":case"videoBitsPerSecond":this._setupMediaRecorder();break}}disconnectedCallback(){this._closeMediaRecorder(),super.disconnectedCallback()}_setupMediaRecorder(e=this.source,t={mimeType:this.mimeType||Xy,audioBitsPerSecond:this.audioBitsPerSecond??Mw,videoBitsPerSecond:this.videoBitsPerSecond??Sw}){if(this._closeMediaRecorder(),!a.isNull(e)){if(Lw(e)){let i=this.fps||kw;e=e.captureStream(i)}try{H(this,on,new MediaRecorder(e,t))}catch(i){console.error(i)}let n=M(this,on);qy.forEach(i=>{n.addEventListener(i,this._recorderLifecycleHandler,!1)})}}_closeMediaRecorder(){let e=M(this,on);a.isNull(e)||(e.state!=="inactive"&&e.stop(),qy.forEach(t=>{e.removeEventListener(t,this._recorderLifecycleHandler,!1)}),H(this,on,null))}flush(){let e=new Blob(M(this,rp),{type:this.mimeType||Xy});H(this,rp,[]),this.output=e}start(){let e=M(this,on);!a.isNull(e)&&e.state==="inactive"&&e.start()}stop(){let e=M(this,on);!a.isNull(e)&&e.state!=="inactive"&&e.stop()}resume(){let e=M(this,on);!a.isNull(e)&&e.state==="paused"&&e.start()}pause(){let e=M(this,on);!a.isNull(e)&&e.state!=="paused"&&e.pause()}};on=new WeakMap,rp=new WeakMap,c([h({emit:!1,converter:m.Element})],an.prototype,"source",2),c([h({emit:!1,converter:m.Number})],an.prototype,"fps",2),c([h({emit:!1,converter:m.String})],an.prototype,"mimeType",2),c([h({emit:!1,converter:m.Number})],an.prototype,"audioBitsPerSecond",2),c([h({emit:!1,converter:m.Number})],an.prototype,"videoBitsPerSecond",2),c([h({converter:m.String})],an.prototype,"state",2),c([h()],an.prototype,"output",2),an=c([C({tagName:d+"-media-recorder"})],an);var dv={};Le(dv,{PacemHubListenerElement:()=>bs,PacemHubProxyElement:()=>Si,PacemServerSentEventsListenerElement:()=>_l,PacemServerSentEventsProxyElement:()=>Li});var Nw="https://cdn.jsdelivr.net/npm/@microsoft/signalr@10.0.0/dist/browser/signalr.min.js",Tw={API_JS:Nw},ru,bs=class extends R.PacemItemElement{constructor(){super(...arguments);z(this,ru);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=>{e.detail.propertyName==="connected"&&e.detail.currentValue===!0&&this._start()}}get _isConnected(){return this.container instanceof Si&&this.container.connected||!1}get _connection(){return this.container instanceof Si&&this.container.connection||null}start(){this.disabled||this._start()}stop(){this._stop()}_stop(e=this.method,t=this.stream){if(!this._isConnected)return;let n=this._connection;a.isNullOrEmpty(e)||(t?M(this,ru)?.dispose():n.off(e,this._receiveHandler))}_start(e=this.method,t=this.stream){if(!this._isConnected)return;let n=this._connection;if(!a.isNullOrEmpty(e))if(!t)n.on(e,this._receiveHandler);else{let i=this.arguments||[],s=signalR.HubConnection.prototype.stream.apply(n,[e].concat(i));H(this,ru,s.subscribe({next:this._receiveHandler,complete:this._completeHandler,error:this._errorHandler}))}}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||e.addEventListener(ee,this._connectedHandler,!1),this.start()}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"arguments":this._stop(),this._start();break;case"method":a.isNullOrEmpty(t)||this._stop(t,this.stream),a.isNullOrEmpty(n)||this._start(n,this.stream);break;case"stream":let s=this.method;a.isNullOrEmpty(s)||(this._stop(s,t),this._start(s,n));break;case"disabled":a.isNullOrEmpty(this.method)||(n?this._stop:this._start)();break}}};ru=new WeakMap,c([h({emit:!1,converter:m.String})],bs.prototype,"method",2),c([h({emit:!1,converter:m.Boolean})],bs.prototype,"stream",2),c([h({emit:!1,converter:m.Json})],bs.prototype,"arguments",2),bs=c([C({tagName:d+"-hub-listener"})],bs);var Si=class extends R.PacemItemsContainerElement{validate(r){return r instanceof bs}get connection(){return this._hub}invoke(r,...e){if(this.connected)return this._hub.invoke.apply(this._hub,arguments);throw"Hub is not connected. Cannot call `invoke` method."}send(r,...e){if(this.connected)return this._hub.send(r,...e);throw"Hub is not connected. Cannot call `send` method."}start(){return this._resetProxy()}async stop(){this.connected&&await this._hub.stop()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="url"||r==="disabled"||r==="accesstoken")&&this._resetProxy()}viewActivatedCallback(){super.viewActivatedCallback(),this.start()}disconnectedCallback(){this.stop(),super.disconnectedCallback()}async _resetProxy(){a.isNull(this._hub)||await this._hub.stop(),this._setupProxy()}async _initialize(){"signalR"in window||await A.importjs(Tw.API_JS)}async _setupProxy(){let r=this.items||[];if(!this.disabled&&!a.isNullOrEmpty(this.url)){await this._initialize();let e=new signalR.HubConnectionBuilder;e.withUrl(this.url,{accessTokenFactory:()=>this.accesstoken});let t=this._hub=e.build();t.onclose(()=>{for(var n of r)n.stop();this.connected=!1,this._hub=null}),await t.start(),this.connected=!0}}};c([h({emit:!1,converter:m.String})],Si.prototype,"url",2),c([h({emit:!1,converter:m.String})],Si.prototype,"accesstoken",2),c([h({converter:m.Boolean})],Si.prototype,"connected",2),Si=c([C({tagName:d+"-hub-proxy"})],Si);var _l=class extends R.PacemItemElement{constructor(){super(...arguments);this._receiveHandler=e=>{this.dispatchEvent(new CustomEvent("receive",{detail:e.data}))};this._connectedHandler=e=>{e.detail.propertyName==="connected"&&e.detail.currentValue===!0&&this._start()}}get _isConnected(){return this.container instanceof Li&&this.container.connected||!1}get _connection(){return this.container instanceof Li&&this.container.eventSource||null}_stop(e=this.method){if(!this._isConnected)return;let t=this._connection;a.isNullOrEmpty(e)||t.removeEventListener(e,this._receiveHandler)}_start(e=this.method){if(!this._isConnected)return;let t=this._connection;a.isNullOrEmpty(e)||t.addEventListener(e,this._receiveHandler)}start(){this.disabled||this._start()}stop(){this._stop()}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||e.addEventListener(ee,this._connectedHandler,!1),this.start()}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"method":a.isNullOrEmpty(t)||this._stop(t),a.isNullOrEmpty(n)||this._start(n);break;case"disabled":a.isNullOrEmpty(this.method)||(n?this._stop:this._start)();break}}};c([h({emit:!1,converter:m.String})],_l.prototype,"method",2),_l=c([C({tagName:d+"-sse-listener"})],_l);var Ga,Li=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);z(this,Ga);this._connectHandler=e=>{this.connected=!0,M(this,Ga).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 _l}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&(e==="url"||e==="disabled")&&this._restart()}_restart(){this._stop(),this._start()}_start(e=this.url){if(!a.isNullOrEmpty(e)&&!this.disabled){let t=H(this,Ga,new EventSource(e));t.onopen=this._connectHandler,t.onerror=this._errorHandler}}get eventSource(){return M(this,Ga)}_stop(){let e=this.items||[];for(var t of e)t.stop();let n=M(this,Ga);a.isNull(n)||(n.onopen=null,n.onerror=null,n.onmessage=null,n.close()),this.connected=!1,H(this,Ga,null)}};Ga=new WeakMap,c([h({emit:!1,converter:m.String})],Li.prototype,"url",2),c([h({converter:m.Boolean})],Li.prototype,"connected",2),c([me(!0)],Li.prototype,"_restart",1),Li=c([C({tagName:d+"-sse-proxy"})],Li);var Tp={};Le(Tp,{Scaffolding:()=>$m});var $m={};Le($m,{BASIC_VALIDATOR_TEMPLATE:()=>Is,CHAR_COUNTER_CHILD:()=>er,CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE:()=>Or,CalendarDateUnselectEvent:()=>Cu,ChangePolicy:()=>Mv,ContenteditableDOMObserver:()=>Cl,ContenteditableUtils:()=>Ee,DEFAULT_ATTRIBUTION:()=>R0,DEFAULT_TILES:()=>D0,FileChangeEvent:()=>Mp,FileChangeEventName:()=>X_,FileUploadEvent:()=>Mu,FileUploadEventName:()=>Om,FormEventEmitter:()=>mm,FormResetEvent:()=>hm,FormResetEventName:()=>Qy,FormSubmitEvent:()=>um,FormSubmitEventName:()=>Zy,ImageFetchRequestEvent:()=>Su,ImageFetchRequestEventName:()=>Im,KnownExecCommand:()=>hv,PacemAsyncValidatorElement:()=>$r,PacemBaseElement:()=>_e,PacemBaseInputElement:()=>Pi,PacemBaseValidatorElement:()=>Gt,PacemBinaryValidatorElement:()=>Os,PacemCalendarMonthPickerElement:()=>Al,PacemCalendarPickerElement:()=>ir,PacemCalendarYearPickerElement:()=>Dl,PacemCharCountElement:()=>ja,PacemCharsInputElement:()=>Bs,PacemCheckboxElement:()=>un,PacemCheckboxListElement:()=>ro,PacemChildFormElement:()=>fr,PacemChildFormPropagatorElement:()=>no,PacemColorInputElement:()=>Vs,PacemCompareValidatorElement:()=>Rs,PacemContenteditableAlignCommandElement:()=>In,PacemContenteditableButtonCommandElement:()=>xt,PacemContenteditableCommandElement:()=>Ni,PacemContenteditableElement:()=>ys,PacemContenteditableExecCommandElement:()=>dr,PacemContenteditableHistoryCommandElement:()=>xs,PacemContenteditableImageCommandElement:()=>Cs,PacemContenteditableLinkCommandElement:()=>Ya,PacemContenteditablePlaceholderElement:()=>Xa,PacemContenteditableWrapCommandElement:()=>ap,PacemCustomValidatorElement:()=>io,PacemDataItemElement:()=>Pn,PacemDataSourceElement:()=>vt,PacemDatetimePickerElement:()=>Ye,PacemEditImageElement:()=>ot,PacemEmailInputElement:()=>Pl,PacemFormElement:()=>Ke,PacemFormFieldElement:()=>sr,PacemFormRelevantElement:()=>On,PacemGeolocateElement:()=>hn,PacemHiddenInputElement:()=>Sp,PacemHierarchyElement:()=>Ct,PacemImageInputElement:()=>Ft,PacemItemElement:()=>ip,PacemItemsContainerBaseElement:()=>Wa,PacemLatLngElement:()=>It,PacemLengthValidatorElement:()=>As,PacemMarkdownTextAreaElement:()=>Gs,PacemModelElement:()=>xl,PacemNameValueListElement:()=>Bl,PacemNumberInputElement:()=>oo,PacemOrdinalInputElement:()=>ao,PacemPasswordInputElement:()=>lo,PacemPropertyPickerElement:()=>Vl,PacemRadioElement:()=>$i,PacemRadioListElement:()=>co,PacemRangeValidatorElement:()=>Ds,PacemRegexValidatorElement:()=>Ps,PacemRequiredValidatorElement:()=>Rl,PacemSearchInputElement:()=>Lp,PacemSelectElement:()=>Us,PacemSliderElement:()=>Tt,PacemSnapshotElement:()=>bt,PacemSuggestElement:()=>Et,PacemTagElement:()=>po,PacemTagsElement:()=>Un,PacemTelInputElement:()=>Il,PacemTextAreaElement:()=>zs,PacemTextInputElement:()=>$l,PacemTextualInputElement:()=>rt,PacemUploadElement:()=>Xe,PacemUrlInputElement:()=>Hl,Picture:()=>Lv,SnapshotStep:()=>Sv});var Zy="submit",Qy="reset",um=class extends oe{constructor(r){super(Zy,r,{bubbles:!0,cancelable:!0})}},hm=class extends Event{constructor(){super(Qy,{bubbles:!0,cancelable:!0})}},Ky=["download",kc,Yt],Jy=!1,mm=class{constructor(r){this._element=r;this._itemEmitHandler=r=>{if(this._element.handle(r),r.type===Yt){let e=r;this._element.handle(new CustomEvent("item"+e.detail.commandName.toLowerCase(),{detail:e.detail.commandArgument}))}}}start(){Ky.forEach(r=>this._element.addEventListener(r,this._itemEmitHandler,!1))}stop(){Ky.forEach(r=>this._element.removeEventListener(r,this._itemEmitHandler,!1))}},On=class extends R.PacemElement{viewActivatedCallback(){super.viewActivatedCallback(),this.form=A.findAncestorOfType(this,Ke)}};c([h({converter:m.Element})],On.prototype,"form",2);var np,Ke=class extends On{constructor(){super("form");this.method=pt.HttpMethod.Post;this._emitter=null;this._buttons={submit:void 0,reset:void 0};z(this,np,!1);this._keyupHandler=e=>{if(e.keyCode===13&&!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let t=e.currentTarget.querySelector(d+"-button[type=submit]");!a.isNull(t)&&a.isVisible(t)&&!t.disabled&&t.click()}};this._submit=(e,t)=>{a.isNull(t)||Q(t),Promise.all(this._validateAllFields()).then(n=>{n.findIndex(i=>i===!1)===-1&&this.submit(e).then(i=>{this.setPristine()},i=>{})})};this._reset=e=>{a.isNull(e)||Q(e);var t=new hm;if(this.dispatchEvent(t),!t.defaultPrevented){for(var n in this._fields){var i=this._fields[n];i instanceof xl&&i.reset()}for(var s of this._subForms)s._reset()}};this._fields={};this._validators={};this._subForms=[];this._fieldPropertyChanged=e=>{switch(e.detail.propertyName){case"value":let t=e.target;this._checkFieldValidity(t.name);break;case"dirty":this._checkDirtyness();break;case"valid":this._checkValidity();break}};this._validatorPropertyChanged=e=>{let t=e.target,n=t.watch;if(e.detail.propertyName==="invalid"){let i=this._fields[t.watch];t.invalid?i.valid=!1:this._checkFieldValidity(n)}else this._checkFieldValidity(n)};this.suddenValidation=!0;this.resettable=!0;this._emitter=new mm(this)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="method"&&this.autogenerate===!0&&!a.isNullOrEmpty(this.metadata)||e==="metadata"&&this.autogenerate===!0||e==="autogenerate"&&n===!0&&this.metadata&&(this.metadata.props||this.metadata).length>0)&&this._buildUpForm()}viewActivatedCallback(){super.viewActivatedCallback(),this.form&&this.form.registerSubForm(this),this._checkValidity(),this.addEventListener("keyup",this._keyupHandler,!1),this._emitter.start()}disconnectedCallback(){this._emitter.stop(),this.removeEventListener("keyup",this._keyupHandler,!1),this.form&&this.form.unregisterSubForm(this),super.disconnectedCallback()}_buildUpForm(){let e="_"+a.uniqueCode(),t=this.id=this.id||e,n="fetch"+e,i=document.createElement("form");i.id="form"+e,i.className=b+"-form",i.setAttribute("pacem",""),i.setAttribute("novalidate","");let s=`<${d}-repeater datasource="{{ #${t}.metadata && (#${t}.metadata.props || #${t}.metadata) }}">
|
|
380
|
+
});`,MAPS_NOT_FOUND:"google.maps not found.",GEOCODER_UNAVAILABLE:"google.maps geocoder unavailable.",INVALID_KEY:"invalid google.maps api key.",TILE_EXTENT:[-Math.PI*6378137,Math.PI*6378137]},iv=class o{#e;#t;_equivalent(r,e,t,n){let i=this.#t;return!a.isNull(i)&&i.key===r&&i.language===(e||i.language)&&i.region===(t||i.region)&&i.version===(n||i.version)}_spinFuture(r,e,t,n){return new Promise((i,s)=>{this._equivalent(r,e,t,n)||o._ensureBootstrapScript(r,e,t,n),this.#t={language:e,region:t,version:n,key:r},google.maps.importLibrary("maps").then(l=>{i(),this.#e=null},l=>{s(l),this.#e=null})})}boostrap(r,e,t,n="weekly"){return a.isNullOrEmpty(r)?Promise.reject(tu.INVALID_KEY):((a.isNull(this.#e)||!this._equivalent(r,e,t,n))&&(this.#e=this._spinFuture(r,e,t,n)),this.#e)}static _ensureBootstrapScript(r,e,t,n){let i="pacem-googlemaps",s=`v=${n},l=${e},r=${t}`,l=document.querySelector(`script[${i}]`);if(!a.isNull(l)){if(l.getAttribute(i)===s)return;l.remove(),document.querySelectorAll("script[src^='https://maps.googleapis.com/maps']").forEach(p=>p.remove()),delete window.google}a.isNullOrEmpty(r)||(l=document.createElement("script"),l.setAttribute(i,s),l.textContent=tu.BOOTSTRAP_SNIPPET(r,e,t,n),document.head.appendChild(l))}},sv=new iv,sn=class o{static getPosition(r){return Array.isArray(r)?{lat:r[0],lng:r[1]}:r}static getBounds(r){return a.isNullOrEmpty(r)?null:{north:r.ne.lat,east:r.ne.lng,south:r.sw.lat,west:r.sw.lng}}static mapGeocodeResults(r,e=[]){let t=[];r??=[];for(let n=0;n<r.length;n++){let i=e.length>n?e[n]:null,s=o.mapGeocodeResult(r[n],i);t.push(s)}return t}static mapGeocodeResult(r,e){let t=r?.address_components||[],n=t.find(_=>_.types.indexOf("street_number")>=0)?.long_name,i=t.find(_=>_.types.indexOf("route")>=0)?.long_name,s=t.find(_=>_.types.indexOf("locality")>=0)?.long_name,l=t.find(_=>_.types.indexOf("administrative_area_level_3")>=0)?.long_name,p=t.find(_=>_.types.indexOf("administrative_area_level_2")>=0),u=t.find(_=>_.types.indexOf("administrative_area_level_1")>=0)?.short_name,f=t.find(_=>_.types.indexOf("country")>=0),g=t.find(_=>_.types.indexOf("postal_code")>=0)?.short_name,v={houseNumber:n,city:l||s,provinceCode:p?.short_name,province:p?.long_name,countryCode:f?.short_name,country:f?.long_name,zipCode:g,streetName:i,state:u,village:s,type:r.geometry.location_type};return{fullAddress:r.formatted_address,position:o.toLiteral(r.geometry.location,e?.elevation),address:v}}static toLiteral(r,e){if(a.isNull(r))return null;if("lat"in r&&typeof r.lat=="function"&&"lng"in r&&typeof r.lng=="function")return{lat:r.lat(),lng:r.lng(),altitude:e};if("getNorthEast"in r&&typeof r.getNorthEast=="function"&&"getSouthWest"in r&&typeof r.getSouthWest=="function"){let t=r.getNorthEast(),n=r.getSouthWest();return{ne:o.toLiteral(t),sw:o.toLiteral(n)}}return"north"in r&&typeof r.north=="number"&&"south"in r&&typeof r.south=="number"&&"west"in r&&typeof r.west=="number"&&"east"in r&&typeof r.east=="number"?{ne:{lat:r.north,lng:r.east},sw:{lat:r.south,lng:r.west}}:a.extend({altitude:e},r)}static areEqual(r,e){if(a.isNull(r)||a.isNull(e))return!1;let t=o.toLiteral(r),n=o.toLiteral(e);return t.lat===n.lat&&t.lng===n.lng}static fitBounds(r,e,t){r?.fitBounds(e,t)}static setCenter(r,e){!a.isNull(r)&&!o.areEqual(r.getCenter(),e)&&r.panTo(e)}},av=class extends fs{getShapeBounds(r){let e=new google.maps.LatLngBounds;if(r instanceof google.maps.Circle){let t=r.getBounds();t&&(e.extend(t.getNorthEast()),e.extend(t.getSouthWest()))}else r instanceof google.maps.Polygon?r.getPath().forEach(t=>e.extend(t)):r instanceof google.maps.Polyline&&r.getPath().forEach(t=>e.extend(t));return e.isEmpty()!==!1?st.Empty:sn.toLiteral(e)}deleteShape(r,e){r.setMap(null)}getShapePosition(r){return"latLng"in r?r.latLng:null}buildShape(r,e){return r instanceof Ei?new google.maps.Polyline({path:r.vertices,clickable:!0,map:e}):r instanceof wi?new google.maps.Polygon({paths:[r.vertices],clickable:!0,map:e}):r instanceof An?new google.maps.Circle({center:r.center,radius:r.radius,clickable:!0,map:e}):null}addClickEventListener(r,e){r.addListener("click",e)}addDragEventListener(r,e){r.addListener("drag",e)}addDragStartEventListener(r,e){r.addListener("dragstart",e)}addDragEndEventListener(r,e){r.addListener("dragend",e)}setShape(r,e){e instanceof Ei&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,path:e.vertices}),e instanceof wi&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:e.fill?.color,fillOpacity:e.fill?.alpha,paths:[e.vertices]}),e instanceof An&&r.setOptions({strokeColor:e.stroke?.color,strokeOpacity:e.stroke?.alpha??1,strokeWeight:e.stroke?.thickness,strokePosition:google.maps.StrokePosition.CENTER,fillColor:e.fill?.color,fillOpacity:e.fill?.alpha,center:e.center,radius:e.radius})}setEditable(r,e){r.setOptions({editable:e})}setDraggable(r,e){r.setOptions({draggable:e})}},ov=class extends ms{deleteInfoWindow(r,e){r.unbindAll()}deleteMarker(r,e){r.setMap(null)}get mapAutomaticallyScrollsOnDrag(){return!0}getMarkerPosition(r){let e=r.getPosition();return{lat:e.lat(),lng:e.lng()}}buildMarker(r,e){return new google.maps.Marker({position:r.position,map:e})}addClickEventListener(r,e,t){r.addListener("click",t)}addDragEventListener(r,e,t){r.addListener("drag",t)}addDragEndEventListener(r,e,t){r.addListener("dragend",t)}setPosition(r,e){r.setPosition(e)}setIcon(r,e){if(typeof e=="string")r.setIcon(e);else if(!a.isNull(e)){let t={url:e.url};a.isNullOrEmpty(e.size)||(t.size=new google.maps.Size(e.size.width,e.size.height),t.anchor=new google.maps.Point(e.size.width/2,e.size.height)),a.isNullOrEmpty(e.anchor)||(t.anchor=new google.maps.Point(e.anchor.x,e.anchor.y)),r.setIcon(t)}}setLabel(r,e){r.setLabel(e)}setDraggable(r,e){r.setDraggable(e)}closeInfo(r){r.close()}openInfo(r,e,t,n){r.open(t,n)}buildInfoWindow(r){let e=0;return typeof r.icon!="string"&&!a.isNull(r.icon)&&(e=(r.icon.size?.width??0)/2-(r.icon.anchor?.x??0)),new google.maps.InfoWindow({pixelOffset:new google.maps.Size(-e,0)})}addCloseClickEventListener(r,e,t){r.addListener("closeclick",t)}setContent(r,e){r.setContent(e)}},lv=class extends hs{addLoadEventListener(r,e,t){r.addListener("tilesloaded",t)}removeLoadEventListener(r,e,t){}deleteLayer(r,e){let n=e.overlayMapTypes.getArray().findIndex(i=>i===r);n>=0&&e.overlayMapTypes.removeAt(n)}_getBounds(r,e,t){let n=tu.TILE_EXTENT;var i=n[1]*2/Math.pow(2,t),s=n[0]+r*i,l=n[0]+(r+1)*i,p=n[1]-(e+1)*i,u=n[1]-e*i;return[s,p,l,u]}_getWmsTileUrl(r,e){return(t,n)=>a.URIs.appendQuery(r,{service:"WMS",styles:"",transparent:"true",request:"GetMap",srs:"EPSG:3857",format:"image/png",version:"1.1.1",layers:e?.join(",")||"",width:"256",height:"256",bbox:this._getBounds(t.x,t.y,n).join(",")})}_getWmsLayer(r,e){let t=new google.maps.ImageMapType({getTileUrl:this._getWmsTileUrl(r.url,r.include),minZoom:r.minZoom,maxZoom:r.maxZoom,opacity:1});return e.overlayMapTypes.push(t),t}_getTmsTileUrl(r){function t(n){return"abc"[Math.abs(n.x+n.y)%3]}return(n,i)=>{let s={r:"",s:t(n),x:""+n.x,y:""+n.y,z:""+i},l=r;for(let p in s)l=l.replaceAll("{"+p+"}",s[p]);return l}}_getTmsLayer(r,e){let t=new google.maps.ImageMapType({getTileUrl:this._getTmsTileUrl(r.url),minZoom:r.minZoom,maxZoom:r.maxZoom,opacity:1});return e.overlayMapTypes.push(t),t}buildLayer(r,e){switch((r.mode||"").toLowerCase()){case"wms":return this._getWmsLayer(r,e);case"tms":return this._getTmsLayer(r,e);default:throw new Error(`"${r.mode}" overlays not supported for the Google Maps integration.`)}}};function ww(o){class r extends google.maps.OverlayView{constructor(i){super();this._item=i}get element(){return this._item}get bounds(){let i=this._item.bounds;return a.isNull(i)?null:sn.getBounds(i)}getBoundingBox(){let i=this.getProjection(),s=this.bounds;if(a.isNullOrEmpty(s))return null;let l=i.fromLatLngToDivPixel({lat:s.south,lng:s.west}),p=i.fromLatLngToDivPixel({lat:s.north,lng:s.east});return{x:l.x,y:p.y,width:p.x-l.x,height:l.y-p.y}}}class e extends r{get src(){return this.element.src}#e;onAdd(){let n=this.#e=this.#e||document.createElement("div");n.style.position="absolute",this.getPanes().overlayLayer.appendChild(n)}onRemove(){let n=this.#e;a.isNull(n)||(n.remove(),this.#e=null)}draw(){let n=this.#e;if(a.isNull(n))return;let i=this.getBoundingBox();a.isNull(i)||(n.style.top=i.y+"px",n.style.left=i.x+"px",n.style.width=i.width+"px",n.style.height=i.height+"px",n.style.backgroundSize=`${i.width}px ${i.height}px`,n.style.backgroundImage=`url(${this.src})`)}}return o instanceof Va?new e(o):null}var cv=class extends us{updateOverlay(r,e,t){r.set,r.draw()}deleteOverlay(r,e){r.setMap(null)}buildOverlay(r,e){let t=ww(r);return t.setMap(e),t}setBounds(r,e,t){r.draw()}},kw=["dragend","zoom_changed","center_changed","maptypeid_changed","tilt_changed","heading_changed","bounds_changed"];function Xy(o){let r=o.theme=="dark"?google.maps.ColorScheme.DARK:o.theme!="light"?google.maps.ColorScheme.FOLLOW_SYSTEM:google.maps.ColorScheme.LIGHT;switch(o.type){case google.maps.MapTypeId.HYBRID:case google.maps.MapTypeId.ROADMAP:case google.maps.MapTypeId.TERRAIN:case google.maps.MapTypeId.SATELLITE:return{type:o.type,theme:r};case"hybrid":return{type:google.maps.MapTypeId.HYBRID,theme:r};case"satellite":return{type:google.maps.MapTypeId.SATELLITE,theme:r};case"terrain":return{type:google.maps.MapTypeId.TERRAIN,theme:r};default:return{type:google.maps.MapTypeId.ROADMAP,theme:r}}}var Jc,Zc,nn=class extends Dn{constructor(){super(...arguments);z(this,Jc,new WeakMap);z(this,Zc,!1)}geocode(e,t){let n=this.language||"",i=this.region||"",s=this.version||"weekly";return new pm(this.apiKey,n,i,s).geocode(e,t)}reverseGeocode(e,t){let n=this.language||"",i=this.region||"",s=this.version||"weekly";return new pm(this.apiKey,n,i,s).reverseGeocode(e,t)}getBounds(e){if(!this.hasMap(e))return st.Empty;let n=this.getMap(e).getBounds();return sn.toLiteral(n)}isActive(){return!a.isNullOrEmpty(this.apiKey)}buildMarkerAdapterFor(e){return new ov(e,this)}buildOverlayAdapterFor(e){return new cv(e,this)}buildShapeAdapterFor(e){return new av(e,this)}buildLayerAdapterFor(e){return new lv(e,this)}getMaxAvailableZoom(e){return new Promise((t,n)=>{new google.maps.MaxZoomService().getMaxZoomAtLatLng(e,s=>{s.status===google.maps.MaxZoomStatus.OK?t(s.zoom):n()})})}snapshot(e,t="image/png",n){let{container:i}=this.tryGetMap(e);return a.snapshotElement(i,null,t,n)}setViewNative(e,t){let n=this.getMap(e);t=a.extend({type:e.type,theme:e.theme},t);let{type:i,theme:s}=Xy(t);if(M(this,Zc)&&s!==n.get("colorScheme")){this._bootstrapDebounced();return}n.setOptions({colorScheme:s,mapTypeId:i}),typeof t.tilt=="number"&&n.setTilt(t.tilt),typeof t.heading=="number"&&n.setHeading(t.heading);let l=()=>{t.center&&sn.setCenter(n,t.center)};if(typeof t.zoom=="number"&&t.zoom!==n.getZoom())switch(n.getMapTypeId()){case google.maps.MapTypeId.SATELLITE:case google.maps.MapTypeId.HYBRID:let u=sn.toLiteral(n.getCenter());this.getMaxAvailableZoom(u).then(g=>{let v=Math.min(g,t.zoom);n.setZoom(v),l()});break;default:let f=Math.min(tu.MAX_ROADMAP_ZOOM,t.zoom);n.setZoom(f),l();break}else l()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"libraries":case"apiKey":case"language":case"region":M(this,Zc)&&this._bootstrapDebounced();break;case"defaultOptions":for(let s of this.enrolledMaps())this._updateMapOptions(s);break;default:for(let s of this.enrolledMaps())this.invalidateSize(s);break}}dispose(e){let t=M(this,Jc).get(e);for(;t.length;)google.maps.event.removeListener(t.pop());M(this,Jc).delete(e)}_updateMapOptions(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);t.setOptions(this._buildMapOptions(e))}_buildMapOptions(e){let t=e.scale,n=e.draggable,i=e.doubleClickZoom,s=e.keyboardShortcuts,{type:l,theme:p}=Xy({type:e.type,theme:e.theme});return a.extend({},this.defaultOptions||{streetViewControl:!1,zoomControl:!1,mapTypeControl:!1,fullscreenControl:!1,cameraControl:!1},{zoomControl:t&&!a.isNullOrEmpty(e.zoomControl),zoomControlOptions:{position:(function(u){switch(u){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:i,keyboardShortcuts:s,draggable:n,mapTypeId:l,colorScheme:p,tilt:e.tilt,heading:e.heading})}_bootstrapDebounced(){this._bootstrap().then(e=>{for(let t of this.enrolledMaps())t.adapter=null,t.adapter=this})}_bootstrap(){return new Promise((e,t)=>{let n=this.apiKey,i=this.language||"",s=this.region||"",l=this.version||"weekly";sv.boostrap(n,i,s,l).then(p=>{let u=[];for(let f of this.libraries||[])u.push(google.maps.importLibrary(f));Promise.all(u).then(f=>{e(),H(this,Zc,!0)},t)},t)})}async init(e){await this._bootstrap();let t=e,n=Rr.parseCoords(t.center),i=new google.maps.LatLng(n[0],n[1]),s=this._buildMapOptions(t),l=t.container,p=document.createElement("div");p.style.width="100%",p.style.height="100%",l.innerHTML="",l.appendChild(p);let u=new google.maps.Map(p,s),f=[];M(this,Jc).set(t,f),kw.forEach(_=>{f.push(u.addListener(_,this._spinMapUpdateHandler(t,u)))}),u.setZoom(t.zoom),u.setCenter(i);var g=u.addListener("idle",function(x){g.remove(),e.dispatchEvent(new Qt("maploaded"))});f.push(u.addListener("tilesloaded",_=>{e.dispatchEvent(new Qt("tilesloaded"))}));let v=Rr.parseCoords(t.center),y=new google.maps.LatLng(v[0],v[1]);return u.setZoom(t.zoom),u.setCenter(y),{map:u,container:p}}invalidateSize(e){if(!this.hasMap(e))return;let{map:t}=this.tryGetMap(e);google.maps.event.trigger(t,"resize")}_spinMapUpdateHandler(e,t){return()=>{if(!a.isNull(t)&&!a.isNull(e)){let n=t.getCenter();if(a.isNull(n))return;this.updateMapElement(e,{center:{lat:n.lat(),lng:n.lng()},zoom:t.getZoom(),type:t.getMapTypeId(),tilt:t.getTilt(),heading:t.getHeading()})}}}fitBoundsNative(e,t,n=this._getPadding(e)){let i=this.tryGetMap(e)?.map;if(a.isNull(i))return;let s=sn.getBounds(t);sn.fitBounds(i,s,n)}_getPadding(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;return n||t||i||s?{top:t,bottom:s,left:n,right:i}:null}_padBounds(e){let t=e.paddingTop||0,n=e.paddingLeft||0,i=e.paddingRight||0,s=e.paddingBottom||0;if(n||t||i||s){let l=this.tryGetMap(e).map,p=l.getBounds(),u=l.getDiv().clientWidth,f=l.getDiv().clientHeight,g=l.getProjection().fromPointToLatLng(new google.maps.Point(-n,-t)),v=l.getProjection().fromPointToLatLng(new google.maps.Point(u+i,f+s));p.extend(g),p.extend(v)}}_redrawMap(){}};Jc=new WeakMap,Zc=new WeakMap,c([h({emit:!1,converter:m.String})],nn.prototype,"apiKey",2),c([h({emit:!1,converter:m.String})],nn.prototype,"version",2),c([h({emit:!1,converter:m.String})],nn.prototype,"language",2),c([h({emit:!1,converter:m.String})],nn.prototype,"region",2),c([h({emit:!1,converter:m.Json})],nn.prototype,"defaultOptions",2),c([h({emit:!1,converter:m.StringArray})],nn.prototype,"libraries",2),c([me(tu.DETACH_TIMEOUT)],nn.prototype,"_bootstrapDebounced",1),nn=c([C({tagName:d+"-map-adapter-google"})],nn);var pm=class{constructor(r,e="",t="",n="weekly"){this.apiKey=r;this.language=e;this.region=t;this.version=n}_elevateResults(r){return new Promise((e,t)=>{new google.maps.ElevationService().getElevationForLocations({locations:r.map(i=>i.geometry.location)},(i,s)=>{if(s===google.maps.ElevationStatus.OK){let l=sn.mapGeocodeResults(r,i);e(l)}else{let l=sn.mapGeocodeResults(r);e(l)}})})}geocode(r,e=10){return new Promise((t,n)=>{sv.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(i=>{new google.maps.Geocoder().geocode({address:r},(l,p)=>{if(p===google.maps.GeocoderStatus.OK||p==google.maps.GeocoderStatus.ZERO_RESULTS){let u=(l||[]).filter((f,g)=>g<(e||10));this._elevateResults(u).then(t)}else n(p)})},n)})}_reverseGeocodeInternal(r,e){let t=sn.getPosition(r);return new Promise((n,i)=>{sv.boostrap(this.apiKey,this.language||"",this.region||"",this.version||"weekly").then(s=>{new google.maps.Geocoder().geocode({location:t},(p,u)=>{if(u===google.maps.GeocoderStatus.OK||u==google.maps.GeocoderStatus.ZERO_RESULTS){let f=(p||[]).filter((g,v)=>v<(e||10));this._elevateResults(f).then(n)}else i(u)})},i)})}reverseGeocode(r,e=1){return this._reverseGeocodeInternal(r,e)}};var pv={};Se(pv,{PacemAudioElement:()=>za,PacemMediaRecorderElement:()=>an});var vs,ep,tp,za=class extends K{constructor(){super(...arguments);z(this,vs);z(this,ep);z(this,tp);this._endedHandler=e=>{this.dispatchEvent(new Event("end"))};this._canPlayHandler=e=>{H(this,ep,!0),this._autoplay()};this._canPlayThroughHandler=e=>{H(this,tp,!0),this._autoplay()}}connectedCallback(){super.connectedCallback();let e=H(this,vs,new Audio);e.addEventListener("canplay",this._canPlayHandler,!1),e.addEventListener("ended",this._endedHandler,!1),e.addEventListener("canplaythrough",this._canPlayThroughHandler,!1)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||e==="src"&&this._init()}viewActivatedCallback(){super.viewActivatedCallback(),this._init()}disconnectedCallback(){let e=M(this,vs);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"):M(this,vs).play().then(e=>{this.dispatchEvent(new Event("start"))},e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))})}pause(){M(this,vs).pause()}reset(){M(this,vs).load()}get _canPlay(){return this.stream&&M(this,ep)||M(this,tp)}_autoplay(){this.autoplay&&this._canPlay&&this.play()}_init(e=this.src){let t=M(this,vs);H(this,ep,H(this,tp,!1)),t.src=e}};vs=new WeakMap,ep=new WeakMap,tp=new WeakMap,c([h({emit:!1,converter:m.String})],za.prototype,"src",2),c([h({emit:!1,converter:m.Boolean})],za.prototype,"stream",2),c([h({emit:!1,converter:m.Boolean})],za.prototype,"autoplay",2),za=c([C({tagName:d+"-audio"})],za);var Mw=25,qy="video/mp4",Sw=128e3,Lw=25e5,Ky=["start","stop","dataavailable","pause","resume","error","warning"];function Nw(o){return o instanceof HTMLCanvasElement?!0:"captureStream"in o&&typeof o.captureStream=="function"}var on,rp,an=class extends K{constructor(){super(...arguments);this._recorderLifecycleHandler=e=>{switch(this.state=M(this,on).state,e.type){case"start":this.output=null;break;case"stop":this.flush();break;case"dataavailable":var t=e;M(this,rp).push(t.data);break}};z(this,on,null);z(this,rp,[])}viewActivatedCallback(){super.viewActivatedCallback(),this._setupMediaRecorder()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"source":case"fps":case"mimeType":case"audioBitsPerSecond":case"videoBitsPerSecond":this._setupMediaRecorder();break}}disconnectedCallback(){this._closeMediaRecorder(),super.disconnectedCallback()}_setupMediaRecorder(e=this.source,t={mimeType:this.mimeType||qy,audioBitsPerSecond:this.audioBitsPerSecond??Sw,videoBitsPerSecond:this.videoBitsPerSecond??Lw}){if(this._closeMediaRecorder(),!a.isNull(e)){if(Nw(e)){let i=this.fps||Mw;e=e.captureStream(i)}try{H(this,on,new MediaRecorder(e,t))}catch(i){console.error(i)}let n=M(this,on);Ky.forEach(i=>{n.addEventListener(i,this._recorderLifecycleHandler,!1)})}}_closeMediaRecorder(){let e=M(this,on);a.isNull(e)||(e.state!=="inactive"&&e.stop(),Ky.forEach(t=>{e.removeEventListener(t,this._recorderLifecycleHandler,!1)}),H(this,on,null))}flush(){let e=new Blob(M(this,rp),{type:this.mimeType||qy});H(this,rp,[]),this.output=e}start(){let e=M(this,on);!a.isNull(e)&&e.state==="inactive"&&e.start()}stop(){let e=M(this,on);!a.isNull(e)&&e.state!=="inactive"&&e.stop()}resume(){let e=M(this,on);!a.isNull(e)&&e.state==="paused"&&e.start()}pause(){let e=M(this,on);!a.isNull(e)&&e.state!=="paused"&&e.pause()}};on=new WeakMap,rp=new WeakMap,c([h({emit:!1,converter:m.Element})],an.prototype,"source",2),c([h({emit:!1,converter:m.Number})],an.prototype,"fps",2),c([h({emit:!1,converter:m.String})],an.prototype,"mimeType",2),c([h({emit:!1,converter:m.Number})],an.prototype,"audioBitsPerSecond",2),c([h({emit:!1,converter:m.Number})],an.prototype,"videoBitsPerSecond",2),c([h({converter:m.String})],an.prototype,"state",2),c([h()],an.prototype,"output",2),an=c([C({tagName:d+"-media-recorder"})],an);var dv={};Se(dv,{PacemHubListenerElement:()=>bs,PacemHubProxyElement:()=>Si,PacemServerSentEventsListenerElement:()=>_l,PacemServerSentEventsProxyElement:()=>Li});var Tw="https://cdn.jsdelivr.net/npm/@microsoft/signalr@10.0.0/dist/browser/signalr.min.js",Aw={API_JS:Tw},ru,bs=class extends R.PacemItemElement{constructor(){super(...arguments);z(this,ru);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=>{e.detail.propertyName==="connected"&&e.detail.currentValue===!0&&this._start()}}get _isConnected(){return this.container instanceof Si&&this.container.connected||!1}get _connection(){return this.container instanceof Si&&this.container.connection||null}start(){this.disabled||this._start()}stop(){this._stop()}_stop(e=this.method,t=this.stream){if(!this._isConnected)return;let n=this._connection;a.isNullOrEmpty(e)||(t?M(this,ru)?.dispose():n.off(e,this._receiveHandler))}_start(e=this.method,t=this.stream){if(!this._isConnected)return;let n=this._connection;if(!a.isNullOrEmpty(e))if(!t)n.on(e,this._receiveHandler);else{let i=this.arguments||[],s=signalR.HubConnection.prototype.stream.apply(n,[e].concat(i));H(this,ru,s.subscribe({next:this._receiveHandler,complete:this._completeHandler,error:this._errorHandler}))}}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||e.addEventListener(ee,this._connectedHandler,!1),this.start()}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"arguments":this._stop(),this._start();break;case"method":a.isNullOrEmpty(t)||this._stop(t,this.stream),a.isNullOrEmpty(n)||this._start(n,this.stream);break;case"stream":let s=this.method;a.isNullOrEmpty(s)||(this._stop(s,t),this._start(s,n));break;case"disabled":a.isNullOrEmpty(this.method)||(n?this._stop:this._start)();break}}};ru=new WeakMap,c([h({emit:!1,converter:m.String})],bs.prototype,"method",2),c([h({emit:!1,converter:m.Boolean})],bs.prototype,"stream",2),c([h({emit:!1,converter:m.Json})],bs.prototype,"arguments",2),bs=c([C({tagName:d+"-hub-listener"})],bs);var Si=class extends R.PacemItemsContainerElement{validate(r){return r instanceof bs}get connection(){return this._hub}invoke(r,...e){if(this.connected)return this._hub.invoke.apply(this._hub,arguments);throw"Hub is not connected. Cannot call `invoke` method."}send(r,...e){if(this.connected)return this._hub.send(r,...e);throw"Hub is not connected. Cannot call `send` method."}start(){return this._resetProxy()}async stop(){this.connected&&await this._hub.stop()}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="url"||r==="disabled"||r==="accesstoken")&&this._resetProxy()}viewActivatedCallback(){super.viewActivatedCallback(),this.start()}disconnectedCallback(){this.stop(),super.disconnectedCallback()}async _resetProxy(){a.isNull(this._hub)||await this._hub.stop(),this._setupProxy()}async _initialize(){"signalR"in window||await A.importjs(Aw.API_JS)}async _setupProxy(){let r=this.items||[];if(!this.disabled&&!a.isNullOrEmpty(this.url)){await this._initialize();let e=new signalR.HubConnectionBuilder;e.withUrl(this.url,{accessTokenFactory:()=>this.accesstoken});let t=this._hub=e.build();t.onclose(()=>{for(var n of r)n.stop();this.connected=!1,this._hub=null}),await t.start(),this.connected=!0}}};c([h({emit:!1,converter:m.String})],Si.prototype,"url",2),c([h({emit:!1,converter:m.String})],Si.prototype,"accesstoken",2),c([h({converter:m.Boolean})],Si.prototype,"connected",2),Si=c([C({tagName:d+"-hub-proxy"})],Si);var _l=class extends R.PacemItemElement{constructor(){super(...arguments);this._receiveHandler=e=>{this.dispatchEvent(new CustomEvent("receive",{detail:e.data}))};this._connectedHandler=e=>{e.detail.propertyName==="connected"&&e.detail.currentValue===!0&&this._start()}}get _isConnected(){return this.container instanceof Li&&this.container.connected||!1}get _connection(){return this.container instanceof Li&&this.container.eventSource||null}_stop(e=this.method){if(!this._isConnected)return;let t=this._connection;a.isNullOrEmpty(e)||t.removeEventListener(e,this._receiveHandler)}_start(e=this.method){if(!this._isConnected)return;let t=this._connection;a.isNullOrEmpty(e)||t.addEventListener(e,this._receiveHandler)}start(){this.disabled||this._start()}stop(){this._stop()}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||e.addEventListener(ee,this._connectedHandler,!1),this.start()}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._connectedHandler,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"method":a.isNullOrEmpty(t)||this._stop(t),a.isNullOrEmpty(n)||this._start(n);break;case"disabled":a.isNullOrEmpty(this.method)||(n?this._stop:this._start)();break}}};c([h({emit:!1,converter:m.String})],_l.prototype,"method",2),_l=c([C({tagName:d+"-sse-listener"})],_l);var Ga,Li=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);z(this,Ga);this._connectHandler=e=>{this.connected=!0,M(this,Ga).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 _l}viewActivatedCallback(){super.viewActivatedCallback(),this._start()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&(e==="url"||e==="disabled")&&this._restart()}_restart(){this._stop(),this._start()}_start(e=this.url){if(!a.isNullOrEmpty(e)&&!this.disabled){let t=H(this,Ga,new EventSource(e));t.onopen=this._connectHandler,t.onerror=this._errorHandler}}get eventSource(){return M(this,Ga)}_stop(){let e=this.items||[];for(var t of e)t.stop();let n=M(this,Ga);a.isNull(n)||(n.onopen=null,n.onerror=null,n.onmessage=null,n.close()),this.connected=!1,H(this,Ga,null)}};Ga=new WeakMap,c([h({emit:!1,converter:m.String})],Li.prototype,"url",2),c([h({converter:m.Boolean})],Li.prototype,"connected",2),c([me(!0)],Li.prototype,"_restart",1),Li=c([C({tagName:d+"-sse-proxy"})],Li);var Tp={};Se(Tp,{Scaffolding:()=>$m});var $m={};Se($m,{BASIC_VALIDATOR_TEMPLATE:()=>Is,CHAR_COUNTER_CHILD:()=>er,CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE:()=>Or,CalendarDateUnselectEvent:()=>Cu,ChangePolicy:()=>Mv,ContenteditableDOMObserver:()=>Cl,ContenteditableUtils:()=>Ee,DEFAULT_ATTRIBUTION:()=>O0,DEFAULT_TILES:()=>R0,FileChangeEvent:()=>Mp,FileChangeEventName:()=>q_,FileUploadEvent:()=>Mu,FileUploadEventName:()=>Om,FormEventEmitter:()=>mm,FormResetEvent:()=>hm,FormResetEventName:()=>e_,FormSubmitEvent:()=>um,FormSubmitEventName:()=>Qy,ImageFetchRequestEvent:()=>Su,ImageFetchRequestEventName:()=>Im,KnownExecCommand:()=>hv,PacemAsyncValidatorElement:()=>$r,PacemBaseElement:()=>_e,PacemBaseInputElement:()=>Pi,PacemBaseValidatorElement:()=>Gt,PacemBinaryValidatorElement:()=>Os,PacemCalendarMonthPickerElement:()=>Al,PacemCalendarPickerElement:()=>ir,PacemCalendarYearPickerElement:()=>Dl,PacemCharCountElement:()=>ja,PacemCharsInputElement:()=>Bs,PacemCheckboxElement:()=>un,PacemCheckboxListElement:()=>ro,PacemChildFormElement:()=>fr,PacemChildFormPropagatorElement:()=>no,PacemColorInputElement:()=>Vs,PacemCompareValidatorElement:()=>Rs,PacemContenteditableAlignCommandElement:()=>In,PacemContenteditableButtonCommandElement:()=>xt,PacemContenteditableCommandElement:()=>Ni,PacemContenteditableElement:()=>ys,PacemContenteditableExecCommandElement:()=>dr,PacemContenteditableHistoryCommandElement:()=>xs,PacemContenteditableImageCommandElement:()=>Cs,PacemContenteditableLinkCommandElement:()=>Ya,PacemContenteditablePlaceholderElement:()=>Xa,PacemContenteditableWrapCommandElement:()=>ap,PacemCustomValidatorElement:()=>io,PacemDataItemElement:()=>Pn,PacemDataSourceElement:()=>vt,PacemDatetimePickerElement:()=>Ye,PacemEditImageElement:()=>ot,PacemEmailInputElement:()=>Pl,PacemFormElement:()=>Ke,PacemFormFieldElement:()=>sr,PacemFormRelevantElement:()=>On,PacemGeolocateElement:()=>hn,PacemHiddenInputElement:()=>Sp,PacemHierarchyElement:()=>Ct,PacemImageInputElement:()=>Ft,PacemItemElement:()=>ip,PacemItemsContainerBaseElement:()=>Wa,PacemLatLngElement:()=>It,PacemLengthValidatorElement:()=>As,PacemMarkdownTextAreaElement:()=>Gs,PacemModelElement:()=>xl,PacemNameValueListElement:()=>Bl,PacemNumberInputElement:()=>oo,PacemOrdinalInputElement:()=>ao,PacemPasswordInputElement:()=>lo,PacemPropertyPickerElement:()=>Vl,PacemRadioElement:()=>$i,PacemRadioListElement:()=>co,PacemRangeValidatorElement:()=>Ds,PacemRegexValidatorElement:()=>Ps,PacemRequiredValidatorElement:()=>Rl,PacemSearchInputElement:()=>Lp,PacemSelectElement:()=>Us,PacemSliderElement:()=>Tt,PacemSnapshotElement:()=>bt,PacemSuggestElement:()=>Et,PacemTagElement:()=>po,PacemTagsElement:()=>Un,PacemTelInputElement:()=>Il,PacemTextAreaElement:()=>zs,PacemTextInputElement:()=>$l,PacemTextualInputElement:()=>rt,PacemUploadElement:()=>Xe,PacemUrlInputElement:()=>Hl,Picture:()=>Lv,SnapshotStep:()=>Sv});var Qy="submit",e_="reset",um=class extends oe{constructor(r){super(Qy,r,{bubbles:!0,cancelable:!0})}},hm=class extends Event{constructor(){super(e_,{bubbles:!0,cancelable:!0})}},Jy=["download",kc,Yt],Zy=!1,mm=class{constructor(r){this._element=r;this._itemEmitHandler=r=>{if(this._element.handle(r),r.type===Yt){let e=r;this._element.handle(new CustomEvent("item"+e.detail.commandName.toLowerCase(),{detail:e.detail.commandArgument}))}}}start(){Jy.forEach(r=>this._element.addEventListener(r,this._itemEmitHandler,!1))}stop(){Jy.forEach(r=>this._element.removeEventListener(r,this._itemEmitHandler,!1))}},On=class extends R.PacemElement{viewActivatedCallback(){super.viewActivatedCallback(),this.form=A.findAncestorOfType(this,Ke)}};c([h({converter:m.Element})],On.prototype,"form",2);var np,Ke=class extends On{constructor(){super("form");this.method=pt.HttpMethod.Post;this._emitter=null;this._buttons={submit:void 0,reset:void 0};z(this,np,!1);this._keyupHandler=e=>{if(e.keyCode===13&&!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let t=e.currentTarget.querySelector(d+"-button[type=submit]");!a.isNull(t)&&a.isVisible(t)&&!t.disabled&&t.click()}};this._submit=(e,t)=>{a.isNull(t)||Q(t),Promise.all(this._validateAllFields()).then(n=>{n.findIndex(i=>i===!1)===-1&&this.submit(e).then(i=>{this.setPristine()},i=>{})})};this._reset=e=>{a.isNull(e)||Q(e);var t=new hm;if(this.dispatchEvent(t),!t.defaultPrevented){for(var n in this._fields){var i=this._fields[n];i instanceof xl&&i.reset()}for(var s of this._subForms)s._reset()}};this._fields={};this._validators={};this._subForms=[];this._fieldPropertyChanged=e=>{switch(e.detail.propertyName){case"value":let t=e.target;this._checkFieldValidity(t.name);break;case"dirty":this._checkDirtyness();break;case"valid":this._checkValidity();break}};this._validatorPropertyChanged=e=>{let t=e.target,n=t.watch;if(e.detail.propertyName==="invalid"){let i=this._fields[t.watch];t.invalid?i.valid=!1:this._checkFieldValidity(n)}else this._checkFieldValidity(n)};this.suddenValidation=!0;this.resettable=!0;this._emitter=new mm(this)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="method"&&this.autogenerate===!0&&!a.isNullOrEmpty(this.metadata)||e==="metadata"&&this.autogenerate===!0||e==="autogenerate"&&n===!0&&this.metadata&&(this.metadata.props||this.metadata).length>0)&&this._buildUpForm()}viewActivatedCallback(){super.viewActivatedCallback(),this.form&&this.form.registerSubForm(this),this._checkValidity(),this.addEventListener("keyup",this._keyupHandler,!1),this._emitter.start()}disconnectedCallback(){this._emitter.stop(),this.removeEventListener("keyup",this._keyupHandler,!1),this.form&&this.form.unregisterSubForm(this),super.disconnectedCallback()}_buildUpForm(){let e="_"+a.uniqueCode(),t=this.id=this.id||e,n="fetch"+e,i=document.createElement("form");i.id="form"+e,i.className=b+"-form",i.setAttribute("pacem",""),i.setAttribute("novalidate","");let s=`<${d}-repeater datasource="{{ #${t}.metadata && (#${t}.metadata.props || #${t}.metadata) }}">
|
|
381
381
|
<${d}-panel css="{{ #${t}.metadata.display && #${t}.metadata.display.css }}" css-class="{{ (#${t}.metadata.display && #${t}.metadata.display.cssClass || []).concat(#${t}.suddenValidation ? [] : ['lazy-validation']) }}" class="${b}-animatable-list ${b}-list-appear">
|
|
382
382
|
<template>
|
|
383
383
|
<${d}-form-field fetch-credentials="{{ #${t}.fetchCredentials }}" fetch-headers="{{ #${t}.fetchHeaders }}"
|
|
@@ -399,24 +399,24 @@ disabled="{{ (#${t}.suddenValidation && (!(#${t}.valid && #${t}.dirty))) || #${t
|
|
|
399
399
|
<${d}-button logger="{{ #${t}.logger }}" on-click="#${t}._reset($event)" type="reset" class="button button-size size-small" css-class="{{ {'buttonset-first': #${t}.readonly || $pacem.isNullOrEmpty(#${t}.action) || !$pacem.isNull(#${t}.form)} }}" hide="{{ !#${t}.resettable || #${t}.readonly || !#${t}.dirty || !$pacem.isNull(#${t}.form) }}" disabled="{{ #${t}.fetching }}">
|
|
400
400
|
<${d}-text text="{{ #${t}.resetCaption || 'Reset' }}"></${d}-text>
|
|
401
401
|
</${d}-button>
|
|
402
|
-
</div></div>`;i.innerHTML=s,this.innerHTML="",this.appendChild(i),i.addEventListener("submit",Q,!1);let l=this._buttons,p=this._buttons={submit:i.lastElementChild.firstElementChild.firstElementChild,reset:i.lastElementChild.firstElementChild.lastElementChild};this.dispatchEvent(new ue({propertyName:"formButtons",currentValue:p,oldValue:l}))}get formButtons(){return this._buttons}get fetching(){return M(this,np)}submit(e){return new Promise((t,n)=>{a.isNull(e)&&n("Fetcher cannot be null while submitting a form."),this._submitInternally(e).then(i=>{this.dispatchEvent(new CustomEvent("success",{detail:i})),t(i)},i=>{i!==Jy&&this.dispatchEvent(new CustomEvent("fail",{detail:i})),n(i)})})}reset(){this._reset()}_submitInternally(e,p){if(a.isNull(e))throw"Fetcher cannot be null while submitting a form.";var n=_t.defer();let i=this.entity,s=this.entityName;var l={};a.isNullOrEmpty(s)?l=i:l[s]=i;var p={parameters:l,fields:this._getAllFields()},u=new um(p);if(this.dispatchEvent(u),u.defaultPrevented)n.reject(Jy);else{e.parameters=a.extend({},u.detail.parameters);let f=_=>{e.removeEventListener(pt.FetchSuccessEventName,f,!1),e.removeEventListener(pt.FetchErrorEventName,v,!1);let x=_.detail;pt.Fetcher.isEmpty(x)&&(e.removeEventListener(pt.FetchResultEventName,g,!1),this.success=!0,n.resolve({})),x.status===205&&this._reset()},g=_=>{e.removeEventListener(pt.FetchResultEventName,g,!1);var x=_.detail;typeof x=="object"&&x.hasOwnProperty("success")?x.success===!0?(this.success=!0,n.resolve(x.result||{})):(this.fail=!0,n.reject(x.error)):(this.success=!0,n.resolve(x))},v=_=>{e.removeEventListener(pt.FetchSuccessEventName,f,!1),e.removeEventListener(pt.FetchResultEventName,g,!1),e.removeEventListener(pt.FetchErrorEventName,v,!1),this.fail=!0;let x=_.detail;n.reject(x)},y=_=>{_.detail.propertyName==="fetching"&&(_.detail.currentValue===!0?(a.addClass(this,b+"-fetching"),H(this,np,!0),this.dispatchEvent(new ue({currentValue:!0,oldValue:!1,propertyName:"fetching"}))):(H(this,np,!1),this.dispatchEvent(new ue({currentValue:!1,oldValue:!0,propertyName:"fetching"})),a.removeClass(this,b+"-fetching"),e.removeEventListener(ee,y,!1)))};e.addEventListener(ee,y,!1),e.addEventListener(pt.FetchSuccessEventName,f,!1),e.addEventListener(pt.FetchResultEventName,g,!1),e.addEventListener(pt.FetchErrorEventName,v,!1),a.isNullOrEmpty(this.action)||(e.url=this.action),e instanceof R.PacemFetchElement&&!e.autofetch&&e.fetch(),this.success=this.fail=!1}return n.promise}_getAllFields(e={}){a.extend(e,this._fields);for(var t of this._subForms)t._getAllFields(e);return e}apply(e){if(!a.isNullOrEmpty(e)){this.entity=a.extend({},this.entity,e);for(let t in e)this.setDirty(t)}}setPristine(...e){this._setAs(!1,...e)}setDirty(...e){this._setAs(!0,...e)}_setAs(e,...t){let n=!a.isEmpty(t);for(let i in this._fields)if(!n||t.indexOf(i)>=0){let s=this._fields[i];s instanceof xl&&(e?s.setDirty():s.setPristine())}for(let i of this._subForms)e?i.setDirty(...t):i.setPristine(...t)}_checkFieldValidity(e){return this.suddenValidation?e in this._fields?this._validateField(e,!1):Promise.resolve(!1):Promise.resolve(null)}validate(e){return a.isNullOrEmpty(e)?Promise.all(this._validateAllFields()).then(t=>!t.some(n=>n===!1)):this._validateField(e,!1)}_validateAllFields(e=!0){let t=[];for(let n in this._fields)t.push(this._validateField(n,e));for(let n of this._subForms)Array.prototype.push.apply(t,n._validateAllFields(e));return t}_validateField(e,t){return new Promise((n,i)=>{var s=this._fields[e];if(s){var l=this._validators[s.name];l&&l.length>0?(this.log(ce.LogLevel.Log,`Computing "${s.name}" validity.`),Promise.all(l.map(p=>p.validate(s.value).then(u=>!(p.invalid=!u)))).then(p=>{let u=!0;for(var f of p)if(f===!1){u=!1,t&&s.setDirty();break}this.log(ce.LogLevel.Log,`Property "${s.name}" turns out to be ${u?"":"not "}valid.`),n(s.valid=u)})):(this.log(ce.LogLevel.Log,`Property "${s.name}" has no validators.`),n(s.valid=!0))}else this.log(ce.LogLevel.Log,`Property "${e}" has no fields in this form.`),n(!0)})}_checkDirtyness(){let e=!1;for(var t in this._fields)if(this._fields[t].dirty===!0){e=!0;break}if(e===!1){for(var n of this._subForms)if(n.dirty){e=!0;break}}this.dirty=e}_checkValidity(){let e=!0;for(var t in this._fields)if(this.log(ce.LogLevel.Log,`Checking "${t}" validity.`),this._fields[t].valid===!1){this.log(ce.LogLevel.Log,`"${t}" is not valid.`),e=!1;break}if(e===!0){for(var n of this._subForms)if(!n.valid){e=!1;break}}this.valid=e}registerSubForm(e){let t=this._subForms;t.indexOf(e)==-1&&(e.addEventListener(ee,this._fieldPropertyChanged,!1),t.push(e),this._checkValidity(),this._checkDirtyness())}unregisterSubForm(e){let t=this._subForms,n=t.indexOf(e);n>=0&&(e.removeEventListener(ee,this._fieldPropertyChanged,!1),t.splice(n,1),this._checkValidity(),this._checkDirtyness())}registerField(e,t){var n=this._fields;n[e]!=t&&(this.unregisterField(e,!1),n[e]=t,this.log(ce.LogLevel.Log,`Registering "${e}" field.`),t instanceof HTMLElement&&t.addEventListener(ee,this._fieldPropertyChanged,!1),this._checkFieldValidity(e),this._checkDirtyness())}unregisterField(e,t=!0){var n=this._fields,i=n[e];i instanceof HTMLElement&&i.removeEventListener(ee,this._fieldPropertyChanged,!1),delete n[e],i&&t===!0&&(this._checkValidity(),this._checkDirtyness())}registerValidator(e,t){var n=this._validators[e]=this._validators[e]||[],i=n.indexOf(t);i==-1&&(n.push(t),t instanceof HTMLElement&&t.addEventListener(ee,this._validatorPropertyChanged,!1),this.log(ce.LogLevel.Log,`Calling "${e}" validity check after validator registration.`),this._checkFieldValidity(e))}unregisterValidator(e,t){this._unregisterValidator(e,t,!0)}_unregisterValidator(e,t,n){var i=this._validators[e]=this._validators[e]||[],s=i.indexOf(t);s>=0&&(t instanceof HTMLElement&&t.removeEventListener(ee,this._validatorPropertyChanged,!1),i.splice(s,1),n&&this._checkFieldValidity(e))}};np=new WeakMap,c([h({emit:!1,converter:m.Element})],Ke.prototype,"fetcher",2),c([h({emit:!1,converter:m.String})],Ke.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],Ke.prototype,"fetchHeaders",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"method",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"submitCaption",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"resetCaption",2),c([me(100)],Ke.prototype,"_buildUpForm",1),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"valid",2),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"dirty",2),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"readonly",2),c([h({converter:m.Boolean})],Ke.prototype,"success",2),c([h({converter:m.Boolean})],Ke.prototype,"fail",2),c([h({converter:m.Json})],Ke.prototype,"entity",2),c([h({emit:!1,converter:m.String})],Ke.prototype,"entityName",2),c([h()],Ke.prototype,"metadata",2),c([h({emit:!1,converter:m.Boolean})],Ke.prototype,"autogenerate",2),c([h({converter:m.Boolean})],Ke.prototype,"suddenValidation",2),c([h({emit:!1,converter:m.Boolean})],Ke.prototype,"resettable",2),c([h({converter:m.String})],Ke.prototype,"action",2),Ke=c([C({tagName:d+"-form"})],Ke);var e_="pacem:model:original-value",Fa=class Fa extends On{viewActivatedCallback(){super.viewActivatedCallback(),this._registerFieldConditionally(),this._setAsOriginalValue(this.value)}_registerFieldConditionally(){let r=this.name,e=this.form;if(!a.isNullOrEmpty(r)&&!a.isNull(e)&&(!this.hasAttribute("autobind")||this.getAttribute("autobind")!=="off"&&this.getAttribute("autobind")!=="false")&&(e.registerField(r,this),!this.hasAttribute("value"))){let t=e.id=e.id||"frm_"+a.uniqueCode();this.setAttribute("value",`{{ #${t}.entity.${r}, twoway }}`)}}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"value":this.viewValue=this.getViewValue(t);break;case"valid":t?a.removeClass(this,b+"-invalid"):a.addClass(this,b+"-invalid");break;case"dirty":t?a.addClass(this,b+"-dirty"):a.removeClass(this,b+"-dirty");break;case"name":let i=this.form;i!=null&&e&&i.unregisterField(e),this._registerFieldConditionally();break;case"form":let s=this.name;a.isNullOrEmpty(s)||e?.unregisterField(s),this._registerFieldConditionally();break}}disconnectedCallback(){let r=this.name,e=this.form;!a.isNullOrEmpty(r)&&!a.isNull(e)&&e.unregisterField(r),super.disconnectedCallback()}get originalValue(){return A.getAttachedPropertyValue(this,e_)}_setAsOriginalValue(r){A.setAttachedPropertyValue(this,e_,r)}reset(){this.value=this.originalValue,this.dirty=!1}setPristine(){this._setAsOriginalValue(this.value),this.dirty=!1}setDirty(){this.dirty=!0}};c([h({converter:m.String})],Fa.prototype,"viewValue",2),c([h({converter:{convert:(r,e)=>e instanceof Fa?e.convertValueAttributeToProperty(r):r,convertBack:r=>r.toString()}})],Fa.prototype,"value",2),c([h({converter:m.Boolean})],Fa.prototype,"dirty",2),c([h({converter:m.Boolean})],Fa.prototype,"valid",2),c([h({converter:m.String})],Fa.prototype,"name",2);var xl=Fa,_e=class extends xl{constructor(){super(...arguments);this.focusHandler=e=>{let t=(i=!0)=>{a.hasClass(this.parentElement,"."+b+"-fieldgroup")&&(i?a.addClass:a.removeClass).apply(this,[this.parentElement,b+"-focus"])},n=()=>t(!1);switch(e.type){case"focus":a.addClass(this,b+"-focus"),t(),this._preFocusValue=this.value;break;case"blur":a.removeClass(this,b+"-focus"),n();break}e.bubbles?this.emit(e):this.dispatchEvent(new FocusEvent(e.type))};this.changeHandler=e=>{let t=this.value;this.onChange(e).then(n=>{this.compareValuePropertyValues(t,n)||(this.dispatchEvent(new xd({fieldName:this.name,oldValue:t,currentValue:n,firstChange:!this.dirty})),this.dirty=!0)},n=>{})};this.keydownHandler=e=>{Re(e)};this.keyupHandler=e=>{switch(e.keyCode){case 27:Re(e),this.compareValuePropertyValues(this.originalValue,this._preFocusValue)?this.reset():this.value=this._preFocusValue,this.blur();break;case 13:this.preventKeyboardSubmit&&Re(e);break}}}compareValuePropertyValues(e,t){return bo(e,t)}get preventKeyboardSubmit(){return!1}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"required":case"disabled":case"autofocus":case"placeholder":case"readonly":for(let s of this.inputFields)n?s.setAttribute(e,n):s.removeAttribute(e);break;case"tabOrder":for(let s of this.inputFields)s.setAttribute("tabindex",n);break;case"value":this.acceptValue(n);break}if(e==="required"||e==="disabled"||e==="readonly"){let s=`${b}-${e}`;n?a.addClass(this,s):a.removeClass(this,s)}e==="readonly"?this.toggleReadonlyView(n):e==="required"?this.aria.attributes.set("required",!!n+""):e==="valid"&&this.aria.attributes.set("invalid",(!n&&!!this.dirty)+"")}registerInputFields(e=this.inputFields){!a.isNull(e)&&!a.isArray(e)&&(e=[e]);for(let t of e)t.addEventListener("focus",this.focusHandler,!1),t.addEventListener("blur",this.focusHandler,!1),t.addEventListener("change",this.changeHandler,!1),t.addEventListener("keydown",this.keydownHandler,!1),t.addEventListener("keyup",this.keyupHandler,!1),t.addEventListener("mousedown",Re,!1),t.addEventListener("touchstart",Re,{passive:!1,capture:!1})}unregisterInputFields(e=this.inputFields){!a.isNull(e)&&!a.isArray(e)&&(e=[e]);for(let t of e)a.isNull(t)||(t.removeEventListener("touchstart",Re,{capture:!1}),t.removeEventListener("keydown",this.keydownHandler,!1),t.removeEventListener("keyup",this.keyupHandler,!1),t.removeEventListener("mousedown",Re,!1),t.removeEventListener("change",this.changeHandler,!1),t.removeEventListener("focus",this.focusHandler,!1),t.removeEventListener("blur",this.focusHandler,!1))}viewActivatedCallback(){if(super.viewActivatedCallback(),this.toggleReadonlyView(this.readonly||!1),!a.isNullOrEmpty(this.id)){let e=document.querySelector(`label[for=${this.id}]`);e?e.id?this.aria.attributes.set("labelledby",e.id):this.aria.attributes.set("label",e.textContent):(this.aria.attributes.remove("labelledby"),this.aria.attributes.remove("label"))}this.registerInputFields()}disconnectedCallback(){this.unregisterInputFields(),super.disconnectedCallback()}focus(){let e=this.inputFields;e&&e.length&&e[0].focus()}blur(){let e=this.inputFields;if(!a.isNullOrEmpty(e))for(let t of e)t.blur()}};c([h({converter:m.Boolean})],_e.prototype,"required",2),c([h({converter:m.Boolean})],_e.prototype,"autofocus",2),c([h({converter:m.Boolean})],_e.prototype,"readonly",2),c([h({converter:m.String})],_e.prototype,"name",2),c([h({converter:m.String})],_e.prototype,"placeholder",2);var ip=class extends R.PacemElement{#e;findContainer(){return A.findAncestor(this,r=>r instanceof Wa)}get container(){return this.#e}viewActivatedCallback(){super.viewActivatedCallback();let r=this.#e=this.findContainer();a.isNull(r)||r.register(this)}disconnectedCallback(){a.isNull(this.#e)||this.#e.unregister(this),super.disconnectedCallback()}},Wa=class extends _e{register(r){let e=!0;return a.isNull(this.items)?this.items=[r]:this.items.indexOf(r)===-1?this.items.push(r):e=!1,e}unregister(r){let e=!a.isNull(this.items)&&this.items.indexOf(r);return e>=0?(this.items.splice(e,1)[0],!0):!1}};c([h()],Wa.prototype,"items",2);var Pn=class extends ip{};c([h({converter:{convert:(r,e)=>{if(r==="true")return!0;if(r==="false")return!1;let t=parseFloat(r);if(!isNaN(t))return t;let n=a.Dates.parse(r);return a.Dates.isDate(n)?n:r},convertBack:r=>r.toString()}})],Pn.prototype,"value",2),c([h({converter:m.String})],Pn.prototype,"label",2),c([h({converter:m.Boolean})],Pn.prototype,"disabled",2),Pn=c([C({tagName:d+"-data-item"})],Pn);var vt=class extends Wa{constructor(e=!1){super();this.multipleChoice=e;this._itemPropertyChangedHandler=e=>{this.databind()}}register(e){let t=super.register(e);return t&&e.addEventListener(ee,this._itemPropertyChangedHandler,!1),t}unregister(e){let t=super.register(e);return t&&e.removeEventListener(ee,this._itemPropertyChangedHandler,!1),t}buildAdaptedDatasource(e=this.datasource){return e&&e.map(t=>this.mapEntityToItem(t))}databind(e=this.buildAdaptedDatasource(this.datasource)){if(a.isNull(e)&&a.isNull(this.adaptedDatasource))return;let t=this.adaptedDatasource=e||[];a.isNullOrEmpty(t.filter(n=>this.isDataSourceItemSelected(n)))&&this.handleDatasourceMismatch(t)}handleDatasourceMismatch(e){this.value=void 0}isItemSelected(e,t=this.value){if(a.isNullOrEmpty(t))return!1;let n=this.mapEntityToValue(e),i=this.compareBy;return this.multipleChoice&&a.isArray(t)?!a.isNull(t.find(s=>s==n||typeof s=="object"&&!a.isNullOrEmpty(i)&&i in n&&i in s&&n[i]==s[i])):this.multipleChoice?!1:t==n||typeof t=="object"&&!a.isNullOrEmpty(i)&&i in n&&i in t&&n[i]==t[i]}isDataSourceItemSelected(e,t=this.value){if(a.isNullOrEmpty(t)||e.disabled)return!1;let n=this.compareBy;if(this.multipleChoice&&a.isArray(t)){let i=t.find(s=>s==e.value||typeof s=="object"&&!a.isNullOrEmpty(n)&&n in s&&!a.isNullOrEmpty(e.value)&&n in e.value&&s[n]==e.value[n]);return!a.isNull(i)}else return!this.multipleChoice&&!a.isNullOrEmpty(e.value)?t==e.value||typeof t=="object"&&!a.isNullOrEmpty(n)&&n in t&&!a.isNullOrEmpty(e.value)&&n in e.value&&t[n]==e.value[n]:!1}mapEntityToValue(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return e.value;let t=e,n;return(n=this.valueProperty)&&(t=e[n]),t}mapEntityToViewValue(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return e.label||e.value;let t=e.toString(),n;return(n=this.textProperty)&&(t=e[n]),t}mapEntityToItem(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return{value:e.value,viewValue:e.label||e.value,disabled:e.disabled,data:e};let t=!1,n=this.disabledProperty;return a.isNullOrEmpty(n)||(t=e[n]||!1),{value:this.mapEntityToValue(e),viewValue:this.mapEntityToViewValue(e),disabled:t,data:e}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this.databind(),this.viewValue=this.getViewValue(this.value)});break;case"items":cancelAnimationFrame(this._handleItems),this._handleItems=requestAnimationFrame(()=>{this.datasource=this.items});break}}getViewValue(e){if(!a.isNullOrEmpty(this.datasource))return this.datasource.filter(t=>this.isItemSelected(t)).map(t=>this.mapEntityToViewValue(t)).join(", ")}convertValueAttributeToProperty(e){return this.multipleChoice?e.split(",").map(t=>t.trim()):e}compareValuePropertyValues(e,t){return bo(e,t)}};c([h({emit:!1,converter:m.Json})],vt.prototype,"datasource",2),c([h({emit:!1,converter:m.String})],vt.prototype,"valueProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"textProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"disabledProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"compareBy",2),c([h({converter:m.Json})],vt.prototype,"adaptedDatasource",2),c([me(!0)],vt.prototype,"databind",1);var er=`<${d}-char-count hide="{{ :host.readonly || !(:host.minlength > 0 || :host.maxlength > 0) }}" minlength="{{ :host.minlength }}" maxlength="{{ :host.maxlength }}" string="{{ :host.value }}"></${d}-char-count>`,ja=class extends R.PacemElement{_isValid(r){let e=this._length(r);return!(this.minlength>0&&e<this.minlength||this.maxlength>0&&e>this.maxlength)}_length(r){return r&&r.length||0}};c([h({converter:m.Number})],ja.prototype,"minlength",2),c([h({converter:m.Number})],ja.prototype,"maxlength",2),c([h({converter:m.String})],ja.prototype,"string",2),ja=c([C({tagName:d+"-char-count",shadow:j.USE_SHADOW_ROOT,template:`<${d}-panel class="${b}-char-count" css-class="{{ {'valid': :host._isValid(:host.string), 'invalid': !:host._isValid(:host.string) } }}">
|
|
402
|
+
</div></div>`;i.innerHTML=s,this.innerHTML="",this.appendChild(i),i.addEventListener("submit",Q,!1);let l=this._buttons,p=this._buttons={submit:i.lastElementChild.firstElementChild.firstElementChild,reset:i.lastElementChild.firstElementChild.lastElementChild};this.dispatchEvent(new ue({propertyName:"formButtons",currentValue:p,oldValue:l}))}get formButtons(){return this._buttons}get fetching(){return M(this,np)}submit(e){return new Promise((t,n)=>{a.isNull(e)&&n("Fetcher cannot be null while submitting a form."),this._submitInternally(e).then(i=>{this.dispatchEvent(new CustomEvent("success",{detail:i})),t(i)},i=>{i!==Zy&&this.dispatchEvent(new CustomEvent("fail",{detail:i})),n(i)})})}reset(){this._reset()}_submitInternally(e,p){if(a.isNull(e))throw"Fetcher cannot be null while submitting a form.";var n=_t.defer();let i=this.entity,s=this.entityName;var l={};a.isNullOrEmpty(s)?l=i:l[s]=i;var p={parameters:l,fields:this._getAllFields()},u=new um(p);if(this.dispatchEvent(u),u.defaultPrevented)n.reject(Zy);else{e.parameters=a.extend({},u.detail.parameters);let f=_=>{e.removeEventListener(pt.FetchSuccessEventName,f,!1),e.removeEventListener(pt.FetchErrorEventName,v,!1);let x=_.detail;pt.Fetcher.isEmpty(x)&&(e.removeEventListener(pt.FetchResultEventName,g,!1),this.success=!0,n.resolve({})),x.status===205&&this._reset()},g=_=>{e.removeEventListener(pt.FetchResultEventName,g,!1);var x=_.detail;typeof x=="object"&&x.hasOwnProperty("success")?x.success===!0?(this.success=!0,n.resolve(x.result||{})):(this.fail=!0,n.reject(x.error)):(this.success=!0,n.resolve(x))},v=_=>{e.removeEventListener(pt.FetchSuccessEventName,f,!1),e.removeEventListener(pt.FetchResultEventName,g,!1),e.removeEventListener(pt.FetchErrorEventName,v,!1),this.fail=!0;let x=_.detail;n.reject(x)},y=_=>{_.detail.propertyName==="fetching"&&(_.detail.currentValue===!0?(a.addClass(this,b+"-fetching"),H(this,np,!0),this.dispatchEvent(new ue({currentValue:!0,oldValue:!1,propertyName:"fetching"}))):(H(this,np,!1),this.dispatchEvent(new ue({currentValue:!1,oldValue:!0,propertyName:"fetching"})),a.removeClass(this,b+"-fetching"),e.removeEventListener(ee,y,!1)))};e.addEventListener(ee,y,!1),e.addEventListener(pt.FetchSuccessEventName,f,!1),e.addEventListener(pt.FetchResultEventName,g,!1),e.addEventListener(pt.FetchErrorEventName,v,!1),a.isNullOrEmpty(this.action)||(e.url=this.action),e instanceof R.PacemFetchElement&&!e.autofetch&&e.fetch(),this.success=this.fail=!1}return n.promise}_getAllFields(e={}){a.extend(e,this._fields);for(var t of this._subForms)t._getAllFields(e);return e}apply(e){if(!a.isNullOrEmpty(e)){this.entity=a.extend({},this.entity,e);for(let t in e)this.setDirty(t)}}setPristine(...e){this._setAs(!1,...e)}setDirty(...e){this._setAs(!0,...e)}_setAs(e,...t){let n=!a.isEmpty(t);for(let i in this._fields)if(!n||t.indexOf(i)>=0){let s=this._fields[i];s instanceof xl&&(e?s.setDirty():s.setPristine())}for(let i of this._subForms)e?i.setDirty(...t):i.setPristine(...t)}_checkFieldValidity(e){return this.suddenValidation?e in this._fields?this._validateField(e,!1):Promise.resolve(!1):Promise.resolve(null)}validate(e){return a.isNullOrEmpty(e)?Promise.all(this._validateAllFields()).then(t=>!t.some(n=>n===!1)):this._validateField(e,!1)}_validateAllFields(e=!0){let t=[];for(let n in this._fields)t.push(this._validateField(n,e));for(let n of this._subForms)Array.prototype.push.apply(t,n._validateAllFields(e));return t}_validateField(e,t){return new Promise((n,i)=>{var s=this._fields[e];if(s){var l=this._validators[s.name];l&&l.length>0?(this.log(ce.LogLevel.Log,`Computing "${s.name}" validity.`),Promise.all(l.map(p=>p.validate(s.value).then(u=>!(p.invalid=!u)))).then(p=>{let u=!0;for(var f of p)if(f===!1){u=!1,t&&s.setDirty();break}this.log(ce.LogLevel.Log,`Property "${s.name}" turns out to be ${u?"":"not "}valid.`),n(s.valid=u)})):(this.log(ce.LogLevel.Log,`Property "${s.name}" has no validators.`),n(s.valid=!0))}else this.log(ce.LogLevel.Log,`Property "${e}" has no fields in this form.`),n(!0)})}_checkDirtyness(){let e=!1;for(var t in this._fields)if(this._fields[t].dirty===!0){e=!0;break}if(e===!1){for(var n of this._subForms)if(n.dirty){e=!0;break}}this.dirty=e}_checkValidity(){let e=!0;for(var t in this._fields)if(this.log(ce.LogLevel.Log,`Checking "${t}" validity.`),this._fields[t].valid===!1){this.log(ce.LogLevel.Log,`"${t}" is not valid.`),e=!1;break}if(e===!0){for(var n of this._subForms)if(!n.valid){e=!1;break}}this.valid=e}registerSubForm(e){let t=this._subForms;t.indexOf(e)==-1&&(e.addEventListener(ee,this._fieldPropertyChanged,!1),t.push(e),this._checkValidity(),this._checkDirtyness())}unregisterSubForm(e){let t=this._subForms,n=t.indexOf(e);n>=0&&(e.removeEventListener(ee,this._fieldPropertyChanged,!1),t.splice(n,1),this._checkValidity(),this._checkDirtyness())}registerField(e,t){var n=this._fields;n[e]!=t&&(this.unregisterField(e,!1),n[e]=t,this.log(ce.LogLevel.Log,`Registering "${e}" field.`),t instanceof HTMLElement&&t.addEventListener(ee,this._fieldPropertyChanged,!1),this._checkFieldValidity(e),this._checkDirtyness())}unregisterField(e,t=!0){var n=this._fields,i=n[e];i instanceof HTMLElement&&i.removeEventListener(ee,this._fieldPropertyChanged,!1),delete n[e],i&&t===!0&&(this._checkValidity(),this._checkDirtyness())}registerValidator(e,t){var n=this._validators[e]=this._validators[e]||[],i=n.indexOf(t);i==-1&&(n.push(t),t instanceof HTMLElement&&t.addEventListener(ee,this._validatorPropertyChanged,!1),this.log(ce.LogLevel.Log,`Calling "${e}" validity check after validator registration.`),this._checkFieldValidity(e))}unregisterValidator(e,t){this._unregisterValidator(e,t,!0)}_unregisterValidator(e,t,n){var i=this._validators[e]=this._validators[e]||[],s=i.indexOf(t);s>=0&&(t instanceof HTMLElement&&t.removeEventListener(ee,this._validatorPropertyChanged,!1),i.splice(s,1),n&&this._checkFieldValidity(e))}};np=new WeakMap,c([h({emit:!1,converter:m.Element})],Ke.prototype,"fetcher",2),c([h({emit:!1,converter:m.String})],Ke.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],Ke.prototype,"fetchHeaders",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"method",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"submitCaption",2),c([h({reflectBack:!0,converter:m.String})],Ke.prototype,"resetCaption",2),c([me(100)],Ke.prototype,"_buildUpForm",1),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"valid",2),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"dirty",2),c([h({reflectBack:!0,converter:m.Boolean})],Ke.prototype,"readonly",2),c([h({converter:m.Boolean})],Ke.prototype,"success",2),c([h({converter:m.Boolean})],Ke.prototype,"fail",2),c([h({converter:m.Json})],Ke.prototype,"entity",2),c([h({emit:!1,converter:m.String})],Ke.prototype,"entityName",2),c([h()],Ke.prototype,"metadata",2),c([h({emit:!1,converter:m.Boolean})],Ke.prototype,"autogenerate",2),c([h({converter:m.Boolean})],Ke.prototype,"suddenValidation",2),c([h({emit:!1,converter:m.Boolean})],Ke.prototype,"resettable",2),c([h({converter:m.String})],Ke.prototype,"action",2),Ke=c([C({tagName:d+"-form"})],Ke);var t_="pacem:model:original-value",Fa=class Fa extends On{viewActivatedCallback(){super.viewActivatedCallback(),this._registerFieldConditionally(),this._setAsOriginalValue(this.value)}_registerFieldConditionally(){let r=this.name,e=this.form;if(!a.isNullOrEmpty(r)&&!a.isNull(e)&&(!this.hasAttribute("autobind")||this.getAttribute("autobind")!=="off"&&this.getAttribute("autobind")!=="false")&&(e.registerField(r,this),!this.hasAttribute("value"))){let t=e.id=e.id||"frm_"+a.uniqueCode();this.setAttribute("value",`{{ #${t}.entity.${r}, twoway }}`)}}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"value":this.viewValue=this.getViewValue(t);break;case"valid":t?a.removeClass(this,b+"-invalid"):a.addClass(this,b+"-invalid");break;case"dirty":t?a.addClass(this,b+"-dirty"):a.removeClass(this,b+"-dirty");break;case"name":let i=this.form;i!=null&&e&&i.unregisterField(e),this._registerFieldConditionally();break;case"form":let s=this.name;a.isNullOrEmpty(s)||e?.unregisterField(s),this._registerFieldConditionally();break}}disconnectedCallback(){let r=this.name,e=this.form;!a.isNullOrEmpty(r)&&!a.isNull(e)&&e.unregisterField(r),super.disconnectedCallback()}get originalValue(){return A.getAttachedPropertyValue(this,t_)}_setAsOriginalValue(r){A.setAttachedPropertyValue(this,t_,r)}reset(){this.value=this.originalValue,this.dirty=!1}setPristine(){this._setAsOriginalValue(this.value),this.dirty=!1}setDirty(){this.dirty=!0}};c([h({converter:m.String})],Fa.prototype,"viewValue",2),c([h({converter:{convert:(r,e)=>e instanceof Fa?e.convertValueAttributeToProperty(r):r,convertBack:r=>r.toString()}})],Fa.prototype,"value",2),c([h({converter:m.Boolean})],Fa.prototype,"dirty",2),c([h({converter:m.Boolean})],Fa.prototype,"valid",2),c([h({converter:m.String})],Fa.prototype,"name",2);var xl=Fa,_e=class extends xl{constructor(){super(...arguments);this.focusHandler=e=>{let t=(i=!0)=>{a.hasClass(this.parentElement,"."+b+"-fieldgroup")&&(i?a.addClass:a.removeClass).apply(this,[this.parentElement,b+"-focus"])},n=()=>t(!1);switch(e.type){case"focus":a.addClass(this,b+"-focus"),t(),this._preFocusValue=this.value;break;case"blur":a.removeClass(this,b+"-focus"),n();break}e.bubbles?this.emit(e):this.dispatchEvent(new FocusEvent(e.type))};this.changeHandler=e=>{let t=this.value;this.onChange(e).then(n=>{this.compareValuePropertyValues(t,n)||(this.dispatchEvent(new xd({fieldName:this.name,oldValue:t,currentValue:n,firstChange:!this.dirty})),this.dirty=!0)},n=>{})};this.keydownHandler=e=>{Re(e)};this.keyupHandler=e=>{switch(e.keyCode){case 27:Re(e),this.compareValuePropertyValues(this.originalValue,this._preFocusValue)?this.reset():this.value=this._preFocusValue,this.blur();break;case 13:this.preventKeyboardSubmit&&Re(e);break}}}compareValuePropertyValues(e,t){return bo(e,t)}get preventKeyboardSubmit(){return!1}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"required":case"disabled":case"autofocus":case"placeholder":case"readonly":for(let s of this.inputFields)n?s.setAttribute(e,n):s.removeAttribute(e);break;case"tabOrder":for(let s of this.inputFields)s.setAttribute("tabindex",n);break;case"value":this.acceptValue(n);break}if(e==="required"||e==="disabled"||e==="readonly"){let s=`${b}-${e}`;n?a.addClass(this,s):a.removeClass(this,s)}e==="readonly"?this.toggleReadonlyView(n):e==="required"?this.aria.attributes.set("required",!!n+""):e==="valid"&&this.aria.attributes.set("invalid",(!n&&!!this.dirty)+"")}registerInputFields(e=this.inputFields){!a.isNull(e)&&!a.isArray(e)&&(e=[e]);for(let t of e)t.addEventListener("focus",this.focusHandler,!1),t.addEventListener("blur",this.focusHandler,!1),t.addEventListener("change",this.changeHandler,!1),t.addEventListener("keydown",this.keydownHandler,!1),t.addEventListener("keyup",this.keyupHandler,!1),t.addEventListener("mousedown",Re,!1),t.addEventListener("touchstart",Re,{passive:!1,capture:!1})}unregisterInputFields(e=this.inputFields){!a.isNull(e)&&!a.isArray(e)&&(e=[e]);for(let t of e)a.isNull(t)||(t.removeEventListener("touchstart",Re,{capture:!1}),t.removeEventListener("keydown",this.keydownHandler,!1),t.removeEventListener("keyup",this.keyupHandler,!1),t.removeEventListener("mousedown",Re,!1),t.removeEventListener("change",this.changeHandler,!1),t.removeEventListener("focus",this.focusHandler,!1),t.removeEventListener("blur",this.focusHandler,!1))}viewActivatedCallback(){if(super.viewActivatedCallback(),this.toggleReadonlyView(this.readonly||!1),!a.isNullOrEmpty(this.id)){let e=document.querySelector(`label[for=${this.id}]`);e?e.id?this.aria.attributes.set("labelledby",e.id):this.aria.attributes.set("label",e.textContent):(this.aria.attributes.remove("labelledby"),this.aria.attributes.remove("label"))}this.registerInputFields()}disconnectedCallback(){this.unregisterInputFields(),super.disconnectedCallback()}focus(){let e=this.inputFields;e&&e.length&&e[0].focus()}blur(){let e=this.inputFields;if(!a.isNullOrEmpty(e))for(let t of e)t.blur()}};c([h({converter:m.Boolean})],_e.prototype,"required",2),c([h({converter:m.Boolean})],_e.prototype,"autofocus",2),c([h({converter:m.Boolean})],_e.prototype,"readonly",2),c([h({converter:m.String})],_e.prototype,"name",2),c([h({converter:m.String})],_e.prototype,"placeholder",2);var ip=class extends R.PacemElement{#e;findContainer(){return A.findAncestor(this,r=>r instanceof Wa)}get container(){return this.#e}viewActivatedCallback(){super.viewActivatedCallback();let r=this.#e=this.findContainer();a.isNull(r)||r.register(this)}disconnectedCallback(){a.isNull(this.#e)||this.#e.unregister(this),super.disconnectedCallback()}},Wa=class extends _e{register(r){let e=!0;return a.isNull(this.items)?this.items=[r]:this.items.indexOf(r)===-1?this.items.push(r):e=!1,e}unregister(r){let e=!a.isNull(this.items)&&this.items.indexOf(r);return e>=0?(this.items.splice(e,1)[0],!0):!1}};c([h()],Wa.prototype,"items",2);var Pn=class extends ip{};c([h({converter:{convert:(r,e)=>{if(r==="true")return!0;if(r==="false")return!1;let t=parseFloat(r);if(!isNaN(t))return t;let n=a.Dates.parse(r);return a.Dates.isDate(n)?n:r},convertBack:r=>r.toString()}})],Pn.prototype,"value",2),c([h({converter:m.String})],Pn.prototype,"label",2),c([h({converter:m.Boolean})],Pn.prototype,"disabled",2),Pn=c([C({tagName:d+"-data-item"})],Pn);var vt=class extends Wa{constructor(e=!1){super();this.multipleChoice=e;this._itemPropertyChangedHandler=e=>{this.databind()}}register(e){let t=super.register(e);return t&&e.addEventListener(ee,this._itemPropertyChangedHandler,!1),t}unregister(e){let t=super.register(e);return t&&e.removeEventListener(ee,this._itemPropertyChangedHandler,!1),t}buildAdaptedDatasource(e=this.datasource){return e&&e.map(t=>this.mapEntityToItem(t))}databind(e=this.buildAdaptedDatasource(this.datasource)){if(a.isNull(e)&&a.isNull(this.adaptedDatasource))return;let t=this.adaptedDatasource=e||[];a.isNullOrEmpty(t.filter(n=>this.isDataSourceItemSelected(n)))&&this.handleDatasourceMismatch(t)}handleDatasourceMismatch(e){this.value=void 0}isItemSelected(e,t=this.value){if(a.isNullOrEmpty(t))return!1;let n=this.mapEntityToValue(e),i=this.compareBy;return this.multipleChoice&&a.isArray(t)?!a.isNull(t.find(s=>s==n||typeof s=="object"&&!a.isNullOrEmpty(i)&&i in n&&i in s&&n[i]==s[i])):this.multipleChoice?!1:t==n||typeof t=="object"&&!a.isNullOrEmpty(i)&&i in n&&i in t&&n[i]==t[i]}isDataSourceItemSelected(e,t=this.value){if(a.isNullOrEmpty(t)||e.disabled)return!1;let n=this.compareBy;if(this.multipleChoice&&a.isArray(t)){let i=t.find(s=>s==e.value||typeof s=="object"&&!a.isNullOrEmpty(n)&&n in s&&!a.isNullOrEmpty(e.value)&&n in e.value&&s[n]==e.value[n]);return!a.isNull(i)}else return!this.multipleChoice&&!a.isNullOrEmpty(e.value)?t==e.value||typeof t=="object"&&!a.isNullOrEmpty(n)&&n in t&&!a.isNullOrEmpty(e.value)&&n in e.value&&t[n]==e.value[n]:!1}mapEntityToValue(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return e.value;let t=e,n;return(n=this.valueProperty)&&(t=e[n]),t}mapEntityToViewValue(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return e.label||e.value;let t=e.toString(),n;return(n=this.textProperty)&&(t=e[n]),t}mapEntityToItem(e){if(e==null)throw"entity cannot be null";if(e instanceof Pn)return{value:e.value,viewValue:e.label||e.value,disabled:e.disabled,data:e};let t=!1,n=this.disabledProperty;return a.isNullOrEmpty(n)||(t=e[n]||!1),{value:this.mapEntityToValue(e),viewValue:this.mapEntityToViewValue(e),disabled:t,data:e}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this.databind(),this.viewValue=this.getViewValue(this.value)});break;case"items":cancelAnimationFrame(this._handleItems),this._handleItems=requestAnimationFrame(()=>{this.datasource=this.items});break}}getViewValue(e){if(!a.isNullOrEmpty(this.datasource))return this.datasource.filter(t=>this.isItemSelected(t)).map(t=>this.mapEntityToViewValue(t)).join(", ")}convertValueAttributeToProperty(e){return this.multipleChoice?e.split(",").map(t=>t.trim()):e}compareValuePropertyValues(e,t){return bo(e,t)}};c([h({emit:!1,converter:m.Json})],vt.prototype,"datasource",2),c([h({emit:!1,converter:m.String})],vt.prototype,"valueProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"textProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"disabledProperty",2),c([h({emit:!1,converter:m.String})],vt.prototype,"compareBy",2),c([h({converter:m.Json})],vt.prototype,"adaptedDatasource",2),c([me(!0)],vt.prototype,"databind",1);var er=`<${d}-char-count hide="{{ :host.readonly || !(:host.minlength > 0 || :host.maxlength > 0) }}" minlength="{{ :host.minlength }}" maxlength="{{ :host.maxlength }}" string="{{ :host.value }}"></${d}-char-count>`,ja=class extends R.PacemElement{_isValid(r){let e=this._length(r);return!(this.minlength>0&&e<this.minlength||this.maxlength>0&&e>this.maxlength)}_length(r){return r&&r.length||0}};c([h({converter:m.Number})],ja.prototype,"minlength",2),c([h({converter:m.Number})],ja.prototype,"maxlength",2),c([h({converter:m.String})],ja.prototype,"string",2),ja=c([C({tagName:d+"-char-count",shadow:j.USE_SHADOW_ROOT,template:`<${d}-panel class="${b}-char-count" css-class="{{ {'valid': :host._isValid(:host.string), 'invalid': !:host._isValid(:host.string) } }}">
|
|
403
403
|
<${d}-span hide="{{ !(:host.minlength > 0) }}" class="${b}-char-min" content="{{ :host.minlength }}"></${d}-span>
|
|
404
404
|
<${d}-span class="${b}-char-curr" content="{{ :host._length(:host.string) || '0' }}"></${d}-span>
|
|
405
405
|
<${d}-span hide="{{ !(:host.maxlength > 0) }}" class="${b}-char-max" content="{{ :host.maxlength }}"></${d}-span>
|
|
406
|
-
</${d}-panel>`})],ja);var uv="execute",fm="<p><br></p>",gm=class extends oe{constructor(r){super("contenteditablechange",{html:r})}},Ni=class extends ip{constructor(){super(...arguments);this._containerPropChangeHandler=e=>{let t=e.detail;this.containerPropertyChangedCallback(t.propertyName,t.oldValue,t.currentValue,t.firstChange)}}execCommand(...e){let t=this;t.disabled||t.exec.apply(t,e).then(n=>{t.dispatchEvent(new Event(uv))},n=>{console.error(n)})}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-contenteditable-command")}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||(this.contentElement=e.contentElement,e.addEventListener(ee,this._containerPropChangeHandler,!1))}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._containerPropChangeHandler,!1),super.disconnectedCallback()}containerPropertyChangedCallback(e,t,n,i){e==="range"&&(this.range=n)}};c([h()],Ni.prototype,"range",2),c([h()],Ni.prototype,"contentElement",2);function
|
|
406
|
+
</${d}-panel>`})],ja);var uv="execute",fm="<p><br></p>",gm=class extends oe{constructor(r){super("contenteditablechange",{html:r})}},Ni=class extends ip{constructor(){super(...arguments);this._containerPropChangeHandler=e=>{let t=e.detail;this.containerPropertyChangedCallback(t.propertyName,t.oldValue,t.currentValue,t.firstChange)}}execCommand(...e){let t=this;t.disabled||t.exec.apply(t,e).then(n=>{t.dispatchEvent(new Event(uv))},n=>{console.error(n)})}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-contenteditable-command")}viewActivatedCallback(){super.viewActivatedCallback();let e=this.container;a.isNull(e)||(this.contentElement=e.contentElement,e.addEventListener(ee,this._containerPropChangeHandler,!1))}disconnectedCallback(){let e=this.container;a.isNull(e)||e.removeEventListener(ee,this._containerPropChangeHandler,!1),super.disconnectedCallback()}containerPropertyChangedCallback(e,t,n,i){e==="range"&&(this.range=n)}};c([h()],Ni.prototype,"range",2),c([h()],Ni.prototype,"contentElement",2);function Dw(o){return o instanceof Ni&&"pasteCallback"in o&&typeof o.pasteCallback=="function"}function r_(o){return o?.nodeType==Node.ELEMENT_NODE}var _s,ys=class extends Wa{constructor(){super("rich text editor");z(this,_s);this._focusHandler=e=>{this._ensureInteractiveMarkup()};this._blurHandler=e=>{let t=this._container;for(let n of this.items)n.cleanUp(t);this._checkChangedHandler(e)};this._pasteHandler=e=>{e.preventDefault();let t=this.range,n=e.clipboardData.files;if(!a.isNull(t)&&n.length===0){let s=e.clipboardData.getData("text/plain").replace(/</gi,"<").replace(/\n/gi,"<br />"),l=t.createContextualFragment(s);t.deleteContents(),t.insertNode(l),this._checkChangedHandler(e)}else for(let i=0;i<n.length;i++){let s=n.item(i);for(let l of this.items)Dw(l)&&l.pasteCallback(s).then(p=>this._checkChangedHandler(e),p=>{})}};this._shortcutHandler=e=>{e.ctrlKey&&["C","V","X"].indexOf(e.key?.toUpperCase())===-1&&e.preventDefault()};this._inputHandler=e=>{this._fixRangeMarkup(),this._checkChangedHandler(e)};this._checkChangedHandler=e=>{let t=this._container,n=t.innerHTML;var i=n;(a.isNullOrEmpty(n)||n==="<br>"||n===fm)&&(t.innerHTML=fm,i=""),i!=this.value&&(this.changeHandler(new gm(i)),this.value!=M(this,_s).current&&this._updateHistory()),this._fireHistoryChange()};this._selectionChangeHandler=e=>{let t=document.getSelection();if(t&&t.anchorNode&&this._container.contains(t.anchorNode)){let n=t.getRangeAt(0);this.range=n.cloneRange()}else this.range=null}}get history(){return M(this,_s)}reset(){super.reset(),M(this,_s).reset(),this._fireHistoryChange()}_fireHistoryChange(){let e=M(this,_s);this.dispatchEvent(new ue({propertyName:"history",oldValue:e,currentValue:e}))}convertValueAttributeToProperty(e){return e}toggleReadonlyView(e){this._dashboard.hidden=e,e?this._container.removeAttribute("contenteditable"):(this._container.setAttribute("contenteditable","true"),document.execCommand("defaultParagraphSeparator",!1,"p"))}register(e){return super.register(e)?(e.addEventListener(uv,this._checkChangedHandler,!1),!0):!1}unregister(e){return super.unregister(e)?(e.removeEventListener(uv,this._checkChangedHandler,!1),!0):!1}get preventKeyboardSubmit(){return!0}get inputFields(){return[this._container]}get contentElement(){return this._container}onChange(e){return new Promise((t,n)=>{if(de.isInstanceOf(e,gm)){let i=this.value=e.detail.html;t(i),this._selectionChangeHandler(e)}else t(this.value)})}_fixRangeMarkup(){let e=this.range,t=i=>{i.childNodes.forEach(s=>t(s)),r_(i)&&i.tagName==="SPAN"?Element.prototype.replaceWith.apply(i,Array.from(i.childNodes)):i instanceof HTMLElement&&i.removeAttribute("style")},n=i=>{let s=i;r_(s)||(s=i.parentElement),t(s)};a.isNull(e)||n(e.commonAncestorContainer)}_ensureInteractiveMarkup(){let e=this._container,t=e.childNodes,n=t.length;if(n==0||e.innerHTML===fm)e.innerHTML=fm;else{let i,s,l=p=>{s.setEndAfter(p);let u=document.createElement("p");s.surroundContents(u)};for(let p=0;p<n;p++)i=t.item(p),i instanceof Element?s&&(l(i.previousSibling),s=null):a.isNull(s)&&(s=document.createRange(),s.setStartBefore(i));a.isNull(s)||l(i)}}_updateHistory(){M(this,_s).push(this.value),this._fireHistoryChange()}acceptValue(e){!a.isNull(this._container)&&e!=this._container.innerHTML&&(this._container.innerHTML=e)}viewActivatedCallback(){super.viewActivatedCallback();let e=this._container;H(this,_s,new Fl(this.value)),e.addEventListener("blur",this._blurHandler,!1),e.addEventListener("keydown",this._shortcutHandler,!1),e.addEventListener("focus",this._focusHandler,!1),e.addEventListener("input",this._inputHandler,!1),e.addEventListener("paste",this._pasteHandler,!1),document.addEventListener("selectionchange",this._selectionChangeHandler,!1)}disconnectedCallback(){document.removeEventListener("selectionchange",this._selectionChangeHandler,!1);let e=this._container;a.isNull(e)||(e.removeEventListener("keydown",this._shortcutHandler,!1),e.removeEventListener("blur",this._blurHandler,!1),e.removeEventListener("focus",this._focusHandler,!1),e.removeEventListener("input",this._inputHandler,!1),e.removeEventListener("paste",this._pasteHandler,!1)),super.disconnectedCallback()}getViewValue(e){return e}};_s=new WeakMap,c([S("div[pacem]")],ys.prototype,"_container",2),c([S("div[dashboard]")],ys.prototype,"_dashboard",2),c([h()],ys.prototype,"range",2),c([me(500)],ys.prototype,"_updateHistory",1),ys=c([C({tagName:d+"-contenteditable",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-contenteditable ${b}-viewfinder">
|
|
407
407
|
<div contenteditable="true" role="presenter" pacem></div>
|
|
408
408
|
</div>${er}
|
|
409
409
|
<div dashboard>
|
|
410
410
|
<${d}-content></${d}-content>
|
|
411
411
|
</div>`})],ys);var xt=class extends Ni{cleanUp(r){}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="range"&&(this.active=!a.isNull(t))}getTooltip(r=this.altText,e=this.keyboardShortcut){let t=r;return a.isNullOrEmpty(e)?t:`${t} (${e})`}};c([h({converter:m.String})],xt.prototype,"icon",2),c([h({converter:m.String})],xt.prototype,"keyboardShortcut",2),c([h({converter:m.String})],xt.prototype,"altText",2),c([h({converter:m.Boolean})],xt.prototype,"active",2);var Or=`<${d}-button disabled="{{ !:host.active }}" css-class="{{ {'text-primary': :host.isRelevant(:host.range)} }}" tooltip="{{ :host.getTooltip(:host.altText, :host.keyboardShortcut) }}" class="button" on-click=":host.execCommand()"><${d}-icon class="text-rootsize" icon="{{ :host.icon }}"></${d}-icon></${d}-button>
|
|
412
|
-
<${d}-shortcut disabled="{{ !:host.active }}" target="{{ :host.contentElement }}" combination="{{ :host.keyboardShortcut }}" on-execute=":host.execCommand()"></${d}-shortcut>`;var xs=class extends xt{exec(){return new Promise((r,e)=>{let t=this.container?.history;a.isNull(t)||(this.command==="redo"?t.canRedo&&(t.redo(),r()):t.canUndo&&(t.undo(),r()),this.contentElement.innerHTML=t.current)})}isRelevant(r){return!1}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="command"&&(this.icon=this.icon||t,this.altText=t,this.keyboardShortcut=this.keyboardShortcut||"Ctrl+"+(t==="redo"?"Y":"Z"))}containerPropertyChangedCallback(r,e,t,n){super.containerPropertyChangedCallback(r,e,t,n);let i=this.container,s=i.history;(r==="range"||r==="history")&&(this.active=!a.isNull(i.range)&&(this.command==="redo"&&s?.canRedo||this.command!=="redo"&&s?.canUndo))}};c([h({emit:!1,converter:m.String,reflectBack:!0})],xs.prototype,"command",2),xs=c([C({tagName:d+"-contenteditable-historycommand",shadow:j.USE_SHADOW_ROOT,template:Or})],xs);var Ya=class extends xt{isRelevant(r){return!a.isNull(Ee.findSurroundingNode(r,HTMLAnchorElement))}viewActivatedCallback(){super.viewActivatedCallback(),a.isNullOrEmpty(this.altText)&&(this.altText="insert link"),a.isNullOrEmpty(this.icon)&&(this.icon="insert_link"),a.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+H")}exec(r,e=this.target){return new Promise((t,n)=>{var i=this.range,s=Ee.findSurroundingNode(i,HTMLAnchorElement),l="http://",p=/<a.*href=\"([^\"]*)/;if(s&&p.test(s.outerHTML)&&(l=p.exec(s.outerHTML)[1]),r==="current")return l=="http://"?"":l;var u=r||r===void 0&&window.prompt("link (empty to unlink):",l);u?(document.execCommand("createLink",!1,u),s=Ee.findSurroundingNode(i,HTMLAnchorElement),s&&s.setAttribute("target",e||"_blank")):document.execCommand("unlink"),t()})}};c([h({emit:!1,converter:m.String})],Ya.prototype,"target",2),Ya=c([C({tagName:d+"-contenteditable-linkcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],Ya);function r_(o,r){return new Promise((e,t)=>{a.blobToDataURL(r).then(a.loadImage).then(n=>{let i=document.createElement("picture");i.setAttribute("contenteditable","false"),n.tabIndex=0,i.appendChild(n),o.deleteContents(),o.insertNode(i),e(i)})})}var nu,Cs=class extends xt{constructor(){super(...arguments);z(this,nu);this._setBehaviorHandler=e=>{let t=e.target,n=t.parentElement;this.range=Ee.select(n)};this._disposeBehaviorHandler=e=>{}}pasteCallback(e){return e.type.startsWith("image")?r_(this.range,e):Promise.reject()}cleanUp(e){e.querySelectorAll("picture[contenteditable=false]").forEach(t=>{let n=t.childNodes.length;for(let i=n-1;i>0;i--)t.childNodes.item(i).remove()}),e.querySelectorAll("div."+b+"-rescale").forEach(t=>t.remove())}isRelevant(e){return!1}viewActivatedCallback(){super.viewActivatedCallback(),a.isNullOrEmpty(this.altText)&&(this.altText="insert image"),a.isNullOrEmpty(this.icon)&&(this.icon="insert_photo"),a.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+Shift+I"),this._rescale.addEventListener("rescale",this._rescaleImg,!1)}disconnectedCallback(){a.isNull(this._rescale)||(this._rescale.removeEventListener("rescale",this._rescaleImg,!1),this._disposeContainer()),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":a.isNull(this._rescale)||(this._rescale.disabled=n);break;case"contentElement":t&&this._disposeContainer(t),n&&this._initContainer(n);break;case"range":this._rangeChangeCallback(t,n);break}}exec(){return new Promise((e,t)=>{let n=this._file,i=this.range;n.onchange=s=>{let l=n.files[0];a.isNull(l)?e():r_(i,l).then(p=>{n.value="",e()})},n.click()})}_rescaleImg(e){e.preventDefault();let t=e.detail.element,n=e.detail.targetRect,i=t.firstElementChild;i.style.width=n.width+"px",i.style.height=n.height+"px"}_rangeChangeCallback(e,t){if(!a.isNull(e)&&!e.collapsed&&e.commonAncestorContainer instanceof Element&&e.commonAncestorContainer===e.startContainer&&e.commonAncestorContainer===e.endContainer&&e.startOffset===e.endOffset-1){let n=e.commonAncestorContainer.childNodes.item(e.startOffset);n instanceof HTMLPictureElement&&this._rescale.unregister(n)}if(!a.isNull(t)&&!t.collapsed&&t.commonAncestorContainer instanceof Element&&t.commonAncestorContainer===t.startContainer&&t.commonAncestorContainer===t.endContainer&&t.startOffset===t.endOffset-1){let n=t.commonAncestorContainer.childNodes.item(t.startOffset);n instanceof HTMLPictureElement&&this._rescale.register(n)}}_enhancePictureElement(e){e.firstElementChild&&(e.firstElementChild.addEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.addEventListener("blur",this._disposeBehaviorHandler,!1))}_downgradePictureElement(e){e.firstElementChild&&(e.firstElementChild.removeEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.removeEventListener("blur",this._disposeBehaviorHandler,!1))}_initContainer(e=this.contentElement){H(this,nu,new Cl(e,(t,n)=>{t instanceof HTMLPictureElement&&(n?this._downgradePictureElement(t):this._enhancePictureElement(t))},"picture"))}_disposeContainer(e=this.contentElement){let t=M(this,nu);a.isNull(t)||t.dispose()}};nu=new WeakMap,c([S("input[type=file]")],Cs.prototype,"_file",2),c([S(d+"-rescale")],Cs.prototype,"_rescale",2),Cs=c([C({tagName:d+"-contenteditable-imagecommand",shadow:j.USE_SHADOW_ROOT,template:`<input type="file" accept="image/png, image/gif, image/jpeg, image/bmp, image/x-icon" class="${b}-trasparent ${b}-inert" pacem hidden>`+Or+`<${d}-rescale keep-proportions="true"></${d}-rescale>`})],Cs);var hv=(f=>(f.Bold="bold",f.Italic="italic",f.Underline="underline",f.StrikeThrough="strikeThrough",f.OrderedList="insertOrderedList",f.UnorderedList="insertUnorderedList",f.JustifyLeft="justifyLeft",f.JustifyCenter="justifyCenter",f.JustifyRight="justifyRight",f.JustifyFull="justifyFull",f))(hv||{});function n_(o){let r=o?.toLowerCase();switch(r){case"bold":case"italic":return"format_"+r;case"underline":return"format_underlined";case"strikethrough":return"strikethrough_s";case"insertorderedlist":return"format_list_numbered";case"insertunorderedlist":return"format_list_bulleted";case"justifyleft":case"justifyright":case"justifycenter":return"format_align_"+r.substr(7);case"justifyfull":return"format_align_justify";default:return"help_outline"}}function i_(o,r){switch(o?.toLowerCase()){case"bold":return["b","strong"];case"italic":return["i","em"];case"underline":return["u"];case"strikethrough":return["strike","s","del"];case"insertorderedlist":return["ol"];case"insertunorderedlist":return["ul"];case"justifyleft":return[{style:{name:"text-align",value:"left"}}];case"justifyright":return[{style:{name:"text-align",value:"right"}}];case"justifycenter":return[{style:{name:"text-align",value:"center"}}];case"justifyfull":return[{style:{name:"text-align",value:"justify"}}];case"formatblock":return[r];default:return["none"]}}var dr=class extends xt{_matchRelevance(r,e){let t=typeof e=="object"?Ee.findSurroundingNode(r,n=>n instanceof HTMLElement&&(a.isNullOrEmpty(e.tagName)||n.tagName===e.tagName.toUpperCase())&&n.style[e.style.name]===e.style.value):Ee.findSurroundingNode(r,e);return!a.isNull(t)}isRelevant(r){let e=i_(this.command,this.argument);for(let t of e)if(this._matchRelevance(r,t))return!0;return!1}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="command"&&((a.isNullOrEmpty(this.icon)||this.icon===n_(e))&&(this.icon=n_(t)),(a.isNullOrEmpty(this.altText)||this.altText===e)&&(this.altText=t))}exec(){return new Promise((r,e)=>{let t=this.range,n=i_(this.command,this.argument)[0];if(!a.isNull(t)){let i=Ee.testInertElementWrapping(t);if(i.result&&typeof n=="string"&&["b","i","strike","u"].indexOf(n)>=0){let s=Ee.findSurroundingNode(t,n);if(!a.isNull(s)&&s.childNodes.length===1){let l=s.childNodes.item(0),p=i.element;s.parentElement.replaceChild(l,s),Ee.select(p)}else{let l=document.createElement(n),p=i.element,u=t.extractContents();t.insertNode(l),l.append(u),Ee.select(p)}}else document.execCommand(this.command,!1,this.argument)}r()})}};c([h({converter:m.String})],dr.prototype,"command",2),c([h({emit:!1,converter:m.String})],dr.prototype,"argument",2),dr=c([C({tagName:d+"-contenteditable-execcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],dr);function mv(o){return o instanceof HTMLDivElement&&o.contentEditable==="true"&&o.hasAttribute("pacem")&&o.hasAttribute("role")&&o.attributes.role.value==="presenter"}var Cl=class{constructor(r,e,t="*[contenteditable=false]"){this.#t=e,this.#e=t,this.#n=new MutationObserver(n=>{let i=(s,l)=>{s.childNodes.forEach(p=>i(p,l)),e(s,l)};for(let s of n){let l=s.addedNodes,p=s.removedNodes;for(let u=0;u<l.length;u++){let f=l.item(u);i(f,!1)}for(let u=0;u<p.length;u++){let f=p.item(u);i(f,!0)}}}),this._initContainer(r)}_initContainer(r){r.querySelectorAll(this.#e).forEach(e=>this.#t(e)),this.#n.observe(r,{subtree:!0,childList:!0}),this.#r=r}_disposeContainer(r){let e=this.#n;a.isNull(e)||e.disconnect(),r.querySelectorAll(this.#e).forEach(t=>this.#t(t,!0))}dispose(){this._disposeContainer(this.#r)}#e;#t;#r;#n},Ee=class o{static getDefaultDashboard(){let r=new DocumentFragment,e=document.createElement("div");a.addClass(e,b+"-contenteditable-toolbar");let t=new xs;t.command="undo",t.keyboardShortcut="Ctrl+Z";let n=new xs;n.command="redo",n.keyboardShortcut="Ctrl+Y",e.append(t,n);let i=document.createElement("div");a.addClass(i,b+"-contenteditable-separator");let s=document.createElement("div");a.addClass(s,b+"-contenteditable-toolbar");let l=new dr;l.command="bold",l.keyboardShortcut="Ctrl+B";let p=new dr;p.command="italic",p.keyboardShortcut="Ctrl+I";let u=new dr;u.command="underline",u.keyboardShortcut="Ctrl+U";let f=new dr;f.command="strikeThrough",u.keyboardShortcut="Ctrl+K";let g=new dr;g.command="insertUnorderedList";let v=new dr;v.command="insertOrderedList";let y=new In;y.align="left";let _=new In;_.align="center";let x=new In;x.align="right";let w=new In;w.align="justify",s.append(l,p,u,f,g,v,y,_,x,w);let E=document.createElement("div");a.addClass(E,b+"-contenteditable-separator");let k=document.createElement("div");a.addClass(k,b+"-contenteditable-toolbar");let N=new Ya,T=new Cs;return k.append(N,T),r.append(e,i,s,E,k),r}static findSurroundingNode(r,e){for(var t=r instanceof Node?r:r.commonAncestorContainer;t&&!(typeof e=="string"&&t instanceof Element&&t.tagName===e.toUpperCase()||typeof e=="function"&&a.isNull(e.prototype)&&e(t)||typeof e=="function"&&!a.isNull(e.prototype)&&t instanceof e);){let n=t.parentNode;if(mv(n)){t=null;break}t=n}return t}static findSurroundingBlockElement(r){return this.findSurroundingNode(r,o.isBlockElement)}static findSurroundingSiblingBlockElements(r){let e=[];if(mv(r.startContainer)){if(!r.collapsed){let i=r.startContainer;for(let s=r.startOffset;s<=r.endOffset;s++){let l=i.children.item(s);this.isBlockElement(l)&&e.push(i.children.item(s))}}return e}if(r.startContainer===r.endContainer){let i=r.startContainer;for(;!o.isBlockElement(i)&&i.parentElement.contentEditable!="true";)i=i.parentElement;return i instanceof Element?[i]:i.parentElement.contentEditable==="true"?[]:[i.parentElement]}let t=r.commonAncestorContainer,n=!1;for(let i=0;i<t.childNodes.length;i++){let s=t.childNodes.item(i);if((!n&&s.contains(r.startContainer)||n)&&o.isBlockElement(s)&&(e.push(s),n=!0,s.contains(r.endContainer)))break}return n?e:t instanceof Element&&!mv(t)?[t]:[]}static findContainingRootElements(r){let e=r.cloneRange(),t=r.cloneRange();e.collapse(!0),t.collapse();let n=this.findSurroundingNode(e,s=>s.parentElement.contentEditable==="true"),i=[n];for(;!n.contains(t.startContainer);)i.push(n=n.nextElementSibling);return i}static isBlockElement(r){return r instanceof Element&&!getComputedStyle(r).display.startsWith("inline")}static select(r,e=!1){let t=document.createRange();e?(t.setStart(r,0),t.setEnd(r,r.childNodes.length)):(t.setStartBefore(r),t.setEndAfter(r));let n=document.getSelection();return n.removeAllRanges(),n.addRange(t),t}static copyAttributes(r,e){let t=e.attributes;for(let n=0;n<t.length;n++){let i=t.item(n);r.setAttribute(i.name,i.value)}}static testInertElementWrapping(r){if(!a.isNull(r)){let t=r.startContainer,n=r.startOffset;var e;if(t===r.endContainer&&n==r.endOffset-1&&(e=t.childNodes.item(n))instanceof HTMLElement&&e.contentEditable==="false")return{result:!0,element:e}}return{result:!1}}};function s_(o){return"format_align_"+o}var In=class extends xt{isRelevant(r){let e=Ee.findSurroundingSiblingBlockElements(r);if(a.isNullOrEmpty(e))return!1;let t=e[0];return getComputedStyle(t).textAlign==this.align}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="align"&&((a.isNullOrEmpty(this.icon)||this.icon===s_(e))&&(this.icon=s_(t)),(a.isNullOrEmpty(this.altText)||this.altText===e)&&(this.altText=t))}exec(){let r=Ee.findSurroundingSiblingBlockElements(this.range),e;for(let t of r)Ee.isBlockElement(t)&&t instanceof HTMLElement&&(a.isNull(e)&&(e=a.hasClass(t,"text-"+this.align)?"":this.align),t.style.textAlign="",a.removeClass(t,"text-left text-right text-center text-justify"),a.isEmpty(e)||a.addClass(t,"text-"+e));return Promise.resolve()}};c([h({converter:m.String})],In.prototype,"align",2),In=c([C({tagName:d+"-contenteditable-aligncommand",shadow:j.USE_SHADOW_ROOT,template:Or})],In);function Dw(o,r){let e=document.createElement("ins");return e.textContent=r,e.setAttribute("contenteditable","false"),e.tabIndex=0,o.deleteContents(),o.insertNode(e),e}function a_(o){return o instanceof HTMLModElement&&o.tagName==="INS"}function Rw(o){let r=Ee.testInertElementWrapping(o);if(r.result&&a_(r.element)){let e=r.element,t=e.textContent;return{result:!0,element:e,placeholder:t}}return{result:!1}}var sp,vm,iu,Xa=class extends Ni{constructor(){super(...arguments);z(this,sp);z(this,vm);z(this,iu);this._focusHandler=e=>{let t=e.target;this.range=Ee.select(t)}}cleanUp(e){e.querySelectorAll("ins[contenteditable=false]").forEach(t=>{a.removeClass(t,"placeholder-selected")})}exec(e){let t=Dw(this.range,e);return Ee.select(t).collapse(!1),Promise.resolve(t)}isRelevant(e){return M(this,sp)?.result??!1}viewActivatedCallback(){super.viewActivatedCallback(),this._fillDropdown(),this._initContainer()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"datasource":this._fillDropdown();break;case"contentElement":t&&this._disposeContainer(t),n&&this._initContainer(n);break;case"range":this._changeRelevancy();break}}disconnectedCallback(){this._disposeContainer(),super.disconnectedCallback()}_changeRelevancy(e=this.range){let t=M(this,sp);a.isNull(t?.element)||a.removeClass(t.element,"placeholder-selected");let n=H(this,sp,Rw(e));a.isNull(n?.element)||a.addClass(n.element,"placeholder-selected"),n.result?this._dropdown.value=n.placeholder:(this._dropdown.popout(),this._dropdown.value=void 0)}_fillDropdown(e=this.datasource||[]){let t=H(this,vm,e.map(i=>typeof i=="string"?{placeholder:i,definition:i}:i)),n=this._dropdown;n.textProperty=n.valueProperty="placeholder",n.datasource=t}_initContainer(e=this.contentElement){H(this,iu,new Cl(e,(t,n)=>{a_(t)&&(n?this._downgradePlaceholderElement(t):this._enhancePlaceholderElement(t))},"ins[contenteditable=false]"))}_disposeContainer(e=this.contentElement){let t=M(this,iu);a.isNull(t)||t.dispose()}_enhancePlaceholderElement(e){e.addEventListener("focus",this._focusHandler,!1)}_downgradePlaceholderElement(e){e.removeEventListener("focus",this._focusHandler,!1)}};sp=new WeakMap,vm=new WeakMap,iu=new WeakMap,c([S("template")],Xa.prototype,"_itemtemplate",2),c([S(d+"-suggest")],Xa.prototype,"_dropdown",2),c([h({emit:!1,converter:m.Json})],Xa.prototype,"datasource",2),Xa=c([C({tagName:d+"-contenteditable-placeholder",shadow:j.USE_SHADOW_ROOT,template:`<template>
|
|
412
|
+
<${d}-shortcut disabled="{{ !:host.active }}" target="{{ :host.contentElement }}" combination="{{ :host.keyboardShortcut }}" on-execute=":host.execCommand()"></${d}-shortcut>`;var xs=class extends xt{exec(){return new Promise((r,e)=>{let t=this.container?.history;a.isNull(t)||(this.command==="redo"?t.canRedo&&(t.redo(),r()):t.canUndo&&(t.undo(),r()),this.contentElement.innerHTML=t.current)})}isRelevant(r){return!1}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="command"&&(this.icon=this.icon||t,this.altText=t,this.keyboardShortcut=this.keyboardShortcut||"Ctrl+"+(t==="redo"?"Y":"Z"))}containerPropertyChangedCallback(r,e,t,n){super.containerPropertyChangedCallback(r,e,t,n);let i=this.container,s=i.history;(r==="range"||r==="history")&&(this.active=!a.isNull(i.range)&&(this.command==="redo"&&s?.canRedo||this.command!=="redo"&&s?.canUndo))}};c([h({emit:!1,converter:m.String,reflectBack:!0})],xs.prototype,"command",2),xs=c([C({tagName:d+"-contenteditable-historycommand",shadow:j.USE_SHADOW_ROOT,template:Or})],xs);var Ya=class extends xt{isRelevant(r){return!a.isNull(Ee.findSurroundingNode(r,HTMLAnchorElement))}viewActivatedCallback(){super.viewActivatedCallback(),a.isNullOrEmpty(this.altText)&&(this.altText="insert link"),a.isNullOrEmpty(this.icon)&&(this.icon="insert_link"),a.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+H")}exec(r,e=this.target){return new Promise((t,n)=>{var i=this.range,s=Ee.findSurroundingNode(i,HTMLAnchorElement),l="http://",p=/<a.*href=\"([^\"]*)/;if(s&&p.test(s.outerHTML)&&(l=p.exec(s.outerHTML)[1]),r==="current")return l=="http://"?"":l;var u=r||r===void 0&&window.prompt("link (empty to unlink):",l);u?(document.execCommand("createLink",!1,u),s=Ee.findSurroundingNode(i,HTMLAnchorElement),s&&s.setAttribute("target",e||"_blank")):document.execCommand("unlink"),t()})}};c([h({emit:!1,converter:m.String})],Ya.prototype,"target",2),Ya=c([C({tagName:d+"-contenteditable-linkcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],Ya);function n_(o,r){return new Promise((e,t)=>{a.blobToDataURL(r).then(a.loadImage).then(n=>{let i=document.createElement("picture");i.setAttribute("contenteditable","false"),n.tabIndex=0,i.appendChild(n),o.deleteContents(),o.insertNode(i),e(i)})})}var nu,Cs=class extends xt{constructor(){super(...arguments);z(this,nu);this._setBehaviorHandler=e=>{let t=e.target,n=t.parentElement;this.range=Ee.select(n)};this._disposeBehaviorHandler=e=>{}}pasteCallback(e){return e.type.startsWith("image")?n_(this.range,e):Promise.reject()}cleanUp(e){e.querySelectorAll("picture[contenteditable=false]").forEach(t=>{let n=t.childNodes.length;for(let i=n-1;i>0;i--)t.childNodes.item(i).remove()}),e.querySelectorAll("div."+b+"-rescale").forEach(t=>t.remove())}isRelevant(e){return!1}viewActivatedCallback(){super.viewActivatedCallback(),a.isNullOrEmpty(this.altText)&&(this.altText="insert image"),a.isNullOrEmpty(this.icon)&&(this.icon="insert_photo"),a.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+Shift+I"),this._rescale.addEventListener("rescale",this._rescaleImg,!1)}disconnectedCallback(){a.isNull(this._rescale)||(this._rescale.removeEventListener("rescale",this._rescaleImg,!1),this._disposeContainer()),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"disabled":a.isNull(this._rescale)||(this._rescale.disabled=n);break;case"contentElement":t&&this._disposeContainer(t),n&&this._initContainer(n);break;case"range":this._rangeChangeCallback(t,n);break}}exec(){return new Promise((e,t)=>{let n=this._file,i=this.range;n.onchange=s=>{let l=n.files[0];a.isNull(l)?e():n_(i,l).then(p=>{n.value="",e()})},n.click()})}_rescaleImg(e){e.preventDefault();let t=e.detail.element,n=e.detail.targetRect,i=t.firstElementChild;i.style.width=n.width+"px",i.style.height=n.height+"px"}_rangeChangeCallback(e,t){if(!a.isNull(e)&&!e.collapsed&&e.commonAncestorContainer instanceof Element&&e.commonAncestorContainer===e.startContainer&&e.commonAncestorContainer===e.endContainer&&e.startOffset===e.endOffset-1){let n=e.commonAncestorContainer.childNodes.item(e.startOffset);n instanceof HTMLPictureElement&&this._rescale.unregister(n)}if(!a.isNull(t)&&!t.collapsed&&t.commonAncestorContainer instanceof Element&&t.commonAncestorContainer===t.startContainer&&t.commonAncestorContainer===t.endContainer&&t.startOffset===t.endOffset-1){let n=t.commonAncestorContainer.childNodes.item(t.startOffset);n instanceof HTMLPictureElement&&this._rescale.register(n)}}_enhancePictureElement(e){e.firstElementChild&&(e.firstElementChild.addEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.addEventListener("blur",this._disposeBehaviorHandler,!1))}_downgradePictureElement(e){e.firstElementChild&&(e.firstElementChild.removeEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.removeEventListener("blur",this._disposeBehaviorHandler,!1))}_initContainer(e=this.contentElement){H(this,nu,new Cl(e,(t,n)=>{t instanceof HTMLPictureElement&&(n?this._downgradePictureElement(t):this._enhancePictureElement(t))},"picture"))}_disposeContainer(e=this.contentElement){let t=M(this,nu);a.isNull(t)||t.dispose()}};nu=new WeakMap,c([S("input[type=file]")],Cs.prototype,"_file",2),c([S(d+"-rescale")],Cs.prototype,"_rescale",2),Cs=c([C({tagName:d+"-contenteditable-imagecommand",shadow:j.USE_SHADOW_ROOT,template:`<input type="file" accept="image/png, image/gif, image/jpeg, image/bmp, image/x-icon" class="${b}-trasparent ${b}-inert" pacem hidden>`+Or+`<${d}-rescale keep-proportions="true"></${d}-rescale>`})],Cs);var hv=(f=>(f.Bold="bold",f.Italic="italic",f.Underline="underline",f.StrikeThrough="strikeThrough",f.OrderedList="insertOrderedList",f.UnorderedList="insertUnorderedList",f.JustifyLeft="justifyLeft",f.JustifyCenter="justifyCenter",f.JustifyRight="justifyRight",f.JustifyFull="justifyFull",f))(hv||{});function i_(o){let r=o?.toLowerCase();switch(r){case"bold":case"italic":return"format_"+r;case"underline":return"format_underlined";case"strikethrough":return"strikethrough_s";case"insertorderedlist":return"format_list_numbered";case"insertunorderedlist":return"format_list_bulleted";case"justifyleft":case"justifyright":case"justifycenter":return"format_align_"+r.substr(7);case"justifyfull":return"format_align_justify";default:return"help_outline"}}function s_(o,r){switch(o?.toLowerCase()){case"bold":return["b","strong"];case"italic":return["i","em"];case"underline":return["u"];case"strikethrough":return["strike","s","del"];case"insertorderedlist":return["ol"];case"insertunorderedlist":return["ul"];case"justifyleft":return[{style:{name:"text-align",value:"left"}}];case"justifyright":return[{style:{name:"text-align",value:"right"}}];case"justifycenter":return[{style:{name:"text-align",value:"center"}}];case"justifyfull":return[{style:{name:"text-align",value:"justify"}}];case"formatblock":return[r];default:return["none"]}}var dr=class extends xt{_matchRelevance(r,e){let t=typeof e=="object"?Ee.findSurroundingNode(r,n=>n instanceof HTMLElement&&(a.isNullOrEmpty(e.tagName)||n.tagName===e.tagName.toUpperCase())&&n.style[e.style.name]===e.style.value):Ee.findSurroundingNode(r,e);return!a.isNull(t)}isRelevant(r){let e=s_(this.command,this.argument);for(let t of e)if(this._matchRelevance(r,t))return!0;return!1}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="command"&&((a.isNullOrEmpty(this.icon)||this.icon===i_(e))&&(this.icon=i_(t)),(a.isNullOrEmpty(this.altText)||this.altText===e)&&(this.altText=t))}exec(){return new Promise((r,e)=>{let t=this.range,n=s_(this.command,this.argument)[0];if(!a.isNull(t)){let i=Ee.testInertElementWrapping(t);if(i.result&&typeof n=="string"&&["b","i","strike","u"].indexOf(n)>=0){let s=Ee.findSurroundingNode(t,n);if(!a.isNull(s)&&s.childNodes.length===1){let l=s.childNodes.item(0),p=i.element;s.parentElement.replaceChild(l,s),Ee.select(p)}else{let l=document.createElement(n),p=i.element,u=t.extractContents();t.insertNode(l),l.append(u),Ee.select(p)}}else document.execCommand(this.command,!1,this.argument)}r()})}};c([h({converter:m.String})],dr.prototype,"command",2),c([h({emit:!1,converter:m.String})],dr.prototype,"argument",2),dr=c([C({tagName:d+"-contenteditable-execcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],dr);function mv(o){return o instanceof HTMLDivElement&&o.contentEditable==="true"&&o.hasAttribute("pacem")&&o.hasAttribute("role")&&o.attributes.role.value==="presenter"}var Cl=class{constructor(r,e,t="*[contenteditable=false]"){this.#t=e,this.#e=t,this.#n=new MutationObserver(n=>{let i=(s,l)=>{s.childNodes.forEach(p=>i(p,l)),e(s,l)};for(let s of n){let l=s.addedNodes,p=s.removedNodes;for(let u=0;u<l.length;u++){let f=l.item(u);i(f,!1)}for(let u=0;u<p.length;u++){let f=p.item(u);i(f,!0)}}}),this._initContainer(r)}_initContainer(r){r.querySelectorAll(this.#e).forEach(e=>this.#t(e)),this.#n.observe(r,{subtree:!0,childList:!0}),this.#r=r}_disposeContainer(r){let e=this.#n;a.isNull(e)||e.disconnect(),r.querySelectorAll(this.#e).forEach(t=>this.#t(t,!0))}dispose(){this._disposeContainer(this.#r)}#e;#t;#r;#n},Ee=class o{static getDefaultDashboard(){let r=new DocumentFragment,e=document.createElement("div");a.addClass(e,b+"-contenteditable-toolbar");let t=new xs;t.command="undo",t.keyboardShortcut="Ctrl+Z";let n=new xs;n.command="redo",n.keyboardShortcut="Ctrl+Y",e.append(t,n);let i=document.createElement("div");a.addClass(i,b+"-contenteditable-separator");let s=document.createElement("div");a.addClass(s,b+"-contenteditable-toolbar");let l=new dr;l.command="bold",l.keyboardShortcut="Ctrl+B";let p=new dr;p.command="italic",p.keyboardShortcut="Ctrl+I";let u=new dr;u.command="underline",u.keyboardShortcut="Ctrl+U";let f=new dr;f.command="strikeThrough",u.keyboardShortcut="Ctrl+K";let g=new dr;g.command="insertUnorderedList";let v=new dr;v.command="insertOrderedList";let y=new In;y.align="left";let _=new In;_.align="center";let x=new In;x.align="right";let w=new In;w.align="justify",s.append(l,p,u,f,g,v,y,_,x,w);let E=document.createElement("div");a.addClass(E,b+"-contenteditable-separator");let k=document.createElement("div");a.addClass(k,b+"-contenteditable-toolbar");let N=new Ya,T=new Cs;return k.append(N,T),r.append(e,i,s,E,k),r}static findSurroundingNode(r,e){for(var t=r instanceof Node?r:r.commonAncestorContainer;t&&!(typeof e=="string"&&t instanceof Element&&t.tagName===e.toUpperCase()||typeof e=="function"&&a.isNull(e.prototype)&&e(t)||typeof e=="function"&&!a.isNull(e.prototype)&&t instanceof e);){let n=t.parentNode;if(mv(n)){t=null;break}t=n}return t}static findSurroundingBlockElement(r){return this.findSurroundingNode(r,o.isBlockElement)}static findSurroundingSiblingBlockElements(r){let e=[];if(mv(r.startContainer)){if(!r.collapsed){let i=r.startContainer;for(let s=r.startOffset;s<=r.endOffset;s++){let l=i.children.item(s);this.isBlockElement(l)&&e.push(i.children.item(s))}}return e}if(r.startContainer===r.endContainer){let i=r.startContainer;for(;!o.isBlockElement(i)&&i.parentElement.contentEditable!="true";)i=i.parentElement;return i instanceof Element?[i]:i.parentElement.contentEditable==="true"?[]:[i.parentElement]}let t=r.commonAncestorContainer,n=!1;for(let i=0;i<t.childNodes.length;i++){let s=t.childNodes.item(i);if((!n&&s.contains(r.startContainer)||n)&&o.isBlockElement(s)&&(e.push(s),n=!0,s.contains(r.endContainer)))break}return n?e:t instanceof Element&&!mv(t)?[t]:[]}static findContainingRootElements(r){let e=r.cloneRange(),t=r.cloneRange();e.collapse(!0),t.collapse();let n=this.findSurroundingNode(e,s=>s.parentElement.contentEditable==="true"),i=[n];for(;!n.contains(t.startContainer);)i.push(n=n.nextElementSibling);return i}static isBlockElement(r){return r instanceof Element&&!getComputedStyle(r).display.startsWith("inline")}static select(r,e=!1){let t=document.createRange();e?(t.setStart(r,0),t.setEnd(r,r.childNodes.length)):(t.setStartBefore(r),t.setEndAfter(r));let n=document.getSelection();return n.removeAllRanges(),n.addRange(t),t}static copyAttributes(r,e){let t=e.attributes;for(let n=0;n<t.length;n++){let i=t.item(n);r.setAttribute(i.name,i.value)}}static testInertElementWrapping(r){if(!a.isNull(r)){let t=r.startContainer,n=r.startOffset;var e;if(t===r.endContainer&&n==r.endOffset-1&&(e=t.childNodes.item(n))instanceof HTMLElement&&e.contentEditable==="false")return{result:!0,element:e}}return{result:!1}}};function a_(o){return"format_align_"+o}var In=class extends xt{isRelevant(r){let e=Ee.findSurroundingSiblingBlockElements(r);if(a.isNullOrEmpty(e))return!1;let t=e[0];return getComputedStyle(t).textAlign==this.align}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="align"&&((a.isNullOrEmpty(this.icon)||this.icon===a_(e))&&(this.icon=a_(t)),(a.isNullOrEmpty(this.altText)||this.altText===e)&&(this.altText=t))}exec(){let r=Ee.findSurroundingSiblingBlockElements(this.range),e;for(let t of r)Ee.isBlockElement(t)&&t instanceof HTMLElement&&(a.isNull(e)&&(e=a.hasClass(t,"text-"+this.align)?"":this.align),t.style.textAlign="",a.removeClass(t,"text-left text-right text-center text-justify"),a.isEmpty(e)||a.addClass(t,"text-"+e));return Promise.resolve()}};c([h({converter:m.String})],In.prototype,"align",2),In=c([C({tagName:d+"-contenteditable-aligncommand",shadow:j.USE_SHADOW_ROOT,template:Or})],In);function Rw(o,r){let e=document.createElement("ins");return e.textContent=r,e.setAttribute("contenteditable","false"),e.tabIndex=0,o.deleteContents(),o.insertNode(e),e}function o_(o){return o instanceof HTMLModElement&&o.tagName==="INS"}function Ow(o){let r=Ee.testInertElementWrapping(o);if(r.result&&o_(r.element)){let e=r.element,t=e.textContent;return{result:!0,element:e,placeholder:t}}return{result:!1}}var sp,vm,iu,Xa=class extends Ni{constructor(){super(...arguments);z(this,sp);z(this,vm);z(this,iu);this._focusHandler=e=>{let t=e.target;this.range=Ee.select(t)}}cleanUp(e){e.querySelectorAll("ins[contenteditable=false]").forEach(t=>{a.removeClass(t,"placeholder-selected")})}exec(e){let t=Rw(this.range,e);return Ee.select(t).collapse(!1),Promise.resolve(t)}isRelevant(e){return M(this,sp)?.result??!1}viewActivatedCallback(){super.viewActivatedCallback(),this._fillDropdown(),this._initContainer()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"datasource":this._fillDropdown();break;case"contentElement":t&&this._disposeContainer(t),n&&this._initContainer(n);break;case"range":this._changeRelevancy();break}}disconnectedCallback(){this._disposeContainer(),super.disconnectedCallback()}_changeRelevancy(e=this.range){let t=M(this,sp);a.isNull(t?.element)||a.removeClass(t.element,"placeholder-selected");let n=H(this,sp,Ow(e));a.isNull(n?.element)||a.addClass(n.element,"placeholder-selected"),n.result?this._dropdown.value=n.placeholder:(this._dropdown.popout(),this._dropdown.value=void 0)}_fillDropdown(e=this.datasource||[]){let t=H(this,vm,e.map(i=>typeof i=="string"?{placeholder:i,definition:i}:i)),n=this._dropdown;n.textProperty=n.valueProperty="placeholder",n.datasource=t}_initContainer(e=this.contentElement){H(this,iu,new Cl(e,(t,n)=>{o_(t)&&(n?this._downgradePlaceholderElement(t):this._enhancePlaceholderElement(t))},"ins[contenteditable=false]"))}_disposeContainer(e=this.contentElement){let t=M(this,iu);a.isNull(t)||t.dispose()}_enhancePlaceholderElement(e){e.addEventListener("focus",this._focusHandler,!1)}_downgradePlaceholderElement(e){e.removeEventListener("focus",this._focusHandler,!1)}};sp=new WeakMap,vm=new WeakMap,iu=new WeakMap,c([S("template")],Xa.prototype,"_itemtemplate",2),c([S(d+"-suggest")],Xa.prototype,"_dropdown",2),c([h({emit:!1,converter:m.Json})],Xa.prototype,"datasource",2),Xa=c([C({tagName:d+"-contenteditable-placeholder",shadow:j.USE_SHADOW_ROOT,template:`<template>
|
|
413
413
|
<${d}-span text="{{ ^item.viewValue }}" class="text-tech"></${d}-span>
|
|
414
414
|
<${d}-markdown hide="{{ $pacem.isNullOrEmpty(^item.data.definition) || ^item.viewValue === ^item.data.definition }}" class="${b}-margin margin-0 text-small" value="{{ ^item.data.definition }}"></${d}-markdown>
|
|
415
415
|
</template>
|
|
416
416
|
<${d}-suggest placeholder="Placeholder" class="pacem-button button" disabled="{{ $pacem.isNull(:host.range) }}"
|
|
417
417
|
on-change=":host.execCommand($this.value)"
|
|
418
418
|
css-class="{{ {'text-primary': :host.isRelevant(:host.range)} }}"
|
|
419
|
-
compare-by="placeholder" text-property="placeholder" itemtemplate="{{ ::_itemtemplate }}" prevent-focus="true" allow-typing="false"></${d}-suggest>`})],Xa);var ap=class extends xt{isRelevant(r){return!a.isNull(Ee.findSurroundingNode(r,this.tagname))}exec(){return new Promise((r,e)=>{let t=this.tagname;if(!a.isNullOrEmpty(t)){let n=this.range,i=Ee.findSurroundingNode(n,t)||Ee.findSurroundingNode(n.startContainer,t)||Ee.findSurroundingNode(n.endContainer,t);if(a.isNull(i)){let s=Ee.findSurroundingSiblingBlockElements(n);if(!a.isNullOrEmpty(s)){let l=document.createElement(t);if(s.length===1){let u=s[0];n.setStart(u,0),n.setEnd(u,u.childNodes.length);let f=n.extractContents();l.append(f),Ee.copyAttributes(l,u),u.parentElement.insertBefore(l,u),u.remove()}else{n.setStartBefore(s[0]),n.setEndAfter(s[s.length-1]);let u=n.extractContents();l.append(u),n.insertNode(l)}Ee.select(l,!0).collapse()}}else{n.setStart(i,0),n.setEnd(i,i.childNodes.length);let s=!1,l=i.childNodes;for(let p=0;p<l.length;p++){let u=l.item(p);if(!Ee.isBlockElement(u)){s=!0;break}}if(s){let p=document.createElement("p");Ee.copyAttributes(p,i),p.append(n.extractContents()),i.parentNode.replaceChild(p,i),Ee.select(p,!0).collapse()}else i.parentNode.replaceChild(n.extractContents(),i),Ee.select(n.endContainer,!0).collapse()}}r()})}};c([h({converter:m.String})],ap.prototype,"tagname",2),ap=c([C({tagName:d+"-contenteditable-wrapcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],ap);var ie={};Le(ie,{UI:()=>Tm});var Tm={};Le(Tm,{AdapterOrientation:()=>fv,AdapterPageButtonRefreshEvent:()=>ym,AdapterPageButtonRefreshEventName:()=>su,BalloonAlignment:()=>h_,BalloonBehavior:()=>d_,BalloonPopoutEventName:()=>v_,BalloonPopupEventName:()=>g_,BalloonPosition:()=>m_,BalloonSizing:()=>f_,BalloonTrigger:()=>u_,BinderAnchor:()=>__,BinderEnd:()=>x_,BinderInteractionEvent:()=>xm,BinderInteractionEventName:()=>E_,BinderTension:()=>C_,CalendarEventSelectEvent:()=>Sm,CalendarEventUnselectEvent:()=>Lm,CalendarZoom:()=>k_,DateSelectEvent:()=>km,DialogButton:()=>yv,DialogButtons:()=>bv,DialogResultEvent:()=>Em,DialogResultEventName:()=>w_,ElementOrPointPropertyConverter:()=>op,LightboxBehavior:()=>Cm,LoaderType:()=>D_,MEDIAQUERY_2K:()=>h0,MEDIAQUERY_4K:()=>m0,MEDIAQUERY_HD:()=>u0,MEDIAQUERY_LANDSCAPE:()=>g0,MEDIAQUERY_LG:()=>p0,MEDIAQUERY_MD:()=>c0,MEDIAQUERY_PORTRAIT:()=>f0,MEDIAQUERY_PREFERS_DARK:()=>b0,MEDIAQUERY_PREFERS_LIGHT:()=>v0,MEDIAQUERY_SM:()=>l0,MEDIAQUERY_XL:()=>d0,MEDIAQUERY_XS:()=>o0,MarkdownService:()=>hu,PacemAdaptedIterativeElement:()=>uu,PacemAdapterElement:()=>Je,PacemAgendaElement:()=>kl,PacemAnchorElement:()=>$n,PacemBalloonElement:()=>Ti,PacemBinderElement:()=>ur,PacemBladeElement:()=>lp,PacemBottomSheetElement:()=>ln,PacemBottomSheetHandleElement:()=>El,PacemButtonElement:()=>tr,PacemButtonsetElement:()=>au,PacemCalendarBaseElement:()=>Pr,PacemCalendarDayOfWeekRuleElement:()=>dp,PacemCalendarElement:()=>Ja,PacemCalendarEventElement:()=>Hn,PacemCalendarRuleBaseElement:()=>ou,PacemCalendarWithEventsBaseElement:()=>cu,PacemClockElement:()=>pp,PacemCollapseElement:()=>Es,PacemDialogBase:()=>cp,PacemDialogElement:()=>cn,PacemDividerElement:()=>mp,PacemIconElement:()=>fp,PacemImageElement:()=>ws,PacemInfiniteScrollerElement:()=>Za,PacemLightboxElement:()=>pn,PacemLoaderElement:()=>Ai,PacemMarkdownElement:()=>vp,PacemMarqueeElement:()=>Ms,PacemMediaQueryElement:()=>Sl,PacemMenuCursorElement:()=>Ll,PacemMenuElement:()=>mr,PacemPagerElement:()=>dn,PacemPictureElement:()=>Di,PacemPictureSourceElement:()=>Ss,PacemProgressbarElement:()=>Ri,PacemScheduleElement:()=>Ml,PacemSidebarElement:()=>Nl,PacemSlideElement:()=>bp,PacemSlideshowElement:()=>gu,PacemStickyHeaderElement:()=>Ls,PacemTabElement:()=>Ns,PacemTabsElement:()=>Oi,PacemTickerElement:()=>eo,PacemToastElement:()=>rr,PacemTocElement:()=>Ir,PacemTunerElement:()=>nr,PacemTweetEmbedElement:()=>yp,PacemVibrateElement:()=>xp,PacemViewElement:()=>Bn,PacemWindowAreaElement:()=>xu,PacemWindowElement:()=>Ts,StickyHeaderVisibility:()=>O_,TimeSelectEvent:()=>Mm,ViewDateChangeEvent:()=>wm});var{PacemElement:bm,RepeaterItemCreateEventName:o_,ItemRegisterEventName:l_,ItemUnregisterEventName:c_}=R,fv=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(fv||{}),su="pagerefresh",ym=class extends CustomEvent{constructor(r){super(su,{detail:r,bubbles:!1,cancelable:!1})}},Je=class extends R.PacemAdapter{constructor(){super(...arguments);this._itemCreatedHandler=e=>{let t=e.detail.index;this._pageMap.set(t,e.detail.dom[0].firstElementChild),this._fireAdapterPageRefreshCallback(t,e.detail.item)};this._pageMap=new Map;this.interactive=!0;this.swipeEnabled=!0;this.loop=!0;this.labelCallback=(e,t)=>(t+1).toString();this._itemRegisterHandler=e=>{let t=e.detail;!a.isNull(this._swiper)&&t instanceof bm&&t.behaviors.indexOf(this._swiper)==-1&&t.behaviors.push(this._swiper)};this._itemUnregisterHandler=e=>{let t=e.detail,n;!a.isNull(this._swiper)&&t instanceof bm&&(n=t.behaviors.indexOf(this._swiper))>=0&&t.behaviors.splice(n,1)};this._keydownHandler=e=>{if(this.interactive)switch(this.orientation){case"vertical":switch(e.keyCode){case 40:this._next(e);break;case 38:this._previous(e);break}break;default:switch(e.keyCode){case 39:this._next(e);break;case 37:this._previous(e);break}break}}}masterPropertyChangedCallback(e,t,n,i){switch(super.masterPropertyChangedCallback(e,t,n,i),e){case"items":this._syncViewWithItems();break;case"index":this._index=n;break}}viewActivatedCallback(){super.viewActivatedCallback(),this._repeater.addEventListener(o_,this._itemCreatedHandler,!1),this._syncViewWithItems()}disconnectedCallback(){this._repeater&&this._repeater.removeEventListener(o_,this._itemCreatedHandler,!1),super.disconnectedCallback()}initializeCallback(){super.initializeCallback(),this.addEventListener("keydown",this._keydownHandler,!1);let e=this.master;if(!a.isNull(e)){let t=this._previousTabIndex=e.tabIndex;(!t||t<0)&&(e.tabIndex=0),e.addEventListener("keydown",this._keydownHandler,!1),e.addEventListener(l_,this._itemRegisterHandler,!1),e.addEventListener(c_,this._itemUnregisterHandler,!1)}this._syncViewWithItems()}destroyCallback(){this.removeEventListener("keydown",this._keydownHandler,!1);let e=this.master;if(!a.isNull(e)){if(e.removeEventListener("keydown",this._keydownHandler,!1),e.removeEventListener(l_,this._itemRegisterHandler,!1),e.removeEventListener(c_,this._itemUnregisterHandler,!1),!a.isNullOrEmpty(e.items))for(let t of e.items){let n=t.behaviors,i=n.indexOf(this._swiper);i>=0&&n.splice(i,1)}e.tabIndex=this._previousTabIndex}super.destroyCallback()}itemPropertyChangedCallback(e,t,n,i,s){super.itemPropertyChangedCallback(e,t,n,i,s),this._tickVersion(),this._fireAdapterPageRefreshCallback(e)}_fireAdapterPageRefreshCallback(e,t){t=t||this.master.items[e];var n=t.hide||!1,i=t.disabled||!1,s=this._labelCallback(t,e);let l=new ym({index:e,hide:n,disabled:i,content:s});this.dispatchEvent(l),n=this._isHidden(t,e,l.detail.hide),i=this._isDisabled(t,e,l.detail.disabled),s=l.detail.content;let p=this._pageMap;if(p.has(e)){let u=p.get(e),f=u.firstElementChild,g=()=>{u.hide=n,u.disabled=i,f.content=s};A.whenReady(u,g)}}_tickVersion(){this._v=Date.now()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"interval":this._resetTimer(n);break;case"swipeEnabled":this._swiper.disabled=!n||!this.interactive;break;case"interactive":this.hidden=!n,this._swiper.disabled=!n||!this.swipeEnabled;break;case"pausable":n==!0?this._liPause.removeAttribute("hidden"):this._liPause.setAttribute("hidden","hidden");break}}_syncViewWithItems(){if(!(!this.isReady||a.isNull(this.master)||a.isNull(this._prevBtn)||a.isNull(this._nextBtn)||a.isNull(this._repeater))){var e=this.master.items;if(this._prevBtn.hide=this._nextBtn.hide=this._panel.hide=!(e&&e.length>1),this._panel.hide=a.isNullOrEmpty(e),this._repeater.datasource=e,this._index=this.master.index,!a.isNullOrEmpty(e))for(let t of e)t instanceof bm&&t.behaviors.indexOf(this._swiper)==-1&&t.behaviors.push(this._swiper)}}_toggle(e){(this._paused=!this._paused)?(Q(e),this._resetTimer(0)):this._next(e)}_resetTimer(e){clearInterval(this._handle),e>0&&(this._handle=window.setInterval(()=>{super.next()},e))}_next(e){e.type!==J.SwipeEventType.SwipeLeft&&Q(e),this._resetTimer(this.interval),super.next(this.loop)}_previous(e){e.type!==J.SwipeEventType.SwipeRight&&Q(e),this._resetTimer(this.interval),super.previous(this.loop)}_select(e,t){Q(t),this._resetTimer(this.interval),!this.deselectable||e!==this._index?super.select(e):this.master.index=this._index=-1}_isDisabled(e,t,n,i){return this._disableOrHide(e,t,n)}_isHidden(e,t,n,i){return this._disableOrHide(e,t,n)}_disableOrHide(e,t,n){let i=e instanceof bm&&n===!0;return(this._index===-1&&i===!1||i===!0&&t===this._index)&&(this.deselectable?this.master.index=this._index=-1:super.select(t)),i}_labelCallback(e,t,n){return this.labelCallback(e,t)}};c([S(d+"-repeater")],Je.prototype,"_repeater",2),c([S(d+"-button."+b+"-adapter-previous")],Je.prototype,"_prevBtn",2),c([S(d+"-button."+b+"-adapter-next")],Je.prototype,"_nextBtn",2),c([S(d+"-panel")],Je.prototype,"_panel",2),c([S(d+"-swipe")],Je.prototype,"_swiper",2),c([S("."+b+"-adapter-dashboard > li[pacem]")],Je.prototype,"_liPause",2),c([me()],Je.prototype,"_tickVersion",1),c([h({converter:m.Boolean})],Je.prototype,"pausable",2),c([h({emit:!1,converter:m.Number})],Je.prototype,"interval",2),c([h({emit:!1,converter:m.String})],Je.prototype,"orientation",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"interactive",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"swipeEnabled",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"deselectable",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"loop",2),c([h({emit:!1})],Je.prototype,"labelCallback",2),c([h()],Je.prototype,"_index",2),c([h()],Je.prototype,"_paused",2),c([h()],Je.prototype,"_v",2),c([Wp(333)],Je.prototype,"_next",1),c([Wp(333)],Je.prototype,"_previous",1),Je=c([C({tagName:d+"-adapter",shadow:j.USE_SHADOW_ROOT,template:`<${d}-button class="${b}-adapter-previous" on-click=":host._previous($event)"><</${d}-button>
|
|
419
|
+
compare-by="placeholder" text-property="placeholder" itemtemplate="{{ ::_itemtemplate }}" prevent-focus="true" allow-typing="false"></${d}-suggest>`})],Xa);var ap=class extends xt{isRelevant(r){return!a.isNull(Ee.findSurroundingNode(r,this.tagname))}exec(){return new Promise((r,e)=>{let t=this.tagname;if(!a.isNullOrEmpty(t)){let n=this.range,i=Ee.findSurroundingNode(n,t)||Ee.findSurroundingNode(n.startContainer,t)||Ee.findSurroundingNode(n.endContainer,t);if(a.isNull(i)){let s=Ee.findSurroundingSiblingBlockElements(n);if(!a.isNullOrEmpty(s)){let l=document.createElement(t);if(s.length===1){let u=s[0];n.setStart(u,0),n.setEnd(u,u.childNodes.length);let f=n.extractContents();l.append(f),Ee.copyAttributes(l,u),u.parentElement.insertBefore(l,u),u.remove()}else{n.setStartBefore(s[0]),n.setEndAfter(s[s.length-1]);let u=n.extractContents();l.append(u),n.insertNode(l)}Ee.select(l,!0).collapse()}}else{n.setStart(i,0),n.setEnd(i,i.childNodes.length);let s=!1,l=i.childNodes;for(let p=0;p<l.length;p++){let u=l.item(p);if(!Ee.isBlockElement(u)){s=!0;break}}if(s){let p=document.createElement("p");Ee.copyAttributes(p,i),p.append(n.extractContents()),i.parentNode.replaceChild(p,i),Ee.select(p,!0).collapse()}else i.parentNode.replaceChild(n.extractContents(),i),Ee.select(n.endContainer,!0).collapse()}}r()})}};c([h({converter:m.String})],ap.prototype,"tagname",2),ap=c([C({tagName:d+"-contenteditable-wrapcommand",shadow:j.USE_SHADOW_ROOT,template:Or})],ap);var ie={};Se(ie,{UI:()=>Tm});var Tm={};Se(Tm,{AdapterOrientation:()=>fv,AdapterPageButtonRefreshEvent:()=>ym,AdapterPageButtonRefreshEventName:()=>su,BalloonAlignment:()=>m_,BalloonBehavior:()=>u_,BalloonPopoutEventName:()=>b_,BalloonPopupEventName:()=>v_,BalloonPosition:()=>f_,BalloonSizing:()=>g_,BalloonTrigger:()=>h_,BinderAnchor:()=>x_,BinderEnd:()=>C_,BinderInteractionEvent:()=>xm,BinderInteractionEventName:()=>w_,BinderTension:()=>E_,CalendarEventSelectEvent:()=>Sm,CalendarEventUnselectEvent:()=>Lm,CalendarZoom:()=>M_,DateSelectEvent:()=>km,DialogButton:()=>yv,DialogButtons:()=>bv,DialogResultEvent:()=>Em,DialogResultEventName:()=>k_,ElementOrPointPropertyConverter:()=>op,LightboxBehavior:()=>Cm,LoaderType:()=>R_,MEDIAQUERY_2K:()=>m0,MEDIAQUERY_4K:()=>f0,MEDIAQUERY_HD:()=>h0,MEDIAQUERY_LANDSCAPE:()=>v0,MEDIAQUERY_LG:()=>d0,MEDIAQUERY_MD:()=>p0,MEDIAQUERY_PORTRAIT:()=>g0,MEDIAQUERY_PREFERS_DARK:()=>y0,MEDIAQUERY_PREFERS_LIGHT:()=>b0,MEDIAQUERY_SM:()=>c0,MEDIAQUERY_XL:()=>u0,MEDIAQUERY_XS:()=>l0,MarkdownService:()=>hu,PacemAdaptedIterativeElement:()=>uu,PacemAdapterElement:()=>Je,PacemAgendaElement:()=>kl,PacemAnchorElement:()=>$n,PacemBalloonElement:()=>Ti,PacemBinderElement:()=>ur,PacemBladeElement:()=>lp,PacemBottomSheetElement:()=>ln,PacemBottomSheetHandleElement:()=>El,PacemButtonElement:()=>tr,PacemButtonsetElement:()=>au,PacemCalendarBaseElement:()=>Pr,PacemCalendarDayOfWeekRuleElement:()=>dp,PacemCalendarElement:()=>Ja,PacemCalendarEventElement:()=>Hn,PacemCalendarRuleBaseElement:()=>ou,PacemCalendarWithEventsBaseElement:()=>cu,PacemClockElement:()=>pp,PacemCollapseElement:()=>Es,PacemDialogBase:()=>cp,PacemDialogElement:()=>cn,PacemDividerElement:()=>mp,PacemIconElement:()=>fp,PacemImageElement:()=>ws,PacemInfiniteScrollerElement:()=>Za,PacemLightboxElement:()=>pn,PacemLoaderElement:()=>Ai,PacemMarkdownElement:()=>vp,PacemMarqueeElement:()=>Ms,PacemMediaQueryElement:()=>Sl,PacemMenuCursorElement:()=>Ll,PacemMenuElement:()=>mr,PacemPagerElement:()=>dn,PacemPictureElement:()=>Di,PacemPictureSourceElement:()=>Ss,PacemProgressbarElement:()=>Ri,PacemScheduleElement:()=>Ml,PacemSidebarElement:()=>Nl,PacemSlideElement:()=>bp,PacemSlideshowElement:()=>gu,PacemStickyHeaderElement:()=>Ls,PacemTabElement:()=>Ns,PacemTabsElement:()=>Oi,PacemTickerElement:()=>eo,PacemToastElement:()=>rr,PacemTocElement:()=>Ir,PacemTunerElement:()=>nr,PacemTweetEmbedElement:()=>yp,PacemVibrateElement:()=>xp,PacemViewElement:()=>Bn,PacemWindowAreaElement:()=>xu,PacemWindowElement:()=>Ts,StickyHeaderVisibility:()=>P_,TimeSelectEvent:()=>Mm,ViewDateChangeEvent:()=>wm});var{PacemElement:bm,RepeaterItemCreateEventName:l_,ItemRegisterEventName:c_,ItemUnregisterEventName:p_}=R,fv=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(fv||{}),su="pagerefresh",ym=class extends CustomEvent{constructor(r){super(su,{detail:r,bubbles:!1,cancelable:!1})}},Je=class extends R.PacemAdapter{constructor(){super(...arguments);this._itemCreatedHandler=e=>{let t=e.detail.index;this._pageMap.set(t,e.detail.dom[0].firstElementChild),this._fireAdapterPageRefreshCallback(t,e.detail.item)};this._pageMap=new Map;this.interactive=!0;this.swipeEnabled=!0;this.loop=!0;this.labelCallback=(e,t)=>(t+1).toString();this._itemRegisterHandler=e=>{let t=e.detail;!a.isNull(this._swiper)&&t instanceof bm&&t.behaviors.indexOf(this._swiper)==-1&&t.behaviors.push(this._swiper)};this._itemUnregisterHandler=e=>{let t=e.detail,n;!a.isNull(this._swiper)&&t instanceof bm&&(n=t.behaviors.indexOf(this._swiper))>=0&&t.behaviors.splice(n,1)};this._keydownHandler=e=>{if(this.interactive)switch(this.orientation){case"vertical":switch(e.keyCode){case 40:this._next(e);break;case 38:this._previous(e);break}break;default:switch(e.keyCode){case 39:this._next(e);break;case 37:this._previous(e);break}break}}}masterPropertyChangedCallback(e,t,n,i){switch(super.masterPropertyChangedCallback(e,t,n,i),e){case"items":this._syncViewWithItems();break;case"index":this._index=n;break}}viewActivatedCallback(){super.viewActivatedCallback(),this._repeater.addEventListener(l_,this._itemCreatedHandler,!1),this._syncViewWithItems()}disconnectedCallback(){this._repeater&&this._repeater.removeEventListener(l_,this._itemCreatedHandler,!1),super.disconnectedCallback()}initializeCallback(){super.initializeCallback(),this.addEventListener("keydown",this._keydownHandler,!1);let e=this.master;if(!a.isNull(e)){let t=this._previousTabIndex=e.tabIndex;(!t||t<0)&&(e.tabIndex=0),e.addEventListener("keydown",this._keydownHandler,!1),e.addEventListener(c_,this._itemRegisterHandler,!1),e.addEventListener(p_,this._itemUnregisterHandler,!1)}this._syncViewWithItems()}destroyCallback(){this.removeEventListener("keydown",this._keydownHandler,!1);let e=this.master;if(!a.isNull(e)){if(e.removeEventListener("keydown",this._keydownHandler,!1),e.removeEventListener(c_,this._itemRegisterHandler,!1),e.removeEventListener(p_,this._itemUnregisterHandler,!1),!a.isNullOrEmpty(e.items))for(let t of e.items){let n=t.behaviors,i=n.indexOf(this._swiper);i>=0&&n.splice(i,1)}e.tabIndex=this._previousTabIndex}super.destroyCallback()}itemPropertyChangedCallback(e,t,n,i,s){super.itemPropertyChangedCallback(e,t,n,i,s),this._tickVersion(),this._fireAdapterPageRefreshCallback(e)}_fireAdapterPageRefreshCallback(e,t){t=t||this.master.items[e];var n=t.hide||!1,i=t.disabled||!1,s=this._labelCallback(t,e);let l=new ym({index:e,hide:n,disabled:i,content:s});this.dispatchEvent(l),n=this._isHidden(t,e,l.detail.hide),i=this._isDisabled(t,e,l.detail.disabled),s=l.detail.content;let p=this._pageMap;if(p.has(e)){let u=p.get(e),f=u.firstElementChild,g=()=>{u.hide=n,u.disabled=i,f.content=s};A.whenReady(u,g)}}_tickVersion(){this._v=Date.now()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"interval":this._resetTimer(n);break;case"swipeEnabled":this._swiper.disabled=!n||!this.interactive;break;case"interactive":this.hidden=!n,this._swiper.disabled=!n||!this.swipeEnabled;break;case"pausable":n==!0?this._liPause.removeAttribute("hidden"):this._liPause.setAttribute("hidden","hidden");break}}_syncViewWithItems(){if(!(!this.isReady||a.isNull(this.master)||a.isNull(this._prevBtn)||a.isNull(this._nextBtn)||a.isNull(this._repeater))){var e=this.master.items;if(this._prevBtn.hide=this._nextBtn.hide=this._panel.hide=!(e&&e.length>1),this._panel.hide=a.isNullOrEmpty(e),this._repeater.datasource=e,this._index=this.master.index,!a.isNullOrEmpty(e))for(let t of e)t instanceof bm&&t.behaviors.indexOf(this._swiper)==-1&&t.behaviors.push(this._swiper)}}_toggle(e){(this._paused=!this._paused)?(Q(e),this._resetTimer(0)):this._next(e)}_resetTimer(e){clearInterval(this._handle),e>0&&(this._handle=window.setInterval(()=>{super.next()},e))}_next(e){e.type!==J.SwipeEventType.SwipeLeft&&Q(e),this._resetTimer(this.interval),super.next(this.loop)}_previous(e){e.type!==J.SwipeEventType.SwipeRight&&Q(e),this._resetTimer(this.interval),super.previous(this.loop)}_select(e,t){Q(t),this._resetTimer(this.interval),!this.deselectable||e!==this._index?super.select(e):this.master.index=this._index=-1}_isDisabled(e,t,n,i){return this._disableOrHide(e,t,n)}_isHidden(e,t,n,i){return this._disableOrHide(e,t,n)}_disableOrHide(e,t,n){let i=e instanceof bm&&n===!0;return(this._index===-1&&i===!1||i===!0&&t===this._index)&&(this.deselectable?this.master.index=this._index=-1:super.select(t)),i}_labelCallback(e,t,n){return this.labelCallback(e,t)}};c([S(d+"-repeater")],Je.prototype,"_repeater",2),c([S(d+"-button."+b+"-adapter-previous")],Je.prototype,"_prevBtn",2),c([S(d+"-button."+b+"-adapter-next")],Je.prototype,"_nextBtn",2),c([S(d+"-panel")],Je.prototype,"_panel",2),c([S(d+"-swipe")],Je.prototype,"_swiper",2),c([S("."+b+"-adapter-dashboard > li[pacem]")],Je.prototype,"_liPause",2),c([me()],Je.prototype,"_tickVersion",1),c([h({converter:m.Boolean})],Je.prototype,"pausable",2),c([h({emit:!1,converter:m.Number})],Je.prototype,"interval",2),c([h({emit:!1,converter:m.String})],Je.prototype,"orientation",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"interactive",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"swipeEnabled",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"deselectable",2),c([h({emit:!1,reflectBack:!0,converter:m.Boolean})],Je.prototype,"loop",2),c([h({emit:!1})],Je.prototype,"labelCallback",2),c([h()],Je.prototype,"_index",2),c([h()],Je.prototype,"_paused",2),c([h()],Je.prototype,"_v",2),c([Wp(333)],Je.prototype,"_next",1),c([Wp(333)],Je.prototype,"_previous",1),Je=c([C({tagName:d+"-adapter",shadow:j.USE_SHADOW_ROOT,template:`<${d}-button class="${b}-adapter-previous" on-click=":host._previous($event)"><</${d}-button>
|
|
420
420
|
<${d}-button class="${b}-adapter-next" on-click=":host._next($event)">></${d}-button>
|
|
421
421
|
<${d}-swipe on-swipeleft=":host._next($event)" on-swiperight=":host._previous($event)"></${d}-swipe>
|
|
422
422
|
<${d}-panel tabindex="0">
|
|
@@ -434,17 +434,17 @@ disabled="{{ (#${t}.suddenValidation && (!(#${t}.valid && #${t}.dirty))) || #${t
|
|
|
434
434
|
</${d}-button>
|
|
435
435
|
</li>
|
|
436
436
|
</template>
|
|
437
|
-
</ol></${d}-repeater></${d}-panel>`})],Je);var $n=class extends R.PacemElement{constructor(){super("link");this._fetching=!1}get fetching(){return this._fetching}connectedCallback(){super.connectedCallback(),this.hasAttribute("tab-order")||(this.tabOrder=0)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"target":(a.isNullOrEmpty(n)?a.removeClass:a.addClass)(this,"a-target");break;case"href":(a.isNull(n)?a.removeClass:a.addClass)(this,"a-url");break;case"download":(a.isNullOrEmpty(n)?a.removeClass:a.addClass)(this,"a-download");break}}emit(e){if(super.emit(e),this.disabled)return;switch(e.type){case"mousedown":a.addClass(this,b+"-active");break;case"keydown":e.key==="Enter"&&(e.preventDefault(),a.addClass(this,b+"-active"));break;case"blur":case"mouseup":a.removeClass(this,b+"-active");break;case"keyup":e.key==="Enter"&&(this.click(),a.removeClass(this,b+"-active"));break}let t=this.href,n=this.target,i=this.router,s=this.download,l=()=>a.isNull(i)?t:a.URIs.format(t,i.state);!a.isNull(t)&&!e.defaultPrevented&&(e.type==="click"&&e.ctrlKey||e.type==="mousedown"&&e.button===1?window.open(l(),"_blank"):e.type==="click"&&(s===!0?this._download(l()):typeof s=="string"&&!a.isNullOrEmpty(s)?this._download(l(),s):a.isNullOrEmpty(n)?a.isNull(i)?location.assign(t):i.path=t:window.open(l(),n)))}async _download(e,t){this.dispatchEvent(new ue({propertyName:"fetching",oldValue:this._fetching,currentValue:this._fetching=!0}));try{await a.download(e,{credentials:this.fetchCredentials,headers:this.fetchHeaders,filename:t})}finally{this.dispatchEvent(new ue({propertyName:"fetching",oldValue:this._fetching,currentValue:this._fetching=!1}))}}};c([h({emit:!1,converter:m.String})],$n.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],$n.prototype,"fetchHeaders",2),c([h({reflectBack:!0,converter:m.String})],$n.prototype,"href",2),c([h({reflectBack:!0,converter:m.String})],$n.prototype,"target",2),c([h({reflectBack:!1,converter:{convert:e=>{switch(e){case"true":return!0;case"false":return!1;default:return e}},convertBack:e=>e}})],$n.prototype,"download",2),c([h({reflectBack:!1,converter:m.Element})],$n.prototype,"router",2),$n=c([C({tagName:d+"-a"})],$n);var op={convert:o=>document.querySelector(o)??JSON.parse(o)};var d_=(t=>(t.Menu="menu",t.Tooltip="tooltip",t.Inert="inert",t))(d_||{}),u_=(n=>(n.Hover="hover",n.Click="click",n.ContextMenu="contextmenu",n.Focus="focus",n))(u_||{}),h_=(n=>(n.Start="start",n.Center="center",n.End="end",n.Auto="auto",n))(h_||{}),m_=(l=>(l.Top="top",l.Left="left",l.Bottom="bottom",l.Right="right",l.Auto="auto",l.HorizontalAuto="x",l.VerticalAuto="y",l))(m_||{}),f_=(e=>(e.Auto="auto",e.Match="match",e))(f_||{}),g_="popup",v_="popout",gv={Defaults:{trigger:"hover",position:"auto",size:"auto",behavior:"menu",verticalOffset:0,horizontalOffset:0,hoverDelay:250,hoverTimeout:500,align:"center",track:!0}},b_="balloon-right balloon-left balloon-bottom balloon-top balloon-start balloon-center balloon-end",p_=b+"-balloon "+b_+" balloon-out balloon-in balloon-on",Ti=class extends R.PacemElement{constructor(){super(...arguments);this._options=gv.Defaults;this._originalNeighborhood=null;this._popoutDelegate=e=>{this.popout()};this._hoverDelegate=e=>{this.disabled||this.popup(this._options.hoverDelay)};this._outConditionalDelegate=e=>{(e.srcElement||e.target)!=this&&this._outDelegate(e)};this._mousedownConditionalDelegate=e=>{jl(e),this._visible&&Re(e)};this._outDelegate=e=>{this.popout(this._options.hoverTimeout)};this._toggleDelegate=e=>{e.preventDefault(),this._visible?this._outDelegate(e):this._hoverDelegate(e)}}get visible(){return this._visible}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"?(t instanceof Element&&this._removeHandlers(t),n instanceof Element||this._adjust()):e==="options"?(this.target instanceof Element&&this._removeHandlers(this.target),this._options=a.extend({},a.clone(gv.Defaults),n),this._synchronizeOptions()):e==="disabled"&&n&&this.popout(),this.target instanceof Element&&e!=="disabled"&&this._setHandlers(this.target)}viewActivatedCallback(){super.viewActivatedCallback(),this._ensurePopup(),this.target=this.target||this.parentElement,this._synchronizeOptions()}disconnectedCallback(){super.disconnectedCallback(),this._destroyPopup(),this.target instanceof Element&&this._removeHandlers(this.target)}_synchronizeOptions(){let e=this,t=e.options||{};if(t.moveToRoot&&a.isNull(this._originalNeighborhood))this._originalNeighborhood={parent:e.parentElement,nextSibling:e.nextElementSibling},document.body.appendChild(e);else if(!t.moveToRoot&&!a.isNull(this._originalNeighborhood)){let n=this._originalNeighborhood.parent;a.isNull(n)||n.appendChild(e),this._originalNeighborhood=null}}_ensurePopup(){let e=this,t=e._container;return e&&t&&!a.hasClass(e,b+"-balloon")&&(a.addClass(e,b+"-balloon"),e.style.position="absolute",t.style.position="relative",t.style.zIndex="1",e.style.visibility="hidden"),e}_destroyPopup(){var e=this,t=e._container;a.removeClass(e,p_),e.style.position="",a.isNull(t)||(t.style.position="",t.style.zIndex="")}_registerEvents(){let e=this._ensurePopup(),t=this._options;switch(t.behavior){case"menu":switch(t.trigger){case"focus":e.addEventListener("mousedown",Re,!1),e.addEventListener("focus",this._hoverDelegate,!1);break;case"click":case"contextmenu":e.addEventListener("mousedown",Re,!1),window.document.body.addEventListener("mousedown",this._outConditionalDelegate,!1);break;default:e.addEventListener("mouseenter",this._hoverDelegate,!1),e.addEventListener("mouseleave",this._outDelegate,!1);break}break;case"tooltip":switch(t.trigger){case"focus":case"click":case"contextmenu":window.document.body.addEventListener("mousedown",this._outConditionalDelegate,!1);break;default:break}break}}_unregisterEvents(){var e=this._ensurePopup(),t=this._options;switch(t.behavior){case"menu":switch(t.trigger){case"focus":e.removeEventListener("mousedown",Re,!1),e.removeEventListener("focus",this._hoverDelegate,!1);break;case"click":case"contextmenu":e.removeEventListener("mousedown",Re,!1),window.document.body.removeEventListener("mousedown",this._outConditionalDelegate,!1);break;default:e.removeEventListener("mouseenter",this._hoverDelegate,!1),e.removeEventListener("mouseleave",this._outDelegate,!1);break}break;case"tooltip":switch(t.trigger){case"click":case"contextmenu":window.document.body.removeEventListener("mousedown",this._outConditionalDelegate,!1);break}break}}_onLayoutChange(e){this._visible&&this._adjust()}_adjust(){let e=this,t=e.target;if(a.isNull(t))return;let n=t instanceof Element?a.offset(t):{top:t.y,left:t.x,width:0,height:0},i=a.windowSize;var s=this._options,l=s.position,p=s.align;if(l!="top"&&l!="bottom"&&l!="left"&&l!="right"){let T=i.height,O=i.width,D=n.left-a.scrollLeft,P=n.top-a.scrollTop,F=T-(P+n.height),B=O-(D+n.width);l==="x"?l=D>B?"left":"right":l=P>F?"top":"bottom"}if(s.size==="match")switch(l){case"bottom":case"top":e.style.minWidth=n.width+"px",e.style.minHeight="";break;case"left":case"right":e.style.minHeight=n.height+"px",e.style.minWidth="";break}else e.style.minWidth=e.style.minHeight="";let u={width:e.offsetWidth,height:e.offsetHeight},f=n.width-u.width,g=f*.5,v=n.height-u.height,y=v*.5;switch(p){case"center":case"start":case"end":break;case"auto":switch(p="center",l){case"right":case"left":let T=a.scrollTop+i.height/2;n.top+n.height<T?p="start":n.top>T&&(p="end");break;case"top":case"bottom":let O=a.scrollLeft+i.width/2;n.left+n.width<O?p="start":n.left>O&&(p="end");break}break;default:p=gv.Defaults.align;break}a.removeClass(e,b_),a.addClass(e,"balloon-"+l),a.addClass(e,"balloon-"+p);let _=a.Css.getVariableValue(`--${b}-balloon-tail-size`),x=a.Css.getVariableValue(`--${b}-balloon-tail-inset`),w=parseInt(x)+.5*parseInt(_),E={width:n.width/2,height:n.height/2},k=s.autoAdjust&&w>E.width,N=s.autoAdjust&&w>E.height;switch(l){case"top":switch(n.top-=u.height,p){case"center":n.left+=g;break;case"end":n.left+=f,k&&(n.left+=w-E.width);break;case"start":k&&(n.left-=w-E.width);break}break;case"left":switch(n.left-=u.width,p){case"center":n.top+=y;break;case"end":n.top+=v,N&&(n.top+=w-E.height);break;case"start":N&&(n.top-=w-E.height);break}break;case"right":switch(n.left+=n.width,p){case"center":n.top+=y;break;case"end":n.top+=v,N&&(n.top+=w-E.height);break;case"start":N&&(n.top-=w-E.height);break}break;default:switch(n.top+=n.height,p){case"center":n.left+=g;break;case"end":n.left+=f,k&&(n.left+=w-E.width);break;case"start":k&&(n.left-=w-E.width);break}break}n.left=Math.min(i.width-u.width,Math.max(0,n.left)),n.top+=s.verticalOffset,n.left+=s.horizontalOffset,e.style.top=Math.round(n.top)+"px",e.style.left=Math.round(n.left)+"px"}_adjustWatchers(e){let t=this.options||{};a.isNull(this._resize)||(this._resize.disabled=!e,this._position.disabled=!e||!(t.track||t.trackPosition))}popup(e=0){if(clearTimeout(this._timer),e>0){this._timer=setTimeout(()=>this.popup(),e);return}let t=this,n=a.isVisible(t);this._adjustWatchers(!0),!(n||this.disabled)&&(this._registerEvents(),t.style.pointerEvents="none",this._visible=!0,t.style.visibility="visible",this._adjust(),a.addClass(t,"balloon-in"),a.addAnimationEndCallback(t,()=>{a.addClass(t,"balloon-on"),t.dispatchEvent(new ue({propertyName:"visible",oldValue:!1,currentValue:!0})),t.dispatchEvent(new Event(g_)),t.style.pointerEvents="auto"},500))}popout(e=0){if(clearTimeout(this._timer),e>0){this._timer=setTimeout(()=>this.popout(),e);return}var t=this;let n=a.isVisible(t);this._adjustWatchers(!1),n&&(this._unregisterEvents(),t.style.pointerEvents="none",a.removeClass(t,"balloon-in balloon-on"),a.addClass(t,"balloon-out"),a.addAnimationEndCallback(t,()=>{t.style.visibility="hidden",this._visible=!1,a.removeClass(t,p_),t.dispatchEvent(new Event(v_)),t.dispatchEvent(new ue({propertyName:"visible",oldValue:!0,currentValue:!1}))},500))}toggle(e=0){!a.isVisible(this)&&!this.disabled?this.popup(e):this.popout(e)}_removeHandlers(e){a.isNull(e)||(e.removeEventListener("mouseenter",this._hoverDelegate,!1),e.removeEventListener("mouseleave",this._outDelegate,!1),e.removeEventListener("mousedown",this._popoutDelegate,!1),e.removeEventListener("mousedown",this._mousedownConditionalDelegate,!1),e.removeEventListener("click",this._toggleDelegate,!1),e.removeEventListener("focus",this._hoverDelegate,!1),e.removeEventListener("blur",this._outDelegate,!1),e.removeEventListener("contextmenu",this._toggleDelegate,!1))}_setHandlers(e){this.popout();var t=this._options;if(t.behavior!="inert")switch(t.trigger){case"hover":e.addEventListener("mouseenter",this._hoverDelegate,!1),e.addEventListener("mouseleave",this._outDelegate,!1),e.addEventListener("mousedown",this._popoutDelegate,!1);break;case"focus":e.addEventListener("focus",this._hoverDelegate,!1),e.addEventListener("blur",this._outDelegate,!1);break;case"click":t.hoverDelay=t.hoverTimeout=0,e.addEventListener("mousedown",this._mousedownConditionalDelegate,!1),e.addEventListener("click",this._toggleDelegate,!1);break;case"contextmenu":t.hoverDelay=t.hoverTimeout=0,e.addEventListener("contextmenu",this._toggleDelegate,!1);break}}};c([S(`.${b}-balloon`)],Ti.prototype,"_container",2),c([S(d+"-resize[content]")],Ti.prototype,"_resize",2),c([S(d+"-resize[watch-position=true]")],Ti.prototype,"_position",2),c([h({converter:op})],Ti.prototype,"target",2),c([h({emit:!1,converter:m.Json})],Ti.prototype,"options",2),Ti=c([C({tagName:d+"-balloon",shadow:!0,template:`<${d}-resize target="{{ :host.target }}" disabled="true" watch-position="true" on-${R.ResizeEventName}=":host._onLayoutChange($event)"></${d}-resize>
|
|
437
|
+
</ol></${d}-repeater></${d}-panel>`})],Je);var $n=class extends R.PacemElement{constructor(){super("link");this._fetching=!1}get fetching(){return this._fetching}connectedCallback(){super.connectedCallback(),this.hasAttribute("tab-order")||(this.tabOrder=0)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"target":(a.isNullOrEmpty(n)?a.removeClass:a.addClass)(this,"a-target");break;case"href":(a.isNull(n)?a.removeClass:a.addClass)(this,"a-url");break;case"download":(a.isNullOrEmpty(n)?a.removeClass:a.addClass)(this,"a-download");break}}emit(e){if(super.emit(e),this.disabled)return;switch(e.type){case"mousedown":a.addClass(this,b+"-active");break;case"keydown":e.key==="Enter"&&(e.preventDefault(),a.addClass(this,b+"-active"));break;case"blur":case"mouseup":a.removeClass(this,b+"-active");break;case"keyup":e.key==="Enter"&&(this.click(),a.removeClass(this,b+"-active"));break}let t=this.href,n=this.target,i=this.router,s=this.download,l=()=>a.isNull(i)?t:a.URIs.format(t,i.state);!a.isNull(t)&&!e.defaultPrevented&&(e.type==="click"&&e.ctrlKey||e.type==="mousedown"&&e.button===1?window.open(l(),"_blank"):e.type==="click"&&(s===!0?this._download(l()):typeof s=="string"&&!a.isNullOrEmpty(s)?this._download(l(),s):a.isNullOrEmpty(n)?a.isNull(i)?location.assign(t):i.path=t:window.open(l(),n)))}async _download(e,t){this.dispatchEvent(new ue({propertyName:"fetching",oldValue:this._fetching,currentValue:this._fetching=!0}));try{await a.download(e,{credentials:this.fetchCredentials,headers:this.fetchHeaders,filename:t})}finally{this.dispatchEvent(new ue({propertyName:"fetching",oldValue:this._fetching,currentValue:this._fetching=!1}))}}};c([h({emit:!1,converter:m.String})],$n.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],$n.prototype,"fetchHeaders",2),c([h({reflectBack:!0,converter:m.String})],$n.prototype,"href",2),c([h({reflectBack:!0,converter:m.String})],$n.prototype,"target",2),c([h({reflectBack:!1,converter:{convert:e=>{switch(e){case"true":return!0;case"false":return!1;default:return e}},convertBack:e=>e}})],$n.prototype,"download",2),c([h({reflectBack:!1,converter:m.Element})],$n.prototype,"router",2),$n=c([C({tagName:d+"-a"})],$n);var op={convert:o=>document.querySelector(o)??JSON.parse(o)};var u_=(t=>(t.Menu="menu",t.Tooltip="tooltip",t.Inert="inert",t))(u_||{}),h_=(n=>(n.Hover="hover",n.Click="click",n.ContextMenu="contextmenu",n.Focus="focus",n))(h_||{}),m_=(n=>(n.Start="start",n.Center="center",n.End="end",n.Auto="auto",n))(m_||{}),f_=(l=>(l.Top="top",l.Left="left",l.Bottom="bottom",l.Right="right",l.Auto="auto",l.HorizontalAuto="x",l.VerticalAuto="y",l))(f_||{}),g_=(e=>(e.Auto="auto",e.Match="match",e))(g_||{}),v_="popup",b_="popout",gv={Defaults:{trigger:"hover",position:"auto",size:"auto",behavior:"menu",verticalOffset:0,horizontalOffset:0,hoverDelay:250,hoverTimeout:500,align:"center",track:!0}},y_="balloon-right balloon-left balloon-bottom balloon-top balloon-start balloon-center balloon-end",d_=b+"-balloon "+y_+" balloon-out balloon-in balloon-on",Ti=class extends R.PacemElement{constructor(){super(...arguments);this._options=gv.Defaults;this._originalNeighborhood=null;this._popoutDelegate=e=>{this.popout()};this._hoverDelegate=e=>{this.disabled||this.popup(this._options.hoverDelay)};this._outConditionalDelegate=e=>{(e.srcElement||e.target)!=this&&this._outDelegate(e)};this._mousedownConditionalDelegate=e=>{jl(e),this._visible&&Re(e)};this._outDelegate=e=>{this.popout(this._options.hoverTimeout)};this._toggleDelegate=e=>{e.preventDefault(),this._visible?this._outDelegate(e):this._hoverDelegate(e)}}get visible(){return this._visible}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="target"?(t instanceof Element&&this._removeHandlers(t),n instanceof Element||this._adjust()):e==="options"?(this.target instanceof Element&&this._removeHandlers(this.target),this._options=a.extend({},a.clone(gv.Defaults),n),this._synchronizeOptions()):e==="disabled"&&n&&this.popout(),this.target instanceof Element&&e!=="disabled"&&this._setHandlers(this.target)}viewActivatedCallback(){super.viewActivatedCallback(),this._ensurePopup(),this.target=this.target||this.parentElement,this._synchronizeOptions()}disconnectedCallback(){super.disconnectedCallback(),this._destroyPopup(),this.target instanceof Element&&this._removeHandlers(this.target)}_synchronizeOptions(){let e=this,t=e.options||{};if(t.moveToRoot&&a.isNull(this._originalNeighborhood))this._originalNeighborhood={parent:e.parentElement,nextSibling:e.nextElementSibling},document.body.appendChild(e);else if(!t.moveToRoot&&!a.isNull(this._originalNeighborhood)){let n=this._originalNeighborhood.parent;a.isNull(n)||n.appendChild(e),this._originalNeighborhood=null}}_ensurePopup(){let e=this,t=e._container;return e&&t&&!a.hasClass(e,b+"-balloon")&&(a.addClass(e,b+"-balloon"),e.style.position="absolute",t.style.position="relative",t.style.zIndex="1",e.style.visibility="hidden"),e}_destroyPopup(){var e=this,t=e._container;a.removeClass(e,d_),e.style.position="",a.isNull(t)||(t.style.position="",t.style.zIndex="")}_registerEvents(){let e=this._ensurePopup(),t=this._options;switch(t.behavior){case"menu":switch(t.trigger){case"focus":e.addEventListener("mousedown",Re,!1),e.addEventListener("focus",this._hoverDelegate,!1);break;case"click":case"contextmenu":e.addEventListener("mousedown",Re,!1),window.document.body.addEventListener("mousedown",this._outConditionalDelegate,!1);break;default:e.addEventListener("mouseenter",this._hoverDelegate,!1),e.addEventListener("mouseleave",this._outDelegate,!1);break}break;case"tooltip":switch(t.trigger){case"focus":case"click":case"contextmenu":window.document.body.addEventListener("mousedown",this._outConditionalDelegate,!1);break;default:break}break}}_unregisterEvents(){var e=this._ensurePopup(),t=this._options;switch(t.behavior){case"menu":switch(t.trigger){case"focus":e.removeEventListener("mousedown",Re,!1),e.removeEventListener("focus",this._hoverDelegate,!1);break;case"click":case"contextmenu":e.removeEventListener("mousedown",Re,!1),window.document.body.removeEventListener("mousedown",this._outConditionalDelegate,!1);break;default:e.removeEventListener("mouseenter",this._hoverDelegate,!1),e.removeEventListener("mouseleave",this._outDelegate,!1);break}break;case"tooltip":switch(t.trigger){case"click":case"contextmenu":window.document.body.removeEventListener("mousedown",this._outConditionalDelegate,!1);break}break}}_onLayoutChange(e){this._visible&&this._adjust()}_adjust(){let e=this,t=e.target;if(a.isNull(t))return;let n=t instanceof Element?a.offset(t):{top:t.y,left:t.x,width:0,height:0},i=a.windowSize;var s=this._options,l=s.position,p=s.align;if(l!="top"&&l!="bottom"&&l!="left"&&l!="right"){let T=i.height,O=i.width,D=n.left-a.scrollLeft,P=n.top-a.scrollTop,F=T-(P+n.height),B=O-(D+n.width);l==="x"?l=D>B?"left":"right":l=P>F?"top":"bottom"}if(s.size==="match")switch(l){case"bottom":case"top":e.style.minWidth=n.width+"px",e.style.minHeight="";break;case"left":case"right":e.style.minHeight=n.height+"px",e.style.minWidth="";break}else e.style.minWidth=e.style.minHeight="";let u={width:e.offsetWidth,height:e.offsetHeight},f=n.width-u.width,g=f*.5,v=n.height-u.height,y=v*.5;switch(p){case"center":case"start":case"end":break;case"auto":switch(p="center",l){case"right":case"left":let T=a.scrollTop+i.height/2;n.top+n.height<T?p="start":n.top>T&&(p="end");break;case"top":case"bottom":let O=a.scrollLeft+i.width/2;n.left+n.width<O?p="start":n.left>O&&(p="end");break}break;default:p=gv.Defaults.align;break}a.removeClass(e,y_),a.addClass(e,"balloon-"+l),a.addClass(e,"balloon-"+p);let _=a.Css.getVariableValue(`--${b}-balloon-tail-size`),x=a.Css.getVariableValue(`--${b}-balloon-tail-inset`),w=parseInt(x)+.5*parseInt(_),E={width:n.width/2,height:n.height/2},k=s.autoAdjust&&w>E.width,N=s.autoAdjust&&w>E.height;switch(l){case"top":switch(n.top-=u.height,p){case"center":n.left+=g;break;case"end":n.left+=f,k&&(n.left+=w-E.width);break;case"start":k&&(n.left-=w-E.width);break}break;case"left":switch(n.left-=u.width,p){case"center":n.top+=y;break;case"end":n.top+=v,N&&(n.top+=w-E.height);break;case"start":N&&(n.top-=w-E.height);break}break;case"right":switch(n.left+=n.width,p){case"center":n.top+=y;break;case"end":n.top+=v,N&&(n.top+=w-E.height);break;case"start":N&&(n.top-=w-E.height);break}break;default:switch(n.top+=n.height,p){case"center":n.left+=g;break;case"end":n.left+=f,k&&(n.left+=w-E.width);break;case"start":k&&(n.left-=w-E.width);break}break}n.left=Math.min(i.width-u.width,Math.max(0,n.left)),n.top+=s.verticalOffset,n.left+=s.horizontalOffset,e.style.top=Math.round(n.top)+"px",e.style.left=Math.round(n.left)+"px"}_adjustWatchers(e){let t=this.options||{};a.isNull(this._resize)||(this._resize.disabled=!e,this._position.disabled=!e||!(t.track||t.trackPosition))}popup(e=0){if(clearTimeout(this._timer),e>0){this._timer=setTimeout(()=>this.popup(),e);return}let t=this,n=a.isVisible(t);this._adjustWatchers(!0),!(n||this.disabled)&&(this._registerEvents(),t.style.pointerEvents="none",this._visible=!0,t.style.visibility="visible",this._adjust(),a.addClass(t,"balloon-in"),a.addAnimationEndCallback(t,()=>{a.addClass(t,"balloon-on"),t.dispatchEvent(new ue({propertyName:"visible",oldValue:!1,currentValue:!0})),t.dispatchEvent(new Event(v_)),t.style.pointerEvents="auto"},500))}popout(e=0){if(clearTimeout(this._timer),e>0){this._timer=setTimeout(()=>this.popout(),e);return}var t=this;let n=a.isVisible(t);this._adjustWatchers(!1),n&&(this._unregisterEvents(),t.style.pointerEvents="none",a.removeClass(t,"balloon-in balloon-on"),a.addClass(t,"balloon-out"),a.addAnimationEndCallback(t,()=>{t.style.visibility="hidden",this._visible=!1,a.removeClass(t,d_),t.dispatchEvent(new Event(b_)),t.dispatchEvent(new ue({propertyName:"visible",oldValue:!0,currentValue:!1}))},500))}toggle(e=0){!a.isVisible(this)&&!this.disabled?this.popup(e):this.popout(e)}_removeHandlers(e){a.isNull(e)||(e.removeEventListener("mouseenter",this._hoverDelegate,!1),e.removeEventListener("mouseleave",this._outDelegate,!1),e.removeEventListener("mousedown",this._popoutDelegate,!1),e.removeEventListener("mousedown",this._mousedownConditionalDelegate,!1),e.removeEventListener("click",this._toggleDelegate,!1),e.removeEventListener("focus",this._hoverDelegate,!1),e.removeEventListener("blur",this._outDelegate,!1),e.removeEventListener("contextmenu",this._toggleDelegate,!1))}_setHandlers(e){this.popout();var t=this._options;if(t.behavior!="inert")switch(t.trigger){case"hover":e.addEventListener("mouseenter",this._hoverDelegate,!1),e.addEventListener("mouseleave",this._outDelegate,!1),e.addEventListener("mousedown",this._popoutDelegate,!1);break;case"focus":e.addEventListener("focus",this._hoverDelegate,!1),e.addEventListener("blur",this._outDelegate,!1);break;case"click":t.hoverDelay=t.hoverTimeout=0,e.addEventListener("mousedown",this._mousedownConditionalDelegate,!1),e.addEventListener("click",this._toggleDelegate,!1);break;case"contextmenu":t.hoverDelay=t.hoverTimeout=0,e.addEventListener("contextmenu",this._toggleDelegate,!1);break}}};c([S(`.${b}-balloon`)],Ti.prototype,"_container",2),c([S(d+"-resize[content]")],Ti.prototype,"_resize",2),c([S(d+"-resize[watch-position=true]")],Ti.prototype,"_position",2),c([h({converter:op})],Ti.prototype,"target",2),c([h({emit:!1,converter:m.Json})],Ti.prototype,"options",2),Ti=c([C({tagName:d+"-balloon",shadow:!0,template:`<${d}-resize target="{{ :host.target }}" disabled="true" watch-position="true" on-${R.ResizeEventName}=":host._onLayoutChange($event)"></${d}-resize>
|
|
438
438
|
<div class="${b}-balloon"><${d}-resize on-${R.ResizeEventName}=":host._onLayoutChange($event)" disabled="true" content><slot></slot></${d}-resize></div>
|
|
439
|
-
<div class="corner top-left" part="corner-topleft"></div><div class="corner bottom-left" part="corner-bottomleft"></div><div class="corner top-right" part="corner-topright"></div><div class="corner bottom-right" part="corner-bottomright"></div>`})],Ti);var __=(s=>(s.Auto="auto",s.Left="left",s.Top="top",s.Right="right",s.Bottom="bottom",s.Center="center",s))(__||{}),x_=(n=>(n.Default="default",n.Arrow="arrow",n.FatArrow="fatarrow",n.None="none",n))(x_||{}),C_=(e=>(e.Mass="mass",e.Path="path",e))(C_||{}),E_="interact",xm=class extends ht{constructor(r){super(E_,null,r)}},_m="pacem:components:ui:binders",vv=class{constructor(r){this.binders=[];this.fire=r=>{for(var e of this.binders)e.refresh(this.resize.target,r.detail)};let e=this.resize=new R.PacemResizeElement;e.target=r,e.watchPosition=!0,document.body.appendChild(e)}dispose(){this.resize.remove()}},qa=class{static{this._pageBinders=[]}static _updateResizeListener(){let r=this._pageBinders;if(a.isNull(this._bodyResizeListener)){let e=this._bodyResizeListener=new R.PacemResizeElement;e.target=document.body,document.body.appendChild(e),document.addEventListener(R.ResizeEventName,()=>{for(let t of r)t.invalidateSize()},!1)}this._bodyResizeListener.disabled=r.length===0}static register(r,e){var t=A.getAttachedPropertyValue(r,_m),n=this._pageBinders;a.isNull(t)&&(t=new vv(r),A.setAttachedPropertyValue(r,_m,t)),t.binders.indexOf(e)==-1&&(t.binders.length===0&&t.resize.addEventListener(R.ResizeEventName,t.fire,!1),e.refresh(r,t.resize.currentSize),t.binders.push(e)),n.indexOf(e)===-1&&(n.push(e),this._updateResizeListener())}static unregister(r,e){var t=A.getAttachedPropertyValue(r,_m),n,i=this._pageBinders,s;!a.isNull(t)&&(n=t.binders.indexOf(e))>-1&&(t.binders.splice(n,1),t.binders.length===0&&(t.resize.removeEventListener(R.ResizeEventName,t.fire,!1),t.dispose(),A.deleteAttachedPropertyValue(r,_m))),(s=i.indexOf(e))>=0&&(i.splice(s,1),this._updateResizeListener())}},y_=["click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"],ur=class extends R.PacemElement{constructor(){super(...arguments);this._broadcastHandler=e=>{var t=new xm(e);this.dispatchEvent(t)};this._state={}}connectedCallback(){super.connectedCallback(),this._ensurePath()}viewActivatedCallback(){super.viewActivatedCallback(),this.from instanceof Element&&qa.register(this.from,this),this.to instanceof Element&&qa.register(this.to,this)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"from":case"to":t instanceof Element&&qa.unregister(t,this),n instanceof Element?qa.register(n,this):this.refresh(n);break;case"fromLimit":case"toLimit":case"fromEnd":case"toEnd":case"tension":this._draw();break;case"fromAnchor":this.refresh(this.from);break;case"toAnchor":this.refresh(this.to);break;case"cssClass":a.isNull(this._svg)||this._svg.setAttribute("class",b+"-binder "+this.className);break;case"hide":i||this._setPathVisibility();break}}disconnectedCallback(){a.isNull(this._path)||(y_.forEach(e=>{this._path.removeEventListener(e,this._broadcastHandler,!1)}),this._svg.remove(),this._path=void 0),this.from instanceof Element&&qa.unregister(this.from,this),this.to instanceof Element&&qa.unregister(this.to,this),super.disconnectedCallback()}_setPathVisibility(e=this._path,t=this.hide,n=this.interactive){a.isNull(e)||(t?e.setAttribute("display","none"):e.removeAttribute("display"),n?(e.setAttribute("pointer-events","visibleStroke"),e.tabIndex=0):(e.removeAttribute("pointer-events"),e.tabIndex=-1))}_ensurePath(){if(a.isNull(this._path)){let e=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");e.style.position="absolute",a.addClass(e,b+"-binder "+this.className),e.style.top="0",e.style.left="0",e.style.overflow="hidden",e.style.pointerEvents="none";let t=this._path=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("fill","none"),t.setAttribute("display","none"),this._setPathVisibility(),e.appendChild(t),this.invalidateSize(),document.body.appendChild(e),y_.forEach(n=>{t.addEventListener(n,this._broadcastHandler,!1)})}}invalidateSize(){let e=this._svg;a.isNull(e)||(e.setAttribute("width",document.body.scrollWidth.toString()),e.setAttribute("height",document.body.scrollHeight.toString()))}_computeAnchorPoints(e,t,n,i,s,l,p){var u,f,g,v;let y=e.top,_=e.left,x=e.width,w=e.height,E=x/2,k=w/2,N=i.top,T=i.left,O=i.width,D=i.height,P=O/2,F=D/2,B={x:_+E,y:y+k},$={x:T+P,y:N+F},U={x:_+E,y},I={x:_+E,y:y+w},G={x:_,y:y+k},Y={x:_+x,y:y+k},W={x:T+P,y:N},V={x:T+P,y:N+D},X={x:T,y:N+F},q={x:T+O,y:N+F},Z={p1_top:U,p1_bottom:I,p1_left:G,p1_right:Y,p2_top:W,p2_bottom:V,p2_left:X,p2_right:q};var ne={};function te(le,re){let Oe=le+"_"+re;return ne[Oe]=ne[Oe]||se.distance(Z["p1_"+le],Z["p2_"+re])}if(t=="auto"||s=="auto"){let le={x:B.x,y:-B.y},re={x:$.x,y:-$.y},Oe=Math.atan2(re.y-le.y,re.x-le.x)*180/Math.PI;switch(Oe){case 0:t=="auto"&&(t="right"),s=="auto"&&(s="left");break;case 90:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break;case 180:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case-90:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break;default:if(Oe<90&&Oe>0){let ge=te("top","left"),Ne=te("right","left"),Pe=te("right","bottom"),He=te("top","bottom");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="top"),s=="auto"&&(s="left");break;case He:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break;case Pe:t=="auto"&&(t="right"),s=="auto"&&(s="bottom");break;default:t=="auto"&&(t="right"),s=="auto"&&(s="left");break}}else if(Oe<180&&Oe>90){let ge=te("top","right"),Ne=te("left","right"),Pe=te("left","bottom"),He=te("top","bottom");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="top"),s=="auto"&&(s="right");break;case Ne:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case Pe:t=="auto"&&(t="left"),s=="auto"&&(s="bottom");break;default:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break}}else if(Oe<-90){let ge=te("bottom","right"),Ne=te("left","right"),Pe=te("left","top"),He=te("bottom","top");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="bottom"),s=="auto"&&(s="right");break;case Ne:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case Pe:t=="auto"&&(t="left"),s=="auto"&&(s="top");break;default:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break}}else{let ge=te("bottom","left"),Ne=te("right","left"),Pe=te("right","top"),He=te("bottom","top");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="bottom"),s=="auto"&&(s="left");break;case Ne:t=="auto"&&(t="right"),s=="auto"&&(s="left");break;case Pe:t=="auto"&&(t="right"),s=="auto"&&(s="top");break;default:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break}}break}}function Se(le){switch(le){case"arrow":case"fatarrow":return 2;default:return 1}}let he=Se(n),fe=Se(l);switch(t){case"bottom":u=I;break;case"center":u={x:_+E,y:y+k},g=u;break;case"left":u=G;break;case"right":u=Y;break;case"top":u=U;break}switch(s){case"bottom":f=V;break;case"center":f={x:T+P,y:N+F},v=f;break;case"left":f=X;break;case"right":f=q;break;case"top":f=W;break}switch(p){case"path":let le=.333;switch(t){case"bottom":g={x:u.x,y:u.y+Math.abs(he*le*(f.y-u.y))};break;case"left":g={x:u.x-Math.abs(he*le*(f.x-u.x)),y:u.y};break;case"right":g={x:u.x+Math.abs(he*le*(f.x-u.x)),y:u.y};break;case"top":g={x:u.x,y:u.y-Math.abs(he*le*(u.y-f.y))};break}switch(s){case"bottom":v={x:f.x,y:f.y+Math.abs(fe*le*(f.y-u.y))};break;case"left":v={x:f.x-Math.abs(fe*le*(f.x-u.x)),y:f.y};break;case"right":v={x:f.x+Math.abs(fe*le*(f.x-u.x)),y:f.y};break;case"top":v={x:f.x,y:f.y-Math.abs(fe*le*(f.y-u.y))};break}break;default:switch(t){case"bottom":g={x:u.x,y:u.y+Math.abs(he*(I.y-B.y))};break;case"left":g={x:u.x-Math.abs(he*(B.x-G.x)),y:u.y};break;case"right":g={x:u.x+Math.abs(he*(Y.x-B.x)),y:u.y};break;case"top":g={x:u.x,y:u.y-Math.abs(he*(U.y-B.y))};break}switch(s){case"bottom":v={x:f.x,y:f.y+Math.abs(fe*(V.y-$.y))};break;case"left":v={x:f.x-Math.abs(fe*($.x-X.x)),y:f.y};break;case"right":v={x:f.x+Math.abs(fe*(q.x-$.x)),y:f.y};break;case"top":v={x:f.x,y:f.y-Math.abs(fe*(W.y-$.y))};break}}return{points:[u,g,f,v],anchors:[t,s]}}refresh(e,t){var n;if(a.isNull(e)||a.isNull(n=this._path))return;let i=!a.isNull(this.from)&&!a.isNull(this.to),s=a.isNull(this.from)&&a.isNull(this.to);if((this.disabled||!i)&&(n.removeAttribute("d"),s))return;let l=e===this.from?"from":"to";var p=(l==="from"?this.fromAnchor:this.toAnchor)||"auto";a.isNull(t)&&(e instanceof Element?l in this._state&&(t=this._state[l].size):(t={height:0,width:0,left:e.x,top:e.y},p="center")),!a.isNull(t)&&(this._state[l]={size:t,anchor:p},i&&this._draw())}_draw(){var e=this._state.from,t=this._state.to,n=this._path;if(a.isNull(n))return;if(a.isNullOrEmpty(e)||a.isNullOrEmpty(t)||this.from instanceof HTMLElement&&!a.isVisible(this.from)||this.to instanceof HTMLElement&&!a.isVisible(this.to)){n.setAttribute("d","");return}let{points:i,anchors:s}=this._computeAnchorPoints(e.size,e.anchor,this.fromEnd,t.size,t.anchor,this.toEnd,this.tension),l=i[0],p=i[1],u=i[2],f=i[3],g=s[0],v=s[1],y=l.x,_=l.y,x=p.x,w=p.y,E=u.x,k=u.y,N=f.x,T=f.y,O=this._getDefaultEndingPath(y,_);switch(this.fromEnd){case"arrow":O=this._getArrowEndingPath(y,_,g);break;case"fatarrow":O=this._getFatArrowEndingPath(y,_,g);break;case"none":O="";break}let D=this._getDefaultEndingPath(E,k);switch(this.toEnd){case"arrow":D=this._getArrowEndingPath(E,k,v);break;case"fatarrow":D=this._getFatArrowEndingPath(E,k,v);break;case"none":D="";break}let P=O+`M${y},${_} C${x},${w} ${N},${T} ${E},${k}`+D;P.indexOf("NaN")===-1&&n.setAttribute("d",P),a.isNullOrEmpty(this.color)||(n.style.stroke=this.color)}_getDefaultEndingPath(e,t){return`M${e-2},${t-2} h4 v4 h-4 z`}_getArrowEndingPath(e,t,n){switch(n){case"bottom":return`M${e-4},${t+4} l4,-4 l4,4`;case"top":return`M${e-4},${t-4} l4,4 l4,-4`;case"left":return`M${e-4},${t-4} l4,4 l-4,4`;case"right":return`M${e+4},${t-4} l-4,4 l4,4`;default:return""}}_getFatArrowEndingPath(e,t,n){switch(n){case"bottom":case"top":case"left":case"right":return this._getArrowEndingPath(e,t,n)+" z";default:return""}}};c([h({emit:!1,converter:op})],ur.prototype,"from",2),c([h({emit:!1,converter:op})],ur.prototype,"to",2),c([h({emit:!1,converter:m.String})],ur.prototype,"fromAnchor",2),c([h({emit:!1,converter:m.String})],ur.prototype,"toAnchor",2),c([h({emit:!1,converter:m.String})],ur.prototype,"fromEnd",2),c([h({emit:!1,converter:m.String})],ur.prototype,"toEnd",2),c([h({emit:!1,converter:m.String})],ur.prototype,"tension",2),c([h({emit:!1,converter:m.String})],ur.prototype,"color",2),c([h({emit:!1,converter:m.Boolean})],ur.prototype,"interactive",2),ur=c([C({tagName:d+"-binder"})],ur);var Ow="blade-open",lp=class extends R.PacemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="open"&&this._toggle(t)}_toggle(r=this.open){(r?a.addClass:a.removeClass)(this,Ow);let t=r?"open":"close";this.dispatchEvent(new Event(t))}};c([h({emit:!1,converter:m.Boolean})],lp.prototype,"open",2),lp=c([C({tagName:d+"-blade",shadow:!0})],lp);var Cm=(e=>(e.ClickOutsideClose="clickOutsideClose",e.ExplicitClose="explicitClose",e))(Cm||{});var Pw="bottom-sheet-open",Ka,El=class extends R.PacemElement{constructor(){super(...arguments);z(this,Ka);this._clickHandler=e=>{let t=M(this,Ka);t.open=!t.open}}viewActivatedCallback(){super.viewActivatedCallback(),this._setIcon(),this._toggleHandle(),H(this,Ka,A.findAncestorOfType(this,ln)),this._bindToBottomSheet()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"iconGlyph":this._setIcon(n);break;case"disabled":this._toggleHandle(n);break}}disconnectedCallback(){this.removeEventListener("click",this._clickHandler);let e=M(this,Ka);!a.isNull(e)&&e.isReady&&e._setHandle(null),H(this,Ka,null),super.disconnectedCallback()}_bindToBottomSheet(){let e=M(this,Ka);a.isNull(e)||(a.isNullOrEmpty(this.id)&&(this.id="handle_"+a.uniqueCode()),A.whenReady(e,()=>{e._setHandle(this),this.addEventListener("click",this._clickHandler,!1)}))}_toggleHandle(e=this.disabled){this.style.pointerEvents=e?"none":""}_setIcon(e=this.iconGlyph){let t=this._icon;a.isNull(t)||(t.icon=e??"horizontal_rule")}};Ka=new WeakMap,c([S(d+"-icon")],El.prototype,"_icon",2),c([h({emit:!1,converter:m.String})],El.prototype,"iconGlyph",2),El=c([C({tagName:d+"-bottom-sheet-handle",shadow:!1,template:`<div class="bottom-sheet-handle">
|
|
439
|
+
<div class="corner top-left" part="corner-topleft"></div><div class="corner bottom-left" part="corner-bottomleft"></div><div class="corner top-right" part="corner-topright"></div><div class="corner bottom-right" part="corner-bottomright"></div>`})],Ti);var x_=(s=>(s.Auto="auto",s.Left="left",s.Top="top",s.Right="right",s.Bottom="bottom",s.Center="center",s))(x_||{}),C_=(n=>(n.Default="default",n.Arrow="arrow",n.FatArrow="fatarrow",n.None="none",n))(C_||{}),E_=(e=>(e.Mass="mass",e.Path="path",e))(E_||{}),w_="interact",xm=class extends ht{constructor(r){super(w_,null,r)}},_m="pacem:components:ui:binders",vv=class{constructor(r){this.binders=[];this.fire=r=>{for(var e of this.binders)e.refresh(this.resize.target,r.detail)};let e=this.resize=new R.PacemResizeElement;e.target=r,e.watchPosition=!0,document.body.appendChild(e)}dispose(){this.resize.remove()}},qa=class{static{this._pageBinders=[]}static _updateResizeListener(){let r=this._pageBinders;if(a.isNull(this._bodyResizeListener)){let e=this._bodyResizeListener=new R.PacemResizeElement;e.target=document.body,document.body.appendChild(e),document.addEventListener(R.ResizeEventName,()=>{for(let t of r)t.invalidateSize()},!1)}this._bodyResizeListener.disabled=r.length===0}static register(r,e){var t=A.getAttachedPropertyValue(r,_m),n=this._pageBinders;a.isNull(t)&&(t=new vv(r),A.setAttachedPropertyValue(r,_m,t)),t.binders.indexOf(e)==-1&&(t.binders.length===0&&t.resize.addEventListener(R.ResizeEventName,t.fire,!1),e.refresh(r,t.resize.currentSize),t.binders.push(e)),n.indexOf(e)===-1&&(n.push(e),this._updateResizeListener())}static unregister(r,e){var t=A.getAttachedPropertyValue(r,_m),n,i=this._pageBinders,s;!a.isNull(t)&&(n=t.binders.indexOf(e))>-1&&(t.binders.splice(n,1),t.binders.length===0&&(t.resize.removeEventListener(R.ResizeEventName,t.fire,!1),t.dispose(),A.deleteAttachedPropertyValue(r,_m))),(s=i.indexOf(e))>=0&&(i.splice(s,1),this._updateResizeListener())}},__=["click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"],ur=class extends R.PacemElement{constructor(){super(...arguments);this._broadcastHandler=e=>{var t=new xm(e);this.dispatchEvent(t)};this._state={}}connectedCallback(){super.connectedCallback(),this._ensurePath()}viewActivatedCallback(){super.viewActivatedCallback(),this.from instanceof Element&&qa.register(this.from,this),this.to instanceof Element&&qa.register(this.to,this)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"from":case"to":t instanceof Element&&qa.unregister(t,this),n instanceof Element?qa.register(n,this):this.refresh(n);break;case"fromLimit":case"toLimit":case"fromEnd":case"toEnd":case"tension":this._draw();break;case"fromAnchor":this.refresh(this.from);break;case"toAnchor":this.refresh(this.to);break;case"cssClass":a.isNull(this._svg)||this._svg.setAttribute("class",b+"-binder "+this.className);break;case"hide":i||this._setPathVisibility();break}}disconnectedCallback(){a.isNull(this._path)||(__.forEach(e=>{this._path.removeEventListener(e,this._broadcastHandler,!1)}),this._svg.remove(),this._path=void 0),this.from instanceof Element&&qa.unregister(this.from,this),this.to instanceof Element&&qa.unregister(this.to,this),super.disconnectedCallback()}_setPathVisibility(e=this._path,t=this.hide,n=this.interactive){a.isNull(e)||(t?e.setAttribute("display","none"):e.removeAttribute("display"),n?(e.setAttribute("pointer-events","visibleStroke"),e.tabIndex=0):(e.removeAttribute("pointer-events"),e.tabIndex=-1))}_ensurePath(){if(a.isNull(this._path)){let e=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");e.style.position="absolute",a.addClass(e,b+"-binder "+this.className),e.style.top="0",e.style.left="0",e.style.overflow="hidden",e.style.pointerEvents="none";let t=this._path=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("fill","none"),t.setAttribute("display","none"),this._setPathVisibility(),e.appendChild(t),this.invalidateSize(),document.body.appendChild(e),__.forEach(n=>{t.addEventListener(n,this._broadcastHandler,!1)})}}invalidateSize(){let e=this._svg;a.isNull(e)||(e.setAttribute("width",document.body.scrollWidth.toString()),e.setAttribute("height",document.body.scrollHeight.toString()))}_computeAnchorPoints(e,t,n,i,s,l,p){var u,f,g,v;let y=e.top,_=e.left,x=e.width,w=e.height,E=x/2,k=w/2,N=i.top,T=i.left,O=i.width,D=i.height,P=O/2,F=D/2,B={x:_+E,y:y+k},$={x:T+P,y:N+F},U={x:_+E,y},I={x:_+E,y:y+w},G={x:_,y:y+k},Y={x:_+x,y:y+k},W={x:T+P,y:N},V={x:T+P,y:N+D},X={x:T,y:N+F},q={x:T+O,y:N+F},Z={p1_top:U,p1_bottom:I,p1_left:G,p1_right:Y,p2_top:W,p2_bottom:V,p2_left:X,p2_right:q};var ne={};function te(le,re){let Oe=le+"_"+re;return ne[Oe]=ne[Oe]||se.distance(Z["p1_"+le],Z["p2_"+re])}if(t=="auto"||s=="auto"){let le={x:B.x,y:-B.y},re={x:$.x,y:-$.y},Oe=Math.atan2(re.y-le.y,re.x-le.x)*180/Math.PI;switch(Oe){case 0:t=="auto"&&(t="right"),s=="auto"&&(s="left");break;case 90:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break;case 180:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case-90:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break;default:if(Oe<90&&Oe>0){let ge=te("top","left"),Ne=te("right","left"),Pe=te("right","bottom"),He=te("top","bottom");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="top"),s=="auto"&&(s="left");break;case He:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break;case Pe:t=="auto"&&(t="right"),s=="auto"&&(s="bottom");break;default:t=="auto"&&(t="right"),s=="auto"&&(s="left");break}}else if(Oe<180&&Oe>90){let ge=te("top","right"),Ne=te("left","right"),Pe=te("left","bottom"),He=te("top","bottom");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="top"),s=="auto"&&(s="right");break;case Ne:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case Pe:t=="auto"&&(t="left"),s=="auto"&&(s="bottom");break;default:t=="auto"&&(t="top"),s=="auto"&&(s="bottom");break}}else if(Oe<-90){let ge=te("bottom","right"),Ne=te("left","right"),Pe=te("left","top"),He=te("bottom","top");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="bottom"),s=="auto"&&(s="right");break;case Ne:t=="auto"&&(t="left"),s=="auto"&&(s="right");break;case Pe:t=="auto"&&(t="left"),s=="auto"&&(s="top");break;default:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break}}else{let ge=te("bottom","left"),Ne=te("right","left"),Pe=te("right","top"),He=te("bottom","top");var ae=Math.min(ge,Ne,Pe,He);switch(ae){case ge:t=="auto"&&(t="bottom"),s=="auto"&&(s="left");break;case Ne:t=="auto"&&(t="right"),s=="auto"&&(s="left");break;case Pe:t=="auto"&&(t="right"),s=="auto"&&(s="top");break;default:t=="auto"&&(t="bottom"),s=="auto"&&(s="top");break}}break}}function Le(le){switch(le){case"arrow":case"fatarrow":return 2;default:return 1}}let he=Le(n),fe=Le(l);switch(t){case"bottom":u=I;break;case"center":u={x:_+E,y:y+k},g=u;break;case"left":u=G;break;case"right":u=Y;break;case"top":u=U;break}switch(s){case"bottom":f=V;break;case"center":f={x:T+P,y:N+F},v=f;break;case"left":f=X;break;case"right":f=q;break;case"top":f=W;break}switch(p){case"path":let le=.333;switch(t){case"bottom":g={x:u.x,y:u.y+Math.abs(he*le*(f.y-u.y))};break;case"left":g={x:u.x-Math.abs(he*le*(f.x-u.x)),y:u.y};break;case"right":g={x:u.x+Math.abs(he*le*(f.x-u.x)),y:u.y};break;case"top":g={x:u.x,y:u.y-Math.abs(he*le*(u.y-f.y))};break}switch(s){case"bottom":v={x:f.x,y:f.y+Math.abs(fe*le*(f.y-u.y))};break;case"left":v={x:f.x-Math.abs(fe*le*(f.x-u.x)),y:f.y};break;case"right":v={x:f.x+Math.abs(fe*le*(f.x-u.x)),y:f.y};break;case"top":v={x:f.x,y:f.y-Math.abs(fe*le*(f.y-u.y))};break}break;default:switch(t){case"bottom":g={x:u.x,y:u.y+Math.abs(he*(I.y-B.y))};break;case"left":g={x:u.x-Math.abs(he*(B.x-G.x)),y:u.y};break;case"right":g={x:u.x+Math.abs(he*(Y.x-B.x)),y:u.y};break;case"top":g={x:u.x,y:u.y-Math.abs(he*(U.y-B.y))};break}switch(s){case"bottom":v={x:f.x,y:f.y+Math.abs(fe*(V.y-$.y))};break;case"left":v={x:f.x-Math.abs(fe*($.x-X.x)),y:f.y};break;case"right":v={x:f.x+Math.abs(fe*(q.x-$.x)),y:f.y};break;case"top":v={x:f.x,y:f.y-Math.abs(fe*(W.y-$.y))};break}}return{points:[u,g,f,v],anchors:[t,s]}}refresh(e,t){var n;if(a.isNull(e)||a.isNull(n=this._path))return;let i=!a.isNull(this.from)&&!a.isNull(this.to),s=a.isNull(this.from)&&a.isNull(this.to);if((this.disabled||!i)&&(n.removeAttribute("d"),s))return;let l=e===this.from?"from":"to";var p=(l==="from"?this.fromAnchor:this.toAnchor)||"auto";a.isNull(t)&&(e instanceof Element?l in this._state&&(t=this._state[l].size):(t={height:0,width:0,left:e.x,top:e.y},p="center")),!a.isNull(t)&&(this._state[l]={size:t,anchor:p},i&&this._draw())}_draw(){var e=this._state.from,t=this._state.to,n=this._path;if(a.isNull(n))return;if(a.isNullOrEmpty(e)||a.isNullOrEmpty(t)||this.from instanceof HTMLElement&&!a.isVisible(this.from)||this.to instanceof HTMLElement&&!a.isVisible(this.to)){n.setAttribute("d","");return}let{points:i,anchors:s}=this._computeAnchorPoints(e.size,e.anchor,this.fromEnd,t.size,t.anchor,this.toEnd,this.tension),l=i[0],p=i[1],u=i[2],f=i[3],g=s[0],v=s[1],y=l.x,_=l.y,x=p.x,w=p.y,E=u.x,k=u.y,N=f.x,T=f.y,O=this._getDefaultEndingPath(y,_);switch(this.fromEnd){case"arrow":O=this._getArrowEndingPath(y,_,g);break;case"fatarrow":O=this._getFatArrowEndingPath(y,_,g);break;case"none":O="";break}let D=this._getDefaultEndingPath(E,k);switch(this.toEnd){case"arrow":D=this._getArrowEndingPath(E,k,v);break;case"fatarrow":D=this._getFatArrowEndingPath(E,k,v);break;case"none":D="";break}let P=O+`M${y},${_} C${x},${w} ${N},${T} ${E},${k}`+D;P.indexOf("NaN")===-1&&n.setAttribute("d",P),a.isNullOrEmpty(this.color)||(n.style.stroke=this.color)}_getDefaultEndingPath(e,t){return`M${e-2},${t-2} h4 v4 h-4 z`}_getArrowEndingPath(e,t,n){switch(n){case"bottom":return`M${e-4},${t+4} l4,-4 l4,4`;case"top":return`M${e-4},${t-4} l4,4 l4,-4`;case"left":return`M${e-4},${t-4} l4,4 l-4,4`;case"right":return`M${e+4},${t-4} l-4,4 l4,4`;default:return""}}_getFatArrowEndingPath(e,t,n){switch(n){case"bottom":case"top":case"left":case"right":return this._getArrowEndingPath(e,t,n)+" z";default:return""}}};c([h({emit:!1,converter:op})],ur.prototype,"from",2),c([h({emit:!1,converter:op})],ur.prototype,"to",2),c([h({emit:!1,converter:m.String})],ur.prototype,"fromAnchor",2),c([h({emit:!1,converter:m.String})],ur.prototype,"toAnchor",2),c([h({emit:!1,converter:m.String})],ur.prototype,"fromEnd",2),c([h({emit:!1,converter:m.String})],ur.prototype,"toEnd",2),c([h({emit:!1,converter:m.String})],ur.prototype,"tension",2),c([h({emit:!1,converter:m.String})],ur.prototype,"color",2),c([h({emit:!1,converter:m.Boolean})],ur.prototype,"interactive",2),ur=c([C({tagName:d+"-binder"})],ur);var Pw="blade-open",lp=class extends R.PacemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="open"&&this._toggle(t)}_toggle(r=this.open){(r?a.addClass:a.removeClass)(this,Pw);let t=r?"open":"close";this.dispatchEvent(new Event(t))}};c([h({emit:!1,converter:m.Boolean})],lp.prototype,"open",2),lp=c([C({tagName:d+"-blade",shadow:!0})],lp);var Cm=(e=>(e.ClickOutsideClose="clickOutsideClose",e.ExplicitClose="explicitClose",e))(Cm||{});var Iw="bottom-sheet-open",Ka,El=class extends R.PacemElement{constructor(){super(...arguments);z(this,Ka);this._clickHandler=e=>{let t=M(this,Ka);t.open=!t.open}}viewActivatedCallback(){super.viewActivatedCallback(),this._setIcon(),this._toggleHandle(),H(this,Ka,A.findAncestorOfType(this,ln)),this._bindToBottomSheet()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"iconGlyph":this._setIcon(n);break;case"disabled":this._toggleHandle(n);break}}disconnectedCallback(){this.removeEventListener("click",this._clickHandler);let e=M(this,Ka);!a.isNull(e)&&e.isReady&&e._setHandle(null),H(this,Ka,null),super.disconnectedCallback()}_bindToBottomSheet(){let e=M(this,Ka);a.isNull(e)||(a.isNullOrEmpty(this.id)&&(this.id="handle_"+a.uniqueCode()),A.whenReady(e,()=>{e._setHandle(this),this.addEventListener("click",this._clickHandler,!1)}))}_toggleHandle(e=this.disabled){this.style.pointerEvents=e?"none":""}_setIcon(e=this.iconGlyph){let t=this._icon;a.isNull(t)||(t.icon=e??"horizontal_rule")}};Ka=new WeakMap,c([S(d+"-icon")],El.prototype,"_icon",2),c([h({emit:!1,converter:m.String})],El.prototype,"iconGlyph",2),El=c([C({tagName:d+"-bottom-sheet-handle",shadow:!1,template:`<div class="bottom-sheet-handle">
|
|
440
440
|
<${d}-icon class="icon-size icon-size-6"></${d}-icon>
|
|
441
|
-
</div>`})],El);var ln=class extends R.PacemElement{constructor(){super(...arguments);this._resizeHandler=e=>{this._rebuildSwiperSnaps(),this._setPosition()};this._panHandler=e=>{let t=this._swiper.snaps.find(l=>l!=0),{delta:n}=e.detail,i=(t<0?n.clamp(t,0):n.clamp(0,t))/t;t>0&&(i=1-i);let s=6*i**2;this.style.backdropFilter=`blur(${s.toFixed(2)}px)`};this._swipeHandler=e=>{switch(jl(e),e.type){case J.SwipeEventType.SwipeAnimationEnd:this.style.backdropFilter="";return;case J.SwipeEventType.SwipeUpAnimationEnd:this.open=!0;break;case J.SwipeEventType.SwipeDownAnimationEnd:this.open=!1;break}this._setPosition()};this._softReleaseHandler=e=>{Q(e),this.behavior!=="explicitClose"&&(this.open=!1)}}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"open":this._toggle(n),this._rebuildSwiperSnaps(n);break;case"logger":this._assignLogger(n);break;case"disabled":this._toggleSwiper(n);break}}_toggleSwiper(e=this.disabled){let t=this._swiper;a.isNull(t)||(t.disabled=e)}_setHandle(e){a.isNull(e)?this._swiper.handleSelector=null:this._swiper.handleSelector=`#${e.id}`,this._handleResizer.target=e}_assignLogger(e=this.logger){this._swiper.logger=e}_rebuildSwiperSnaps(e=this.open){let t=this._swiper,n=this._getSnap(e);t.snaps=[0,n].sort()}viewActivatedCallback(){super.viewActivatedCallback(),this._assignLogger(),this._resizer.addEventListener(R.ResizeEventName,this._resizeHandler),this._handleResizer.addEventListener(R.ResizeEventName,this._resizeHandler);let e=this._swiper;e.addEventListener(J.SwipeEventType.Pan,this._panHandler,!1),e.addEventListener(J.SwipeEventType.SwipeAnimationEnd,this._swipeHandler,!1),e.addEventListener(J.SwipeEventType.SwipeUpAnimationEnd,this._swipeHandler,!1),e.addEventListener(J.SwipeEventType.SwipeDownAnimationEnd,this._swipeHandler,!1),this._toggle(),this._rebuildSwiperSnaps(),this._toggleSwiper(),this._sheet.addEventListener("pointerdown",Re,!1),this.addEventListener("pointerdown",this._softReleaseHandler,!1)}disconnectedCallback(){let e=this._resizer;a.isNull(e)||e.removeEventListener(R.ResizeEventName,this._resizeHandler);let t=this._handleResizer;a.isNull(e)||t.removeEventListener(R.ResizeEventName,this._resizeHandler);let n=this._swiper;a.isNull(n)||(n.removeEventListener(J.SwipeEventType.Pan,this._panHandler),n.removeEventListener(J.SwipeEventType.SwipeAnimationEnd,this._swipeHandler),n.removeEventListener(J.SwipeEventType.SwipeUpAnimationEnd,this._swipeHandler),n.removeEventListener(J.SwipeEventType.SwipeDownAnimationEnd,this._swipeHandler));let i=this._sheet;a.isNull(i)||i.removeEventListener("pointerdown",Re),this.removeEventListener("pointerdown",this._softReleaseHandler),super.disconnectedCallback()}_getSnap(e=this.open){let t=this._resizer,n=this._handleResizer;if(a.isNull(t)||a.isNull(n))return 0;let{top:i}=a.naturalOffset(t.target),{top:s}=a.naturalOffset(n.target),{height:l}=t.currentSize,{height:p}=n.currentSize,{height:u}=a.windowSize,f=Math.max(parseInt(a.Css.getVariableValue(`--${b}-layout-header-height`)),u-(l??0)),g=u-((i??0)-(s??0)+(p??0));return(e?1:-1)*Math.abs(f-g)}_getCssTransform(e=this.open){let t=this._resizer,n=this._handleResizer;if(a.isNull(t)||a.isNull(n))return"";if(e)return`translate3d(0, max(var(--${b}-layout-header-height), calc(100vh - 100%)), 0)`;{let{top:i}=a.naturalOffset(t.target),{top:s,height:l}=a.naturalOffset(n.target);return`translate3d(0, calc(100vh - ${-(i??0)+(s??0)+(l??0)}px), 0)`}}_setPosition(e=this.open){let t=this._sheet,n=this._getCssTransform(e);t.style.transform=n}_toggle(e=this.open){(e?a.addClass:a.removeClass)(this,
|
|
441
|
+
</div>`})],El);var ln=class extends R.PacemElement{constructor(){super(...arguments);this._resizeHandler=e=>{this._rebuildSwiperSnaps(),this._setPosition()};this._panHandler=e=>{let t=this._swiper.snaps.find(l=>l!=0),{delta:n}=e.detail,i=(t<0?n.clamp(t,0):n.clamp(0,t))/t;t>0&&(i=1-i);let s=6*i**2;this.style.backdropFilter=`blur(${s.toFixed(2)}px)`};this._swipeHandler=e=>{switch(jl(e),e.type){case J.SwipeEventType.SwipeAnimationEnd:this.style.backdropFilter="";return;case J.SwipeEventType.SwipeUpAnimationEnd:this.open=!0;break;case J.SwipeEventType.SwipeDownAnimationEnd:this.open=!1;break}this._setPosition()};this._softReleaseHandler=e=>{Q(e),this.behavior!=="explicitClose"&&(this.open=!1)}}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"open":this._toggle(n),this._rebuildSwiperSnaps(n);break;case"logger":this._assignLogger(n);break;case"disabled":this._toggleSwiper(n);break}}_toggleSwiper(e=this.disabled){let t=this._swiper;a.isNull(t)||(t.disabled=e)}_setHandle(e){a.isNull(e)?this._swiper.handleSelector=null:this._swiper.handleSelector=`#${e.id}`,this._handleResizer.target=e}_assignLogger(e=this.logger){this._swiper.logger=e}_rebuildSwiperSnaps(e=this.open){let t=this._swiper,n=this._getSnap(e);t.snaps=[0,n].sort()}viewActivatedCallback(){super.viewActivatedCallback(),this._assignLogger(),this._resizer.addEventListener(R.ResizeEventName,this._resizeHandler),this._handleResizer.addEventListener(R.ResizeEventName,this._resizeHandler);let e=this._swiper;e.addEventListener(J.SwipeEventType.Pan,this._panHandler,!1),e.addEventListener(J.SwipeEventType.SwipeAnimationEnd,this._swipeHandler,!1),e.addEventListener(J.SwipeEventType.SwipeUpAnimationEnd,this._swipeHandler,!1),e.addEventListener(J.SwipeEventType.SwipeDownAnimationEnd,this._swipeHandler,!1),this._toggle(),this._rebuildSwiperSnaps(),this._toggleSwiper(),this._sheet.addEventListener("pointerdown",Re,!1),this.addEventListener("pointerdown",this._softReleaseHandler,!1)}disconnectedCallback(){let e=this._resizer;a.isNull(e)||e.removeEventListener(R.ResizeEventName,this._resizeHandler);let t=this._handleResizer;a.isNull(e)||t.removeEventListener(R.ResizeEventName,this._resizeHandler);let n=this._swiper;a.isNull(n)||(n.removeEventListener(J.SwipeEventType.Pan,this._panHandler),n.removeEventListener(J.SwipeEventType.SwipeAnimationEnd,this._swipeHandler),n.removeEventListener(J.SwipeEventType.SwipeUpAnimationEnd,this._swipeHandler),n.removeEventListener(J.SwipeEventType.SwipeDownAnimationEnd,this._swipeHandler));let i=this._sheet;a.isNull(i)||i.removeEventListener("pointerdown",Re),this.removeEventListener("pointerdown",this._softReleaseHandler),super.disconnectedCallback()}_getSnap(e=this.open){let t=this._resizer,n=this._handleResizer;if(a.isNull(t)||a.isNull(n))return 0;let{top:i}=a.naturalOffset(t.target),{top:s}=a.naturalOffset(n.target),{height:l}=t.currentSize,{height:p}=n.currentSize,{height:u}=a.windowSize,f=Math.max(parseInt(a.Css.getVariableValue(`--${b}-layout-header-height`)),u-(l??0)),g=u-((i??0)-(s??0)+(p??0));return(e?1:-1)*Math.abs(f-g)}_getCssTransform(e=this.open){let t=this._resizer,n=this._handleResizer;if(a.isNull(t)||a.isNull(n))return"";if(e)return`translate3d(0, max(var(--${b}-layout-header-height), calc(100vh - 100%)), 0)`;{let{top:i}=a.naturalOffset(t.target),{top:s,height:l}=a.naturalOffset(n.target);return`translate3d(0, calc(100vh - ${-(i??0)+(s??0)+(l??0)}px), 0)`}}_setPosition(e=this.open){let t=this._sheet,n=this._getCssTransform(e);t.style.transform=n}_toggle(e=this.open){(e?a.addClass:a.removeClass)(this,Iw),this._sheet.style.transform="";let n=e?"open":"close";this.dispatchEvent(new Event(n))}};c([S(d+"-swipe")],ln.prototype,"_swiper",2),c([S(d+"-resize")],ln.prototype,"_resizer",2),c([S(d+"-resize[handle]")],ln.prototype,"_handleResizer",2),c([S(d+"-panel.bottom-sheet")],ln.prototype,"_sheet",2),c([h({emit:!1,converter:m.Boolean})],ln.prototype,"open",2),c([h({emit:!1,converter:m.String})],ln.prototype,"behavior",2),ln=c([C({tagName:d+"-bottom-sheet",shadow:!1,template:`
|
|
442
442
|
<${d}-swipe direction="vertical" options='{ "bouncy": false }'></${d}-swipe>
|
|
443
443
|
<${d}-resize target="{{ ::_sheet }}"></${d}-resize>
|
|
444
444
|
<${d}-resize handle></${d}-resize>
|
|
445
445
|
<${d}-panel class="bottom-sheet" behaviors="{{ [::_swiper] }}">
|
|
446
446
|
<${d}-content></${d}-content>
|
|
447
|
-
</${d}-panel>`})],ln);var bv=(n=>(n.YesNo="yesno",n.YesNoCancel="yesnocancel",n.Ok="ok",n.OkCancel="okcancel",n))(bv||{}),yv=(n=>(n.Yes="yes",n.No="no",n.Cancel="cancel",n.Ok="ok",n))(yv||{}),w_="commit",Em=class extends oe{constructor(r){super(w_,r)}},cp=class extends R.PacemElement{#e;open(r){let e=this.lightbox;if(!a.isNull(this.#e))throw"Dialog already open.";let t=this.#e=Promise.withResolvers();return this.hide||this.disabled?(this.log(ce.LogLevel.Warn,"Dialog hidden or disabled, opening forbidden."),t.reject()):(this.dispatchEvent(new Event("open")),e.show=!0,this.state=r),t.promise}commit(r,e){Q(e),this.log(ce.LogLevel.Debug,`Committing dialog by clicking '${r}'.`);let t=this.state;var n=new Em({button:r,state:t});this.lightbox.show=!1,this.#e.resolve(n.detail),this.#e=null,this.dispatchEvent(n)}};c([h()],cp.prototype,"state",2);var tr=class extends R.PacemIterableElement{constructor(){super("button")}connectedCallback(){super.connectedCallback(),this.hasAttribute("tab-order")||(this.tabOrder=0)}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"iconGlyph":case"iconUrl":this.dataset[r]=t;break}}emit(r){let e=t=>{if(super.emit(t),!t.defaultPrevented)switch(t.type==="click"&&!a.isNullOrEmpty(this.commandName)&&this.dispatchEvent(new ql({commandName:this.commandName,commandArgument:this.commandArgument})),t.type){case"mousedown":r.button===0&&a.addClass(this,b+"-active");break;case"pointerdown":a.addClass(this,b+"-active");break;case"keydown":(t.keyCode===32||t.keyCode===13)&&(r.preventDefault(),a.addClass(this,b+"-active"));break;case"blur":case"mouseup":case"pointerup":case"click":a.removeClass(this,b+"-active");break;case"keyup":(t.keyCode===32||t.keyCode===13)&&(this.click(),a.removeClass(this,b+"-active"));break}};!this.disabled&&r.type==="click"&&!a.isNull(this.confirmationDialog)?this.confirmationDialog.open(this.confirmationMessage).then(t=>{(t.button==="yes"||t.button==="ok")&&e(r)}):(!(r instanceof MouseEvent)||r.button===0)&&e(r)}};c([h({emit:!1,converter:m.String})],tr.prototype,"iconGlyph",2),c([h({emit:!1,converter:m.String})],tr.prototype,"iconUrl",2),c([h({emit:!1,converter:m.String})],tr.prototype,"commandName",2),c([h({emit:!1,converter:m.Json})],tr.prototype,"commandArgument",2),c([h({emit:!1,converter:m.String})],tr.prototype,"confirmationMessage",2),c([h({emit:!1,converter:m.Element})],tr.prototype,"confirmationDialog",2),tr=c([C({tagName:d+"-button"})],tr);var au=class extends R.PacemIterativeElement{connectedCallback(){super.connectedCallback(),"tabindex"in this.attributes||(this.tabIndex=0)}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"index":let s=0;for(var i of this.items){if(s==t){i.focus();break}s++}break}}validate(r){return r instanceof tr}};au=c([C({tagName:d+"-buttonset"})],au);var k_=(t=>(t.Month="month",t.Week="week",t.Day="day",t))(k_||{}),wm=class extends oe{constructor(r){super("viewdatechange",r)}},km=class extends oe{constructor(r){super("dateselect",r,{bubbles:!0})}},Mm=class extends oe{constructor(r){super("timeselect",r,{bubbles:!0})}},lu=1e3*60*60,up=lu*24,wl=[0,.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5],Iw=new Date,$w=a.Dates.dateOnly(Iw).valueOf(),Hw=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Hn=class extends R.PacemItemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{let i=this.container;a.isNull(i)||i.dispatchEvent(new ue({propertyName:"items",oldValue:i.items,currentValue:i.items}))})}};c([h({converter:m.Datetime})],Hn.prototype,"start",2),c([h({converter:m.Datetime})],Hn.prototype,"end",2),c([h({converter:m.String})],Hn.prototype,"caption",2),c([h({converter:m.Json})],Hn.prototype,"place",2),c([h({converter:m.Boolean})],Hn.prototype,"allDay",2),Hn=c([C({tagName:d+"-calendar-event"})],Hn);var Sm=class extends oe{constructor(r){super("eventselect",r,{bubbles:!1,cancelable:!0})}},Lm=class extends oe{constructor(r){super("eventunselect",r,{bubbles:!1,cancelable:!0})}},Pr=class extends R.PacemItemsContainerElement{validate(r){return r instanceof Hn}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),(r==="viewDate"||r==="weekStart")&&this._synchronizeWeek(),r){case"viewDate":this.dispatchEvent(new wm(t)),a.removeClass(this,"viewdate-next viewdate-previous"),requestAnimationFrame(()=>{a.addClass(this,e>t?"viewdate-previous":"viewdate-next")});break;case"zoom":a.removeClass(this,"viewdate-next viewdate-previous");break}}oneventselect(r,e){this.dispatchEvent(new Sm({element:r,event:e}))}oneventunselect(r,e){this.dispatchEvent(new Lm({element:r,event:e}))}getHeaderLabel(r,e){let t=e==="week"?{weekday:"short",day:"numeric",month:"numeric"}:e==="day"?{weekday:"long"}:{weekday:"short"};return a.parseDate(r).toLocaleString(a.lang(this),t)}getDayLabel(r){let e=r.getDate()==1?{month:"short",day:"numeric"}:{day:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}getHourLabel(r){let e={hour:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}getTimeLabel(r){let e={hour:"numeric",minute:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}isNow(r,e){let t=a.parseDate(r),n=a.parseDate(e||new Date);return t.getHours()===n.getHours()&&this.isToday(r,e)}isToday(r,e){return this.isDate(r,e||new Date)}isViewDay(r,e=this.viewDate){return this.isDate(r,e||this.viewDate||new Date)}isDate(r,e){if(!a.Dates.isDate(e)||!a.Dates.isDate(r))return!1;let t=a.parseDate(r),n=a.parseDate(e);return t.getDate()===n.getDate()&&t.getMonth()==n.getMonth()&&t.getFullYear()===n.getFullYear()}isViewWeek(r){let e=a.parseDate(r);return this.week&&this.week.find(t=>t.getDate()==e.getDate()&&t.getMonth()==e.getMonth()&&t.getDate()==e.getDate())}isViewMonth(r){let e=a.parseDate(r),t=a.parseDate(this.viewDate||new Date);return e.getMonth()==t.getMonth()&&e.getFullYear()===t.getFullYear()}isTimeSlotDisabled(r,e,t){if(!a.isNullOrEmpty(r)){t=t||0;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),Math.floor(t),60*(t%1)),i=n.getTimezoneOffset(),s=n.valueOf()-i*60*1e3;for(let l of r){let p=a.Dates.parse(l.from),u=a.Dates.parse(l.to);if((!p||p&&p.valueOf()<=s)&&(!u||u&&u.valueOf()>s)&&(u||p))return!0}}return!1}_getWeekStart(r,e){let t=r.getDay(),n=r.valueOf(),i=(e||"m").toLowerCase().startsWith("m")?1:0;return t===i?n:(t===0&&(t=7),n+(i-t)*up)}_getDatasource(r,e=this.weekStart){let t=a.Dates.dateOnly(a.parseDate(r)),n=this.month,i=n&&n.length&&n[0]&&n[0].length&&n[0][0];if(i&&i.getMonth()==t.getMonth()&&i.getFullYear()==t.getFullYear()&&n.find(f=>!a.isNull(f.find(g=>g.valueOf()==t.valueOf()))))return n;let s=new Date(t.getFullYear(),t.getMonth(),1),l=this._getWeekStart(s,e),p=[],u=[];do{let f=a.Dates.dateOnly(new Date(l));u.push(f),u.length==7&&p.push(u.splice(0)),l=f.valueOf()+up+lu}while(p.length<6);return this.month=p}_synchronizeWeek(){let r=a.parseDate(this.viewDate),e=new Date(r.getFullYear(),r.getMonth(),1),n=this._getDatasource(e,this.weekStart).filter((i,s)=>i.some(l=>l.getDate()==r.getDate()&&l.getMonth()==r.getMonth()&&l.getFullYear()==r.getFullYear()))[0];(!(this.week&&this.week.length)||this.week[0]!==n[0])&&(this.week=n)}};c([h({converter:m.Datetime})],Pr.prototype,"viewDate",2),c([h({converter:m.Datetime})],Pr.prototype,"now",2),c([h({converter:m.String})],Pr.prototype,"zoom",2),c([h({converter:m.String})],Pr.prototype,"weekStart",2),c([h({converter:m.Eval})],Pr.prototype,"week",2),c([h({converter:m.Eval})],Pr.prototype,"month",2),c([h({converter:m.Eval})],Pr.prototype,"disabledRanges",2);var cu=class extends Pr{constructor(){super(...arguments);this._datasource=[]}get datasource(){return this._datasource}_getSortedItems(e){return e.slice().sort((t,n)=>{let i=t.start.valueOf(),s=n.start.valueOf();if(i!=s)return i<s?-1:1;let l=t.end.valueOf(),p=n.end.valueOf(),u=l-i,f=p-s;return u!=f?u>f?-1:1:0})}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"month":case"week":case"items":case"zoom":case"viewDate":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{let s=this._datasource,l=this._datasource=this.buildDataSource(this._getSortedItems(this.items||[]));this.dispatchEvent(new ue({propertyName:"datasource",oldValue:s,currentValue:l}))});break}}};function M_(o,r){let e=r.length-1,t=r[0].valueOf(),n=r[e].valueOf();return o.filter(i=>{let s=a.Dates.dateOnly(i.start),l=a.Dates.dateOnly(i.end);return s.valueOf()<=n&&l.valueOf()>=t}).map(i=>{let s=a.Dates.dateOnly(i.start),l=r.find(_=>_.valueOf()==s.valueOf()),p=r.indexOf(l),u=a.Dates.dateOnly(i.end),f=r.find(_=>_.valueOf()==u.valueOf()),g=r.indexOf(f),v=p==-1?0:p,y=g==-1?e:g;return{start:i.start,end:i.end,allDay:!0,day:v,continuing:{start:p==-1,end:g==-1},span:y+1-v,caption:i.caption,event:i}})}function Bw(){let o="";for(let r=0;r<7;r++)r==0&&(o+='<div class="agenda-left all-day"></div>'),o+=`<${d}-panel class="agenda-slot all-day day-${r+1}" css-class="{{ {'viewday': :host.isViewDay(:host.week[${r}], :host.viewDate), 'today': :host.isToday(:host.week[${r}], :host.now)} }}"></${d}-panel>`;for(let r=0;r<7;r++)for(let e of wl){let t=e%1==0,n=`hour-${t?"whole":"half"}`;r==0&&t&&(o+=`<${d}-text class="agenda-left ${n} hour-${e*2+1}"" text="{{ :host.getHourLabel(${$w+e*lu}) }}"></${d}-text>`),o+=`<${d}-panel on-click=":host.time = Pacem.Utils.Dates.parse(:host.week[${r}].valueOf() + ${e*lu})" disabled="{{ :host.isTimeSlotDisabled(:host.disabledRanges, :host.week[${r}], ${e}) }}" class="agenda-slot ${n} day-${r+1} hour-${e*2+1}" css-class="{{ {'viewday': :host.isViewDay(:host.week[${r}], :host.viewDate), 'today': :host.isToday(:host.week[${r}], :host.now)} }}"></${d}-panel>`}return o}var kl=class extends cu{constructor(){super(...arguments);this._allDayDatasource=[]}buildDataSource(e){var t=this.week;this.zoom==="day"&&(t=[a.Dates.dateOnly(this.viewDate)]);let n=[];if(!a.isNull(t)){this.dispatchEvent(new ue({propertyName:"allDayDatasource",oldValue:this._allDayDatasource,currentValue:this._allDayDatasource=M_(e.filter(i=>i.end.valueOf()-i.start.valueOf()>=up),t)}));for(let i=0;i<t.length;i++){let s=t[i],l=s.valueOf(),p=e.filter(u=>{let f=a.Dates.dateOnly(u.start),g=a.Dates.dateOnly(u.end);return f.valueOf()<=l&&g.valueOf()>=l}).map(u=>{let f=u.start.valueOf(),g=u.end.valueOf(),v={allDay:u.allDay||g-f>=up,continuing:{start:f<l,end:g>l+up},caption:u.caption,hour:0,span:wl.length-1,offset:{start:"0",end:"0"},event:u},y=u.start.getHours()+u.start.getMinutes()/60,_=v.continuing.start?0:Math.floor(y*2),x=u.end.getHours()+u.end.getMinutes()/60,w=-1+(v.continuing.end?wl.length:Math.ceil(x*2)),E=w+1,k=E>=wl.length?24:wl[E],N=k-wl[_];return v.hour=_,v.span=1+w-_,v.continuing.start||(v.offset.start=(y-wl[_])/N*100+"%"),v.continuing.end||(v.offset.end=(k-x)/N*100+"%"),v});n.push(p)}}return n}get allDayDatasource(){return this._allDayDatasource}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i);let s=this._clock;if(e==="time")this.dispatchEvent(new Mm(n));else if(!a.isNull(s)&&(e==="now"&&(s.now=n,s.className=`hour-${n.getHours()} minute-${n.getMinutes()}`),e==="now"||e==="zoom"||e==="viewDate")){let l=this.now,p=this.zoom,u=l&&p&&(this.isViewDay(l)&&p==="day"||this.isViewWeek(l)&&p==="week");s.hidden=!u}}};c([S(d+"-clock")],kl.prototype,"_clock",2),c([h({converter:m.Datetime})],kl.prototype,"time",2),kl=c([C({tagName:d+"-agenda",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater class="${b}-agenda agenda-grid" datasource="{{ :host.datasource }}">${Bw()}<${d}-clock hidden></${d}-clock>
|
|
447
|
+
</${d}-panel>`})],ln);var bv=(n=>(n.YesNo="yesno",n.YesNoCancel="yesnocancel",n.Ok="ok",n.OkCancel="okcancel",n))(bv||{}),yv=(n=>(n.Yes="yes",n.No="no",n.Cancel="cancel",n.Ok="ok",n))(yv||{}),k_="commit",Em=class extends oe{constructor(r){super(k_,r)}},cp=class extends R.PacemElement{#e;open(r){let e=this.lightbox;if(!a.isNull(this.#e))throw"Dialog already open.";let t=this.#e=Promise.withResolvers();return this.hide||this.disabled?(this.log(ce.LogLevel.Warn,"Dialog hidden or disabled, opening forbidden."),t.reject()):(this.dispatchEvent(new Event("open")),e.show=!0,this.state=r),t.promise}commit(r,e){Q(e),this.log(ce.LogLevel.Debug,`Committing dialog by clicking '${r}'.`);let t=this.state;var n=new Em({button:r,state:t});this.lightbox.show=!1,this.#e.resolve(n.detail),this.#e=null,this.dispatchEvent(n)}};c([h()],cp.prototype,"state",2);var tr=class extends R.PacemIterableElement{constructor(){super("button")}connectedCallback(){super.connectedCallback(),this.hasAttribute("tab-order")||(this.tabOrder=0)}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"iconGlyph":case"iconUrl":this.dataset[r]=t;break}}emit(r){let e=t=>{if(super.emit(t),!t.defaultPrevented)switch(t.type==="click"&&!a.isNullOrEmpty(this.commandName)&&this.dispatchEvent(new ql({commandName:this.commandName,commandArgument:this.commandArgument})),t.type){case"mousedown":r.button===0&&a.addClass(this,b+"-active");break;case"pointerdown":a.addClass(this,b+"-active");break;case"keydown":(t.keyCode===32||t.keyCode===13)&&(r.preventDefault(),a.addClass(this,b+"-active"));break;case"blur":case"mouseup":case"pointerup":case"click":a.removeClass(this,b+"-active");break;case"keyup":(t.keyCode===32||t.keyCode===13)&&(this.click(),a.removeClass(this,b+"-active"));break}};!this.disabled&&r.type==="click"&&!a.isNull(this.confirmationDialog)?this.confirmationDialog.open(this.confirmationMessage).then(t=>{(t.button==="yes"||t.button==="ok")&&e(r)}):(!(r instanceof MouseEvent)||r.button===0)&&e(r)}};c([h({emit:!1,converter:m.String})],tr.prototype,"iconGlyph",2),c([h({emit:!1,converter:m.String})],tr.prototype,"iconUrl",2),c([h({emit:!1,converter:m.String})],tr.prototype,"commandName",2),c([h({emit:!1,converter:m.Json})],tr.prototype,"commandArgument",2),c([h({emit:!1,converter:m.String})],tr.prototype,"confirmationMessage",2),c([h({emit:!1,converter:m.Element})],tr.prototype,"confirmationDialog",2),tr=c([C({tagName:d+"-button"})],tr);var au=class extends R.PacemIterativeElement{connectedCallback(){super.connectedCallback(),"tabindex"in this.attributes||(this.tabIndex=0)}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),r){case"index":let s=0;for(var i of this.items){if(s==t){i.focus();break}s++}break}}validate(r){return r instanceof tr}};au=c([C({tagName:d+"-buttonset"})],au);var M_=(t=>(t.Month="month",t.Week="week",t.Day="day",t))(M_||{}),wm=class extends oe{constructor(r){super("viewdatechange",r)}},km=class extends oe{constructor(r){super("dateselect",r,{bubbles:!0})}},Mm=class extends oe{constructor(r){super("timeselect",r,{bubbles:!0})}},lu=1e3*60*60,up=lu*24,wl=[0,.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5],$w=new Date,Hw=a.Dates.dateOnly($w).valueOf(),Bw=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Hn=class extends R.PacemItemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{let i=this.container;a.isNull(i)||i.dispatchEvent(new ue({propertyName:"items",oldValue:i.items,currentValue:i.items}))})}};c([h({converter:m.Datetime})],Hn.prototype,"start",2),c([h({converter:m.Datetime})],Hn.prototype,"end",2),c([h({converter:m.String})],Hn.prototype,"caption",2),c([h({converter:m.Json})],Hn.prototype,"place",2),c([h({converter:m.Boolean})],Hn.prototype,"allDay",2),Hn=c([C({tagName:d+"-calendar-event"})],Hn);var Sm=class extends oe{constructor(r){super("eventselect",r,{bubbles:!1,cancelable:!0})}},Lm=class extends oe{constructor(r){super("eventunselect",r,{bubbles:!1,cancelable:!0})}},Pr=class extends R.PacemItemsContainerElement{validate(r){return r instanceof Hn}propertyChangedCallback(r,e,t,n){switch(super.propertyChangedCallback(r,e,t,n),(r==="viewDate"||r==="weekStart")&&this._synchronizeWeek(),r){case"viewDate":this.dispatchEvent(new wm(t)),a.removeClass(this,"viewdate-next viewdate-previous"),requestAnimationFrame(()=>{a.addClass(this,e>t?"viewdate-previous":"viewdate-next")});break;case"zoom":a.removeClass(this,"viewdate-next viewdate-previous");break}}oneventselect(r,e){this.dispatchEvent(new Sm({element:r,event:e}))}oneventunselect(r,e){this.dispatchEvent(new Lm({element:r,event:e}))}getHeaderLabel(r,e){let t=e==="week"?{weekday:"short",day:"numeric",month:"numeric"}:e==="day"?{weekday:"long"}:{weekday:"short"};return a.parseDate(r).toLocaleString(a.lang(this),t)}getDayLabel(r){let e=r.getDate()==1?{month:"short",day:"numeric"}:{day:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}getHourLabel(r){let e={hour:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}getTimeLabel(r){let e={hour:"numeric",minute:"numeric"};return a.parseDate(r).toLocaleString(a.lang(this),e)}isNow(r,e){let t=a.parseDate(r),n=a.parseDate(e||new Date);return t.getHours()===n.getHours()&&this.isToday(r,e)}isToday(r,e){return this.isDate(r,e||new Date)}isViewDay(r,e=this.viewDate){return this.isDate(r,e||this.viewDate||new Date)}isDate(r,e){if(!a.Dates.isDate(e)||!a.Dates.isDate(r))return!1;let t=a.parseDate(r),n=a.parseDate(e);return t.getDate()===n.getDate()&&t.getMonth()==n.getMonth()&&t.getFullYear()===n.getFullYear()}isViewWeek(r){let e=a.parseDate(r);return this.week&&this.week.find(t=>t.getDate()==e.getDate()&&t.getMonth()==e.getMonth()&&t.getDate()==e.getDate())}isViewMonth(r){let e=a.parseDate(r),t=a.parseDate(this.viewDate||new Date);return e.getMonth()==t.getMonth()&&e.getFullYear()===t.getFullYear()}isTimeSlotDisabled(r,e,t){if(!a.isNullOrEmpty(r)){t=t||0;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),Math.floor(t),60*(t%1)),i=n.getTimezoneOffset(),s=n.valueOf()-i*60*1e3;for(let l of r){let p=a.Dates.parse(l.from),u=a.Dates.parse(l.to);if((!p||p&&p.valueOf()<=s)&&(!u||u&&u.valueOf()>s)&&(u||p))return!0}}return!1}_getWeekStart(r,e){let t=r.getDay(),n=r.valueOf(),i=(e||"m").toLowerCase().startsWith("m")?1:0;return t===i?n:(t===0&&(t=7),n+(i-t)*up)}_getDatasource(r,e=this.weekStart){let t=a.Dates.dateOnly(a.parseDate(r)),n=this.month,i=n&&n.length&&n[0]&&n[0].length&&n[0][0];if(i&&i.getMonth()==t.getMonth()&&i.getFullYear()==t.getFullYear()&&n.find(f=>!a.isNull(f.find(g=>g.valueOf()==t.valueOf()))))return n;let s=new Date(t.getFullYear(),t.getMonth(),1),l=this._getWeekStart(s,e),p=[],u=[];do{let f=a.Dates.dateOnly(new Date(l));u.push(f),u.length==7&&p.push(u.splice(0)),l=f.valueOf()+up+lu}while(p.length<6);return this.month=p}_synchronizeWeek(){let r=a.parseDate(this.viewDate),e=new Date(r.getFullYear(),r.getMonth(),1),n=this._getDatasource(e,this.weekStart).filter((i,s)=>i.some(l=>l.getDate()==r.getDate()&&l.getMonth()==r.getMonth()&&l.getFullYear()==r.getFullYear()))[0];(!(this.week&&this.week.length)||this.week[0]!==n[0])&&(this.week=n)}};c([h({converter:m.Datetime})],Pr.prototype,"viewDate",2),c([h({converter:m.Datetime})],Pr.prototype,"now",2),c([h({converter:m.String})],Pr.prototype,"zoom",2),c([h({converter:m.String})],Pr.prototype,"weekStart",2),c([h({converter:m.Eval})],Pr.prototype,"week",2),c([h({converter:m.Eval})],Pr.prototype,"month",2),c([h({converter:m.Eval})],Pr.prototype,"disabledRanges",2);var cu=class extends Pr{constructor(){super(...arguments);this._datasource=[]}get datasource(){return this._datasource}_getSortedItems(e){return e.slice().sort((t,n)=>{let i=t.start.valueOf(),s=n.start.valueOf();if(i!=s)return i<s?-1:1;let l=t.end.valueOf(),p=n.end.valueOf(),u=l-i,f=p-s;return u!=f?u>f?-1:1:0})}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"month":case"week":case"items":case"zoom":case"viewDate":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{let s=this._datasource,l=this._datasource=this.buildDataSource(this._getSortedItems(this.items||[]));this.dispatchEvent(new ue({propertyName:"datasource",oldValue:s,currentValue:l}))});break}}};function S_(o,r){let e=r.length-1,t=r[0].valueOf(),n=r[e].valueOf();return o.filter(i=>{let s=a.Dates.dateOnly(i.start),l=a.Dates.dateOnly(i.end);return s.valueOf()<=n&&l.valueOf()>=t}).map(i=>{let s=a.Dates.dateOnly(i.start),l=r.find(_=>_.valueOf()==s.valueOf()),p=r.indexOf(l),u=a.Dates.dateOnly(i.end),f=r.find(_=>_.valueOf()==u.valueOf()),g=r.indexOf(f),v=p==-1?0:p,y=g==-1?e:g;return{start:i.start,end:i.end,allDay:!0,day:v,continuing:{start:p==-1,end:g==-1},span:y+1-v,caption:i.caption,event:i}})}function Vw(){let o="";for(let r=0;r<7;r++)r==0&&(o+='<div class="agenda-left all-day"></div>'),o+=`<${d}-panel class="agenda-slot all-day day-${r+1}" css-class="{{ {'viewday': :host.isViewDay(:host.week[${r}], :host.viewDate), 'today': :host.isToday(:host.week[${r}], :host.now)} }}"></${d}-panel>`;for(let r=0;r<7;r++)for(let e of wl){let t=e%1==0,n=`hour-${t?"whole":"half"}`;r==0&&t&&(o+=`<${d}-text class="agenda-left ${n} hour-${e*2+1}"" text="{{ :host.getHourLabel(${Hw+e*lu}) }}"></${d}-text>`),o+=`<${d}-panel on-click=":host.time = Pacem.Utils.Dates.parse(:host.week[${r}].valueOf() + ${e*lu})" disabled="{{ :host.isTimeSlotDisabled(:host.disabledRanges, :host.week[${r}], ${e}) }}" class="agenda-slot ${n} day-${r+1} hour-${e*2+1}" css-class="{{ {'viewday': :host.isViewDay(:host.week[${r}], :host.viewDate), 'today': :host.isToday(:host.week[${r}], :host.now)} }}"></${d}-panel>`}return o}var kl=class extends cu{constructor(){super(...arguments);this._allDayDatasource=[]}buildDataSource(e){var t=this.week;this.zoom==="day"&&(t=[a.Dates.dateOnly(this.viewDate)]);let n=[];if(!a.isNull(t)){this.dispatchEvent(new ue({propertyName:"allDayDatasource",oldValue:this._allDayDatasource,currentValue:this._allDayDatasource=S_(e.filter(i=>i.end.valueOf()-i.start.valueOf()>=up),t)}));for(let i=0;i<t.length;i++){let s=t[i],l=s.valueOf(),p=e.filter(u=>{let f=a.Dates.dateOnly(u.start),g=a.Dates.dateOnly(u.end);return f.valueOf()<=l&&g.valueOf()>=l}).map(u=>{let f=u.start.valueOf(),g=u.end.valueOf(),v={allDay:u.allDay||g-f>=up,continuing:{start:f<l,end:g>l+up},caption:u.caption,hour:0,span:wl.length-1,offset:{start:"0",end:"0"},event:u},y=u.start.getHours()+u.start.getMinutes()/60,_=v.continuing.start?0:Math.floor(y*2),x=u.end.getHours()+u.end.getMinutes()/60,w=-1+(v.continuing.end?wl.length:Math.ceil(x*2)),E=w+1,k=E>=wl.length?24:wl[E],N=k-wl[_];return v.hour=_,v.span=1+w-_,v.continuing.start||(v.offset.start=(y-wl[_])/N*100+"%"),v.continuing.end||(v.offset.end=(k-x)/N*100+"%"),v});n.push(p)}}return n}get allDayDatasource(){return this._allDayDatasource}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i);let s=this._clock;if(e==="time")this.dispatchEvent(new Mm(n));else if(!a.isNull(s)&&(e==="now"&&(s.now=n,s.className=`hour-${n.getHours()} minute-${n.getMinutes()}`),e==="now"||e==="zoom"||e==="viewDate")){let l=this.now,p=this.zoom,u=l&&p&&(this.isViewDay(l)&&p==="day"||this.isViewWeek(l)&&p==="week");s.hidden=!u}}};c([S(d+"-clock")],kl.prototype,"_clock",2),c([h({converter:m.Datetime})],kl.prototype,"time",2),kl=c([C({tagName:d+"-agenda",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater class="${b}-agenda agenda-grid" datasource="{{ :host.datasource }}">${Vw()}<${d}-clock hidden></${d}-clock>
|
|
448
448
|
<template>
|
|
449
449
|
<${d}-repeater class="agenda-day" datasource="{{ ^item }}">
|
|
450
450
|
<template>
|
|
@@ -466,7 +466,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
466
466
|
</${d}-panel>
|
|
467
467
|
</template>
|
|
468
468
|
</${d}-repeater>
|
|
469
|
-
</${d}-repeater><${d}-content></${d}-content>`})],kl);function
|
|
469
|
+
</${d}-repeater><${d}-content></${d}-content>`})],kl);function Uw(){let o="";for(let r=0;r<6;r++)for(let e=0;e<7;e++){let t=`class="calendar-day week-${r+1} day-${e+1}"`;o+=`<${d}-panel disabled="{{ :host.isTimeSlotDisabled(:host.disabledRanges, :host.month[${r}][${e}]) }}" on-click=":host._setDate(:host.month[${r}][${e}])" ${t} css-class="{{ {'viewmonth': :host.isViewMonth(:host.month[${r}][${e}]), 'viewday': :host.isViewDay(:host.month[${r}][${e}], :host.viewDate), 'today': :host.isToday(:host.month[${r}][${e}], :host.now), 'selected-date': :host.isDate(:host.month[${r}][${e}], :host.date)} }}"><${d}-span culture="{{ :host.culture }}" class="text-ellipsed" text="{{ :host.getDayLabel(:host.month[${r}][${e}], :host._formatVersion) }}"></${d}-span></${d}-panel>`}return o}var Ja=class extends cu{buildDataSource(r){let e=this.month,t=[];if(!a.isNull(e))for(let n=0;n<e.length;n++){let i=e[n],s=S_(r,i);t.push(s)}return t}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="dayLabelFormatter"&&(this._formatVersion=Date.now())}_setDate(r){r?.valueOf()!==this.date?.valueOf()&&(this.date=r,this.dispatchEvent(new km(r)))}getDayLabel(r,e=this._formatVersion){let t=this.dayLabelFormatter;return typeof t=="function"?t(r):super.getDayLabel(r)}};c([h({converter:m.Datetime})],Ja.prototype,"date",2),c([h({emit:!1})],Ja.prototype,"dayLabelFormatter",2),c([h()],Ja.prototype,"_formatVersion",2),Ja=c([C({tagName:d+"-calendar",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater class="${b}-calendar calendar-grid" datasource="{{ :host.datasource }}">${Uw()}
|
|
470
470
|
<template>
|
|
471
471
|
<${d}-repeater class="calendar-week" datasource="{{ ^item }}">
|
|
472
472
|
<template>
|
|
@@ -479,13 +479,13 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
479
479
|
</template>
|
|
480
480
|
</${d}-repeater>
|
|
481
481
|
</template>
|
|
482
|
-
</${d}-repeater><${d}-content></${d}-content>`})],Ja);var pp=class extends R.PacemElement{};c([h({converter:m.Datetime})],pp.prototype,"now",2),pp=c([C({tagName:d+"-clock"})],pp);function
|
|
482
|
+
</${d}-repeater><${d}-content></${d}-content>`})],Ja);var pp=class extends R.PacemElement{};c([h({converter:m.Datetime})],pp.prototype,"now",2),pp=c([C({tagName:d+"-clock"})],pp);function zw(){let o="";for(let e=0;e<7;e++)o+=`<${d}-span culture="{{ :host.culture }}" css-class="{{ {'viewday': :host.isViewDay(:host.week[${e}], :host.viewDate)} }}" class="schedule-heading day-${e+1} text-ellipsed" text="{{ :host.getHeaderLabel(:host.week[${e}], :host.zoom) }}"></${d}-span>`;let r="dock_"+a.uniqueCode();return`<div class="schedule-header schedule-grid"><div class="heading-left"></div>${o}</div>`}var Ml=class extends Pr{viewActivatedCallback(){super.viewActivatedCallback(),this._calendar.addEventListener("dateselect",this.emitHandler,!1),this._agenda.addEventListener("timeselect",this.emitHandler,!1),this.now=new Date}disconnectedCallback(){this._calendar&&(this._calendar.removeEventListener("dateselect",this.emitHandler,!1),this._agenda.removeEventListener("timeselect",this.emitHandler,!1)),super.disconnectedCallback()}};c([S(d+"-calendar")],Ml.prototype,"_calendar",2),c([S(d+"-agenda")],Ml.prototype,"_agenda",2),Ml=c([C({tagName:d+"-schedule",shadow:j.USE_SHADOW_ROOT,template:`<${d}-panel class="${b}-schedule" css-class="{{ ['schedule-'+ (:host.zoom || 'month')] }}">
|
|
483
483
|
<${d}-timer interval="10000" on-tick=":host.now = Pacem.Utils.parseDate(Date.now())"></${d}-timer>
|
|
484
|
-
${
|
|
484
|
+
${zw()}
|
|
485
485
|
<${d}-agenda disabled-ranges="{{ :host.disabledRanges }}" on-eventselect=":host.handle($event)" on-eventunselect=":host.handle($event)" now="{{ :host.now }}" culture="{{ :host.culture }}" view-date="{{ :host.viewDate }}" zoom="{{ :host.zoom }}" week-start="{{ :host.weekStart }}" items="{{ :host.items }}"></${d}-agenda>
|
|
486
486
|
<${d}-calendar disabled-ranges="{{ :host.disabledRanges }}" on-eventselect=":host.handle($event)" on-eventunselect=":host.handle($event)" now="{{ :host.now }}" culture="{{ :host.culture }}" view-date="{{ :host.viewDate }}" zoom="{{ :host.zoom }}" week-start="{{ :host.weekStart }}" items="{{ :host.items }}"></${d}-calendar>
|
|
487
487
|
<${d}-content></${d}-content>
|
|
488
|
-
</${d}-panel>`})],Ml);var ou=class extends HTMLElement{constructor(){super(...arguments);this._disabledRanges=[]}viewActivatedCallback(){if(!a.isNull(this._target=A.findAncestor(this,e=>e instanceof Pr)))this.refreshDisabledRanges();else throw`Missing ancestor calendar element for ${this.constructor.name}.`}disconnectedCallback(){this._target=void 0}get target(){return this._target}refreshDisabledRanges(){if(a.isNullOrEmpty(this._target))return;let e=this._target.disabledRanges||[];for(let t of this._disabledRanges){let n=e.indexOf(t);n>=0&&e.splice(n,1)}this._disabledRanges=this.computeDisabledRanges()||[];for(let t of this._disabledRanges)e.push(t);this._target.disabledRanges=e}};c([me(!0)],ou.prototype,"refreshDisabledRanges",1);var dp=class extends ou{constructor(){super(...arguments);this._daysOfWeek=[];this._calendarChangeHandler=e=>{e.detail.propertyName=="month"&&this.refreshDisabledRanges()}}viewActivatedCallback(){super.viewActivatedCallback(),this.target.addEventListener(ee,this._calendarChangeHandler,!1)}propertyChangedCallback(e,t,n,i){e==="days"&&(this._daysOfWeek=(n||[]).map(s=>
|
|
488
|
+
</${d}-panel>`})],Ml);var ou=class extends HTMLElement{constructor(){super(...arguments);this._disabledRanges=[]}viewActivatedCallback(){if(!a.isNull(this._target=A.findAncestor(this,e=>e instanceof Pr)))this.refreshDisabledRanges();else throw`Missing ancestor calendar element for ${this.constructor.name}.`}disconnectedCallback(){this._target=void 0}get target(){return this._target}refreshDisabledRanges(){if(a.isNullOrEmpty(this._target))return;let e=this._target.disabledRanges||[];for(let t of this._disabledRanges){let n=e.indexOf(t);n>=0&&e.splice(n,1)}this._disabledRanges=this.computeDisabledRanges()||[];for(let t of this._disabledRanges)e.push(t);this._target.disabledRanges=e}};c([me(!0)],ou.prototype,"refreshDisabledRanges",1);var dp=class extends ou{constructor(){super(...arguments);this._daysOfWeek=[];this._calendarChangeHandler=e=>{e.detail.propertyName=="month"&&this.refreshDisabledRanges()}}viewActivatedCallback(){super.viewActivatedCallback(),this.target.addEventListener(ee,this._calendarChangeHandler,!1)}propertyChangedCallback(e,t,n,i){e==="days"&&(this._daysOfWeek=(n||[]).map(s=>Bw.indexOf(s)).filter(s=>s>=0),this.refreshDisabledRanges())}computeDisabledRanges(){let e=[];for(let t of this.target.month)for(let n of t)if(this._daysOfWeek.indexOf(n.getDay())==-1){let i=a.Dates.dateOnly(n),s=a.Dates.dateOnly(new Date(i.valueOf()+up+lu));e.push({from:i,to:s})}return e}};c([h({emit:!1,converter:m.StringArray})],dp.prototype,"days",2),dp=c([C({tagName:d+"-calendar-daysofweek-rule"})],dp);var hp,Es=class extends K{constructor(){super(...arguments);z(this,hp);this._resizeHandler=e=>{H(this,hp,e.detail),this._toggle()}}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"collapse":this._toggle();case"disabled":a.isNull(this._resizer)||(this._resizer.disabled=this.disabled||this.collapse);break}}viewActivatedCallback(){super.viewActivatedCallback();let e=this._resizer;H(this,hp,e.currentSize),this._toggle()}_toggle(){let e=this,t=this.collapse,n=M(this,hp);this.disabled||a.isNull(e)||(this.horizontal?(a.addClass(e,b+"-horizontal"),e.style.height=n&&n.height+"px"||"",e.style.width=t?"0":n&&n.width+"px"||""):(a.removeClass(e,b+"-horizontal"),e.style.height=t?"0":n&&n.height+"px"||""))}};hp=new WeakMap,c([h({converter:m.Boolean})],Es.prototype,"collapse",2),c([h({emit:!1,converter:m.Boolean})],Es.prototype,"horizontal",2),c([S(d+"-resize")],Es.prototype,"_resizer",2),c([S("[part=content]")],Es.prototype,"_container",2),Es=c([C({tagName:d+"-collapse",shadow:!0,template:`<${d}-resize on-${R.ResizeEventName}=":host._resizeHandler($event)" target="{{ ::_container }}"></${d}-resize><div part="container"><div part="content"><slot></slot></div></div>`})],Es);var cn=class extends cp{constructor(){super(...arguments);this.buttons="ok";this.okCaption="OK";this.yesCaption="Yes";this.noCaption="No";this.cancelCaption="Cancel"}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i)}open(e){let t=super.open(e);switch(this.buttons){case"ok":case"okcancel":this.dialogButtons.ok.focus();break;default:this.dialogButtons.yes.focus();break}return t}viewActivatedCallback(){super.viewActivatedCallback()}get dialogButtons(){let e=this._buttons;return{ok:e&&e.firstElementChild.firstElementChild,yes:e&&e.firstElementChild.children.item(1),no:e&&e.firstElementChild.children.item(2),cancel:e&&e.firstElementChild.lastElementChild}}};c([h({converter:m.String})],cn.prototype,"buttons",2),c([h({reflectBack:!0,converter:m.String})],cn.prototype,"okCaption",2),c([h({reflectBack:!0,converter:m.String})],cn.prototype,"yesCaption",2),c([h({reflectBack:!0,converter:m.String})],cn.prototype,"noCaption",2),c([h({reflectBack:!0,converter:m.String})],cn.prototype,"cancelCaption",2),c([S(`.${b}-dialog-buttons`)],cn.prototype,"_buttons",2),c([S(d+"-lightbox")],cn.prototype,"lightbox",2),cn=c([C({tagName:d+"-dialog",shadow:j.USE_SHADOW_ROOT,template:`<${d}-lightbox modal="true" logger="{{ :host.logger }}">
|
|
489
489
|
<${d}-content></${d}-content>
|
|
490
490
|
<div class="${b}-dialog-buttons ${b}-buttonset buttons" part="dialog-buttons" slot="bottom">
|
|
491
491
|
<div class="buttonset-left">
|
|
@@ -495,7 +495,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
495
495
|
<${d}-button class="button button-size size-small dialog-cancel" on-click=":host.commit('cancel', $event)" disabled="{{ :host.disabled || this.hide }}" hide="{{ :host.buttons !== 'yesnocancel' && :host.buttons !== 'okcancel' }}"><${d}-text text="{{ :host.cancelCaption }}"></${d}-text></${d}-button>
|
|
496
496
|
</div>
|
|
497
497
|
</div>
|
|
498
|
-
</${d}-lightbox>`})],cn);var mp=class extends R.PacemElement{constructor(){super("separator")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="orientation"&&this._syncOrientation(t)}viewActivatedCallback(){super.viewActivatedCallback(),this._syncOrientation()}_syncOrientation(r=this.orientation){r!=="vertical"&&(r="horizontal"),super.aria.attributes.set("orientation",r),r==="vertical"?a.addClass(this,"divider-vertical"):a.removeClass(this,"divider-vertical")}};c([h({converter:m.String,emit:!1})],mp.prototype,"orientation",2),mp=c([C({tagName:d+"-divider",shadow:!0,template:'<div part="divider"><div part="prepend"></div><slot part="content"></slot><div part="append"></div></div>'})],mp);var zw=/^\s*<svg\s/,Gw=/^fa(b|r|s|l|d|t|-brands|-solid|-regular|-light|-thin|-duotone)?\s+fa-/,S_={url:"https://kit.fontawesome.com/4922589c3c.js",crossOrigin:!0},Fw=/^lni\s+lni-/,Ww="https://cdn.lineicons.com/2.0/LineIcons.css",jw=/^ci[dlsbf]-/,Yw="https://unpkg.com/@coreui/icons/css/all.min.css",L_=/^material-icons?\s+([\w]+)/,N_=/^material(-symbols?)?\s+([\w]+)/,T_="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200",Xw=/^(https?:\/\/|\/\/)?.+\.(webp|svg|gif|png|jpe?g)$/,A_=[];function pu(o,r,e,t,n){return A_.indexOf(o)>=0||(A_.push(o),a.Css.isClassDefined(o))?Promise.resolve():n?A.importjs(r,e,t):A.importcss(r,e,t)}function qw(o){return new Promise((r,e)=>{if(a.isNullOrEmpty(o))e("No icon provided");else if(zw.test(o))r(o);else if(Gw.test(o))pu("fa",S_.url,void 0,S_.crossOrigin,!0).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(N_.test(o))pu("material-symbols",T_).then(t=>{let n=N_.exec(o),i=n[2],s=o.substring(n[0].length);r(`<i class="material-symbols-outlined${s}">${i}</i>`)},t=>e(t));else if(L_.test(o))pu("material-icons",T_).then(t=>{let n=L_.exec(o),i=n[1],s=o.substring(n[0].length);r(`<i class="material-icons${s}">${i}</i>`)},t=>e(t));else if(Fw.test(o))pu("lni",Ww).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(jw.test(o))pu("clb",Yw).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(Xw.test(o))r(`<img src="${o}" />`);else{let t=o.trim().split(" "),n=t[0],i=t.length>1?" "+t.slice(1).join(" "):"";r(`<i class="${b}-icon${i}">${n}</i>`)}})}var fp=class extends R.PacemElement{constructor(){super("",{hidden:"true"})}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"icon":this._setIcon();break;case"hide":t||this.aria.attributes.set("hidden","true");break}}viewActivatedCallback(){super.viewActivatedCallback(),this._setIcon()}_setIcon(r=this.icon){qw(r).then(e=>{this.innerHTML=e},e=>{this.innerHTML=""})}};c([h({emit:!1,converter:m.String})],fp.prototype,"icon",2),fp=c([C({tagName:d+"-icon"})],fp);var du,ws=class extends R.PacemElement{constructor(){super("img");z(this,du)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":case"disabled":this._setSource();break;case"size":case"adapt":this._setLayout();break;case"loading":(n?a.removeClass:a.addClass)(this,"img-ready");break}}viewActivatedCallback(){super.viewActivatedCallback(),this._setLayout(),this._setSource()}_setLayout(){let e=!a.isNullOrEmpty(this.size),t=this.adapt||"auto",n=this.size||M(this,du)||{width:"0",height:"0"};this.style.backgroundSize=t;let i=t==="auto",s=n.width,l=n.height;(i||e)&&(this.style.width=s||"",this.style.height=l||"")}async _setSource(){if(this.disabled||!this.isReady)return;let e=this.src;if(this.style.backgroundImage="",!a.isNullOrEmpty(e)){this.loading=!0;try{let t=await a.loadImage(e),n,i,s;window.performance&&(i=performance.getEntriesByName(t.src))&&(s=i[0])&&(n=s.decodedBodySize),H(this,du,{width:t.naturalWidth+"px",height:t.naturalHeight+"px",weight:n}),this._setLayout(),this.style.backgroundImage=`url("${t.src}")`}catch{}finally{this.loading=!1}}}};du=new WeakMap,c([h({emit:!1,converter:m.String})],ws.prototype,"adapt",2),c([h({emit:!1,converter:m.String})],ws.prototype,"src",2),c([h({emit:!1,converter:{convert:(e,t)=>{let i=/^\s*([\d.]+)(px|em|rem|vw|vh)?\s*(?:,\s*([\d.]+)(px|em|rem|vw|vh)?)?\s*$/i.exec(e),s=i?i[1]+(i[2]||"px"):"0",l=i?i[3]?i[3]+(i[4]||"px"):s:"0";return{width:s,height:l}},convertBack:(e,t)=>`${e?.width},${e?.height}`},reflectBack:!0})],ws.prototype,"size",2),c([h({converter:m.Boolean})],ws.prototype,"loading",2),ws=c([C({tagName:d+"-img"})],ws);var Za=class extends K{constructor(){super();this._scrollDelegate=()=>this._doScroll();this._enabled=!0;this._viewportHeight=0;this._innerHeight=0;this._isDocument=!1;this._container=null;this._viewport=null;this._scroller=null;this._bottomGap=10;this._container=this,this._viewport=this,this._scroller=this}viewActivatedCallback(){super.viewActivatedCallback(),this.setInfiniteScrollContainer(this._container)}disconnectedCallback(){a.isNull(this._scroller)||this._scroller.removeEventListener("scroll",this._scrollDelegate,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"container":this.setInfiniteScrollContainer(n);break;case"disabled":(this._enabled=!n)&&this._doScroll();break;case"threshold":this._bottomGap=n||0;break}}setInfiniteScrollContainer(e="$document"){var t=e,n=this._isDocument=t==="$document"||t===document.body||t===document.documentElement;this._container=n?document.body||document.documentElement:typeof e=="string"?document.querySelector(t):t,this._viewport=n?window:this._container,this._scroller&&this._scroller.removeEventListener("scroll",this._scrollDelegate,!1),this._scroller=n?window.document:this._container,this._scroller.addEventListener("scroll",this._scrollDelegate,!1),this._enabled&&this._doScroll()}_emitFetchMore(){var e=new CustomEvent("fetchmore");this.dispatchEvent(e)}_doScroll(){if(this._enabled)if(this._computeHeight())this._doScroll();else{var e=this._scroller instanceof Document?window.pageYOffset:this._scroller.scrollTop,t=this._viewportHeight,n=this._innerHeight,i=n-(e+t);(i<this._bottomGap||n<=t)&&(this._emitFetchMore(),window.requestAnimationFrame(()=>{this._enabled&&this._doScroll()}))}}_computeHeight(){if(this._container){var e=this._container,t=Number.MAX_VALUE,n=0,i=0,s;if(this._isDocument){var l=e;s=Math.max(l.scrollHeight,l.offsetHeight,l.clientHeight)}else{for(var p=0;p<e.children.length;p++){var u=e.children.item(p),f=u.offsetTop,g=u.offsetHeight,v=f+g;i+=g,f<t&&(t=f),v>n&&(n=v)}s=Math.round(n-t)}var y=this._viewport instanceof Window?a.windowSize.height:this._viewport.offsetHeight;return s!=this._innerHeight||y!=this._viewportHeight?(this._innerHeight=s,this._viewportHeight=y,!0):!1}}};c([h({converter:m.String})],Za.prototype,"container",2),c([h({reflectBack:!0,converter:m.Number})],Za.prototype,"threshold",2),c([me(100)],Za.prototype,"_doScroll",1),Za=c([C({tagName:d+"-infinite-scroller"})],Za);var uu=class extends R.PacemElement{constructor(){super(...arguments);this.index=0}isCloseTo(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isCloseToCore(e,t,this.datasource.length)}isPrevious(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isPreviousCore(e,t,this.datasource.length)}isNext(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isNextCore(e,t,this.datasource.length)}_isNextCore(e,t,n){return(t+1)%n===e}_isPreviousCore(e,t,n){return(t-1+n)%n===e}_isCloseToCore(e,t,n){return(t+n)%n==(e+n)%n||this._isNextCore(e,t,n)||this._isPreviousCore(e,t,n)}};c([h({converter:m.Number})],uu.prototype,"index",2),c([h()],uu.prototype,"datasource",2);var ks,pn=class extends R.PacemElement{constructor(){super(...arguments);this._keyupHandler=e=>{e.keyCode===27&&this.show&&!this.modal&&(this.show=!1)};this._wrapperMousedownHandler=e=>{this.modal||this.behavior==="explicitClose"?Re(e):this.show=!1};this._slotchangeHandler=e=>{this._resetLayout()};this._closeHandler=e=>{this._close(e)};z(this,ks)}_resetLayout(){this._disposeButton();let e=this._ensureButton();a.isNull(e)||e.addEventListener("click",this._closeHandler,!1)}_toggleCloseVisibility(){let e=this._closeWrapper;a.isNull(e)||(e.hidden=this.modal)}viewActivatedCallback(){super.viewActivatedCallback(),this._toggleCloseVisibility();var e=this._wrapperElement,t=this._container;e.addEventListener("mousedown",this._wrapperMousedownHandler,!1),t.addEventListener("mousedown",Re,!1),document.body.removeEventListener("scroll",Q,!0),window.addEventListener("keyup",this._keyupHandler,!1),this._resetLayout(),this._slot.addEventListener("slotchange",this._slotchangeHandler,!1),this.show&&this._toggle(!0)}_toggle(e){let t=this._wrapperElement,n=this._container;if(e){this.inert=!1,this.dispatchEvent(new Event("open",{bubbles:!0,cancelable:!1})),t.style.display="",t.hidden=!1,window.requestAnimationFrame(()=>{a.addPart(t,"lightbox-wrapper-shown"),a.addPart(n,"lightbox-shown")});var i=this.querySelector("."+b+"-scrollable");i&&window.requestAnimationFrame(()=>i.scrollTop=0)}else this.inert=!0,this.dispatchEvent(new Event("close",{bubbles:!0,cancelable:!1})),a.removePart(t,"lightbox-wrapper-shown"),a.removePart(n,"lightbox-shown"),a.addAnimationEndCallback(t,s=>{s.hidden=!0,s.style.display="none"},500)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"show":n?this._toggle(!0):t&&this._toggle(!1);break;case"modal":this._toggleCloseVisibility();break}}disconnectedCallback(){this.show&&this._close();var e=this._wrapperElement,t=this._container;document.body.removeEventListener("scroll",Q,!0),a.isNull(e)||e.removeEventListener("mousedown",this._wrapperMousedownHandler,!1),a.isNull(t)||t.removeEventListener("mousedown",Re,!1),window.removeEventListener("keyup",this._keyupHandler,!1),this._disposeButton(),this._disposeSlot(),super.disconnectedCallback()}_disposeButton(){M(this,ks)?.removeEventListener("click",this._closeHandler),H(this,ks,null)}_disposeSlot(){this._slot?.removeEventListener("slotchange",this._slotchangeHandler,!1)}_close(e){a.isNull(e)||Q(e),this.show=!1}_ensureButton(){if(!a.isNull(M(this,ks)))return M(this,ks);let e=this._slot;if(a.isNull(e))return null;let t=this._lookForAButton();if(!a.isNull(t))return H(this,ks,t);let n=new tr;return n.setAttribute("slot","close"),n.className=`${b}-margin margin-0 ${b}-rise rise--2 button-circle circle-smaller`,n.iconGlyph="close",this.appendChild(n),H(this,ks,n)}_lookForAButton(){let e=this._slot;if(a.isNull(e))return null;let t=e.assignedElements({flatten:!0});return a.isNullOrEmpty(t)?null:t[0]}};ks=new WeakMap,c([h({converter:m.Boolean})],pn.prototype,"show",2),c([h({converter:m.Boolean})],pn.prototype,"modal",2),c([h({emit:!1,converter:m.String})],pn.prototype,"behavior",2),c([S("."+b+"-lightbox-wrapper")],pn.prototype,"_wrapperElement",2),c([S("."+b+"-lightbox")],pn.prototype,"_container",2),c([S("slot[name=close]")],pn.prototype,"_slot",2),c([S("div[part=close]")],pn.prototype,"_closeWrapper",2),pn=c([C({tagName:d+"-lightbox",shadow:!0,template:`<div class="${b}-lightbox-wrapper" part="lightbox-wrapper" hidden>
|
|
498
|
+
</${d}-lightbox>`})],cn);var mp=class extends R.PacemElement{constructor(){super("separator")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="orientation"&&this._syncOrientation(t)}viewActivatedCallback(){super.viewActivatedCallback(),this._syncOrientation()}_syncOrientation(r=this.orientation){r!=="vertical"&&(r="horizontal"),super.aria.attributes.set("orientation",r),r==="vertical"?a.addClass(this,"divider-vertical"):a.removeClass(this,"divider-vertical")}};c([h({converter:m.String,emit:!1})],mp.prototype,"orientation",2),mp=c([C({tagName:d+"-divider",shadow:!0,template:'<div part="divider"><div part="prepend"></div><slot part="content"></slot><div part="append"></div></div>'})],mp);var Gw=/^\s*<svg\s/,Fw=/^fa(b|r|s|l|d|t|-brands|-solid|-regular|-light|-thin|-duotone)?\s+fa-/,L_={url:"https://kit.fontawesome.com/4922589c3c.js",crossOrigin:!0},Ww=/^lni\s+lni-/,jw="https://cdn.lineicons.com/2.0/LineIcons.css",Yw=/^ci[dlsbf]-/,Xw="https://unpkg.com/@coreui/icons/css/all.min.css",N_=/^material-icons?\s+([\w]+)/,T_=/^material(-symbols?)?\s+([\w]+)/,A_="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200",qw=/^(https?:\/\/|\/\/)?.+\.(webp|svg|gif|png|jpe?g)$/,D_=[];function pu(o,r,e,t,n){return D_.indexOf(o)>=0||(D_.push(o),a.Css.isClassDefined(o))?Promise.resolve():n?A.importjs(r,e,t):A.importcss(r,e,t)}function Kw(o){return new Promise((r,e)=>{if(a.isNullOrEmpty(o))e("No icon provided");else if(Gw.test(o))r(o);else if(Fw.test(o))pu("fa",L_.url,void 0,L_.crossOrigin,!0).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(T_.test(o))pu("material-symbols",A_).then(t=>{let n=T_.exec(o),i=n[2],s=o.substring(n[0].length);r(`<i class="material-symbols-outlined${s}">${i}</i>`)},t=>e(t));else if(N_.test(o))pu("material-icons",A_).then(t=>{let n=N_.exec(o),i=n[1],s=o.substring(n[0].length);r(`<i class="material-icons${s}">${i}</i>`)},t=>e(t));else if(Ww.test(o))pu("lni",jw).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(Yw.test(o))pu("clb",Xw).then(t=>{r(`<i class="${o}"></i>`)},t=>e(t));else if(qw.test(o))r(`<img src="${o}" />`);else{let t=o.trim().split(" "),n=t[0],i=t.length>1?" "+t.slice(1).join(" "):"";r(`<i class="${b}-icon${i}">${n}</i>`)}})}var fp=class extends R.PacemElement{constructor(){super("",{hidden:"true"})}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"icon":this._setIcon();break;case"hide":t||this.aria.attributes.set("hidden","true");break}}viewActivatedCallback(){super.viewActivatedCallback(),this._setIcon()}_setIcon(r=this.icon){Kw(r).then(e=>{this.innerHTML=e},e=>{this.innerHTML=""})}};c([h({emit:!1,converter:m.String})],fp.prototype,"icon",2),fp=c([C({tagName:d+"-icon"})],fp);var du,ws=class extends R.PacemElement{constructor(){super("img");z(this,du)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"src":case"disabled":this._setSource();break;case"size":case"adapt":this._setLayout();break;case"loading":(n?a.removeClass:a.addClass)(this,"img-ready");break}}viewActivatedCallback(){super.viewActivatedCallback(),this._setLayout(),this._setSource()}_setLayout(){let e=!a.isNullOrEmpty(this.size),t=this.adapt||"auto",n=this.size||M(this,du)||{width:"0",height:"0"};this.style.backgroundSize=t;let i=t==="auto",s=n.width,l=n.height;(i||e)&&(this.style.width=s||"",this.style.height=l||"")}async _setSource(){if(this.disabled||!this.isReady)return;let e=this.src;if(this.style.backgroundImage="",!a.isNullOrEmpty(e)){this.loading=!0;try{let t=await a.loadImage(e),n,i,s;window.performance&&(i=performance.getEntriesByName(t.src))&&(s=i[0])&&(n=s.decodedBodySize),H(this,du,{width:t.naturalWidth+"px",height:t.naturalHeight+"px",weight:n}),this._setLayout(),this.style.backgroundImage=`url("${t.src}")`}catch{}finally{this.loading=!1}}}};du=new WeakMap,c([h({emit:!1,converter:m.String})],ws.prototype,"adapt",2),c([h({emit:!1,converter:m.String})],ws.prototype,"src",2),c([h({emit:!1,converter:{convert:(e,t)=>{let i=/^\s*([\d.]+)(px|em|rem|vw|vh)?\s*(?:,\s*([\d.]+)(px|em|rem|vw|vh)?)?\s*$/i.exec(e),s=i?i[1]+(i[2]||"px"):"0",l=i?i[3]?i[3]+(i[4]||"px"):s:"0";return{width:s,height:l}},convertBack:(e,t)=>`${e?.width},${e?.height}`},reflectBack:!0})],ws.prototype,"size",2),c([h({converter:m.Boolean})],ws.prototype,"loading",2),ws=c([C({tagName:d+"-img"})],ws);var Za=class extends K{constructor(){super();this._scrollDelegate=()=>this._doScroll();this._enabled=!0;this._viewportHeight=0;this._innerHeight=0;this._isDocument=!1;this._container=null;this._viewport=null;this._scroller=null;this._bottomGap=10;this._container=this,this._viewport=this,this._scroller=this}viewActivatedCallback(){super.viewActivatedCallback(),this.setInfiniteScrollContainer(this._container)}disconnectedCallback(){a.isNull(this._scroller)||this._scroller.removeEventListener("scroll",this._scrollDelegate,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"container":this.setInfiniteScrollContainer(n);break;case"disabled":(this._enabled=!n)&&this._doScroll();break;case"threshold":this._bottomGap=n||0;break}}setInfiniteScrollContainer(e="$document"){var t=e,n=this._isDocument=t==="$document"||t===document.body||t===document.documentElement;this._container=n?document.body||document.documentElement:typeof e=="string"?document.querySelector(t):t,this._viewport=n?window:this._container,this._scroller&&this._scroller.removeEventListener("scroll",this._scrollDelegate,!1),this._scroller=n?window.document:this._container,this._scroller.addEventListener("scroll",this._scrollDelegate,!1),this._enabled&&this._doScroll()}_emitFetchMore(){var e=new CustomEvent("fetchmore");this.dispatchEvent(e)}_doScroll(){if(this._enabled)if(this._computeHeight())this._doScroll();else{var e=this._scroller instanceof Document?window.pageYOffset:this._scroller.scrollTop,t=this._viewportHeight,n=this._innerHeight,i=n-(e+t);(i<this._bottomGap||n<=t)&&(this._emitFetchMore(),window.requestAnimationFrame(()=>{this._enabled&&this._doScroll()}))}}_computeHeight(){if(this._container){var e=this._container,t=Number.MAX_VALUE,n=0,i=0,s;if(this._isDocument){var l=e;s=Math.max(l.scrollHeight,l.offsetHeight,l.clientHeight)}else{for(var p=0;p<e.children.length;p++){var u=e.children.item(p),f=u.offsetTop,g=u.offsetHeight,v=f+g;i+=g,f<t&&(t=f),v>n&&(n=v)}s=Math.round(n-t)}var y=this._viewport instanceof Window?a.windowSize.height:this._viewport.offsetHeight;return s!=this._innerHeight||y!=this._viewportHeight?(this._innerHeight=s,this._viewportHeight=y,!0):!1}}};c([h({converter:m.String})],Za.prototype,"container",2),c([h({reflectBack:!0,converter:m.Number})],Za.prototype,"threshold",2),c([me(100)],Za.prototype,"_doScroll",1),Za=c([C({tagName:d+"-infinite-scroller"})],Za);var uu=class extends R.PacemElement{constructor(){super(...arguments);this.index=0}isCloseTo(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isCloseToCore(e,t,this.datasource.length)}isPrevious(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isPreviousCore(e,t,this.datasource.length)}isNext(e,t){return a.isNull(this.datasource)||this.datasource.length==0?!1:this._isNextCore(e,t,this.datasource.length)}_isNextCore(e,t,n){return(t+1)%n===e}_isPreviousCore(e,t,n){return(t-1+n)%n===e}_isCloseToCore(e,t,n){return(t+n)%n==(e+n)%n||this._isNextCore(e,t,n)||this._isPreviousCore(e,t,n)}};c([h({converter:m.Number})],uu.prototype,"index",2),c([h()],uu.prototype,"datasource",2);var ks,pn=class extends R.PacemElement{constructor(){super(...arguments);this._keyupHandler=e=>{e.keyCode===27&&this.show&&!this.modal&&(this.show=!1)};this._wrapperMousedownHandler=e=>{this.modal||this.behavior==="explicitClose"?Re(e):this.show=!1};this._slotchangeHandler=e=>{this._resetLayout()};this._closeHandler=e=>{this._close(e)};z(this,ks)}_resetLayout(){this._disposeButton();let e=this._ensureButton();a.isNull(e)||e.addEventListener("click",this._closeHandler,!1)}_toggleCloseVisibility(){let e=this._closeWrapper;a.isNull(e)||(e.hidden=this.modal)}viewActivatedCallback(){super.viewActivatedCallback(),this._toggleCloseVisibility();var e=this._wrapperElement,t=this._container;e.addEventListener("mousedown",this._wrapperMousedownHandler,!1),t.addEventListener("mousedown",Re,!1),document.body.removeEventListener("scroll",Q,!0),window.addEventListener("keyup",this._keyupHandler,!1),this._resetLayout(),this._slot.addEventListener("slotchange",this._slotchangeHandler,!1),this.show&&this._toggle(!0)}_toggle(e){let t=this._wrapperElement,n=this._container;if(e){this.inert=!1,this.dispatchEvent(new Event("open",{bubbles:!0,cancelable:!1})),t.style.display="",t.hidden=!1,window.requestAnimationFrame(()=>{a.addPart(t,"lightbox-wrapper-shown"),a.addPart(n,"lightbox-shown")});var i=this.querySelector("."+b+"-scrollable");i&&window.requestAnimationFrame(()=>i.scrollTop=0)}else this.inert=!0,this.dispatchEvent(new Event("close",{bubbles:!0,cancelable:!1})),a.removePart(t,"lightbox-wrapper-shown"),a.removePart(n,"lightbox-shown"),a.addAnimationEndCallback(t,s=>{s.hidden=!0,s.style.display="none"},500)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"show":n?this._toggle(!0):t&&this._toggle(!1);break;case"modal":this._toggleCloseVisibility();break}}disconnectedCallback(){this.show&&this._close();var e=this._wrapperElement,t=this._container;document.body.removeEventListener("scroll",Q,!0),a.isNull(e)||e.removeEventListener("mousedown",this._wrapperMousedownHandler,!1),a.isNull(t)||t.removeEventListener("mousedown",Re,!1),window.removeEventListener("keyup",this._keyupHandler,!1),this._disposeButton(),this._disposeSlot(),super.disconnectedCallback()}_disposeButton(){M(this,ks)?.removeEventListener("click",this._closeHandler),H(this,ks,null)}_disposeSlot(){this._slot?.removeEventListener("slotchange",this._slotchangeHandler,!1)}_close(e){a.isNull(e)||Q(e),this.show=!1}_ensureButton(){if(!a.isNull(M(this,ks)))return M(this,ks);let e=this._slot;if(a.isNull(e))return null;let t=this._lookForAButton();if(!a.isNull(t))return H(this,ks,t);let n=new tr;return n.setAttribute("slot","close"),n.className=`${b}-margin margin-0 ${b}-rise rise--2 button-circle circle-smaller`,n.iconGlyph="close",this.appendChild(n),H(this,ks,n)}_lookForAButton(){let e=this._slot;if(a.isNull(e))return null;let t=e.assignedElements({flatten:!0});return a.isNullOrEmpty(t)?null:t[0]}};ks=new WeakMap,c([h({converter:m.Boolean})],pn.prototype,"show",2),c([h({converter:m.Boolean})],pn.prototype,"modal",2),c([h({emit:!1,converter:m.String})],pn.prototype,"behavior",2),c([S("."+b+"-lightbox-wrapper")],pn.prototype,"_wrapperElement",2),c([S("."+b+"-lightbox")],pn.prototype,"_container",2),c([S("slot[name=close]")],pn.prototype,"_slot",2),c([S("div[part=close]")],pn.prototype,"_closeWrapper",2),pn=c([C({tagName:d+"-lightbox",shadow:!0,template:`<div class="${b}-lightbox-wrapper" part="lightbox-wrapper" hidden>
|
|
499
499
|
<div class="${b}-lightbox" part="lightbox">
|
|
500
500
|
<div part="top"><slot name="top"></slot></div>
|
|
501
501
|
<div class="${b}-scrollable" part="scrollable">
|
|
@@ -506,7 +506,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
506
506
|
<slot name="close"></slot>
|
|
507
507
|
</div>
|
|
508
508
|
</div>
|
|
509
|
-
</div>`})],pn);var
|
|
509
|
+
</div>`})],pn);var R_=(t=>(t.Spinner="spin",t.Pacem="pacem",t.Custom="custom",t))(R_||{}),Ai=class extends R.PacemElement{viewActivatedCallback(){super.viewActivatedCallback();var r="_"+a.uniqueCode();this._svgSpinner.innerHTML=`<defs>
|
|
510
510
|
<mask id="hole${r}">
|
|
511
511
|
<rect width="100%" height="100%" fill="white" />
|
|
512
512
|
<circle cx="36" cy="36" r="12"></circle>
|
|
@@ -534,9 +534,9 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
534
534
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
535
535
|
viewBox="-18,-18,108,108" preserveAspectRatio="xMidYMid">
|
|
536
536
|
</svg>
|
|
537
|
-
</div>`})],Ai);var hr=(o,r,e)=>{let t=r.exec(o);return t&&t.length?e(t):null},
|
|
537
|
+
</div>`})],Ai);var hr=(o,r,e)=>{let t=r.exec(o);return t&&t.length?e(t):null},Jw=[{exec:o=>hr(o,/^((<|<)!--(?:(?!(--(>|>)))[\s\S])*(--(?:>|>)|$))/,r=>{let e=r[0];return[{type:"code-comment",raw:e,text:e,index:r.index}]})},{exec:(o,r)=>hr(o,/^(<|<)([\w-]+)(?:\s+[\w-]+(?:=(?:'[^']*'|"[^"]*"))*)*(\s*\/?(?:>|>))/,e=>{let t=e[1],n=e[2],i=e[3],s=e[0].length-i.length,l=t.length+n.length,p=o.substring(l,s),u=r.tokenize(p,[{exec:g=>hr(g,/^(\s+[\w-]+)(=('[^']*'|"[^"]*"))?/,v=>{let y=v[1],_=[{type:"code-attribute",raw:y,text:y,index:v[0].indexOf(y)}];return v.length>2&&_.push({type:"code-string",raw:v[2],text:v[2],index:v.index+v[0].length-v[2].length}),_})}]),f=[{type:"code-tag",raw:t,text:t,index:0},{type:"code-tagname",raw:n,text:n,index:t.length}];return Array.prototype.push.apply(f,u),f.push({type:"code-tag",raw:i,text:i,index:s}),f})},{exec:o=>hr(o,/^((?:<|<)\/)([\w-]+)(\s*(?:>|>))/,r=>{let e=r[1],t=r[2],n=r[3];return[{type:"code-tag",raw:e,text:e,index:0},{type:"code-tagname",raw:t,text:t,index:e.length},{type:"code-tag",raw:n,text:n,index:r.index+r[0].length-n.length}]})},{exec:o=>hr(o,/^(<|<)?((?!<|<).)+/,r=>{let e=r[0];return[{type:"text",raw:e,text:e}]})}],gp=[{exec:(o,r)=>hr(o,/^\/\/.*/,e=>{let t=e[0];return[{type:"code-comment",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^\/\*(?:(?!(\*\/))[\s\S])*(?:\*\/|$)/,e=>{let t=e[0];return[{type:"code-comment",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^('(\\'|[^'])*[^\\]?'|@?\$?"(\\"|[^"])*[^\\]?")/,e=>{let t=e[0];return[{type:"code-string",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^\b(abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|static|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|nameof|orderby|partial|remove|select|set|value|var|when|where|yield)\b/,e=>{let t=e[0];return[{type:"code-keyword",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^\b((0x[0-9a-fA-F]|[\d])*\.?[\d]+)\b/,e=>{let t=e[0];return[{type:"code-number",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^(@?\w+|:|\?\??|\?=?|\|\|?|&&?|&=?|;|,|=|\*=?|--|-=?|\+\+|\+=?|\/=?|\^|\(|\[|\)|\]|\{|\})/,e=>{let t=e[0];return[{type:"text",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^\s+/,e=>{let t=e[0];return[{type:"space",raw:t,text:t}]})}],Zw=[gp[0],gp[1],{exec:(o,r)=>hr(o,/^('(\\'|[^'])*[^\\]?'|"(\\"|[^"])*[^\\]?"|`(\\`|[^`])*[^\\]?`)/,e=>{let t=e[0];return[{type:"code-string",raw:t,text:t}]})},{exec:(o,r)=>hr(o,/^\b(abstract|any|arguments|async|await|boolean|break|byte|case|catch|char|class|const|continue|debugger|declare|default|delete|do|double|else|enum|eval|export|extends|false|final|finally|float|for|function|get|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|number|package|private|protected|public|return|short|static|string|super|switch|synchronized|this|throw|throws|transient|true|try|type|typeof|var|void|volatile|while|with|yield)\b/,e=>{let t=e[0];return[{type:"code-keyword",raw:t,text:t}]})},gp[4],gp[5],gp[6]],Qw={rule:{exec:o=>{let r=/\{tweet\}\(([^\)]+)\)/.exec(o);return r&&r.length>1?[{type:"tweet",raw:r[0],text:r[1],index:r.index}]:null}},type:"inline"},e0={rule:{exec:o=>{let r=/\{yt([\d]+x[\d]+)?\}\(([^\)]+)\)/.exec(o);if(r&&r.length>2){let t=(r[1]||"560x315").split("x"),n=t[0],i=t[1];return[{type:"youtube",raw:r[0],text:r[2],index:r.index,width:n,height:i}]}return null}},type:"inline"},t0=o=>{switch(o.type){case"youtube":return`<!-- youtube embed -->
|
|
538
538
|
<iframe width="${o.width}" height="${o.height}" src="https://www.youtube-nocookie.com/embed/${o.text}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>`;case"tweet":return`<!-- twitter embed -->
|
|
539
|
-
<${d}-tweetembed tweetid="${o.text}"></${d}-tweetembed>`;case"code-string":case"code-keyword":case"code-number":case"code-comment":case"code-tag":case"code-tagname":case"code-attribute":return`<span class="${o.type}">${o.text}</span>`}},hu=class{constructor(){let r=[
|
|
539
|
+
<${d}-tweetembed tweetid="${o.text}"></${d}-tweetembed>`;case"code-string":case"code-keyword":case"code-number":case"code-comment":case"code-tag":case"code-tagname":case"code-attribute":return`<span class="${o.type}">${o.text}</span>`}},hu=class{constructor(){let r=[Qw,e0];for(let e of["c-sharp","c","c#","csharp","c++","cpp"]){let t=gp.map(n=>({rule:n,lang:e,type:"code"}));Array.prototype.push.apply(r,t)}for(let e of["ts","js","typescript","javascript"]){let t=Zw.map(n=>({rule:n,lang:e,type:"code"}));Array.prototype.push.apply(r,t)}for(let e of["xml","html"]){let t=Jw.map(n=>({rule:n,lang:e,type:"code"}));Array.prototype.push.apply(r,t)}this.#e=r}#e;#t=new Gu.Markdown.Parser;_escape(r){return(r??"").replace(/</g,"<")}toHtml(r){return this.#t.toHtml(this._escape(r),this.#e,t0)}tokenize(r){return this.#t.tokenize(this._escape(r),this.#e)}};var vp=class extends R.PacemElement{constructor(e=new hu){super();this._md=e}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="value"&&(this.innerHTML=this.html())}tokens(e=this.value){return this._md.tokenize(e)}html(e=this.value){return this._md.toHtml(e)}};c([h({emit:!1,converter:m.String})],vp.prototype,"value",2),vp=c([C({tagName:d+"-markdown"})],vp);var Ms=class extends R.PacemElement{constructor(){super(...arguments);this._state={overlap:0,content:0}}connectedCallback(){super.connectedCallback();let e=this._css=document.createElement("style");document.head.appendChild(e)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="speed"&&this._adjust()}viewActivatedCallback(){super.viewActivatedCallback(),this._adjust()}disconnectedCallback(){a.isNull(this._css)||this._css.remove(),super.disconnectedCallback()}_overlapResize(e){this._state.overlap=e.detail.width,this._adjust()}_contentResize(e){this._state.content=e.detail.width,this._adjust()}_adjust(){let e=this._state;if(e.content>0&&e.overlap>0){let t=this._marquee,n="marquee-"+a.uniqueCode(),i=Math.round(e.overlap),s=-Math.round(e.content);this._css.innerHTML=`@keyframes ${n} {
|
|
540
540
|
0% {
|
|
541
541
|
transform: translateX(${i}px);
|
|
542
542
|
}
|
|
@@ -546,7 +546,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
546
546
|
}
|
|
547
547
|
}`;let l=this.speed||20,p=Math.max(l,Math.round(l*Math.abs(i-s)/1920));t.style.animationName=n,t.style.animationDuration=p+"s",t.style.animationIterationCount="infinite",t.style.animationTimingFunction="linear"}}};c([S(`.${b}-marquee`)],Ms.prototype,"_marquee",2),c([S(`.${b}-marquee-overlap`)],Ms.prototype,"_overlap",2),c([S(d+"-resize")],Ms.prototype,"_resizer",2),c([h({converter:m.Number})],Ms.prototype,"speed",2),Ms=c([C({tagName:d+"-marquee",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-marquee"><${d}-content></${d}-content></div><div class="${b}-marquee-overlap"></div>
|
|
548
548
|
<${d}-resize target="{{ :host._overlap }}" on-${R.ResizeEventName}=":host._overlapResize($event)"></${d}-resize>
|
|
549
|
-
<${d}-resize target="{{ :host._marquee }}" on-${R.ResizeEventName}=":host._contentResize($event)"></${d}-resize>`})],Ms);var
|
|
549
|
+
<${d}-resize target="{{ :host._marquee }}" on-${R.ResizeEventName}=":host._contentResize($event)"></${d}-resize>`})],Ms);var O_=768,r0=992,n0=1200,i0=1824,s0=1920,a0=2048,o0=3840,l0=`(max-width: ${O_-1}px)`,c0=`(min-width: ${O_}px)`,p0=`(min-width: ${r0}px)`,d0=`(min-width: ${n0}px)`,u0=`(min-width: ${i0}px)`,h0=`(min-width: ${s0}px)`,m0=`(min-width: ${a0}px)`,f0=`(min-width: ${o0}px)`,g0="(orientation: portrait)",v0="(orientation: landscape)",b0="(prefers-color-scheme: light)",y0="(prefers-color-scheme: dark)",mu,Sl=class extends K{constructor(){super(...arguments);z(this,mu);this._changeHandler=e=>{this.isMatch=e.matches}}viewActivatedCallback(){super.viewActivatedCallback(),this._init()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"query":i||this._init();break;case"isMatch":this._broadcastChange(n);break}}disconnectedCallback(){this._init(""),super.disconnectedCallback()}_broadcastChange(e=this.isMatch){this.dispatchEvent(new Event("change")),this.dispatchEvent(new Event(e?"match":"unmatch"))}_init(e=this.query){let t=M(this,mu);if(a.isNull(t)||t.removeEventListener("change",this._changeHandler),!a.isNullOrEmpty(e)){let n=H(this,mu,window.matchMedia(e));n.addEventListener("change",this._changeHandler),this.isMatch=n.matches}}};mu=new WeakMap,c([h({emit:!1,converter:m.String})],Sl.prototype,"query",2),c([h({reflectBack:!0,converter:m.Boolean})],Sl.prototype,"isMatch",2),Sl=c([C({tagName:d+"-media-query"})],Sl);var mr=class extends R.PacemElement{constructor(){super(...arguments);this.synchronizeShell=!0;this._stopPropagationHandlerConditional=e=>{if(!a.isNull(this._container)&&!a.isNull(this._base)){let t=a.offset(this._container),n=a.offset(this._base);t.width<n.width&&(this.open=!1)}}}viewActivatedCallback(){super.viewActivatedCallback(),this._container.addEventListener("click",Re,!1),this._container.addEventListener("scroll",Re,!1),this._sync()}disconnectedCallback(){window.removeEventListener("navigate",this._stopPropagationHandlerConditional,!1),a.isNull(this._container)||(this._container.removeEventListener("click",Re,!1),this._container.removeEventListener("scroll",Re,!1)),this._sync(!1),super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),window.addEventListener("navigate",this._stopPropagationHandlerConditional,!1),this._shell=A.findAncestorShell(this)}_toggle(e){Q(e),this.open=!this.open,this.dispatchEvent(new Event("toggle"))}_sync(e=this.open){this.synchronizeShell?(a.addClass(this,"menu-sync"),a.addClass(this._shell,b+(e===!0?"-menu-open":"-menu-close")),a.removeClass(this._shell,b+(e===!0?"-menu-close":"-menu-open"))):(a.removeClass(this,"menu-sync"),a.removeClass(this._shell,b+"-menu-close "+b+"-menu-open")),this.outset?a.addClass(this,"menu-outset"):a.removeClass(this,"menu-outset")}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="open"||e==="synchronizeShell"||e==="outset")&&this._sync()}};c([h({converter:m.Boolean})],mr.prototype,"open",2),c([h({converter:m.Boolean})],mr.prototype,"hideHamburgerButton",2),c([h({converter:m.Boolean})],mr.prototype,"hideBackButton",2),c([h({emit:!1,converter:m.Boolean})],mr.prototype,"outset",2),c([h({emit:!1,converter:m.Boolean})],mr.prototype,"synchronizeShell",2),c([S("nav")],mr.prototype,"_container",2),c([S(`.${b}-menu`)],mr.prototype,"_base",2),mr=c([C({tagName:d+"-menu",template:`<${d}-panel class="${b}-menu" css-class="{{ {'menu-close': !:host.open, 'menu-open': :host.open} }}" on-click=":host._toggle($event)">
|
|
550
550
|
<nav><${d}-content></${d}-content></nav>
|
|
551
551
|
</${d}-panel>
|
|
552
552
|
<${d}-shell-proxy>
|
|
@@ -562,12 +562,12 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
562
562
|
<div class="progressbar-track"><div class="progressbar-bar"></div></div>
|
|
563
563
|
<label class="progressbar-caption"></label>`})],Ri);var fu,Nl=class extends R.PacemElement{constructor(){super(...arguments);this.open=!1;this.synchronizeShell=!0;z(this,fu)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"open":case"synchronizeShell":this._sync();break}}disconnectedCallback(){this._sync(!1),super.disconnectedCallback()}_sync(e=this.open){let t=M(this,fu);this.synchronizeShell?(a.addClass(this,"sidebar-sync"),a.addClass(t,b+(e===!0?"-sidebar-open":"-sidebar-close")),a.removeClass(t,b+(e===!0?"-sidebar-close":"-sidebar-open"))):(a.removeClass(this,"sidebar-sync"),a.removeClass(t,b+"-sidebar-close "+b+"-sidebar-open"))}connectedCallback(){super.connectedCallback(),H(this,fu,A.findAncestorShell(this))}};fu=new WeakMap,c([h({converter:m.Boolean})],Nl.prototype,"open",2),c([h({emit:!1,converter:m.Boolean})],Nl.prototype,"synchronizeShell",2),Nl=c([C({tagName:d+"-sidebar",template:`<${d}-panel class="sidebar-drawer" part="drawer" css-part="{{ { 'open': :host.open } }}" css-class="{{ {'open': :host.open } }}">
|
|
564
564
|
<slot></slot>
|
|
565
|
-
</${d}-panel>`,shadow:!0})],Nl);var bp=class extends R.PacemIterableElement{};bp=c([C({tagName:d+"-slide"})],bp);var gu=class extends R.PacemIterativeElement{validate(r){return r instanceof bp}};gu=c([C({tagName:d+"-slideshow"})],gu);var yp=class extends R.PacemElement{constructor(){super(...arguments);this._scriptsLoaded=!1}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="tweetid"&&this._scriptsLoaded&&this._render()}viewActivatedCallback(){super.viewActivatedCallback(),A.importjs("https://platform.twitter.com/widgets.js").then(()=>{this._scriptsLoaded=!0,this._render()})}_render(){this.tweetid&&this._scriptsLoaded&&twttr.ready(e=>e.widgets.createTweet(this.tweetid,this))}};c([h({emit:!1,converter:m.String})],yp.prototype,"tweetid",2),yp=c([C({tagName:d+"-tweetembed"})],yp);var
|
|
565
|
+
</${d}-panel>`,shadow:!0})],Nl);var bp=class extends R.PacemIterableElement{};bp=c([C({tagName:d+"-slide"})],bp);var gu=class extends R.PacemIterativeElement{validate(r){return r instanceof bp}};gu=c([C({tagName:d+"-slideshow"})],gu);var yp=class extends R.PacemElement{constructor(){super(...arguments);this._scriptsLoaded=!1}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="tweetid"&&this._scriptsLoaded&&this._render()}viewActivatedCallback(){super.viewActivatedCallback(),A.importjs("https://platform.twitter.com/widgets.js").then(()=>{this._scriptsLoaded=!0,this._render()})}_render(){this.tweetid&&this._scriptsLoaded&&twttr.ready(e=>e.widgets.createTweet(this.tweetid,this))}};c([h({emit:!1,converter:m.String})],yp.prototype,"tweetid",2),yp=c([C({tagName:d+"-tweetembed"})],yp);var P_=(e=>(e.Persistent="persistent",e.QuickReturn="quickreturn",e))(P_||{}),Qa,vu,Tl,_p,Ls=class extends K{constructor(){super(...arguments);z(this,Qa);z(this,vu,{left:0,top:0});z(this,Tl);z(this,_p);this._scrollHandler=e=>{this.offset=e.detail}}_ensureScrollAwareElement(){if(a.isNull(M(this,Qa))){let e=H(this,Qa,new R.PacemScrollAwareElement);this.log(ce.LogLevel.Debug,"creating scroll aware "+M(this,Tl)),H(this,_p,A.findAncestorShell(this)).appendChild(e),e.dataset.target=M(this,Tl),e.addEventListener(R.ScrollEventName,this._scrollHandler,!1)}M(this,Qa).disabled=this.disabled}_manageOffsetChange(e=this.offset){if(this.disabled)return;let t=this.visibility||"persistent",n=M(this,vu).top,i=e.top,s=this.threshold||0,l=M(this,_p);n<=s&&i>s?(a.removeClass(l,"sticky-header-top"),a.addClass(l,"sticky-header-scroll"),t==="quickreturn"&&(a.addClass(l,"sticky-header-fade"),this.visible=!1)):n>s&&i<=s?(a.removeClass(l,"sticky-header-fade"),a.removeClass(l,"sticky-header-scroll"),a.addClass(l,"sticky-header-top")):n>s&&i>s&&n>i?(this.visible=!0,a.removeClass(l,"sticky-header-fade")):n>s&&i>s&&n<i&&t=="quickreturn"&&a.addClass(l,"sticky-header-fade"),H(this,vu,e)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"offset":this._manageOffsetChange(n);break;case"disabled":this._ensureScrollAwareElement();break}}connectedCallback(){super.connectedCallback(),H(this,Tl,this.id||"sticky-"+a.uniqueCode()),this._ensureScrollAwareElement()}disconnectedCallback(){let e=M(this,Qa),t=M(this,_p);a.isNull(e)||(this.log(ce.LogLevel.Debug,"disposing scroll aware "+M(this,Tl)),e.removeEventListener(R.ScrollEventName,this._scrollHandler,!1),e.remove(),H(this,Qa,void 0),a.removeClass(t,"sticky-header-fade"),a.removeClass(t,"sticky-header-top"),a.removeClass(t,"sticky-header-scroll")),super.disconnectedCallback()}};Qa=new WeakMap,vu=new WeakMap,Tl=new WeakMap,_p=new WeakMap,c([h({converter:m.Number,emit:!1})],Ls.prototype,"threshold",2),c([h({converter:m.Point})],Ls.prototype,"offset",2),c([h({converter:m.Boolean})],Ls.prototype,"visible",2),c([h({converter:m.String,emit:!1})],Ls.prototype,"visibility",2),Ls=c([C({tagName:d+"-sticky-header"})],Ls);var I_="tab-focus",_0={convert:(o,r)=>o.startsWith("#")?m.Element.convert(o,r):m.String.convert(o,r),convertBack:(o,r)=>o instanceof Node?m.Element.convertBack(o,r):m.String.convertBack(o,r),retryConversionWhenReady:!0},bu,Ns=class extends R.PacemIterableElement{constructor(){super("tab");this._slotChangeHandler=e=>{let t=M(this,bu),n=H(this,bu,this.content);this.dispatchEvent(new ue({propertyName:"content",currentValue:n,oldValue:t}))};z(this,bu)}viewActivatedCallback(){super.viewActivatedCallback(),this._slotLabel.addEventListener("slotchange",this._slotChangeHandler,!1)}disconnectedCallback(){let e=this._slotLabel;a.isNull(e)||e.removeEventListener("slotchange",this._slotChangeHandler,!1),super.disconnectedCallback()}get content(){return this.querySelectorAll("*[slot=label]")}};bu=new WeakMap,c([S("slot[name=label]")],Ns.prototype,"_slotLabel",2),c([h({converter:_0})],Ns.prototype,"label",2),c([h({converter:m.String})],Ns.prototype,"key",2),Ns=c([C({tagName:d+"-tab",shadow:!0,template:'<slot name="label" part="label"></slot><slot></slot>'})],Ns);var Oi=class extends R.PacemIterativeElement{constructor(e=new Bt.TweenService){super("tablist");this._tweener=e}_labelCallback(e,t){let n=e.content;if(n.length>0){let i="";return n.forEach(s=>{i+=s.outerHTML}),i}return e.label instanceof Node?e.label:`<span class="${e.key||"tab"}">${e.label}</span>`}_syncOrientation(e=this.orientation){a.isNull(this._defaultTabAdapter)||(this._defaultTabAdapter.orientation=e),a.isNull(this._tabs)||(e==="vertical"?a.addClass:a.removeClass)(this._tabs,"tabs-vertical")}_syncVisibility(e=this.index,t=-1){let i=this._container,s=i.clientHeight,l=getComputedStyle(i),p=l.boxSizing==="border-box"?0:parseInt(l.paddingTop)+parseInt(l.paddingBottom);i.style.height=s-p+"px";let u=0;for(let f of this.items||[])u===e?(a.addClass(f,"tab-in"),requestAnimationFrame(()=>{a.addClass(f,I_),a.removeClass(f,"tab-in"),a.addAnimationEndCallback(f,g=>{a.removeClass(g,"tab-previous tab-next");let v=a.offset(g).height;this._tweener.run(parseInt(i.style.height),v,100,0,Bt.Easings.sineOut,(y,_)=>{i.style.height=Math.round(_)+"px"}).then(y=>{i.style.height=""})},500)}),f.aria.attributes.set("selected","true")):(a.removeClass(f,"tab-previous tab-next"),a.addClass(f,u<e?"tab-previous":"tab-next"),u===t&&(a.addClass(f,"tab-out"),a.removeClass(f,I_),a.addAnimationEndCallback(f,g=>{a.removeClass(g,"tab-out")},500),f.aria.attributes.set("selected","false"))),u++}viewActivatedCallback(){super.viewActivatedCallback(),a.isNull(this.adapter)&&(this._syncOrientation(),this._syncVisibility(),this.adapter=this._defaultTabAdapter)}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"adapter":a.isNull(n)&&(this.adapter=this._defaultTabAdapter),this._isUsingDefaultTabAdapter=this.adapter===this._defaultTabAdapter;break;case"index":this._syncVisibility(n,t);break;case"orientation":this._syncOrientation(n);break}}validate(e){return e instanceof Ns}};c([S(d+"-adapter")],Oi.prototype,"_defaultTabAdapter",2),c([S("."+b+"-tabs")],Oi.prototype,"_tabs",2),c([S("."+b+"-tabs-content")],Oi.prototype,"_container",2),c([h()],Oi.prototype,"_isUsingDefaultTabAdapter",2),c([h({converter:m.String})],Oi.prototype,"orientation",2),Oi=c([C({tagName:d+"-tabs",shadow:!1,template:`<div class="${b}-tabs">
|
|
566
566
|
<${d}-adapter class="${b}-tabs-adapter" swipe-enabled="false" hide="{{ !:host._isUsingDefaultTabAdapter }}" label-callback="{{ :host._labelCallback }}"></${d}-adapter>
|
|
567
567
|
<div class="${b}-tabs-content">
|
|
568
568
|
<${d}-content></${d}-content>
|
|
569
569
|
</div>
|
|
570
|
-
</div>`})],Oi);var to,eo=class extends R.PacemSafeContentElement{constructor(){super(...arguments);z(this,to);this._contentChangeHandler=e=>{this._incoming.replaceChildren(...M(this,to)),a.addClass(this,"ticking"),a.addAnimationEndCallback(this._incoming,t=>{a.removeClass(this,"ticking"),this._outgoing.replaceChildren(...M(this,to))})}}_tickContent(e=this.content){if(typeof e=="number"&&(e=e.toLocaleString()),typeof e=="string"){let t=this.sanitize(e);H(this,to,this._buildMarkupNode(t))}else if(e instanceof Node){let t=this.sanitize(e);this.replaceChildren(...H(this,to,[t]))}else{let t=e.map(n=>this.sanitize(n));this.replaceChildren(...H(this,to,t))}}_buildMarkupNode(e){let t=document.createElement("template");return t.innerHTML=e,Array.from(t.content.childNodes)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="content"&&!i&&this._tickContent(n)}viewActivatedCallback(){super.viewActivatedCallback(),this._slot.addEventListener("slotchange",this._contentChangeHandler,!1);let e=this.content??this._slot.assignedNodes();this._tickContent(e)}disconnectedCallback(){let e=this._slot;a.isNull(e)||e.removeEventListener("slotchange",this._contentChangeHandler),super.disconnectedCallback()}};to=new WeakMap,c([S("slot")],eo.prototype,"_slot",2),c([S("div[part=ticker-outgoing]")],eo.prototype,"_outgoing",2),c([S("div[part=ticker-incoming]")],eo.prototype,"_incoming",2),eo=c([C({tagName:d+"-ticker",shadow:!0,template:'<div part="ticker-outgoing"></div><div part="ticker-incoming"></div><slot hidden></slot>'})],eo);var
|
|
570
|
+
</div>`})],Oi);var to,eo=class extends R.PacemSafeContentElement{constructor(){super(...arguments);z(this,to);this._contentChangeHandler=e=>{this._incoming.replaceChildren(...M(this,to)),a.addClass(this,"ticking"),a.addAnimationEndCallback(this._incoming,t=>{a.removeClass(this,"ticking"),this._outgoing.replaceChildren(...M(this,to))})}}_tickContent(e=this.content){if(typeof e=="number"&&(e=e.toLocaleString()),typeof e=="string"){let t=this.sanitize(e);H(this,to,this._buildMarkupNode(t))}else if(e instanceof Node){let t=this.sanitize(e);this.replaceChildren(...H(this,to,[t]))}else{let t=e.map(n=>this.sanitize(n));this.replaceChildren(...H(this,to,t))}}_buildMarkupNode(e){let t=document.createElement("template");return t.innerHTML=e,Array.from(t.content.childNodes)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="content"&&!i&&this._tickContent(n)}viewActivatedCallback(){super.viewActivatedCallback(),this._slot.addEventListener("slotchange",this._contentChangeHandler,!1);let e=this.content??this._slot.assignedNodes();this._tickContent(e)}disconnectedCallback(){let e=this._slot;a.isNull(e)||e.removeEventListener("slotchange",this._contentChangeHandler),super.disconnectedCallback()}};to=new WeakMap,c([S("slot")],eo.prototype,"_slot",2),c([S("div[part=ticker-outgoing]")],eo.prototype,"_outgoing",2),c([S("div[part=ticker-incoming]")],eo.prototype,"_incoming",2),eo=c([C({tagName:d+"-ticker",shadow:!0,template:'<div part="ticker-outgoing"></div><div part="ticker-incoming"></div><slot hidden></slot>'})],eo);var $_="pacem:toast:pops",rr=class extends R.PacemElement{constructor(){super(...arguments);this.autohide=!0;this.timeout=3e3;this._doHide=e=>{window.clearTimeout(this._handle),this.show=!1}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._doHide,!1)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),e==="show")if(n!==!0)a.removeClass(this,"toast-show"),a.addClass(this,"toast-hide"),this.dispatchEvent(new CustomEvent("close")),a.waitForAnimationEnd(this,1e3).then(()=>{a.removeClass(this,"toast-hide")});else{let s=A.getAttachedPropertyValue(rr,$_,0)-1;A.setAttachedPropertyValue(rr,$_,s),this.style.order=""+s,a.addClass(this,"toast-show"),this._show()}}disconnectedCallback(){this.removeEventListener("click",this._doHide,!1),super.disconnectedCallback()}_show(){window.clearTimeout(this._handle),!this.disabled&&this.autohide&&(this._handle=window.setTimeout(()=>{this.show=!1},this.timeout))}popup(){this.show?this._show():this.show=!0}static toast(e,t,n,i){var s=new rr;if(a.isNullOrEmpty(i?.cssClass))s.className="toast-"+t;else{let g=a.isArray(i.cssClass)?i.cssClass.join(" "):i.cssClass;a.addClass(s,g)}a.isNull(i?.autohide)||(s.autohide=i.autohide),i?.timeout>0&&(s.timeout=i.timeout);let l=document.createElement("i");l.className=b+"-icon text-bigger-steady "+b+"-margin margin-right-1 flex-auto";var p="info";switch(t){case"danger":case"error":p="error";break;case"warning":p="warning";break;case"success":p="check_circle";break}l.textContent=p;let u=document.createElement("div");a.addClass(u,"display-flex flex-stretch flex-start flex-nowrap"),u.appendChild(l);let f=document.createElement("span");return a.addClass(f,"text-small text-pre"),typeof n=="string"?f.innerHTML=n:f.appendChild(n),u.appendChild(f),s.appendChild(u),e.appendChild(s),new Promise((g,v)=>{window.setTimeout(()=>{s.popup()},100);let y=()=>{s.removeEventListener("close",y,!1),g(),a.waitForAnimationEnd(s,1e3).then(_=>{s.remove()})};s.addEventListener("close",y,!1)})}static toast2(e,t,n,i){let s=i?.cssClass,l=["fill-"+t+"-container","fill-glass","border-solid","border-size--2","border-round","border-radius--6"];return a.isNullOrEmpty(s)||(a.isArray(s)?Array.prototype.push.apply(l,s):Array.prototype.push.apply(l,s.split(" "))),rr.toast(e,t,n,a.extend({},i??{},{cssClass:l}))}};c([h({emit:!1,converter:m.Boolean})],rr.prototype,"autohide",2),c([h({emit:!1,converter:m.Number})],rr.prototype,"timeout",2),c([h({converter:m.Boolean})],rr.prototype,"show",2),c([Te("poptoast")],rr,"toast",1),c([Te("poptoastcontainer")],rr,"toast2",1),rr=c([C({tagName:d+"-toast"})],rr);var Ir=class extends R.PacemElement{constructor(e=new Bt.TweenService){super();this._tweener=e;this._items=[];this._scrollToSelf=e=>{this._scrollTo("#"+e.target.id)};this._hashChange=e=>{e.preventDefault(),this._scrollTo(window.location.hash,!1)}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"target":a.isNull(this._observer)||this._observe();break;case"selector":this.refresh();break}}connectedCallback(){super.connectedCallback(),window.addEventListener("hashchange",this._hashChange,!1)}disconnectedCallback(){window.removeEventListener("hashchange",this._hashChange,!1),a.isNull(this._observer)||this._observer.disconnect(),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._observer=new MutationObserver(e=>{this.refresh()}),this._observe()}_onScroll(e){this._update(a.scrollTop)}_observe(){this._observer.observe(this.target||document.body,{subtree:!0,childList:!0})}_getTop(e){return a.offset(e).top}_scrollTo(e,t=!0){if(/^#[^&=]+$/.test(e)){let n=!a.isNullOrEmpty(e)&&document.querySelector(e),i=!a.isNull(n)&&this._items.find(s=>s.dom===n);if(i&&!a.isNull(i.dom)){let s=this._getTop(i.dom)-(this.offset||0);if(t){let l=a.scrollTop;window.location.hash=i.dom.id,this._tweener.run(l,s,500,0,Bt.Easings.sineInOut,(p,u)=>{window.scrollTo(0,u)})}else window.scrollTo(0,s)}}}_startScrollTo(e,t){Q(t),this._scrollTo(e.url)}_update(e){let t=e+(this.offset||0);var n=this._items&&this._items.length>0&&this._items[0];for(var i of this._items)if(a.offset(i.dom).top<=t)n=i;else break;let s=[];for(var i of this._items)a.isNullOrEmpty(i.dom.id)&&(i.dom.id=i.dom.innerText.trim().replace(/[^a-zA-Z0-9]/g,"-").replace(/-*$/,"").replace(/^-*/,"").toLowerCase()),s.push({focus:i===n,label:i.dom.innerText,url:"#"+i.dom.id});a.isNull(this._repeater)||(this._repeater.datasource=s)}refresh(){for(let s of this._items)s.dom.removeEventListener("click",this._scrollToSelf,!1),a.removeClass(s.dom,b+"-toc-item");let e=this.selector;if(a.isNullOrEmpty(e)){this._repeater&&(this._repeater.datasource=[]),this.hasContent=!1;return}let t=(this.target||document).querySelectorAll(e),n=[];for(let s=0;s<t.length;s++){let l=t.item(s);l.addEventListener("click",this._scrollToSelf,!1),a.addClass(l,b+"-toc-item"),n.push({dom:l,top:this._getTop(l)})}this._items=n,this._update(a.scrollTop),this.hasContent=!a.isNullOrEmpty(n);let i=window.location.hash;a.isNullOrEmpty(i)||setTimeout(()=>{this._scrollTo(i,!0)},1e3)}};c([h({emit:!1,converter:m.String})],Ir.prototype,"selector",2),c([h({emit:!1,converter:m.Number})],Ir.prototype,"offset",2),c([h({emit:!1,converter:m.Element})],Ir.prototype,"target",2),c([h({converter:m.Element})],Ir.prototype,"router",2),c([h({converter:m.Boolean})],Ir.prototype,"hasContent",2),c([S(d+"-repeater")],Ir.prototype,"_repeater",2),c([me(100)],Ir.prototype,"_onScroll",1),c([me(250)],Ir.prototype,"refresh",1),Ir=c([C({tagName:d+"-toc",shadow:j.USE_SHADOW_ROOT,template:`<${d}-scroll-aware on-${R.ScrollEventName}=":host._onScroll($event)" url="{{ :host.url }}"></${d}-scroll-aware>
|
|
571
571
|
<${d}-repeater><nav class="${b}-toc"><template>
|
|
572
572
|
<${d}-a on-click=":host._startScrollTo(^item, $event)" router="{{ :host.router }}" css-class="{{ {'toc-focus': ^item.focus} }}" href="{{ ^item.url }}"><${d}-text text="{{ ^item.label }}"></${d}-text></${d}-a>
|
|
573
573
|
</template></nav></${d}-repeater>`})],Ir);var Nm=Math.PI*2;function _v(o,r,e,t){return{x:o+e*Math.cos(t),y:r+e*Math.sin(t)}}var yu,nr=class extends R.PacemElement{constructor(){super();z(this,yu);this.min=0;this.max=100;this._rotateStartHandler=e=>{let t=H(this,yu,this._getAngle(e)),n=this._rotate;n.minRotation=0-t,n.maxRotation=Nm-t,this._setValue(t)};this._rotateEndHandler=e=>{};this._rotateHandler=e=>{e.preventDefault();let t=e.detail.rotation+M(this,yu);this._setValue(t)}}viewActivatedCallback(){super.viewActivatedCallback();let e=this._rotate,t=this._tween;e.addEventListener(J.RotateEventType.Start,this._rotateStartHandler,!1),e.addEventListener(J.RotateEventType.Rotate,this._rotateHandler,!1),e.addEventListener(J.RotateEventType.End,this._rotateEndHandler,!1),e.register(this._canvas),this._toggleRotate(),requestAnimationFrame(()=>this._draw(this.min)),t.easing=Bt.Easings.sineInOut,t.delay=500+(Math.random()*100-100),t.start=this.value>this.min}disconnectedCallback(){let e=this._rotate,t=this._canvas;a.isNull(e)||(e.removeEventListener(J.RotateEventType.Rotate,this._rotateHandler,!1),a.isNull(t)||e.unregister(t)),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"interactive":this._toggleRotate(n),n?a.addClass(this,"tuner-interactive"):a.removeClass(this,"tuner-interactive");break;case"round":if(Math.round(n)!=n||n<0)throw`${this.constructor.name}: round value must be an integer greater or equal to zero.`;break;default:this._draw();break}}_toggleRotate(e=this.interactive){let t=this._rotate;a.isNull(t)||(t.disabled=!e)}_angleToValue(e){let t=Math.pow(10,this.round||0),n=this.min+e*(this.max-this.min)/Nm;return Math.round(t*n)/t}_valueToAngle(e=this.value??this.min){return Nm*(e-this.min)/(this.max-this.min)}_setValue(e){let t=this._angleToValue(e).clamp(this.min,this.max);t!=this.value&&(this.value=t,this.dispatchEvent(new Event("change")))}_getAngle(e){let t={vertex:e.detail.center,end:e.detail.currentPosition,start:{x:e.detail.center.x,y:e.detail.center.y-1}},n=Wn.value(t);return n>0?Nm-n:-n}_draw(e=this.value){if(this.disabled||a.isNull(this._rail))return;e=(isNaN(e)?this.min:e).clamp(this.min,this.max);let t=this._rail,n=this._counterRail,i=e===this.min,s=e===this.max;if(i||s){let l="M 50 50 m -50,0 a 50,50 0 1,1 100,0 a 50,50 0 1,1 -100,0";t.setAttribute("d",i?"":l),n.setAttribute("d",s?"":l)}else{let l=Math.PI*.5,p=_v(50,50,50,-l),u=this._valueToAngle(e),f=_v(50,50,50,-l+u),g=u>Math.PI?1:0,v=`M ${f.x} ${f.y} A 50 50 0 ${g} 0 ${p.x} ${p.y}`;t.setAttribute("d",v);let y=f,_=_v(50,50,50,3*l),w=this._valueToAngle(this.max-e)>Math.PI?1:0,E=`M ${_.x} ${_.y} A 50 50 0 ${w} 0 ${y.x} ${y.y}`;n.setAttribute("d",E)}}};yu=new WeakMap,c([S("svg")],nr.prototype,"_canvas",2),c([S("path[part=rail]")],nr.prototype,"_rail",2),c([S("path[part=complementary-rail]")],nr.prototype,"_counterRail",2),c([S(d+"-tween")],nr.prototype,"_tween",2),c([S(d+"-rotate")],nr.prototype,"_rotate",2),c([h({converter:m.Number})],nr.prototype,"value",2),c([h({emit:!1,converter:m.Number})],nr.prototype,"min",2),c([h({emit:!1,converter:m.Number})],nr.prototype,"max",2),c([h({emit:!1,converter:m.Boolean})],nr.prototype,"interactive",2),c([h({emit:!1,converter:m.Number})],nr.prototype,"round",2),nr=c([C({tagName:d+"-tuner",shadow:!0,template:`<svg xmlns="http://www.w3.org/2000/svg" class="${b}-tuner" part="tuner" viewBox="0 0 100 100">
|
|
@@ -576,14 +576,14 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
576
576
|
<path part="complementary-rail" />
|
|
577
577
|
</svg><div class="${b}-content" part="content"><slot></slot></div>
|
|
578
578
|
<${d}-rotate></${d}-rotate>
|
|
579
|
-
<${d}-tween on-step=":host._draw($event.detail.value)" on-end="this.disabled = true" duration="500" to="{{ :host.value }}" from="{{ :host.min }}"></${d}-tween>`})],nr);var xp=class extends K{vibrate(){if(this.disabled)return;let r=this.pattern;a.isNullOrEmpty(r)||typeof navigator.vibrate=="function"&&navigator.vibrate(r)}};c([h({emit:!1,converter:{convert:r=>r?.split(/[ ,]+/).map(e=>parseInt(e)),convertBack:r=>r?.join(" ")}})],xp.prototype,"pattern",2),xp=c([C({tagName:d+"-vibrate"})],xp);var
|
|
579
|
+
<${d}-tween on-step=":host._draw($event.detail.value)" on-end="this.disabled = true" duration="500" to="{{ :host.value }}" from="{{ :host.min }}"></${d}-tween>`})],nr);var xp=class extends K{vibrate(){if(this.disabled)return;let r=this.pattern;a.isNullOrEmpty(r)||typeof navigator.vibrate=="function"&&navigator.vibrate(r)}};c([h({emit:!1,converter:{convert:r=>r?.split(/[ ,]+/).map(e=>parseInt(e)),convertBack:r=>r?.join(" ")}})],xp.prototype,"pattern",2),xp=c([C({tagName:d+"-vibrate"})],xp);var H_=500,x0={convert:(o,r)=>{try{return document.querySelector(o)??(r.isConnected?o:null)}catch{return o}},convertBack:o=>o instanceof Element&&o.id?"#"+o.id:o,retryConversionWhenReady:!0},Cp,_u,Bn=class extends K{constructor(){super(...arguments);this._templateChangeHandler=e=>{let t=e.target;this._setTmpl(t.target)};z(this,Cp);z(this,_u);this._debounceDispatchHandler=e=>{clearTimeout(M(this,_u)),H(this,_u,setTimeout(()=>{if(e){let t=e.srcElement;t.removeEventListener(R.ResizeEventName,this._debounceDispatchHandler),t.remove()}this.dispatchEvent(new CustomEvent("render"))},100))}}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="url"||e==="disabled"?(this._dispose(t),this._manage()):e==="fetching"&&(n?a.addClass:a.removeClass)(this,"view-fetching")}viewActivatedCallback(){super.viewActivatedCallback();let e=this.url;this._isReference(e)&&!this.disabled&&this._manageRef()}_isReference(e){return e instanceof HTMLElement||typeof e=="string"&&e.trim().startsWith("#")}_dispose(e){e instanceof R.PacemTemplateProxyElement&&e.removeEventListener("templatechange",this._templateChangeHandler)}_manage(){if(this.disabled)return;let e=this.debounce||0,t=this.url;this._isReference(t)?(clearTimeout(this._fetchHandle),this._fetchHandle=setTimeout((()=>this._manageRef()),e)):typeof t=="string"&&!a.isNullOrEmpty(t)?(this.fetching=!0,clearTimeout(this._fetchHandle),this._fetchHandle=setTimeout((()=>this._manageUrl(t)),e)):this.innerHTML=""}_manageRef(){let e=this.url,t=e instanceof HTMLElement?e:document.querySelector("template"+e);t instanceof R.PacemTemplateProxyElement?(t.addEventListener("templatechange",this._templateChangeHandler,!1),this._setTmpl(t.target)):t instanceof HTMLTemplateElement?this._setTmpl(t):a.isNull(t)?this.log(ce.LogLevel.Error,"Template element not found."):this.log(ce.LogLevel.Error,`Invalid '${t.constructor.name}' element, HTMLTemplate expected.`)}_setTmpl(e){cancelAnimationFrame(this._renderHandle),this.innerHTML="",this._dispatchPrerender(),this._renderHandle=requestAnimationFrame(()=>{if(a.isNull(e)){this.log(ce.LogLevel.Error,"Template element not found.");return}this.appendChild(e.cloneNode(!0).content),this._dispatchRender()})}_manageUrl(e){M(this,Cp)&&M(this,Cp).abort();let{signal:t}=H(this,Cp,new AbortController);fetch(e,{credentials:"same-origin",signal:t}).then(async n=>{let i=(l,p)=>{(l.status===301||l.status===302)&&this.followRedirects?this._manageUrl(l.headers.get("Location")):l.ok||this.renderErrors?p.then(u=>a.addAnimationEndCallback(this,()=>this._manageResult(u),H_)):this._manageResult("")},s=+n.headers.get("Content-Length");if(s>0){this.progress=0;let l=0,p=[],u=n.body.getReader();for(;;){let{done:f,value:g}=await u.read();if(f)break;this.progress=(l+=g.length)/s,p.push(g)}i(n,new Promise((f,g)=>{try{let v=new Uint8Array(l),y=0;for(let x of p)v.set(x,y),y+=x.length;let _=new TextDecoder("utf-8").decode(v);f(_)}catch(v){g(v)}}))}else i(n,n.text())},n=>{})}_manageResult(e){cancelAnimationFrame(this._renderHandle),this.scrollTo({top:0,left:0,behavior:"instant"}),this.innerHTML="",this._dispatchPrerender(),this._renderHandle=requestAnimationFrame(()=>{this.innerHTML=e,this.fetching=!1,this.progress=Number.NaN,a.addAnimationEndCallback(this,()=>{this._dispatchRender()},H_)})}_dispatchRender(){let e=new R.PacemResizeElement;e.target=this,e.addEventListener(R.ResizeEventName,this._debounceDispatchHandler),A.findAncestorShell(this).appendChild(e),this._debounceDispatchHandler()}_dispatchPrerender(){this.dispatchEvent(new CustomEvent("prerender"))}};Cp=new WeakMap,_u=new WeakMap,c([h({reflectBack:!0,converter:x0})],Bn.prototype,"url",2),c([h()],Bn.prototype,"fetching",2),c([h()],Bn.prototype,"progress",2),c([h({emit:!1,converter:m.Boolean})],Bn.prototype,"renderErrors",2),c([h({emit:!1,converter:m.Boolean})],Bn.prototype,"followRedirects",2),c([h({emit:!1,converter:m.Number})],Bn.prototype,"debounce",2),Bn=c([C({tagName:d+"-view"})],Bn);var B_="window-title",xu=class extends R.PacemIterativeElement{constructor(){super(...arguments);this._zIndex=1;this._startHandler=e=>{this._incrementZIndex(e.detail.element),a.addClass(e.detail.element,"window-rescaling")};this._blurHandler=e=>{a.removeClass(e.detail.element,"window-rescaling")};this._focusHandler=e=>{this._incrementZIndex(e.currentTarget)};this._itemPropertyChangeHandler=e=>{if(e.detail.propertyName==="floating"&&e.detail.currentValue===!1){let t=e.currentTarget,n=this.items.indexOf(t);a.addClass(t,"docking-in"),this.adapter.select(n),a.addAnimationEndCallback(t,i=>{a.removeClass(i,"docking-in")},150)}};this._adapterPagerCallback=e=>{let t=e.detail.index,n=this.items[t];e.detail.hide=n.hide||n.floating}}validate(e){return e instanceof Ts}_incrementZIndex(e){this._zIndex!=parseInt(e.style.zIndex)&&(e.style.zIndex=""+ ++this._zIndex)}connectedCallback(){super.connectedCallback();let e=A.findAncestorShell(this);this._behaviors=[e.appendChild(this._dragDrop=document.createElement(d+"-drag-drop")),e.appendChild(this._rescale=document.createElement(d+"-rescale"))],this._dragDrop.handleSelector="."+B_,this._rescale.addEventListener(J.RescaleEventType.Start,this._startHandler,!1),this._rescale.addEventListener(J.RescaleEventType.End,this._blurHandler,!1)}viewActivatedCallback(){if(super.viewActivatedCallback(),a.isNull(this.adapter)){let e=this.adapter=this.appendChild(document.createElement(d+"-adapter"));a.addClass(e,"windows-adapter"),e.labelCallback=(t,n)=>t.caption,e.swipeEnabled=!1,e.deselectable=!0,e.initialize(this)}this.adapter.addEventListener(su,this._adapterPagerCallback,!1)}disconnectedCallback(){a.isNull(this.adapter)||(this.adapter.removeEventListener(su,this._adapterPagerCallback,!1),this.adapter.remove(),this.adapter=null),this._rescale.removeEventListener(J.RescaleEventType.End,this._blurHandler,!1),this._rescale.removeEventListener(J.RescaleEventType.Start,this._startHandler,!1);for(let e of this._behaviors)e.remove();super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="index"&&this._syncVisibility()}register(e){let t=super.register(e);if(t){e.addEventListener(ee,this._itemPropertyChangeHandler,!1),e.addEventListener("mousedown",this._focusHandler,!1);for(let n of this._behaviors)e.behaviors.indexOf(n)===-1&&e.behaviors.push(n)}return t}unregister(e){let t=super.unregister(e);if(t){e.removeEventListener(ee,this._itemPropertyChangeHandler,!1),e.removeEventListener("mousedown",this._focusHandler,!1);for(let n of this._behaviors){let i=e.behaviors.indexOf(n);i>=0&&e.behaviors.splice(i,1)}}return t}_syncVisibility(){let e=0,t=this.items??[];for(let n of t)e===this.index?a.addClass(n,"dock-open"):a.removeClass(n,"dock-open"),e++}};xu=c([C({tagName:d+"-window-area"})],xu);var Ts=class extends R.PacemIterableElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),(r==="minimized"||r==="floating")&&this._syncLayout()}viewActivatedCallback(){super.viewActivatedCallback(),this._syncLayout()}_syncLayout(){(this.minimized?a.addClass:a.removeClass).apply(this,[this,"window-min"]),(this.floating?a.removeClass:a.addClass).apply(this,[this,"window-dock"])}};c([h({converter:m.String})],Ts.prototype,"caption",2),c([h({converter:m.Boolean})],Ts.prototype,"minimized",2),c([h({converter:m.Boolean})],Ts.prototype,"floating",2),Ts=c([C({tagName:d+"-window",shadow:j.USE_SHADOW_ROOT,template:`<div class="${B_}">
|
|
580
580
|
<${d}-text text="{{ :host.caption || 'Window' }}"></${d}-text>
|
|
581
581
|
</div>
|
|
582
582
|
<div class="window-buttons ${b}-buttonset"><div class="buttonset-right">
|
|
583
583
|
<${d}-button class="button" on-click=":host.minimized = !:host.minimized" icon-glyph="{{ :host.minimized ? 'maximize' : 'minimize' }}" hide="{{ !:host.floating }}"></${d}-button>
|
|
584
584
|
<${d}-button class="button" on-click=":host.floating = !:host.floating" css-class="{{ {'buttonset-first': !:host.floating} }}" icon-glyph="{{ :host.floating? 'lock_open' : 'lock' }}"></${d}-button>
|
|
585
585
|
</div></div>
|
|
586
|
-
<div class="window-content"><${d}-content></${d}-content></div>`})],Ts);var
|
|
586
|
+
<div class="window-content"><${d}-content></${d}-content></div>`})],Ts);var C0={convert:(o,r)=>/\{.+\}/.test(o)?m.Json.convert(o):m.String.convert(o),convertBack:(o,r)=>typeof o=="string"?o:m.Json.convertBack(o,r)};function E0(){let o="";for(let r=0;r<12;r++)o+=`<div class="calendar-month month-${r+1}"><${d}-span class="month-button text-ellipsed" on-click=":host._setMonth(${r})" css-class="{{ { 'selected-month': :host._isSelectedMonth(${r}, :host.month, :host.viewYear), 'this-month': :host._isThisMonth(${r}, :host.viewYear) } }}" text="{{ :host._getMonthLabel(${r}) }}"></${d}-span></div>`;return o}var Al=class extends R.PacemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="viewYear"&&(this.dispatchEvent(new CustomEvent("viewyearchange",{detail:new Date(t,0,1),bubbles:!1,cancelable:!1})),a.removeClass(this,"viewyear-next viewyear-previous"),requestAnimationFrame(()=>{a.addClass(this,e>t?"viewyear-previous":"viewyear-next")}))}_getMonthLabel(r){let e=new Date().getFullYear();return new Date(e,r,1).toLocaleString(a.lang(this),{month:"short"})}_isThisMonth(r,e=this.viewYear){return this._isSelectedMonth(r,new Date,e)}_isSelectedMonth(r,e=this.month,t=this.viewYear){let n=a.parseDate(e);if(!a.Dates.isDate(n))return!1;let i=t??new Date().getFullYear();return n.getMonth()===r&&n.getFullYear()===i}_setMonth(r){let e=this.viewYear,t=new Date(e,r,1);this.month=t,this.dispatchEvent(new CustomEvent("monthselect",{detail:t,bubbles:!1,cancelable:!1}))}};c([h({converter:m.Date})],Al.prototype,"month",2),c([h({converter:m.Date})],Al.prototype,"viewYear",2),Al=c([C({tagName:d+"-calendar-month-picker",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-month-picker">${E0()}</div>`})],Al);var Cu=class extends ie.UI.DateSelectEvent{constructor(){super(void 0)}},V_=12;function w0(){let o="";for(let r=0;r<V_;r++)o+=`<div class="calendar-year year-${r+1}"><${d}-span class="year-button text-ellipsed" on-click=":host._setYear(${r})" css-class="{{ { 'selected-year': :host._isSelectedYear(${r}, :host.year, :host.viewYear), 'this-year': :host._isThisYear(${r}, :host.viewYear) } }}" text="{{ :host._getYearLabel(${r}, :host.viewYear) }}"></${d}-span></div>`;return o}function Am(o){let r=o%10;return o-r}var Dl=class extends R.PacemElement{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),r==="viewYear"&&(this.dispatchEvent(new CustomEvent("viewyearchange",{detail:new Date(t,0,1),bubbles:!1,cancelable:!1})),a.removeClass(this,"viewyear-next viewyear-previous"),requestAnimationFrame(()=>{a.addClass(this,e>t?"viewyear-previous":"viewyear-next")}))}_getYearLabel(r,e=this.viewYear){return""+(Am(e)+r)}_isThisYear(r,e=this.viewYear){return this._isSelectedYear(r,new Date,e)}_isSelectedYear(r,e=this.year,t=this.viewYear){let n=a.parseDate(e);if(!a.Dates.isDate(n))return!1;let i=Am(t),s=i+r;return n.getFullYear()===s}_setYear(r){let e=this.viewYear,t=Am(e),n=new Date(t+r,0,1);this.year=n,this.dispatchEvent(new CustomEvent("yearselect",{detail:n,bubbles:!1,cancelable:!1}))}};c([h({converter:m.Date})],Dl.prototype,"year",2),c([h({converter:m.Date})],Dl.prototype,"viewYear",2),Dl=c([C({tagName:d+"-calendar-year-picker",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-year-picker">${w0()}</div>`})],Dl);function k0(){let o="";for(let r=0;r<7;r++)o+=`<${d}-span class="calendar-heading day-${r+1} text-ellipsed" text="{{ :host._getHeaderLabel(:host._week[${r}]) }}"></${d}-span>`;return`<${d}-panel hide="{{ :host.viewmode !== 'calendar' }}" class="calendar-header">${o}</${d}-panel>`}var Ep,ir=class extends _e{constructor(){super(...arguments);this.viewmode="calendar";z(this,Ep,!1);this._swipeHandler=e=>{switch(e.detail.direction){case"left":this._next(e);break;case"right":this._prev(e);break}};this._clearBtnHandler=e=>{e.preventDefault(),this._viewDate=new Date,this.changeHandler(new Cu)};this._viewDateChangeHandler=e=>{this._onViewDateChange(e)};this._popCalendarHandler=e=>{if(M(this,Ep))return;this.viewmode="calendar";let t=a.parseDate(this.value);this._calendar.viewDate=this._monthPicker.month=this._yearPicker.year=a.Dates.isDate(t)?t:this._calendar.viewDate;let n=a.offset(this._input),i=this._dropdown;i.style.top=n.top+n.height+"px",i.style.left=n.left+"px",i.hidden=!1,requestAnimationFrame(()=>{a.addClass(i,"dropdown-in")})};this._hideCalendarHandler=e=>{let t=e.composedPath()||[];t.indexOf(this._input)>=0||t.indexOf(this._dropdown)>=0||this._hideCalendar()}}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"viewmode":case"_viewDate":this._onViewDateChange(this._viewDate);break}}viewActivatedCallback(){super.viewActivatedCallback();let e=this._dropdown=this._proxy.dom[0],t=this._calendar=e.querySelector(d+"-calendar"),n=this._monthPicker=e.querySelector(d+"-calendar-month-picker"),i=this._yearPicker=e.querySelector(d+"-calendar-year-picker");this._monthLabel=e.querySelector(".calendar-month"),this._yearLabel=e.querySelector(".calendar-year"),this._rangeLabel=e.querySelector(".calendar-year-range");let s=this._calendar.now=new Date,l=a.Dates.parse(this.value),u=a.Dates.isDate(l)?l:s;t.dayLabelFormatter=y=>a.parseDate(y).toLocaleString(a.lang(this),{day:"numeric"}),n.addEventListener("viewyearchange",this._viewDateChangeHandler,!1),i.addEventListener("viewyearchange",this._viewDateChangeHandler,!1),t.addEventListener("viewdatechange",this._viewDateChangeHandler,!1),t.viewDate=u,t.date=l;let f=this._input;f.addEventListener("focus",this._popCalendarHandler,!1),f.addEventListener("mousedown",this._popCalendarHandler,!1),e.addEventListener("mousedown",Re,!1),window.document.body.addEventListener("mousedown",this._hideCalendarHandler,!0),this._clearButton.addEventListener("mousedown",this._clearBtnHandler,!1);let g=new R.PacemSwipeElement;t.behaviors.push(g),n.behaviors.push(g),i.behaviors.push(g),g.addEventListener("swipe",this._swipeHandler,!1);let v=A.findAncestorShell(this);this._swiper=v.appendChild(g)}disconnectedCallback(){let e=this._input;a.isNull(e)||(this._clearButton.removeEventListener("mousedown",this._clearBtnHandler,!1),e.removeEventListener("focus",this._popCalendarHandler,!1),e.removeEventListener("mousedown",this._popCalendarHandler,!1),this._dropdown.removeEventListener("mousedown",Re,!1),window.document.body.removeEventListener("mousedown",this._hideCalendarHandler,!0),this._calendar.removeEventListener("viewdatechange",this._viewDateChangeHandler,!1),this._monthPicker.removeEventListener("viewyearchange",this._viewDateChangeHandler,!1),this._yearPicker.removeEventListener("viewyearchange",this._viewDateChangeHandler,!1));let t=this._swiper;if(!a.isNull(t)){let n=this._calendar,i=this._monthPicker,s=this._yearPicker;for(let l of[n,i,s]){let p=l.behaviors,u=p.indexOf(t);u>=0&&l.behaviors.splice(u,1)}t.removeEventListener("swipe",this._swipeHandler,!1),t.remove(),this._swiper=null}super.disconnectedCallback()}_getHeaderLabel(e,t=this.viewmode){let n=a.parseDate(e);return a.Dates.isDate(n)?n.toLocaleString(a.lang(this),{weekday:"narrow"}):"..."}_prev(e){let t=-1;switch(this.viewmode){case"month":t=-12;break;case"year":t=-120;break}this._jumpMonths(t)}_next(e){let t=1;switch(this.viewmode){case"month":t=12;break;case"year":t=120;break}this._jumpMonths(t)}_jumpMonths(e){let t=a.parseDate(this._viewDate);this._viewDate=a.Dates.addMonths(t,e)}_setMonth(e){this._viewDate=e.detail,this.viewmode="calendar"}_setYear(e){this._viewDate=e.detail,this.viewmode="month"}_onViewDateChange(e){if(a.isNullOrEmpty(e))return;let t=a.parseDate(this._viewDate);if(a.Dates.isDate(t)&&!a.isNull(this._monthLabel))switch(this.viewmode){case"month":this._yearLabel.text=t.toLocaleString(a.lang(this),{year:"numeric"});break;case"year":let n=Am(t.getFullYear());this._rangeLabel.text=`${n} - ${n+V_-1}`;break;default:this._monthLabel.text=t.toLocaleString(a.lang(this),{month:"long",year:"numeric"});break}}_hideCalendar(){a.removeClass(this._dropdown,"dropdown-in"),a.addAnimationEndCallback(this._dropdown,e=>{this._dropdown.hidden=!0,a.removeClass(this._dropdown,"dropdown-select")},250)}get inputFields(){return[this._input]}toggleReadonlyView(e){this.isReady&&(this._input.readOnly=!0,this._input.hidden=e,this._span.hide=!e)}onChange(e){return new Promise((t,n)=>{de.isInstanceOf(e,ie.UI.DateSelectEvent)?(a.addClass(this._dropdown,"dropdown-select"),de.isInstanceOf(e,Cu)&&H(this,Ep,!0),this.focus(),H(this,Ep,!1),this._hideCalendar(),t(this.value=e.detail)):t(this.value)})}acceptValue(e){this._input.value=this.viewValue;let t=this._calendar;if(!a.isNull(t)){let n=a.parseDate(e);a.Dates.isDate(n)?t.viewDate=t.date=n:t.date=void 0}}getViewValue(e){let t=a.Dates.parse(e);return a.Dates.isDate(t)?a.core.date(t,this.format||"short",a.lang(this)):""}compareValuePropertyValues(e,t){let n=a.parseDate(e),i=a.parseDate(t);return a.isNullOrEmpty(n)&&a.isNullOrEmpty(i)?!0:a.isNullOrEmpty(n)||a.isNullOrEmpty(i)?!1:n.valueOf()==i.valueOf()}convertValueAttributeToProperty(e){return m.Datetime.convert(e)}};Ep=new WeakMap,c([S("input[type=text]")],ir.prototype,"_input",2),c([S(`.${b}-readonly`)],ir.prototype,"_span",2),c([S(`${d}-button[clear]`)],ir.prototype,"_clearButton",2),c([S(d+"-shell-proxy")],ir.prototype,"_proxy",2),c([h({emit:!1,converter:C0})],ir.prototype,"format",2),c([h({converter:m.Eval})],ir.prototype,"disabledRanges",2),c([h({converter:m.String})],ir.prototype,"weekStart",2),c([h({converter:m.String})],ir.prototype,"viewmode",2),c([h()],ir.prototype,"_week",2),c([h()],ir.prototype,"_viewDate",2),ir=c([C({tagName:d+"-calendar-picker",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-calendar-picker">
|
|
587
587
|
<input type="text" class="${b}-input" /><${d}-span text="{{ :host.viewValue }}" class="${b}-readonly"></${d}-span>
|
|
588
588
|
<${d}-button class="button-flat ${b}-anim anim-pop anim-sudden anim-quick pos-absolute absolute-right absolute-top display-block ${b}-margin margin-0"
|
|
589
589
|
tab-order="-1"
|
|
@@ -606,7 +606,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
606
606
|
<${d}-button class="button button-size size-auto" on-click=":host._next($event)" icon-glyph="chevron_right"></${d}-button>
|
|
607
607
|
</div>
|
|
608
608
|
</div>
|
|
609
|
-
${
|
|
609
|
+
${k0()}
|
|
610
610
|
<${d}-calendar hide="{{ :host.viewmode !== 'calendar' }}" week="{{ :host._week, twoway }}" view-date="{{ :host._viewDate, twoway }}" week-start="{{ :host.weekStart }}" disabled-ranges="{{ :host.disabledRanges }}" on-dateselect="{{ :host.changeHandler($event) }}"></${d}-calendar>
|
|
611
611
|
<${d}-calendar-month-picker hide="{{ :host.viewmode !== 'month' }}" on-monthselect=":host._setMonth($event)" month="{{ :host.value || Date.now() }}" view-year="{{ :host._viewDate && :host._viewDate.getFullYear() }}"></${d}-calendar-month-picker>
|
|
612
612
|
<${d}-calendar-year-picker hide="{{ :host.viewmode !== 'year' }}" on-yearselect=":host._setYear($event)" year="{{ :host.value || Date.now() }}" view-year="{{ :host._viewDate && :host._viewDate.getFullYear() }}"></${d}-calendar-year-picker>
|
|
@@ -641,7 +641,7 @@ on-${ee}=":host._selectionChanged($event, ^index, ^item)" on-change=":host.chang
|
|
|
641
641
|
<${d}-drag-drop floater="{{ ::_floater }}" disabled="{{ :host.lockItems }}"
|
|
642
642
|
on-${J.DragDropEventType.Start}=":host._dragStart($event)"
|
|
643
643
|
on-${J.DragDropEventType.End}=":host._dragEnd($event)"
|
|
644
|
-
drop-behavior="${J.DropBehavior.InsertChild}" mode="${J.DragDataMode.Alias}" handle-selector=".drag-handle" drop-targets="{{ [::_container] }}"></${d}-drag-drop>`})],fr);var
|
|
644
|
+
drop-behavior="${J.DropBehavior.InsertChild}" mode="${J.DragDataMode.Alias}" handle-selector=".drag-handle" drop-targets="{{ [::_container] }}"></${d}-drag-drop>`})],fr);var M0={convert:(o,r)=>/\{.+\}/.test(o)?m.Json.convert(o):m.String.convert(o),convertBack:(o,r)=>typeof o=="string"?o:m.Json.convertBack(o,r)},Ye=class extends _e{constructor(){super();this.precision="day";this._months=[];this._dates=[];this._a24=[];this._a60=[];this._years=[];this.hours="00";this.minutes="00";this.seconds="00"}get inputFields(){return[this._yearel,this._monthel,this._dateel,this._hourel,this._minel,this._secel]}toggleReadonlyView(e){this._allFields.hidden=e}convertValueAttributeToProperty(e){return m.Datetime.convert(e)}connectedCallback(){super.connectedCallback();let e=new Date,t=this.year=e.getFullYear();this.min=new Date(t-100,0,1),this.max=new Date(t+10,11,31),this.month=e.getMonth();let n=[],i=[],s=[],l=a.leftPad;for(let p=0;p<12;p++){let u=new Date(t,p,1),f=u.toLocaleString(a.lang(this),{month:"short"});n.push({value:p,date:u,label:f})}this._months=n;for(let p=0;p<24;p++)i.push(l(p,2,"0"));this._a24=i;for(let p=0;p<60;p++)s.push(l(p,2,"0"));this._a60=s}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"dateValue":this.log(ce.LogLevel.Log,`dateValue changed from ${t} to ${n}`),this._disassembleDate(n);break;case"min":case"max":!a.isNullOrEmpty(this.min)&&!a.isNullOrEmpty(this.max)&&this._setupYears();break;case"year":case"month":this._buildupDates();break;case"date":case"hours":case"minutes":case"seconds":this._buildup();break}}acceptValue(e){this.dateValue=a.parseDate(e)}_disassembleDate(e){if(!e){this.date=void 0;return}typeof e=="string"&&(e=a.parseDate(e));let t=n=>a.leftPad(n,2,"0");this.year=e.getFullYear(),this.month=e.getMonth(),this.date=e.getDate(),this.hours=t(e.getHours()),this.minutes=t(e.getMinutes()),this.seconds=t(e.getSeconds())}_setupYears(){let e=[],t=a.parseDate(this.min),n=a.parseDate(this.max);for(let i=t.getFullYear();i<=n.getFullYear();i++)e.push(i);this._years=e}onChange(e){return new Promise((t,n)=>{t(this.value=this._computeValue())})}_buildupDates(e){e&&e.stopPropagation();let t=this,n={weekday:"short",day:"numeric"},i=l=>{try{let p=+t.month;return new Date(+t.year,+t.month,l).getMonth()==p}catch{return!1}};var s=[];if(!a.isNullOrEmpty(t.year)&&!a.isNullOrEmpty(t.month)){let l=1;do{let p=new Date(+t.year,+t.month,l),u=p.toLocaleString(a.lang(this),n);s.push({value:l,date:p,label:u,disabled:p<this.min||p>this.max})}while(i(++l))}this._dates=s,i(+this.date)?this._buildup():this.date=""}_computeValue(){let e=this;if(a.isNullOrEmpty(e.year)||a.isNullOrEmpty(e.month)||a.isNullOrEmpty(e.date))return null;try{let t=new Date(+e.year,+e.month,+e.date);return t.setHours(+e.hours),t.setMinutes(+e.minutes),t.setSeconds(+e.seconds),t.setMilliseconds(0),Number.isNaN(t.valueOf())?null:t}catch{return null}}_buildup(e){e&&e.stopPropagation(),this.dateValue=this._computeValue()}getViewValue(e){let t=e;return t?a.core.date(t,this.format||(this.precision!="day"?"full":"short"),a.lang(this)):""}};c([S("."+b+"-datetime-picker-year > "+d+"-select")],Ye.prototype,"_yearel",2),c([S("."+b+"-datetime-picker-month > "+d+"-select")],Ye.prototype,"_monthel",2),c([S("."+b+"-datetime-picker-date > "+d+"-select")],Ye.prototype,"_dateel",2),c([S("."+b+"-datetime-picker-hours > "+d+"-select")],Ye.prototype,"_hourel",2),c([S("."+b+"-datetime-picker-minutes > "+d+"-select")],Ye.prototype,"_minel",2),c([S("."+b+"-datetime-picker-seconds > "+d+"-select")],Ye.prototype,"_secel",2),c([S(`div.${b}-datetime-picker-fields`)],Ye.prototype,"_allFields",2),c([h({converter:m.Datetime})],Ye.prototype,"dateValue",2),c([h({converter:m.Datetime})],Ye.prototype,"min",2),c([h({converter:m.Datetime})],Ye.prototype,"max",2),c([h({converter:m.String})],Ye.prototype,"precision",2),c([h({emit:!1,converter:M0})],Ye.prototype,"format",2),c([h()],Ye.prototype,"_dates",2),c([h()],Ye.prototype,"_years",2),c([h()],Ye.prototype,"year",2),c([h()],Ye.prototype,"month",2),c([h()],Ye.prototype,"date",2),c([h()],Ye.prototype,"hours",2),c([h()],Ye.prototype,"minutes",2),c([h()],Ye.prototype,"seconds",2),c([me(10)],Ye.prototype,"_buildup",1),Ye=c([C({tagName:d+"-datetime-picker",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-datetime-picker">
|
|
645
645
|
<div class="${b}-datetime-picker-fields ${b}-viewfinder">
|
|
646
646
|
|
|
647
647
|
<div class="${b}-datetime-picker-year">
|
|
@@ -676,22 +676,22 @@ on-${ee}=":host._selectionChanged($event, ^index, ^item)" on-change=":host.chang
|
|
|
676
676
|
</dl>
|
|
677
677
|
</${d}-panel>
|
|
678
678
|
<${d}-span class="${b}-readonly" css-class="{{ { 'date': :host.precision === 'day', 'datetime': :host.precision !== 'day' } }}" content="{{ :host.viewValue }}" hide="{{ !:host.readonly }}"></${d}-span>
|
|
679
|
-
</div>`})],Ye);var Gt=class extends On{constructor(){super()}viewActivatedCallback(){super.viewActivatedCallback(),a.addClass(this,b+"-validator")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.form;switch(r){case"watch":e&&i&&i.unregisterValidator(t,this),i&&i.registerValidator(t,this);break;case"invalid":break;case"form":let s=this.watch;a.isNullOrEmpty(s)||(e?.unregisterValidator(s,this),t?.registerValidator(s,this));break;case"disabled":this.triggerFormFieldValidation();break}}#e;triggerFormFieldValidation(){let r=this.form,e=this.watch;!a.isNull(r)&&!a.isNullOrEmpty(e)&&(cancelAnimationFrame(this.#e),this.#e=requestAnimationFrame(()=>{r.validate(e)}))}validate(r){return this.disabled?a.fromResult(!0):this.evaluate(r)}};c([h({converter:m.Boolean})],Gt.prototype,"invalid",2),c([h({converter:m.String})],Gt.prototype,"errorMessage",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Gt.prototype,"watch",2);var Is=`<${d}-span part="error-message" hide="{{ !:host.invalid }}" text="{{ :host.errorMessage }}"></${d}-span>`;function so(o){return a.isNullOrEmpty(o)}var Rl=class extends Gt{evaluate(r){let e=!so(r);return a.fromResult(e)}};Rl=c([C({tagName:d+"-required-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Rl);var Ps=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="pattern"&&this.triggerFormFieldValidation()}evaluate(r){let e=!0,t=this.pattern;return so(r)||(e=new RegExp(t).test(r)),a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Ps.prototype,"pattern",2),Ps=c([C({tagName:d+"-regex-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Ps);var As=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="min"||r==="max")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;return so(r)||(this.min>=0&&(e=e&&(r||"").toString().length>=this.min),this.max>=0&&(e=e&&(r||"").toString().length<=this.max)),a.fromResult(e)}};c([h({emit:!1,converter:m.Number})],As.prototype,"min",2),c([h({emit:!1,converter:m.Number})],As.prototype,"max",2),As=c([C({tagName:d+"-length-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],As);var Ds=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="min"||r==="max")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;if(!so(r)){let t=r;r instanceof Date||typeof r!="number"&&(t=a.parseDate(r))instanceof Date&&isFinite(t.valueOf())?(this.min!=null&&(e=e&&t.valueOf()>=a.parseDate(this.min).valueOf()),this.max!=null&&(e=e&&t.valueOf()<=a.parseDate(this.max).valueOf())):(this.min!=null&&(e=e&&r>=this.min),this.max!=null&&(e=e&&r<=this.max))}return a.fromResult(e)}};c([h({emit:!1,converter:m.Number})],Ds.prototype,"min",2),c([h({emit:!1,converter:m.Number})],Ds.prototype,"max",2),Ds=c([C({tagName:d+"-range-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Ds);var Rs=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="operator"||r==="to")&&this.triggerFormFieldValidation()}_prepareValuesForComparison(r,e){return a.Dates.isDate(r)||a.Dates.isDate(e)?[a.parseDate(r),a.parseDate(e)]:[r,e]}evaluate(r){let e=!0,t=this.to;if(!so(r)&&!so(t)){let n=this._prepareValuesForComparison(r,t);switch(r=n[0],t=n[1],this.operator){case"lessOrEqual":e=r<=t;break;case"less":e=r<t;break;case"greaterOrEqual":e=r>=t;break;case"greater":e=r>t;break;case"notEqual":e=r!==t;break;default:e=r===t;break}}return a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Rs.prototype,"operator",2),c([h({emit:!1,reflectBack:!0})],Rs.prototype,"to",2),Rs=c([C({tagName:d+"-compare-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Rs);var Os=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="pattern"||r==="maxSize")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0,t=this.pattern,n=this.maxSize;if(!so(r)){if(!a.isNullOrEmpty(t)){let i=typeof r=="string"?r:r.name;e=new RegExp(t,"i").test(i)}!a.isNull(n)&&typeof r=="object"&&r.size>0&&(e=e&&r.size<=n)}return a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Os.prototype,"pattern",2),c([h({emit:!1,converter:m.String})],Os.prototype,"maxSize",2),Os=c([C({tagName:d+"-binary-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Os);var Eu,$r=class extends Gt{constructor(){super(...arguments);z(this,Eu);this._deferredToken=null}_evaluateResult(){let t=this._fetcher.result;switch(t){case"true":return!0;case"false":return!1;default:try{let n=JSON.parse(t);return a.getApiResult(n)||!1}catch{return!1}}}_fetch(e){let t=this._deferredToken,n=this._fetcher;var i=this.parameters||{};i[this.watch]=e;let s={parameters:i,url:this.url,as:"text",method:this.method},l=a.jsonSortStringify(s),p=M(this,Eu),u=!1;if(a.isNullOrEmpty(p)||(u=l===p),u){let f=this._evaluateResult();t.resolve(f)}else a.extend(n,s),clearTimeout(this._debouncer),this._debouncer=setTimeout(()=>{n.fetch().then(f=>{let g=this._evaluateResult();t.resolve(g),H(this,Eu,l)},f=>{t.resolve(!1)})},1e3);return t.promise}evaluate(e){return a.isNullOrEmpty(e)?a.fromResult(!0):(this._deferredToken=this._deferredToken=_t.defer(),this._fetch(e).then(t=>(this._deferredToken=null,t),t=>(this._deferredToken=null,!1)))}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"parameters":case"url":case"method":case"fetchCredentials":case"fetchHeaders":this.triggerFormFieldValidation();break}}};Eu=new WeakMap,c([h({emit:!1,converter:m.Json})],$r.prototype,"parameters",2),c([h({emit:!1,converter:m.Json})],$r.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],$r.prototype,"fetchHeaders",2),c([h({emit:!1,converter:m.String})],$r.prototype,"url",2),c([h({emit:!1,converter:m.String})],$r.prototype,"method",2),c([S(d+"-fetch")],$r.prototype,"_fetcher",2),$r=c([C({tagName:d+"-async-validator",template:Is+`<${d}-fetch autofetch="false" throttle="true" credentials="{{ :host.fetchCredentials }}" headers="{{ :host.fetchHeaders }}"></${d}-fetch>`,shadow:j.USE_SHADOW_ROOT})],$r);var io=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="isValid"&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;return so(r)||(e=!!this.isValid),a.fromResult(e)}};c([h({emit:!1,converter:m.Boolean})],io.prototype,"isValid",2),io=c([C({tagName:d+"-custom-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],io);function M0(o){return"form"+o}function Cv(o){return new RegExp(o).source}function S0(o){return"errorMessage"in o}function L0(o){return"attributes"in o&&typeof o.attributes=="function"}var sr=class extends On{constructor(e=new ie.UI.MarkdownService){super();this._md=e;this._entityPropertyChangeHandler=e=>{this.dispatchEvent(new ue({propertyName:"entity",currentValue:this.entity}))};this._labelClickHandler=e=>{document.getElementById(this._label.htmlFor).focus()};this._key="_"+a.uniqueCode()}get key(){return this._key}get fetcher(){return this._fetcher}get field(){return this._field}viewActivatedCallback(){super.viewActivatedCallback(),this._buildUpForm(),this._buildUpFetcher()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"readonly":this._ensureBalloon();break;case"metadata":this._ensureBalloon(),this._buildUpCss(),this._buildUpLabel(),this._buildUpField();break;case"entity":t instanceof HTMLElement&&t.removeEventListener(ee,this._entityPropertyChangeHandler,!1),n instanceof HTMLElement&&n.addEventListener(ee,this._entityPropertyChangeHandler,!1);break}}disconnectedCallback(){this.entity instanceof HTMLElement&&this.entity.removeEventListener(ee,this._entityPropertyChangeHandler,!1),a.isNull(this._label)||this._label.removeEventListener("click",this._labelClickHandler,!1),a.isNull(this._balloon)||this._balloon.remove(),super.disconnectedCallback()}_normalizeTooltip(){let e=this.metadata&&this.metadata.extra&&this.metadata.extra.tooltip||!1;return typeof e=="object"?e:{type:e}}_ensureBalloon(){var e,t;let n=this.readonly||(t=this._normalizeTooltip()).type===!1||a.isNullOrEmpty(e=this.metadata&&this.metadata.display&&this.metadata.display.description);if(a.isNull(this._balloon)&&!n){let l=document.createElement(d+"-balloon");l.options={behavior:ie.UI.BalloonBehavior.Tooltip,trigger:t.trigger||ie.UI.BalloonTrigger.Hover,position:t.position||ie.UI.BalloonPosition.Top,hoverDelay:200,hoverTimeout:50,align:t.align||ie.UI.BalloonAlignment.Auto},a.addClass(l,b+"-field-tooltip");var i=A.findAncestorShell(this);i.appendChild(this._balloon=l)}let s=this._balloon;if(!a.isNull(s)&&(s.target=this._label,!(s.disabled=n))){let l=e||"";switch(t.type){case"md":case"markdown":s.innerHTML=this._md.toHtml(l);break;case"html":s.innerHTML=l;break;default:s.innerText=l;break}}}_buildUpCss(){let e=this.metadata?.display;if(!a.isNull(e)){if(typeof e.cssClass=="function"){let{cssClassAttr:t}=e.cssClass(this,"$this","$this.entity");this.setAttribute("css-class",t)}else this.cssClass=e.cssClass;if(typeof e.css=="function"){let{cssAttr:t}=e.css(this,"$this","$this.entity");this.setAttribute("css",t)}else this.css=e.css}}_buildUpLabel(){let e=this._label,t=e.firstElementChild,n=this.metadata;e.htmlFor=this._key,a.addClass(e,b+"-label");let i=this.metadata.validators;if(i&&i.find(s=>s.type==="required")?a.addClass(e,b+"-required"):a.removeClass(e,b+"-required"),!a.isNull(this._balloon)&&!this._balloon.disabled?a.addClass(e,b+"-tooltip"):a.removeClass(e,b+"-tooltip"),typeof n.display?.name=="function"){let{contentAttr:s}=n.display.name(this,":host",":host.entity","::_form");t.setAttribute("content",s)}else t.removeAttribute("content"),t.content=n.display&&n.display.name||n.prop;e.setAttribute("id","label"+this._key),e.addEventListener("click",this._labelClickHandler,!1)}_isValueNullOrEmpty(e=this.entity,t=this.metadata){if(a.isNull(t))return!0;let n=t.prop.split("."),i=e;for(let s=0;s<n.length;s++){let l=n[s];if(a.isNullOrEmpty(i&&i[l]))return!0;i=i[l]}return!1}_handleValueChange(e){if(e.detail.propertyName==="value"){let t=e.detail.currentValue,n=this.metadata.prop;if(this.entity instanceof HTMLElement){let i=A.camelToKebab(n);a.isNullOrEmpty(t)?this.entity.removeAttribute(i):this.entity.setAttribute(i,t.toString())}else this.entity[n]=t}}_adjustDependencyValue(e){return a.Dates.isDate(e)?a.Dates.parse(e).toISOString():e}_broadcastFetchResult(e){let t=this;this.dispatchEvent(new CustomEvent("fetch",{detail:e,bubbles:!0,cancelable:!1}))}_buildUpFetcher(){var e=this._fetcher;e.setAttribute("id","fetch"+this._key),e.setAttribute("on-fetchresult",":host._broadcastFetchResult($event.detail)")}_buildUpForm(){var e=this._form;e.setAttribute("id",M0(this._key)),e.setAttribute("sudden-validation","{{ ::form.suddenValidation }}")}_apiResult(e){return a.getApiResult(e)}_buildUpField(){this._field&&this._field.remove(),this._fetcher.removeAttribute("parameters"),this._fetcher.result=this._fetcher.url=null;for(var e=this._validators.children.length-1;e>=0;e--)this._validators.children[e].remove();var t=this.metadata;let n=d+"-input-text",i=d+(t.display&&t.display.ui==="slider"?"-slider":"-input-number"),s={id:this._key,name:t.prop,readonly:"{{ :host.readonly || :host.metadata.isReadOnly || ::_form.readonly }}",value:`{{ :host.entity.${t.prop}, twoway }}`,placeholder:`${t.display&&t.display.watermark||""}`};t.extra?.autofocus==!0&&(s["on-load"]="requestAnimationFrame(() => $this.focus())");let l=t.extra||{},p={},u="false",f="",g="",v="",y=[];if(!a.isNullOrEmpty(l.dependsOn))if(typeof l.dependsOn=="function"){let F=l.dependsOn(this,":host",":host.entity","$this.entity"),B=F.hideAttr;if(a.isNullOrEmpty(B)||this.setAttribute("hide",B),a.isNullOrEmpty(F.disabledAttr)||(u=F.disabledAttr,A.isBindingAttribute(u)&&(g=A.extractBindingAttributeExpression(u))),!a.isNullOrEmpty(F.parameterAttrs)){let $=F.parameterAttrs,U=[];for(let I in $){let G=$[I];U.push(`${I}: ${G}`),y.push({prop:G})}v=U.join(", ")}}else{y=l.dependsOn;let F={empty:[],notEqual:{}},B={empty:[],notEqual:{}},$=[],U=[];for(var _ of y){let G=":host.entity."+_.prop,Y="$this.entity."+_.prop;if(a.isNullOrEmpty(_.value)){if(!_.optional){let W=V=>"$pacem.isNullOrEmpty("+V+")";F.empty.push(W(G)),_.hide&&B.empty.push(W(Y))}}else{let W=V=>V+" !== "+JSON.stringify(_.value);(F.notEqual[G]=F.notEqual[G]||[]).push(W(G)),_.hide&&(B.notEqual[Y]=B.notEqual[Y]||[]).push(W(Y))}U.push(G),$.push(`${_.alias||_.prop}: :host._adjustDependencyValue(${G})`),_.optional||(f+=`!$pacem.isNullOrEmpty(${G}) && `)}v=$.join(", ");let I=G=>{let Y="false",W="false";if(!a.isNullOrEmpty(G.notEqual)){let V=[];for(let X in G.notEqual)V.push("("+G.notEqual[X].join(" && ")+")");Y="("+V.join(" || ")+")"}return a.isNullOrEmpty(G.empty)||(W="("+G.empty.join(" || ")+")"),Y+" || "+W};g=I(F),u=`{{ ${g} }}`,this.setAttribute("hide",`{{ ${I(B)} }}`)}let x="fn",w=this[x]=this[x]||{},E=(F=[])=>{let B=(y||[]).map(U=>":host.entity."+U.prop).join(", "),$="fn"+a.uniqueCode();switch(typeof F){case"function":w[$]=F;break;default:if(a.isArray(F))w[$]=()=>F;else throw"Unsupported source format.";break}return`{{ :host.${x}.${$}(${B}) }}`},k=new DocumentFragment,N;if(typeof t.type=="function"){var T=t.type(this,":host",":host.entity");if(T.tagName.indexOf("-")===-1)this.log(ce.LogLevel.Error,`${n} is not an allowed form-field`);else{let F=function(B,$){if(!a.isNullOrEmpty($))for(let U of $){if(U.tagName.indexOf("-")===-1){this.log(ce.LogLevel.Error,`${U.tagName} is not an allowed child element for form-field ${n}`);continue}let I=document.createElement(U.tagName);if(!a.isNullOrEmpty(U.attrs))for(let G in U.attrs){let Y=U.attrs[G];I.setAttribute(G,Y)}a.isNullOrEmpty(U.children)||F(I,U.children),B.appendChild(I)}};n=T.tagName,a.extend(s,T.attrs||{}),F(k,T.children)}}else switch(N=t.display&&t.display.ui){case"contentEditable":console.warn("`contentEditable` ui hint is deprecated. Lean on `dataType` equal to 'HTML' instead."),n=d+"-contenteditable",k.append(Ee.getDefaultDashboard());break;case"snapshot":n=d+"-snapshot",l.width>0&&(s.width=""+l.width),l.height>0&&(s.height=""+l.height),l.quality>=0&&(s.quality=""+l.quality);break;case"chars":case"digits":case"otp":n=d+"-input-chars",l.charCount>0&&(s.charCount=""+l.charCount),a.isNullOrEmpty(l.inputTransform)||(s["input-transform"]=l.inputTransform);break;case"oneToMany":case"dropdown":case"radioList":case"checkboxList":case"manyToMany":N==="oneToMany"||N==="dropdown"?(n=d+"-select",l.preventWheel!==!1&&(s["on-wheel"]="$event.preventDefault()")):(delete s.placeholder,n=d+(N==="radioList"?"-radio-list":"-checkbox-list")),a.isNullOrEmpty(l.textProperty)||(s["text-property"]=l.textProperty),a.isNullOrEmpty(l.disabledProperty)||(s["disabled-property"]=l.disabledProperty),a.isNullOrEmpty(l.valueProperty)||(t.isComplexType?s["compare-by"]=l.valueProperty:s["value-property"]=l.valueProperty),a.isNullOrEmpty(l.source)?(this._fetcher.id=`fetch${this._key}`,this._fetcher.url=l.sourceUrl,this._fetcher.method=l.verb,p.parameters=`{{ { ${v} } }}`,p.disabled=u,s.datasource=`{{ ${f}:host._apiResult(#fetch${this._key}.result) || null }}`):s.datasource=E(l.source);break;case"suggest":case"tags":case"autocomplete":let F=t.display.ui==="tags";n=d+(F?"-tags":"-suggest"),this._fetcher.id=`fetch${this._key}`,a.isNullOrEmpty(l.textProperty)||(s["text-property"]=l.textProperty);let B=`#${this._key}.value`;if(a.isNullOrEmpty(l.valueProperty)||(s["compare-by"]=l.valueProperty,F?B=`(${B} && ${B}.${l.valueProperty}) || ''`:t.isComplexType?B+=` && ${B}.${l.valueProperty}`:s["value-property"]=l.valueProperty),a.isNullOrEmpty(l.sourceUrl)?s.datasource=E(l.source):(p.url=`${l.sourceUrl}`,this._fetcher.method=l.verb,a.isNullOrEmpty(l.dependsOn)?p.parameters=`{{ {q: #${this._key}.hint || '', ${l.valueProperty||"value"}: ${B} || '' } }}`:(p.parameters=`{{ { ${v}, q: #${this._key}.hint || '', ${l.valueProperty||"value"}: ${B} || '' } }}`,p.disabled=u),s.datasource=`{{ ${f}:host._apiResult(#fetch${this._key}.result) || null }}`),F)s["allow-new"]=(t.extra.allowNew===!0).toString(),s["allow-duplicates"]=(t.extra.allowDuplicates===!0).toString();else{if(a.isNullOrEmpty(l.disabledProperty)||(s["disabled-property"]=l.disabledProperty),!a.isNullOrEmpty(l.itemtemplate)){let I=l.itemtemplate;I instanceof HTMLElement?(s.itemtemplate="{{ #"+(I.id=I.id||this._key+"_itemtmpl")+" }}",I.isConnected||this.append(I)):s.itemtemplate=I}if(!a.isNullOrEmpty(l.filterFields)){let I=l.filterFields;s["filter-fields"]=a.isArray(I)?I.join(" "):I}a.isNullOrEmpty(l.maxSuggestions)||(s["max-suggestions"]=l.maxSuggestions.toString())}break;case"calendar":n=d+"-calendar-picker";let $=t.display?.format??t.extra?.format;a.isNullOrEmpty($)||(s.format="{{ "+JSON.stringify($)+" }}"),a.isNullOrEmpty(l.disabledRanges)||(s["disabled-ranges"]="{{ "+JSON.stringify(l.disabledRanges)+" }}");break;case"dictionary":n=d+"-namevalue-list",s.dictionary="true";break;case"switcher":if((t.type||"").toLowerCase()==="boolean")s.class="checkbox-switch";else break;default:let U=(t.dataType||t.type||"").toLowerCase();switch(U){case"upload":n=d+"-upload";let I=t.extra||{};s.url=I.uploadUrl,s.parallelism=""+I.parallelism,s["chunk-size"]=""+I.chunkSize,s["max-image-width"]=""+I.maxImageWidth,s["max-image-height"]=""+I.maxImageHeight,s["select-mode"]=I.mode??"file";break;case"html":n=d+"-contenteditable",k.append(Ee.getDefaultDashboard());break;case"enumeration":n=d+"-radio-list",s.class=b+"-radio-list",s["value-property"]="value",s["text-property"]="caption",s.datasource="{{ "+JSON.stringify(t.extra.enum)+" }}",delete s.placeholder;break;case"password":n=d+"-input-password";break;case"emailaddress":n=d+"-input-email";break;case"color":n=d+"-input-color";break;case"time":case"date":case"datetime":n=d+"-datetime-picker",delete s.placeholder,U==="datetime"&&(s.precision="minute");let G=t.display?.format??t.extra?.format;a.isNullOrEmpty(G)||(s.format="{{ "+JSON.stringify(G)+" }}"),a.isNullOrEmpty(l.disabledRanges)||(s["disabled-ranges"]="{{ "+JSON.stringify(l.disabledRanges)+" }}");break;case"url":n=d+"-input-url";break;case"phonenumber":n=d+"-input-tel";break;case"multilinetext":n=d+"-textarea";break;case"markdown":n=d+"-textarea-markdown";break;case"latlng":n=d+"-latlng",!a.isNullOrEmpty(t.extra)&&typeof t.extra=="object"&&!a.isArray(t.extra)&&(s.options=JSON.stringify(t.extra));break;case"percent":case"percentage":case"currency":let Y=U==="currency"?{style:"currency",currency:"EUR"}:{style:"percent",maximumFractionDigits:2},W=t.display?.format??Y;s.format=JSON.stringify(W);default:switch((t.type||"").toLowerCase()){case"boolean":n=d+"-checkbox",s["true-value"]="{{ true }}",s["false-value"]="{{ false }}",s.caption=s.placeholder,delete s.placeholder;break;case"byte":s.min="0",s.max="255";case"int16":case"int32":case"int64":case"short":case"integer":case"int":case"long":s.step=""+(t.extra?.step??"1"),n=i;let V=t.display?.format;a.isNullOrEmpty(V)||(s.format=JSON.stringify(V)),l.preventWheel!==!1&&n===d+"-input-number"&&(s["on-wheel"]="$event.preventDefault()");break;case"double":case"decimal":case"float":case"single":case"number":n=i,s.step=""+(t.extra?.step??"any");let X=t.display?.format;a.isNullOrEmpty(X)||(s.format=JSON.stringify(X)),l.preventWheel!==!1&&n===d+"-input-number"&&(s["on-wheel"]="$event.preventDefault()");break;default:if((t.type==="array"||t.type==="object")&&!a.isNullOrEmpty(t.props)){if(n=d+"-childform",delete s.placeholder,s.metadata=a.Json.stringify(t.props,{functions:"reference"}),s.mode=t.type,s["lock-items"]=""+(t.extra&&t.extra.lockItems||!1),s.logger="{{ :host.logger }}",!a.isNullOrEmpty(y)){var O="";for(let q of y)O+=`<${d}-childform-propagator model="${s.value}" watch="{{ :host.entity.${q.prop} }}" property="${q.alias||q.prop}"></${d}-childform-propagator>
|
|
680
|
-
`;this._container.innerHTML=O}s["fetch-credentials"]="{{ :host.fetchCredentials }}",s["fetch-headers"]="{{ :host.fetchHeaders }}"}break}break}break}if(!a.isNullOrEmpty(t.commands)){a.addClass(this._container,b+"-fieldgroup");let F=this._container.appendChild(document.createElement("div")),B=this._container.appendChild(document.createElement("div"));a.addClass(F,`fieldgroup-prepend ${b}-buttonset buttons`),a.addClass(B,`fieldgroup-append ${b}-buttonset buttons`);let $=g||"false";t.commands.forEach(U=>{let I=document.createElement(d+"-button");I.setAttribute("icon-glyph",U.icon),I.setAttribute("command-name",U.name),U.dependsOnValue?(I.setAttribute("disabled",`{{ (${$}) || !::_form.valid || $pacem.isNullOrEmpty(:host.entity.${t.prop}) }}`),I.setAttribute("command-argument",`{{ :host.entity.${t.prop} }}`)):I.setAttribute("disabled",u),I.setAttribute("tooltip",U.tooltip),a.isNullOrEmpty(U.cssClass)||a.addClass(I,U.cssClass.join(" ")),(U.prepend?F:B).appendChild(I)})}a.isNullOrEmpty(t.validators)||t.validators.forEach(F=>{var B,$={},U={};switch(
|
|
679
|
+
</div>`})],Ye);var Gt=class extends On{constructor(){super()}viewActivatedCallback(){super.viewActivatedCallback(),a.addClass(this,b+"-validator")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.form;switch(r){case"watch":e&&i&&i.unregisterValidator(t,this),i&&i.registerValidator(t,this);break;case"invalid":break;case"form":let s=this.watch;a.isNullOrEmpty(s)||(e?.unregisterValidator(s,this),t?.registerValidator(s,this));break;case"disabled":this.triggerFormFieldValidation();break}}#e;triggerFormFieldValidation(){let r=this.form,e=this.watch;!a.isNull(r)&&!a.isNullOrEmpty(e)&&(cancelAnimationFrame(this.#e),this.#e=requestAnimationFrame(()=>{r.validate(e)}))}validate(r){return this.disabled?a.fromResult(!0):this.evaluate(r)}};c([h({converter:m.Boolean})],Gt.prototype,"invalid",2),c([h({converter:m.String})],Gt.prototype,"errorMessage",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Gt.prototype,"watch",2);var Is=`<${d}-span part="error-message" hide="{{ !:host.invalid }}" text="{{ :host.errorMessage }}"></${d}-span>`;function so(o){return a.isNullOrEmpty(o)}var Rl=class extends Gt{evaluate(r){let e=!so(r);return a.fromResult(e)}};Rl=c([C({tagName:d+"-required-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Rl);var Ps=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="pattern"&&this.triggerFormFieldValidation()}evaluate(r){let e=!0,t=this.pattern;return so(r)||(e=new RegExp(t).test(r)),a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Ps.prototype,"pattern",2),Ps=c([C({tagName:d+"-regex-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Ps);var As=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="min"||r==="max")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;return so(r)||(this.min>=0&&(e=e&&(r||"").toString().length>=this.min),this.max>=0&&(e=e&&(r||"").toString().length<=this.max)),a.fromResult(e)}};c([h({emit:!1,converter:m.Number})],As.prototype,"min",2),c([h({emit:!1,converter:m.Number})],As.prototype,"max",2),As=c([C({tagName:d+"-length-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],As);var Ds=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="min"||r==="max")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;if(!so(r)){let t=r;r instanceof Date||typeof r!="number"&&(t=a.parseDate(r))instanceof Date&&isFinite(t.valueOf())?(this.min!=null&&(e=e&&t.valueOf()>=a.parseDate(this.min).valueOf()),this.max!=null&&(e=e&&t.valueOf()<=a.parseDate(this.max).valueOf())):(this.min!=null&&(e=e&&r>=this.min),this.max!=null&&(e=e&&r<=this.max))}return a.fromResult(e)}};c([h({emit:!1,converter:m.Number})],Ds.prototype,"min",2),c([h({emit:!1,converter:m.Number})],Ds.prototype,"max",2),Ds=c([C({tagName:d+"-range-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Ds);var Rs=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="operator"||r==="to")&&this.triggerFormFieldValidation()}_prepareValuesForComparison(r,e){return a.Dates.isDate(r)||a.Dates.isDate(e)?[a.parseDate(r),a.parseDate(e)]:[r,e]}evaluate(r){let e=!0,t=this.to;if(!so(r)&&!so(t)){let n=this._prepareValuesForComparison(r,t);switch(r=n[0],t=n[1],this.operator){case"lessOrEqual":e=r<=t;break;case"less":e=r<t;break;case"greaterOrEqual":e=r>=t;break;case"greater":e=r>t;break;case"notEqual":e=r!==t;break;default:e=r===t;break}}return a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Rs.prototype,"operator",2),c([h({emit:!1,reflectBack:!0})],Rs.prototype,"to",2),Rs=c([C({tagName:d+"-compare-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Rs);var Os=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&(r==="pattern"||r==="maxSize")&&this.triggerFormFieldValidation()}evaluate(r){let e=!0,t=this.pattern,n=this.maxSize;if(!so(r)){if(!a.isNullOrEmpty(t)){let i=typeof r=="string"?r:r.name;e=new RegExp(t,"i").test(i)}!a.isNull(n)&&typeof r=="object"&&r.size>0&&(e=e&&r.size<=n)}return a.fromResult(e)}};c([h({emit:!1,converter:m.String})],Os.prototype,"pattern",2),c([h({emit:!1,converter:m.String})],Os.prototype,"maxSize",2),Os=c([C({tagName:d+"-binary-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],Os);var Eu,$r=class extends Gt{constructor(){super(...arguments);z(this,Eu);this._deferredToken=null}_evaluateResult(){let t=this._fetcher.result;switch(t){case"true":return!0;case"false":return!1;default:try{let n=JSON.parse(t);return a.getApiResult(n)||!1}catch{return!1}}}_fetch(e){let t=this._deferredToken,n=this._fetcher;var i=this.parameters||{};i[this.watch]=e;let s={parameters:i,url:this.url,as:"text",method:this.method},l=a.jsonSortStringify(s),p=M(this,Eu),u=!1;if(a.isNullOrEmpty(p)||(u=l===p),u){let f=this._evaluateResult();t.resolve(f)}else a.extend(n,s),clearTimeout(this._debouncer),this._debouncer=setTimeout(()=>{n.fetch().then(f=>{let g=this._evaluateResult();t.resolve(g),H(this,Eu,l)},f=>{t.resolve(!1)})},1e3);return t.promise}evaluate(e){return a.isNullOrEmpty(e)?a.fromResult(!0):(this._deferredToken=this._deferredToken=_t.defer(),this._fetch(e).then(t=>(this._deferredToken=null,t),t=>(this._deferredToken=null,!1)))}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"parameters":case"url":case"method":case"fetchCredentials":case"fetchHeaders":this.triggerFormFieldValidation();break}}};Eu=new WeakMap,c([h({emit:!1,converter:m.Json})],$r.prototype,"parameters",2),c([h({emit:!1,converter:m.Json})],$r.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.Json})],$r.prototype,"fetchHeaders",2),c([h({emit:!1,converter:m.String})],$r.prototype,"url",2),c([h({emit:!1,converter:m.String})],$r.prototype,"method",2),c([S(d+"-fetch")],$r.prototype,"_fetcher",2),$r=c([C({tagName:d+"-async-validator",template:Is+`<${d}-fetch autofetch="false" throttle="true" credentials="{{ :host.fetchCredentials }}" headers="{{ :host.fetchHeaders }}"></${d}-fetch>`,shadow:j.USE_SHADOW_ROOT})],$r);var io=class extends Gt{propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n),!n&&r==="isValid"&&this.triggerFormFieldValidation()}evaluate(r){let e=!0;return so(r)||(e=!!this.isValid),a.fromResult(e)}};c([h({emit:!1,converter:m.Boolean})],io.prototype,"isValid",2),io=c([C({tagName:d+"-custom-validator",template:Is,shadow:j.USE_SHADOW_ROOT})],io);function S0(o){return"form"+o}function Cv(o){return new RegExp(o).source}function L0(o){return"errorMessage"in o}function N0(o){return"attributes"in o&&typeof o.attributes=="function"}var sr=class extends On{constructor(e=new ie.UI.MarkdownService){super();this._md=e;this._entityPropertyChangeHandler=e=>{this.dispatchEvent(new ue({propertyName:"entity",currentValue:this.entity}))};this._labelClickHandler=e=>{document.getElementById(this._label.htmlFor).focus()};this._key="_"+a.uniqueCode()}get key(){return this._key}get fetcher(){return this._fetcher}get field(){return this._field}viewActivatedCallback(){super.viewActivatedCallback(),this._buildUpForm(),this._buildUpFetcher()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"readonly":this._ensureBalloon();break;case"metadata":this._ensureBalloon(),this._buildUpCss(),this._buildUpLabel(),this._buildUpField();break;case"entity":t instanceof HTMLElement&&t.removeEventListener(ee,this._entityPropertyChangeHandler,!1),n instanceof HTMLElement&&n.addEventListener(ee,this._entityPropertyChangeHandler,!1);break}}disconnectedCallback(){this.entity instanceof HTMLElement&&this.entity.removeEventListener(ee,this._entityPropertyChangeHandler,!1),a.isNull(this._label)||this._label.removeEventListener("click",this._labelClickHandler,!1),a.isNull(this._balloon)||this._balloon.remove(),super.disconnectedCallback()}_normalizeTooltip(){let e=this.metadata&&this.metadata.extra&&this.metadata.extra.tooltip||!1;return typeof e=="object"?e:{type:e}}_ensureBalloon(){var e,t;let n=this.readonly||(t=this._normalizeTooltip()).type===!1||a.isNullOrEmpty(e=this.metadata&&this.metadata.display&&this.metadata.display.description);if(a.isNull(this._balloon)&&!n){let l=document.createElement(d+"-balloon");l.options={behavior:ie.UI.BalloonBehavior.Tooltip,trigger:t.trigger||ie.UI.BalloonTrigger.Hover,position:t.position||ie.UI.BalloonPosition.Top,hoverDelay:200,hoverTimeout:50,align:t.align||ie.UI.BalloonAlignment.Auto},a.addClass(l,b+"-field-tooltip");var i=A.findAncestorShell(this);i.appendChild(this._balloon=l)}let s=this._balloon;if(!a.isNull(s)&&(s.target=this._label,!(s.disabled=n))){let l=e||"";switch(t.type){case"md":case"markdown":s.innerHTML=this._md.toHtml(l);break;case"html":s.innerHTML=l;break;default:s.innerText=l;break}}}_buildUpCss(){let e=this.metadata?.display;if(!a.isNull(e)){if(typeof e.cssClass=="function"){let{cssClassAttr:t}=e.cssClass(this,"$this","$this.entity");this.setAttribute("css-class",t)}else this.cssClass=e.cssClass;if(typeof e.css=="function"){let{cssAttr:t}=e.css(this,"$this","$this.entity");this.setAttribute("css",t)}else this.css=e.css}}_buildUpLabel(){let e=this._label,t=e.firstElementChild,n=this.metadata;e.htmlFor=this._key,a.addClass(e,b+"-label");let i=this.metadata.validators;if(i&&i.find(s=>s.type==="required")?a.addClass(e,b+"-required"):a.removeClass(e,b+"-required"),!a.isNull(this._balloon)&&!this._balloon.disabled?a.addClass(e,b+"-tooltip"):a.removeClass(e,b+"-tooltip"),typeof n.display?.name=="function"){let{contentAttr:s}=n.display.name(this,":host",":host.entity","::_form");t.setAttribute("content",s)}else t.removeAttribute("content"),t.content=n.display&&n.display.name||n.prop;e.setAttribute("id","label"+this._key),e.addEventListener("click",this._labelClickHandler,!1)}_isValueNullOrEmpty(e=this.entity,t=this.metadata){if(a.isNull(t))return!0;let n=t.prop.split("."),i=e;for(let s=0;s<n.length;s++){let l=n[s];if(a.isNullOrEmpty(i&&i[l]))return!0;i=i[l]}return!1}_handleValueChange(e){if(e.detail.propertyName==="value"){let t=e.detail.currentValue,n=this.metadata.prop;if(this.entity instanceof HTMLElement){let i=A.camelToKebab(n);a.isNullOrEmpty(t)?this.entity.removeAttribute(i):this.entity.setAttribute(i,t.toString())}else this.entity[n]=t}}_adjustDependencyValue(e){return a.Dates.isDate(e)?a.Dates.parse(e).toISOString():e}_broadcastFetchResult(e){let t=this;this.dispatchEvent(new CustomEvent("fetch",{detail:e,bubbles:!0,cancelable:!1}))}_buildUpFetcher(){var e=this._fetcher;e.setAttribute("id","fetch"+this._key),e.setAttribute("on-fetchresult",":host._broadcastFetchResult($event.detail)")}_buildUpForm(){var e=this._form;e.setAttribute("id",S0(this._key)),e.setAttribute("sudden-validation","{{ ::form.suddenValidation }}")}_apiResult(e){return a.getApiResult(e)}_buildUpField(){this._field&&this._field.remove(),this._fetcher.removeAttribute("parameters"),this._fetcher.result=this._fetcher.url=null;for(var e=this._validators.children.length-1;e>=0;e--)this._validators.children[e].remove();var t=this.metadata;let n=d+"-input-text",i=d+(t.display&&t.display.ui==="slider"?"-slider":"-input-number"),s={id:this._key,name:t.prop,readonly:"{{ :host.readonly || :host.metadata.isReadOnly || ::_form.readonly }}",value:`{{ :host.entity.${t.prop}, twoway }}`,placeholder:`${t.display&&t.display.watermark||""}`};t.extra?.autofocus==!0&&(s["on-load"]="requestAnimationFrame(() => $this.focus())");let l=t.extra||{},p={},u="false",f="",g="",v="",y=[];if(!a.isNullOrEmpty(l.dependsOn))if(typeof l.dependsOn=="function"){let F=l.dependsOn(this,":host",":host.entity","$this.entity"),B=F.hideAttr;if(a.isNullOrEmpty(B)||this.setAttribute("hide",B),a.isNullOrEmpty(F.disabledAttr)||(u=F.disabledAttr,A.isBindingAttribute(u)&&(g=A.extractBindingAttributeExpression(u))),!a.isNullOrEmpty(F.parameterAttrs)){let $=F.parameterAttrs,U=[];for(let I in $){let G=$[I];U.push(`${I}: ${G}`),y.push({prop:G})}v=U.join(", ")}}else{y=l.dependsOn;let F={empty:[],notEqual:{}},B={empty:[],notEqual:{}},$=[],U=[];for(var _ of y){let G=":host.entity."+_.prop,Y="$this.entity."+_.prop;if(a.isNullOrEmpty(_.value)){if(!_.optional){let W=V=>"$pacem.isNullOrEmpty("+V+")";F.empty.push(W(G)),_.hide&&B.empty.push(W(Y))}}else{let W=V=>V+" !== "+JSON.stringify(_.value);(F.notEqual[G]=F.notEqual[G]||[]).push(W(G)),_.hide&&(B.notEqual[Y]=B.notEqual[Y]||[]).push(W(Y))}U.push(G),$.push(`${_.alias||_.prop}: :host._adjustDependencyValue(${G})`),_.optional||(f+=`!$pacem.isNullOrEmpty(${G}) && `)}v=$.join(", ");let I=G=>{let Y="false",W="false";if(!a.isNullOrEmpty(G.notEqual)){let V=[];for(let X in G.notEqual)V.push("("+G.notEqual[X].join(" && ")+")");Y="("+V.join(" || ")+")"}return a.isNullOrEmpty(G.empty)||(W="("+G.empty.join(" || ")+")"),Y+" || "+W};g=I(F),u=`{{ ${g} }}`,this.setAttribute("hide",`{{ ${I(B)} }}`)}let x="fn",w=this[x]=this[x]||{},E=(F=[])=>{let B=(y||[]).map(U=>":host.entity."+U.prop).join(", "),$="fn"+a.uniqueCode();switch(typeof F){case"function":w[$]=F;break;default:if(a.isArray(F))w[$]=()=>F;else throw"Unsupported source format.";break}return`{{ :host.${x}.${$}(${B}) }}`},k=new DocumentFragment,N;if(typeof t.type=="function"){var T=t.type(this,":host",":host.entity");if(T.tagName.indexOf("-")===-1)this.log(ce.LogLevel.Error,`${n} is not an allowed form-field`);else{let F=function(B,$){if(!a.isNullOrEmpty($))for(let U of $){if(U.tagName.indexOf("-")===-1){this.log(ce.LogLevel.Error,`${U.tagName} is not an allowed child element for form-field ${n}`);continue}let I=document.createElement(U.tagName);if(!a.isNullOrEmpty(U.attrs))for(let G in U.attrs){let Y=U.attrs[G];I.setAttribute(G,Y)}a.isNullOrEmpty(U.children)||F(I,U.children),B.appendChild(I)}};n=T.tagName,a.extend(s,T.attrs||{}),F(k,T.children)}}else switch(N=t.display&&t.display.ui){case"contentEditable":console.warn("`contentEditable` ui hint is deprecated. Lean on `dataType` equal to 'HTML' instead."),n=d+"-contenteditable",k.append(Ee.getDefaultDashboard());break;case"snapshot":n=d+"-snapshot",l.width>0&&(s.width=""+l.width),l.height>0&&(s.height=""+l.height),l.quality>=0&&(s.quality=""+l.quality);break;case"chars":case"digits":case"otp":n=d+"-input-chars",l.charCount>0&&(s.charCount=""+l.charCount),a.isNullOrEmpty(l.inputTransform)||(s["input-transform"]=l.inputTransform);break;case"oneToMany":case"dropdown":case"radioList":case"checkboxList":case"manyToMany":N==="oneToMany"||N==="dropdown"?(n=d+"-select",l.preventWheel!==!1&&(s["on-wheel"]="$event.preventDefault()")):(delete s.placeholder,n=d+(N==="radioList"?"-radio-list":"-checkbox-list")),a.isNullOrEmpty(l.textProperty)||(s["text-property"]=l.textProperty),a.isNullOrEmpty(l.disabledProperty)||(s["disabled-property"]=l.disabledProperty),a.isNullOrEmpty(l.valueProperty)||(t.isComplexType?s["compare-by"]=l.valueProperty:s["value-property"]=l.valueProperty),a.isNullOrEmpty(l.source)?(this._fetcher.id=`fetch${this._key}`,this._fetcher.url=l.sourceUrl,this._fetcher.method=l.verb,p.parameters=`{{ { ${v} } }}`,p.disabled=u,s.datasource=`{{ ${f}:host._apiResult(#fetch${this._key}.result) || null }}`):s.datasource=E(l.source);break;case"suggest":case"tags":case"autocomplete":let F=t.display.ui==="tags";n=d+(F?"-tags":"-suggest"),this._fetcher.id=`fetch${this._key}`,a.isNullOrEmpty(l.textProperty)||(s["text-property"]=l.textProperty);let B=`#${this._key}.value`;if(a.isNullOrEmpty(l.valueProperty)||(s["compare-by"]=l.valueProperty,F?B=`(${B} && ${B}.${l.valueProperty}) || ''`:t.isComplexType?B+=` && ${B}.${l.valueProperty}`:s["value-property"]=l.valueProperty),a.isNullOrEmpty(l.sourceUrl)?s.datasource=E(l.source):(p.url=`${l.sourceUrl}`,this._fetcher.method=l.verb,a.isNullOrEmpty(l.dependsOn)?p.parameters=`{{ {q: #${this._key}.hint || '', ${l.valueProperty||"value"}: ${B} || '' } }}`:(p.parameters=`{{ { ${v}, q: #${this._key}.hint || '', ${l.valueProperty||"value"}: ${B} || '' } }}`,p.disabled=u),s.datasource=`{{ ${f}:host._apiResult(#fetch${this._key}.result) || null }}`),F)s["allow-new"]=(t.extra.allowNew===!0).toString(),s["allow-duplicates"]=(t.extra.allowDuplicates===!0).toString();else{if(a.isNullOrEmpty(l.disabledProperty)||(s["disabled-property"]=l.disabledProperty),!a.isNullOrEmpty(l.itemtemplate)){let I=l.itemtemplate;I instanceof HTMLElement?(s.itemtemplate="{{ #"+(I.id=I.id||this._key+"_itemtmpl")+" }}",I.isConnected||this.append(I)):s.itemtemplate=I}if(!a.isNullOrEmpty(l.filterFields)){let I=l.filterFields;s["filter-fields"]=a.isArray(I)?I.join(" "):I}a.isNullOrEmpty(l.maxSuggestions)||(s["max-suggestions"]=l.maxSuggestions.toString())}break;case"calendar":n=d+"-calendar-picker";let $=t.display?.format??t.extra?.format;a.isNullOrEmpty($)||(s.format="{{ "+JSON.stringify($)+" }}"),a.isNullOrEmpty(l.disabledRanges)||(s["disabled-ranges"]="{{ "+JSON.stringify(l.disabledRanges)+" }}");break;case"dictionary":n=d+"-namevalue-list",s.dictionary="true";break;case"switcher":if((t.type||"").toLowerCase()==="boolean")s.class="checkbox-switch";else break;default:let U=(t.dataType||t.type||"").toLowerCase();switch(U){case"upload":n=d+"-upload";let I=t.extra||{};s.url=I.uploadUrl,s.parallelism=""+I.parallelism,s["chunk-size"]=""+I.chunkSize,s["max-image-width"]=""+I.maxImageWidth,s["max-image-height"]=""+I.maxImageHeight,s["select-mode"]=I.mode??"file";break;case"html":n=d+"-contenteditable",k.append(Ee.getDefaultDashboard());break;case"enumeration":n=d+"-radio-list",s.class=b+"-radio-list",s["value-property"]="value",s["text-property"]="caption",s.datasource="{{ "+JSON.stringify(t.extra.enum)+" }}",delete s.placeholder;break;case"password":n=d+"-input-password";break;case"emailaddress":n=d+"-input-email";break;case"color":n=d+"-input-color";break;case"time":case"date":case"datetime":n=d+"-datetime-picker",delete s.placeholder,U==="datetime"&&(s.precision="minute");let G=t.display?.format??t.extra?.format;a.isNullOrEmpty(G)||(s.format="{{ "+JSON.stringify(G)+" }}"),a.isNullOrEmpty(l.disabledRanges)||(s["disabled-ranges"]="{{ "+JSON.stringify(l.disabledRanges)+" }}");break;case"url":n=d+"-input-url";break;case"phonenumber":n=d+"-input-tel";break;case"multilinetext":n=d+"-textarea";break;case"markdown":n=d+"-textarea-markdown";break;case"latlng":n=d+"-latlng",!a.isNullOrEmpty(t.extra)&&typeof t.extra=="object"&&!a.isArray(t.extra)&&(s.options=JSON.stringify(t.extra));break;case"percent":case"percentage":case"currency":let Y=U==="currency"?{style:"currency",currency:"EUR"}:{style:"percent",maximumFractionDigits:2},W=t.display?.format??Y;s.format=JSON.stringify(W);default:switch((t.type||"").toLowerCase()){case"boolean":n=d+"-checkbox",s["true-value"]="{{ true }}",s["false-value"]="{{ false }}",s.caption=s.placeholder,delete s.placeholder;break;case"byte":s.min="0",s.max="255";case"int16":case"int32":case"int64":case"short":case"integer":case"int":case"long":s.step=""+(t.extra?.step??"1"),n=i;let V=t.display?.format;a.isNullOrEmpty(V)||(s.format=JSON.stringify(V)),l.preventWheel!==!1&&n===d+"-input-number"&&(s["on-wheel"]="$event.preventDefault()");break;case"double":case"decimal":case"float":case"single":case"number":n=i,s.step=""+(t.extra?.step??"any");let X=t.display?.format;a.isNullOrEmpty(X)||(s.format=JSON.stringify(X)),l.preventWheel!==!1&&n===d+"-input-number"&&(s["on-wheel"]="$event.preventDefault()");break;default:if((t.type==="array"||t.type==="object")&&!a.isNullOrEmpty(t.props)){if(n=d+"-childform",delete s.placeholder,s.metadata=a.Json.stringify(t.props,{functions:"reference"}),s.mode=t.type,s["lock-items"]=""+(t.extra&&t.extra.lockItems||!1),s.logger="{{ :host.logger }}",!a.isNullOrEmpty(y)){var O="";for(let q of y)O+=`<${d}-childform-propagator model="${s.value}" watch="{{ :host.entity.${q.prop} }}" property="${q.alias||q.prop}"></${d}-childform-propagator>
|
|
680
|
+
`;this._container.innerHTML=O}s["fetch-credentials"]="{{ :host.fetchCredentials }}",s["fetch-headers"]="{{ :host.fetchHeaders }}"}break}break}break}if(!a.isNullOrEmpty(t.commands)){a.addClass(this._container,b+"-fieldgroup");let F=this._container.appendChild(document.createElement("div")),B=this._container.appendChild(document.createElement("div"));a.addClass(F,`fieldgroup-prepend ${b}-buttonset buttons`),a.addClass(B,`fieldgroup-append ${b}-buttonset buttons`);let $=g||"false";t.commands.forEach(U=>{let I=document.createElement(d+"-button");I.setAttribute("icon-glyph",U.icon),I.setAttribute("command-name",U.name),U.dependsOnValue?(I.setAttribute("disabled",`{{ (${$}) || !::_form.valid || $pacem.isNullOrEmpty(:host.entity.${t.prop}) }}`),I.setAttribute("command-argument",`{{ :host.entity.${t.prop} }}`)):I.setAttribute("disabled",u),I.setAttribute("tooltip",U.tooltip),a.isNullOrEmpty(U.cssClass)||a.addClass(I,U.cssClass.join(" ")),(U.prepend?F:B).appendChild(I)})}a.isNullOrEmpty(t.validators)||t.validators.forEach(F=>{var B,$={},U={};switch(L0(F)&&($=F.params||{},U["error-message"]=F.errorMessage),N0(F)&&a.extend(U,F.attributes(this,":host",":host.entity")),F.type){case"required":s.required="true",B=new Rl;break;case"length":let I=new As;B=I;let G=$&&$.max,Y=$&&$.min;G!=null?(s.maxlength=""+(I.max=G),n===d+"-input-chars"&&(s.count??=""+G)):"max"in U&&(s.max=U.max),Y!=null?s.minlength=""+(I.min=Y):"min"in U&&(s.minlength=U.min);break;case"range":let W=new Ds;B=W;let V=$&&$.max,X=$&&$.min,q=n===d+"-datetime-picker";V!=null?(W.max=V,s.max="{{ "+(q?"'"+V+"'":V)+" }}"):"max"in U&&(s.max=U.max),X!=null?(W.min=X,s.min="{{ "+(q?"'"+X+"'":X)+" }}"):"min"in U&&(s.min=U.min);break;case"email":let Z=new Ps;B=Z,s.pattern=Cv(Z.pattern=/^[\w\-\.]+@[\w\-\.]+\.[a-zA-Z0-9]{2,6}$/);break;case"regex":let ne=new Ps;B=ne;let te=$.pattern;te||=U.pattern,s.pattern=Cv(te),ne.pattern=te;break;case"binary":let ae=new Os;B=ae;let Le=$.pattern;Le!=null?(s.pattern=Cv(Le),ae.pattern=Le):"pattern"in U&&(s.pattern=U.pattern);let he=$&&$.maxSize;he!=null?(ae.maxSize=he,s["max-size"]=""+he):"max-size"in U&&(s["max-size"]=U["max-size"]);break;case"compare":let fe=new Rs;B=fe;let le="";"value"in $?le=JSON.stringify($.value):le=`:host.entity.${"to"in $?$.to:$.toProperty}`;let re=`{{ ${le} }}`;fe.setAttribute("to",re);let Oe=fe.operator=$.operator||U.operator||"equal";if(n===d+"-datetime-picker")switch(Oe){case"lessOrEqual":case"less":s.max=re;break;case"greaterOrEqual":case"greater":s.min=re;break}break;case"async":let ge=new $r;B=ge,ge.url=$.url;let Ne=[],Pe=$.dependsOn||y;Ne.push(`${t.prop}: :host._adjustDependencyValue(:host.entity.${t.prop})`);for(let He of Pe||[])Ne.push(`${He.alias||He.prop}: :host._adjustDependencyValue(:host.entity.${He.prop})`);ge.setAttribute("parameters",`{{ { ${Ne.join(", ")} } }}`),ge.method=$.verb||pt.HttpMethod.Get,ge.setAttribute("fetch-credentials","{{ :host.fetchCredentials }}"),ge.setAttribute("fetch-headers","{{ :host.fetchHeaders }}");break;case"custom":B=new io;break;default:if(!a.isNullOrEmpty(F.type)&&F.type.indexOf("-")>0){let He=F.type,Wt=document.createElement(He);Wt instanceof Gt&&(B=Wt)}break}if(a.isNull(B))throw`Cannot generate a formfield validator based on type: ${F.type}.`;B.watch=t.prop,B.setAttribute("hide","{{ !this.invalid }}"),B.setAttribute("disabled",u);for(let I in U)B.setAttribute(I,U[I]);this._validators.appendChild(B)});let D=document.createElement(n);for(var P in s){let F;a.isNullOrEmpty(F=s[P])||D.setAttribute(P,F)}D.append(k),this._field=D,this._container.insertBefore(D,this._container.firstElementChild);for(var P in p){let B;a.isNullOrEmpty(B=p[P])||this._fetcher.setAttribute(P,B)}this.dispatchEvent(new ue({propertyName:"field",currentValue:D}))}};c([S("label")],sr.prototype,"_label",2),c([S(`div.${b}-input-container`)],sr.prototype,"_container",2),c([S(d+"-fetch")],sr.prototype,"_fetcher",2),c([S(d+"-form")],sr.prototype,"_form",2),c([S(d+"-panel."+b+"-validators")],sr.prototype,"_validators",2),c([h({converter:m.Json})],sr.prototype,"metadata",2),c([h({converter:m.Json})],sr.prototype,"fetchHeaders",2),c([h({converter:m.String})],sr.prototype,"fetchCredentials",2),c([h({converter:m.Boolean})],sr.prototype,"readonly",2),c([h()],sr.prototype,"entity",2),sr=c([C({tagName:d+"-form-field",template:`<${d}-form class="${b}-field" logger="{{ :host.logger }}"
|
|
681
681
|
css-class="{{ {'${b}-fetching': ::_fetcher.fetching, '${b}-dirty': this.dirty, '${b}-invalid': !this.valid, '${b}-editable': !:host.readonly, '${b}-readonly': :host.readonly, '${b}-pristine': !this.dirty, '${b}-valid': this.valid, '${b}-has-value': !:host._isValueNullOrEmpty(:host.entity, :host.metadata) } }}">
|
|
682
682
|
<label class="${b}-label"><${d}-span></${d}-span></label>
|
|
683
683
|
<div class="${b}-input-container"></div>
|
|
684
684
|
<${d}-fetch debounce="300" logger="{{ :host.logger }}" credentials="{{ :host.fetchCredentials }}" headers="{{ :host.fetchHeaders }}" diff-by-values="true"
|
|
685
685
|
on-fetchresult=":host._broadcastFetchResult($event.detail)"></${d}-fetch>
|
|
686
686
|
<${d}-panel class="${b}-validators" hide="{{ ::_form.valid || !::_form.dirty || :host.readonly }}"></${d}-panel>
|
|
687
|
-
</${d}-form>`})],sr);var
|
|
688
|
-
disabled="{{ (::_suggest.hint || '').length < ${
|
|
687
|
+
</${d}-form>`})],sr);var T0=3,$s,hn=class extends _e{constructor(){super(...arguments);z(this,$s);this._dragendHandler=e=>{this._reverseGeocoder.position=e.detail.position}}get inputFields(){return[]}toggleReadonlyView(e){this._setupSuggest(),this._setupMapMarker()}onChange(e){return new Promise((t,n)=>{if(e.type==="success"&&e.target===this._reverseGeocoder){let i=M(this,$s).position,s=e.detail.sort((u,f)=>{let g=es.MapProjection.distanceBetween(u.position,i),v=es.MapProjection.distanceBetween(f.position,i);return g<v?0:-1}),l=s[0].position.altitude,p=a.extend({},s[0],{position:a.extend({altitude:l},i)});t(this.value=p)}else e.type===kc&&e.target===this._suggest?t(this.value=this._suggest.value):t(this.value)})}fetch(e){es.LatLng.isLatLng(e)&&(M(this,$s).position=this._reverseGeocoder.position=e)}compareValuePropertyValues(e,t){let n=e?.position??es.LatLng.Empty,i=t?.position??es.LatLng.Empty;return es.LatLng.equals(n,i)}acceptValue(e){a.isNull(e)?this._datasource.model=[]:(this._datasource.model=[e],this._setupMapMarker()),this._setupSuggest()}getViewValue(e){return e?.fullAddress||""}convertValueAttributeToProperty(e){return m.Json.convert(e,this)}viewActivatedCallback(){super.viewActivatedCallback(),this._setup()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"adapter":this._setupAdapters(n);break;case"map":t&&this._detachMarker(t),n&&this._setupMapMarker(n);break;case"icon":this._setupMapMarker();break;case"plaeholder":this._setupSuggest();break;case"disabled":this._setupMapMarker(),this._setupSuggest();break}}disconnectedCallback(){this._disposeMarker(),super.disconnectedCallback()}_setupAdapters(e=this.adapter){let t=this._geocoder,n=this._reverseGeocoder;a.isNull(t)||(t.adapter=e),a.isNull(n)||(n.adapter=e)}_setupSuggest(){let e=this._suggest;a.isNull(e)||(e.placeholder=this.placeholder??"search...",e.readonly=this.readonly,e.disabled=this.disabled,e.value=this.value)}_detachMarker(e=this.map){let t=M(this,$s);!a.isNull(t)&&t.map===e&&t.remove()}_createMarker(){let e=new Qc.Maps.PacemMapMarkerElement;return e.addEventListener("dragend",this._dragendHandler,!1),e}_disposeMarker(){let e=M(this,$s);a.isNull(e)||e.removeEventListener("dragend",this._dragendHandler,!1)}_setupMapMarker(e=this.map){let t=M(this,$s)||H(this,$s,this._createMarker());t.icon=this.icon,t.draggable=!this.readonly&&!this.disabled,t.hide=this.disabled;let n=this.value;n&&n.position&&(t.position=n.position),t.map!==e&&!a.isNull(e)&&e.appendChild(t)}_setup(){this._setupAdapters(),this._setupSuggest(),this._setupMapMarker()}};$s=new WeakMap,c([h({emit:!1,converter:m.Element})],hn.prototype,"adapter",2),c([h({emit:!1,converter:m.Element})],hn.prototype,"map",2),c([h({emit:!1,converter:m.Json})],hn.prototype,"icon",2),c([S(d+"-data[ds]")],hn.prototype,"_datasource",2),c([S(d+"-suggest")],hn.prototype,"_suggest",2),c([S(d+"-map-geocode")],hn.prototype,"_geocoder",2),c([S(d+"-map-geocode[reverse]")],hn.prototype,"_reverseGeocoder",2),hn=c([C({tagName:d+"-geolocate",shadow:!1,template:`<${d}-map-geocode search="{{ ::_suggest.hint }}"
|
|
688
|
+
disabled="{{ (::_suggest.hint || '').length < ${T0} }}" on-success="::_datasource.model = $event.detail"></${d}-map-geocode>
|
|
689
689
|
<${d}-map-geocode reverse on-success=":host.changeHandler($event)"></${d}-map-geocode>
|
|
690
690
|
|
|
691
691
|
<${d}-data ds></${d}-data>
|
|
692
692
|
|
|
693
693
|
<${d}-suggest on-change=":host.changeHandler($event)" datasource="{{ ::_datasource.model || [] }}"
|
|
694
|
-
compare-by="fullAddress" text-property="fullAddress"></${d}-suggest>`})],hn);var Dm=class extends CustomEvent{constructor(r){super("hierarchychange",{detail:r,bubbles:!1,cancelable:!1})}},kv="hierarchy-item",V_=kv+" "+b+"-anim anim-fade-in anim-sudden",U_="{{ { 'item-disabled' : ^item.disabled } }}",z_="pacemHierarchy",G_="item-content",Y_="item-link",F_=Y_+" icon-rotate rotate-135",W_="link",Ev="item-move",j_="drag_indicator",wv="parents",Ol,wp,Hs,wu,Vn,kp,Ct=class extends _e{constructor(){super();z(this,Ol);z(this,wp,new Map);z(this,Hs);z(this,wu);z(this,Vn,new Map);z(this,kp);this.unlinkCaption="Delete";this._binderClickHandler=e=>{let t=e.originalEvent.type;if(t==="mousedown"&&e.originalEvent.button===1){Q(e.originalEvent);let n=e.srcElement;this._unlink(n)}else if(t==="click"||t==="contextmenu"){Q(e.originalEvent),H(this,wu,e.srcElement);let n=this._balloon;n.target={x:e.pageX,y:e.pageY},n.popup()}};this._dragInitHandler=e=>{let t=e.detail,n=this._dragger;n.floater=document.createElement("span"),n.dropTargets=Array.from(M(this,Vn).keys()).filter(s=>s!==t.element),a.isNull(M(this,Hs))||M(this,Hs).remove();let i=H(this,Hs,new ie.UI.PacemBinderElement);i.from=t.element,M(this,kp).appendChild(i)};this._dragStartHandler=e=>{a.addClass(e.detail.element,"item-drag")};this._dragHandler=e=>{M(this,Hs).to=e.detail.currentPosition};this._dragEndHandler=e=>{a.removeClass(e.detail.element,"item-drag"),M(this,Hs).remove(),H(this,Hs,null)};this._dropHandler=e=>{let t=e.detail.data,n=M(this,Vn).get(e.detail.target);!this._isInAncestors(t,n)&&!this._isInDescendants(t,n)&&this._compileHierarchy({source:t,target:n})};this._dragOverHandler=e=>{let t=e.detail.data,n=M(this,Vn).get(e.detail.target);(n.disabled||this._isInAncestors(t,n)||this._isInDescendants(t,n))&&e.preventDefault()};this._dragOutHandler=e=>{};this._popoutHandler=e=>{this._balloon.popout()};H(this,Ol,a.uniqueCode())}getViewValue(e){return""}convertValueAttributeToProperty(e){return a.Json.parse(e)}get inputFields(){return[]}toggleReadonlyView(e){this._dragger.disabled=e,a.isNull(this._adaptedDatasource)||this._databind()}onChange(e){return new Promise((t,n)=>{de.isInstanceOf(e,Dm)?t(this.value=e.detail):t(this.value)})}acceptValue(e){}viewActivatedCallback(){super.viewActivatedCallback(),H(this,kp,A.findAncestorShell(this)),this._setupItemTemplate(),this._setupDragger(),this._setupBalloon()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this._buildAdaptedDatasource()});break;case"itemtemplate":i||this._setupItemTemplate();break;case"_adaptedDatasource":case"value":cancelAnimationFrame(this._handle2),this._handle2=requestAnimationFrame(()=>{this._databind()});break}}disconnectedCallback(){this._disposeBindersAndTargets(),this._disposeDragger(),this._disposeBalloon(),super.disconnectedCallback()}_buildAdaptedDatasource(e=this.datasource){this._adaptedDatasource=e&&e.map(t=>this._mapEntityToItem(t))}_mapEntityToValue(e){let t=e,n;return(n=this.valueProperty)&&(t=e[n]),t}_mapEntityToViewValue(e){let t=e.toString(),n;return(n=this.textProperty)&&(t=e[n]),t}_mapEntityToItem(e){if(e==null)throw new Error("Entity cannot be null");let t=!1,n=this.disabledProperty;return a.isNullOrEmpty(n)||(t=e[n]||!1),{value:this._mapEntityToValue(e),viewValue:this._mapEntityToViewValue(e),disabled:t,data:e}}_unlink(e){var t;e instanceof ie.UI.PacemBinderElement?t=e:(e.preventDefault(),e.stopPropagation(),t=M(this,wu));let{parent:n,child:i}=JSON.parse(t.dataset[z_]),s=this._adaptedDatasource,l=s.find(u=>u.value===n),p=s.find(u=>u.value===i);!l.disabled&&!p.disabled&&this._compileHierarchy({source:l,target:p},!0)}_buildHierarchyItemDomId(e){return`hierarchyitem_${M(this,Ol)}_${e}`}_itemCreate(e){let t=e.detail.dom.find(u=>u instanceof HTMLElement&&u.classList.contains(kv)),n=e.detail.index,i=e.detail.item;t.id=this._buildHierarchyItemDomId(i.value),i.disabled?t.setAttribute("behaviors","{{ [#"+this._dragger2.id+"] }}"):t.setAttribute("behaviors","{{ [#"+this._dragger.id+", #"+this._dragger2.id+"] }}");let s=M(this,wp),l=i.value,p;s.has(l)?p=s.get(l):s.set(l,p=new Map);for(let u of i.parents||[]){let f=u.value,g=!p.has(f),v=g?new ie.UI.PacemBinderElement:p.get(f);v.fromAnchor=ie.UI.BinderAnchor.Bottom,v.toAnchor=ie.UI.BinderAnchor.Top,v.toEnd=ie.UI.BinderEnd.Arrow,v.setAttribute("from","{{ #"+this._buildHierarchyItemDomId(u.value)+" }}"),v.setAttribute("to","{{ #"+t.id+" }}"),v.cssClass=["hierarchy-binder"],v.dataset[z_]=JSON.stringify({parent:u.value,child:i.value}),v.interactive=!this.readonly&&!i.disabled&&!u.disabled,g&&(v.addEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler,!1),M(this,kp).appendChild(v),p.set(f,v))}for(let u of p.keys()){let f=i.parents.find(v=>v.value===u);if(!a.isNull(f))continue;let g=p.get(u);g.removeEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler),g.remove(),p.delete(u)}M(this,Vn).has(t)||M(this,Vn).set(t,i)}_itemRemove(e){let t=e.detail.dom.find(i=>i instanceof HTMLElement&&i.classList.contains(kv)),n=e.detail.item;this._disposeBinders(n.value),M(this,Vn).has(t)&&M(this,Vn).delete(t)}_disposeBinders(e){let t=M(this,wp);if(t.has(e)){let n=t.get(e);for(let i of n.keys()){let s=n.get(i);s.removeEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler,!1),s.remove()}t.delete(e)}}_disposeBindersAndTargets(){for(let e of M(this,wp).keys())this._disposeBinders(e);M(this,Vn).clear()}_setupItemTemplate(){if(this.itemtemplate instanceof HTMLTemplateElement){let e=this.itemtemplate.cloneNode(!0).content,t=document.createElement("template"),n=document.createElement(d+"-panel");n.className=V_,n.setAttribute("css-class",U_);let i=new ie.UI.PacemIconElement;i.setAttribute("icon",j_),i.className=Ev,n.appendChild(i);let s=document.createElement("div");s.className=G_,s.append(e),n.appendChild(s);let l=new ie.UI.PacemIconElement;l.setAttribute("icon",W_),l.className=F_,n.appendChild(l),t.content.appendChild(n),this._template=t}else this._template=this._defaultTemplate}_compileHierarchy(e,t=!1){let n=a.clone(this.value||[]),i=e.source.value,s=e.target.value,l=this.parentsProperty||wv;var p=n.find(u=>u[this.valueProperty]===s);if(t){if(!a.isNull(p)){let u=p[l]||[],f=u.indexOf(i);f>=0&&u.splice(f,1)}}else a.isNull(p)&&(p={},p[this.valueProperty]=s,p[l]=[],n.push(p)),p[l].push(i);this._tidyUpHierarchy(n),this.changeHandler(new Dm(n))}_tidyUpHierarchy(e=[]){let t=this.valueProperty,n=this.parentsProperty||wv,i=(s,l)=>{let p=e.find(f=>f[t]==l);if(a.isNull(p)||a.isNullOrEmpty(p[n]))return!1;let u=p[n];return u.indexOf(s)>=0?!0:u.some(f=>i(s,f))};for(let s of e){let l=s[n]||[];for(let p=l.length-1;p>=0;p--){let u=l[p],f=l.filter(g=>g!==u);for(let g of f)if(i(u,g)){l.splice(p,1);break}}}}_setupDragger(){let e=this._dragger;e.id="hierarchy_link_"+M(this,Ol),e.handleSelector="."+Y_,e.dropBehavior=J.DropBehavior.None,e.spillBehavior=J.DropTargetMissedBehavior.None,e.mode=J.DragDataMode.Copy,e.addEventListener(J.DragDropEventType.Drop,this._dropHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._dragHandler,!1),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Start,this._dragStartHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.addEventListener(J.DragDropEventType.Over,this._dragOverHandler,!1),e.addEventListener(J.DragDropEventType.Out,this._dragOutHandler,!1);let t=this._dragger2;t.id="hierarchy_move_"+M(this,Ol),t.mode=J.DragDataMode.Self,t.dropBehavior=J.DropBehavior.None,t.spillBehavior=J.DropTargetMissedBehavior.None,t.handleSelector="."+Ev}_disposeDragger(){let e=this._dragger;a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Drop,this._dropHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._dragHandler,!1),e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Start,this._dragStartHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.removeEventListener(J.DragDropEventType.Over,this._dragOverHandler,!1),e.removeEventListener(J.DragDropEventType.Out,this._dragOutHandler,!1))}_setupBalloon(){this._balloon=this._shellProxy.dom.find(e=>e instanceof ie.UI.PacemBalloonElement),window.addEventListener("mousedown",this._popoutHandler,!1)}_disposeBalloon(){window.removeEventListener("mousedown",this._popoutHandler,!1)}_isInAncestors(e,t){return a.isNull(t)||a.isNullOrEmpty(t.parents)?!1:t.parents.indexOf(e)>=0?!0:t.parents.some(n=>this._isInAncestors(e,n))}_isInDescendants(e,t){return this._isInAncestors(t,e)}_databind(){let e=this.valueProperty;if(a.isNullOrEmpty(e))throw new Error("Missing valueProperty.");let t=a.clone(this._adaptedDatasource||[]),n=this.value||[],i=this.parentsProperty||wv;for(let s of t){let l=n.find(p=>p[e]===s.value);a.isNull(l)||(s.parents=(l[i]||[]).map(p=>t.find(u=>u.value===p)).filter(p=>!a.isNull(p)))}this._databindByParents(t)}_databindByParents(e){let t=[];function n(){return t.reduce((i,s)=>i+s.length,0)}do if(a.isNullOrEmpty(t)){let i=e.filter(s=>a.isNullOrEmpty(s.parents));t.push(i)}else{let i=Array.prototype.concat.apply([],t),s=t[t.length-1],l=e.filter(p=>a.isNullOrEmpty(p.parents)?!1:p.parents.every(u=>i.indexOf(u)>=0)&&p.parents.some(u=>s.indexOf(u)>=0));t.push(l)}while(n()<e.length);this._repeater.datasource=t}};Ol=new WeakMap,wp=new WeakMap,Hs=new WeakMap,wu=new WeakMap,Vn=new WeakMap,kp=new WeakMap,c([S("template[default]")],Ct.prototype,"_defaultTemplate",2),c([S(d+"-repeater")],Ct.prototype,"_repeater",2),c([S(d+"-drag-drop")],Ct.prototype,"_dragger",2),c([S(d+"-drag-drop[move]")],Ct.prototype,"_dragger2",2),c([S(d+"-shell-proxy")],Ct.prototype,"_shellProxy",2),c([h({emit:!1,converter:m.Json})],Ct.prototype,"datasource",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"valueProperty",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"textProperty",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"disabledProperty",2),c([h({converter:m.String})],Ct.prototype,"unlinkCaption",2),c([h({converter:m.Json})],Ct.prototype,"_adaptedDatasource",2),c([h({emit:!1,converter:m.Element})],Ct.prototype,"itemtemplate",2),c([h({converter:m.Element})],Ct.prototype,"_template",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"parentsProperty",2),Ct=c([C({tagName:d+"-hierarchy",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater>
|
|
694
|
+
compare-by="fullAddress" text-property="fullAddress"></${d}-suggest>`})],hn);var Dm=class extends CustomEvent{constructor(r){super("hierarchychange",{detail:r,bubbles:!1,cancelable:!1})}},kv="hierarchy-item",U_=kv+" "+b+"-anim anim-fade-in anim-sudden",z_="{{ { 'item-disabled' : ^item.disabled } }}",G_="pacemHierarchy",F_="item-content",X_="item-link",W_=X_+" icon-rotate rotate-135",j_="link",Ev="item-move",Y_="drag_indicator",wv="parents",Ol,wp,Hs,wu,Vn,kp,Ct=class extends _e{constructor(){super();z(this,Ol);z(this,wp,new Map);z(this,Hs);z(this,wu);z(this,Vn,new Map);z(this,kp);this.unlinkCaption="Delete";this._binderClickHandler=e=>{let t=e.originalEvent.type;if(t==="mousedown"&&e.originalEvent.button===1){Q(e.originalEvent);let n=e.srcElement;this._unlink(n)}else if(t==="click"||t==="contextmenu"){Q(e.originalEvent),H(this,wu,e.srcElement);let n=this._balloon;n.target={x:e.pageX,y:e.pageY},n.popup()}};this._dragInitHandler=e=>{let t=e.detail,n=this._dragger;n.floater=document.createElement("span"),n.dropTargets=Array.from(M(this,Vn).keys()).filter(s=>s!==t.element),a.isNull(M(this,Hs))||M(this,Hs).remove();let i=H(this,Hs,new ie.UI.PacemBinderElement);i.from=t.element,M(this,kp).appendChild(i)};this._dragStartHandler=e=>{a.addClass(e.detail.element,"item-drag")};this._dragHandler=e=>{M(this,Hs).to=e.detail.currentPosition};this._dragEndHandler=e=>{a.removeClass(e.detail.element,"item-drag"),M(this,Hs).remove(),H(this,Hs,null)};this._dropHandler=e=>{let t=e.detail.data,n=M(this,Vn).get(e.detail.target);!this._isInAncestors(t,n)&&!this._isInDescendants(t,n)&&this._compileHierarchy({source:t,target:n})};this._dragOverHandler=e=>{let t=e.detail.data,n=M(this,Vn).get(e.detail.target);(n.disabled||this._isInAncestors(t,n)||this._isInDescendants(t,n))&&e.preventDefault()};this._dragOutHandler=e=>{};this._popoutHandler=e=>{this._balloon.popout()};H(this,Ol,a.uniqueCode())}getViewValue(e){return""}convertValueAttributeToProperty(e){return a.Json.parse(e)}get inputFields(){return[]}toggleReadonlyView(e){this._dragger.disabled=e,a.isNull(this._adaptedDatasource)||this._databind()}onChange(e){return new Promise((t,n)=>{de.isInstanceOf(e,Dm)?t(this.value=e.detail):t(this.value)})}acceptValue(e){}viewActivatedCallback(){super.viewActivatedCallback(),H(this,kp,A.findAncestorShell(this)),this._setupItemTemplate(),this._setupDragger(),this._setupBalloon()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(()=>{this._buildAdaptedDatasource()});break;case"itemtemplate":i||this._setupItemTemplate();break;case"_adaptedDatasource":case"value":cancelAnimationFrame(this._handle2),this._handle2=requestAnimationFrame(()=>{this._databind()});break}}disconnectedCallback(){this._disposeBindersAndTargets(),this._disposeDragger(),this._disposeBalloon(),super.disconnectedCallback()}_buildAdaptedDatasource(e=this.datasource){this._adaptedDatasource=e&&e.map(t=>this._mapEntityToItem(t))}_mapEntityToValue(e){let t=e,n;return(n=this.valueProperty)&&(t=e[n]),t}_mapEntityToViewValue(e){let t=e.toString(),n;return(n=this.textProperty)&&(t=e[n]),t}_mapEntityToItem(e){if(e==null)throw new Error("Entity cannot be null");let t=!1,n=this.disabledProperty;return a.isNullOrEmpty(n)||(t=e[n]||!1),{value:this._mapEntityToValue(e),viewValue:this._mapEntityToViewValue(e),disabled:t,data:e}}_unlink(e){var t;e instanceof ie.UI.PacemBinderElement?t=e:(e.preventDefault(),e.stopPropagation(),t=M(this,wu));let{parent:n,child:i}=JSON.parse(t.dataset[G_]),s=this._adaptedDatasource,l=s.find(u=>u.value===n),p=s.find(u=>u.value===i);!l.disabled&&!p.disabled&&this._compileHierarchy({source:l,target:p},!0)}_buildHierarchyItemDomId(e){return`hierarchyitem_${M(this,Ol)}_${e}`}_itemCreate(e){let t=e.detail.dom.find(u=>u instanceof HTMLElement&&u.classList.contains(kv)),n=e.detail.index,i=e.detail.item;t.id=this._buildHierarchyItemDomId(i.value),i.disabled?t.setAttribute("behaviors","{{ [#"+this._dragger2.id+"] }}"):t.setAttribute("behaviors","{{ [#"+this._dragger.id+", #"+this._dragger2.id+"] }}");let s=M(this,wp),l=i.value,p;s.has(l)?p=s.get(l):s.set(l,p=new Map);for(let u of i.parents||[]){let f=u.value,g=!p.has(f),v=g?new ie.UI.PacemBinderElement:p.get(f);v.fromAnchor=ie.UI.BinderAnchor.Bottom,v.toAnchor=ie.UI.BinderAnchor.Top,v.toEnd=ie.UI.BinderEnd.Arrow,v.setAttribute("from","{{ #"+this._buildHierarchyItemDomId(u.value)+" }}"),v.setAttribute("to","{{ #"+t.id+" }}"),v.cssClass=["hierarchy-binder"],v.dataset[G_]=JSON.stringify({parent:u.value,child:i.value}),v.interactive=!this.readonly&&!i.disabled&&!u.disabled,g&&(v.addEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler,!1),M(this,kp).appendChild(v),p.set(f,v))}for(let u of p.keys()){let f=i.parents.find(v=>v.value===u);if(!a.isNull(f))continue;let g=p.get(u);g.removeEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler),g.remove(),p.delete(u)}M(this,Vn).has(t)||M(this,Vn).set(t,i)}_itemRemove(e){let t=e.detail.dom.find(i=>i instanceof HTMLElement&&i.classList.contains(kv)),n=e.detail.item;this._disposeBinders(n.value),M(this,Vn).has(t)&&M(this,Vn).delete(t)}_disposeBinders(e){let t=M(this,wp);if(t.has(e)){let n=t.get(e);for(let i of n.keys()){let s=n.get(i);s.removeEventListener(ie.UI.BinderInteractionEventName,this._binderClickHandler,!1),s.remove()}t.delete(e)}}_disposeBindersAndTargets(){for(let e of M(this,wp).keys())this._disposeBinders(e);M(this,Vn).clear()}_setupItemTemplate(){if(this.itemtemplate instanceof HTMLTemplateElement){let e=this.itemtemplate.cloneNode(!0).content,t=document.createElement("template"),n=document.createElement(d+"-panel");n.className=U_,n.setAttribute("css-class",z_);let i=new ie.UI.PacemIconElement;i.setAttribute("icon",Y_),i.className=Ev,n.appendChild(i);let s=document.createElement("div");s.className=F_,s.append(e),n.appendChild(s);let l=new ie.UI.PacemIconElement;l.setAttribute("icon",j_),l.className=W_,n.appendChild(l),t.content.appendChild(n),this._template=t}else this._template=this._defaultTemplate}_compileHierarchy(e,t=!1){let n=a.clone(this.value||[]),i=e.source.value,s=e.target.value,l=this.parentsProperty||wv;var p=n.find(u=>u[this.valueProperty]===s);if(t){if(!a.isNull(p)){let u=p[l]||[],f=u.indexOf(i);f>=0&&u.splice(f,1)}}else a.isNull(p)&&(p={},p[this.valueProperty]=s,p[l]=[],n.push(p)),p[l].push(i);this._tidyUpHierarchy(n),this.changeHandler(new Dm(n))}_tidyUpHierarchy(e=[]){let t=this.valueProperty,n=this.parentsProperty||wv,i=(s,l)=>{let p=e.find(f=>f[t]==l);if(a.isNull(p)||a.isNullOrEmpty(p[n]))return!1;let u=p[n];return u.indexOf(s)>=0?!0:u.some(f=>i(s,f))};for(let s of e){let l=s[n]||[];for(let p=l.length-1;p>=0;p--){let u=l[p],f=l.filter(g=>g!==u);for(let g of f)if(i(u,g)){l.splice(p,1);break}}}}_setupDragger(){let e=this._dragger;e.id="hierarchy_link_"+M(this,Ol),e.handleSelector="."+X_,e.dropBehavior=J.DropBehavior.None,e.spillBehavior=J.DropTargetMissedBehavior.None,e.mode=J.DragDataMode.Copy,e.addEventListener(J.DragDropEventType.Drop,this._dropHandler,!1),e.addEventListener(J.DragDropEventType.Drag,this._dragHandler,!1),e.addEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(J.DragDropEventType.Start,this._dragStartHandler,!1),e.addEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.addEventListener(J.DragDropEventType.Over,this._dragOverHandler,!1),e.addEventListener(J.DragDropEventType.Out,this._dragOutHandler,!1);let t=this._dragger2;t.id="hierarchy_move_"+M(this,Ol),t.mode=J.DragDataMode.Self,t.dropBehavior=J.DropBehavior.None,t.spillBehavior=J.DropTargetMissedBehavior.None,t.handleSelector="."+Ev}_disposeDragger(){let e=this._dragger;a.isNull(e)||(e.removeEventListener(J.DragDropEventType.Drop,this._dropHandler,!1),e.removeEventListener(J.DragDropEventType.Drag,this._dragHandler,!1),e.removeEventListener(J.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(J.DragDropEventType.Start,this._dragStartHandler,!1),e.removeEventListener(J.DragDropEventType.End,this._dragEndHandler,!1),e.removeEventListener(J.DragDropEventType.Over,this._dragOverHandler,!1),e.removeEventListener(J.DragDropEventType.Out,this._dragOutHandler,!1))}_setupBalloon(){this._balloon=this._shellProxy.dom.find(e=>e instanceof ie.UI.PacemBalloonElement),window.addEventListener("mousedown",this._popoutHandler,!1)}_disposeBalloon(){window.removeEventListener("mousedown",this._popoutHandler,!1)}_isInAncestors(e,t){return a.isNull(t)||a.isNullOrEmpty(t.parents)?!1:t.parents.indexOf(e)>=0?!0:t.parents.some(n=>this._isInAncestors(e,n))}_isInDescendants(e,t){return this._isInAncestors(t,e)}_databind(){let e=this.valueProperty;if(a.isNullOrEmpty(e))throw new Error("Missing valueProperty.");let t=a.clone(this._adaptedDatasource||[]),n=this.value||[],i=this.parentsProperty||wv;for(let s of t){let l=n.find(p=>p[e]===s.value);a.isNull(l)||(s.parents=(l[i]||[]).map(p=>t.find(u=>u.value===p)).filter(p=>!a.isNull(p)))}this._databindByParents(t)}_databindByParents(e){let t=[];function n(){return t.reduce((i,s)=>i+s.length,0)}do if(a.isNullOrEmpty(t)){let i=e.filter(s=>a.isNullOrEmpty(s.parents));t.push(i)}else{let i=Array.prototype.concat.apply([],t),s=t[t.length-1],l=e.filter(p=>a.isNullOrEmpty(p.parents)?!1:p.parents.every(u=>i.indexOf(u)>=0)&&p.parents.some(u=>s.indexOf(u)>=0));t.push(l)}while(n()<e.length);this._repeater.datasource=t}};Ol=new WeakMap,wp=new WeakMap,Hs=new WeakMap,wu=new WeakMap,Vn=new WeakMap,kp=new WeakMap,c([S("template[default]")],Ct.prototype,"_defaultTemplate",2),c([S(d+"-repeater")],Ct.prototype,"_repeater",2),c([S(d+"-drag-drop")],Ct.prototype,"_dragger",2),c([S(d+"-drag-drop[move]")],Ct.prototype,"_dragger2",2),c([S(d+"-shell-proxy")],Ct.prototype,"_shellProxy",2),c([h({emit:!1,converter:m.Json})],Ct.prototype,"datasource",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"valueProperty",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"textProperty",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"disabledProperty",2),c([h({converter:m.String})],Ct.prototype,"unlinkCaption",2),c([h({converter:m.Json})],Ct.prototype,"_adaptedDatasource",2),c([h({emit:!1,converter:m.Element})],Ct.prototype,"itemtemplate",2),c([h({converter:m.Element})],Ct.prototype,"_template",2),c([h({emit:!1,converter:m.String})],Ct.prototype,"parentsProperty",2),Ct=c([C({tagName:d+"-hierarchy",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater>
|
|
695
695
|
<template>
|
|
696
696
|
<${d}-repeater on-${R.RepeaterItemCreateEventName}=":host._itemCreate($event)" on-${R.RepeaterItemRemoveEventName}=":host._itemRemove($event)" datasource="{{ ^item }}">
|
|
697
697
|
<div class="hierarchy-level">
|
|
@@ -704,10 +704,10 @@ css-class="{{ {'${b}-fetching': ::_fetcher.fetching, '${b}-dirty': this.dirty, '
|
|
|
704
704
|
<${d}-drag-drop></${d}-drag-drop>
|
|
705
705
|
<${d}-drag-drop move></${d}-drag-drop>
|
|
706
706
|
<template default>
|
|
707
|
-
<${d}-panel class="${
|
|
708
|
-
<${d}-icon class="${Ev}" icon="${
|
|
709
|
-
<pacem-span class="${
|
|
710
|
-
<${d}-icon class="${
|
|
707
|
+
<${d}-panel class="${U_} item-default" css-class="${z_}">
|
|
708
|
+
<${d}-icon class="${Ev}" icon="${Y_}"></${d}-icon>
|
|
709
|
+
<pacem-span class="${F_}" content="{{ ^item.viewValue }}"></${d}-span>
|
|
710
|
+
<${d}-icon class="${W_}" icon="${j_}"></${d}-icon>
|
|
711
711
|
</${d}-panel>
|
|
712
712
|
</template>
|
|
713
713
|
<${d}-shell-proxy>
|
|
@@ -723,8 +723,8 @@ css-class="{{ {'${b}-fetching': ::_fetcher.fetching, '${b}-dirty': this.dirty, '
|
|
|
723
723
|
<${d}-panel class="${b}-input-color" css="{{ { 'background-color': :host.viewValue } }}"><input type="color" class="${b}-input" /></${d}-panel>
|
|
724
724
|
<input class="${b}-input" type="number" min="0" max="100" step="1" value="100" />
|
|
725
725
|
</div>
|
|
726
|
-
<${d}-span class="${b}-readonly" css="{{ { 'background-color': :host.viewValue } }}"></${d}-span>`,shadow:j.USE_SHADOW_ROOT})],Vs);var Pl=class extends rt{toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=email]")],Pl.prototype,"_input",2),c([S(d+"-a")],Pl.prototype,"_anchor",2),Pl=c([C({tagName:d+"-input-email",template:`<input type="email" class="${b}-input ${b}-viewfinder" />${er}<${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'mailto:'+ :host.value }}"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Pl);var Om="fileupload",
|
|
727
|
-
(${l} file${l===1?"":"s"}, ${a.core.size(s)})`}toggleReadonlyView(e){this._setupInputElement(e)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupInputElement(),this._fileupload.addEventListener("click",Re,!1)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||e==="selectMode"&&this._setupInputElement()}disconnectedCallback(){this._fileupload&&this._fileupload.removeEventListener("click",Re,!1),super.disconnectedCallback()}_setupInputElement(e=this.readonly,t=this.selectMode??"file"){let n=this._fileupload;switch(n.removeAttribute("webkitdirectory"),n.removeAttribute("multiple"),n.hidden=e,t){case"directory":n.setAttribute("webkitdirectory","true");break;case"multiple":n.setAttribute("multiple","true");break;case"directory-picker":case"file-picker":case"multiple-picker":n.hidden=!0;break}}_dispatchDownload(e){Q(e);let t=this._localValue||this.value,n=i=>{this.dispatchEvent(new CustomEvent("download",{detail:i,bubbles:!0,cancelable:!1}))};a.isNullOrEmpty(t)||(typeof t=="string"?n(t):"content"in t&&!a.isNullOrEmpty(t.content)?a.download(a.dataURLToBlob("data:application/download;base64,"+t.content),t.name,t.type):"name"in t&&("kind"in t&&t.kind==="file"?t.getFile().then(i=>{a.download(i,i.name,i.type)}):n(t.name)))}reset(){super.reset(),this._localValue=null,this.invalidFile=!1}_validateAll(){let e=this._stats,t=this.maxSize;return t>0&&t<e.size?(this.invalidFile=!0,!1):(this.invalidFile=!1,!0)}_validateSingleFile(e=this._fileupload.files[0],t){e instanceof File&&(t=e.name),t=t.substring(t.lastIndexOf("\\")+1);let n=this.maxSize;if(n>0&&n<e.size)return this.invalidFile=!0,!1;let i=this.pattern;return i&&!new RegExp(i,"i").test(t)?(this.invalidFile=!0,!1):(this.invalidFile=!1,!0)}upload(e,t,n){if(this._validateSingleFile(e,t))return this._upload(e,t,n)}async _upload(e,t,n){var i=this,s=i._fields;if(!e)return;!t&&e instanceof File&&(t=e.name),i.failed=!1,s.undone=!1,s.ongoing=0;let l=e,p=i.size=l.size;t=t.substring(t.lastIndexOf("\\")+1),i.percentage=0,i.complete=!1;var u={filename:t,length:p,action:"start",state:n,type:e.type};i.uploading=!0;try{var f=await i._fetch(u);if(f.ok){var g=await f.json();s.retryFrom=0,s.blob=l,s.uid=g.uid,i._manage()}else i.uploading=!1;return f}catch{i.uploading=!1}}async _blobToBase64(e){let t=await a.blobToDataURL(e);return t.substring(t.indexOf("base64,")+7)}async _doUpload(e,t){var n=this,i=n._fields;i.ongoing++;var l={chunk:await this._blobToBase64(e),uid:i.uid,position:t,action:"do"};try{let p=await n._fetch(l);if(p.ok){if(i.ongoing--,i.undone)return;let f=await p.json();f.percentage>this.percentage&&await n._tweenPercentage(Math.round(Math.max(1,f.percentage)),200),n.complete!=f.complete&&(n.complete=f.complete,n.complete===!0&&(n.uploading=!1,n.changeHandler(new Mu(f))))}else i.retryFrom=t,n.failed=!0,n.uploading=!1}catch{i.retryFrom=t,n.failed=!0,n.uploading=!1}}_manage(){let e=this._fields,t=this.size,n=e.blob,i=this.chunkSize||e.chunkSize;var s=e.retryFrom,l=s+i;e.enqueuer=setInterval(()=>{if(s<t&&!this.failed){let u=this.parallelism||e.parallelism;if(e.ongoing>=u)return;this._doUpload(n.slice(s,l),s),s=l,l=s+i}else{var p=this._fileupload;p.value="",window.clearInterval(e.enqueuer)}},100)}async _buildLocalValue(e,t=e.name,n=e){return this._localValue={name:t,size:n.size,type:e.type,lastModified:a.parseDate(e.lastModified).toISOString(),content:await this._blobToBase64(n)}}_canPick(e){return"showDirectoryPicker"in e&&(()=>{try{return e.self===e.top}catch{return!1}})()}_tryPickDirectory(){this._canPick(window)&&window.showDirectoryPicker({mode:"read"}).then(e=>{this.changeHandler(new ku(e))})}_tryPickFiles(e=this.selectMode==="multiple-picker",t=this.pattern){this._canPick(window)&&window.showOpenFilePicker({multiple:e}).then(n=>{this.changeHandler(new ku(n))})}_clickHandler(e){if(Q(e),!this.readonly)switch(this.selectMode){case"directory-picker":this._tryPickDirectory();break;case"file-picker":case"multiple-picker":this._tryPickFiles();break}}async _mimicCompute(){this.uploading=!0,a.isNullOrEmpty(this.value)?await a.idle(250):(this.percentage=0,await a.waitForAnimationEnd(this._tuner)),await this._tweener.run(0,100,500,0,Bt.Easings.sineInOut,(e,t)=>{this.percentage=t}),this.percentage=0,this.uploading=!1}onChange(e){return new Promise(async(t,n)=>{if(de.isInstanceOf(e,Mu)){let i=this.value=e.detail.filename;this.dispatchEvent(e),t(i)}else if(de.isInstanceOf(e,ku)){let i=e.detail,s,l,p;switch(this.selectMode){case"directory-picker":s=i,this._stats=await
|
|
726
|
+
<${d}-span class="${b}-readonly" css="{{ { 'background-color': :host.viewValue } }}"></${d}-span>`,shadow:j.USE_SHADOW_ROOT})],Vs);var Pl=class extends rt{toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=email]")],Pl.prototype,"_input",2),c([S(d+"-a")],Pl.prototype,"_anchor",2),Pl=c([C({tagName:d+"-input-email",template:`<input type="email" class="${b}-input ${b}-viewfinder" />${er}<${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'mailto:'+ :host.value }}"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Pl);var Om="fileupload",q_="filechange",ku=class extends oe{constructor(r){super("pick",r)}},Mu=class extends oe{constructor(r){super(Om,r)}},Mp=class extends oe{constructor(r){super(q_,r)}},A0="!$pacem.isNullOrEmpty(:host.value) && :host.invalidFile && $pacem.isNullOrEmpty(:host.url)";async function K_(o,r={files:0,directories:0,size:0}){for await(let[e,t]of o.entries())if(t.kind==="file"){r.files++;let n=await t.getFile();r.size+=n.size}else r.directories++,await K_(t,r);return r}async function D0(o){let r={files:0,directories:0,size:0};for(let e of o){let t=await e.getFile();r.files++,r.size+=t.size}return r}var Xe=class extends _e{constructor(e=new Bt.TweenService){super();this._tweener=e;this.undoCaption="undo";this.retryCaption="retry";this.clearCaption="clear";this.uploading=!1;this.size=0;this.percentage=0;this.complete=!1;this.failed=!1;this.invalidFile=!1;this._fields={parallelism:3,uid:"",ongoing:0,enqueuer:null,blob:null,retryFrom:0,chunkSize:1024*128,undone:!1}}convertValueAttributeToProperty(e){return e}acceptValue(e){this.percentage=0,this.uploading=!1,this._fileupload.value=""}_getMimeIcon(e=this.value,t=this.uploading,n=this.selectMode??"file"){if(t)return"sync";let i=!a.isNullOrEmpty(e);switch(n){case"directory":case"directory-picker":return i?"folder":"drive_folder_upload";case"multiple":case"multiple-picker":return i?"files":"upload_file"}if(a.isNullOrEmpty(e))return"upload_file";var s=e;typeof e=="object"&&(s=e.name);let p=/\.([\w]+)(\s|$)/.exec(s);if(p&&p.length)switch(p[1].toLowerCase()){case"pdf":return"picture_as_pdf";case"jpg":case"jpeg":case"gif":case"png":return"filter"}return"filter_none"}get blob(){return this._fields.blob}get inputFields(){return a.isNull(this._fileupload)?[]:[this._fileupload]}getViewValue(e){let t=this._localValue||e;if(a.isNullOrEmpty(t))return"";if(typeof t=="string")return t;let n="name"in t?t.name:"";a.isArray(t)&&(n=t.map(p=>p.name).join(", "));let i=this._stats;if(a.isNullOrEmpty(i))return n;let{size:s,files:l}=i;return`${n}
|
|
727
|
+
(${l} file${l===1?"":"s"}, ${a.core.size(s)})`}toggleReadonlyView(e){this._setupInputElement(e)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupInputElement(),this._fileupload.addEventListener("click",Re,!1)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),i||e==="selectMode"&&this._setupInputElement()}disconnectedCallback(){this._fileupload&&this._fileupload.removeEventListener("click",Re,!1),super.disconnectedCallback()}_setupInputElement(e=this.readonly,t=this.selectMode??"file"){let n=this._fileupload;switch(n.removeAttribute("webkitdirectory"),n.removeAttribute("multiple"),n.hidden=e,t){case"directory":n.setAttribute("webkitdirectory","true");break;case"multiple":n.setAttribute("multiple","true");break;case"directory-picker":case"file-picker":case"multiple-picker":n.hidden=!0;break}}_dispatchDownload(e){Q(e);let t=this._localValue||this.value,n=i=>{this.dispatchEvent(new CustomEvent("download",{detail:i,bubbles:!0,cancelable:!1}))};a.isNullOrEmpty(t)||(typeof t=="string"?n(t):"content"in t&&!a.isNullOrEmpty(t.content)?a.download(a.dataURLToBlob("data:application/download;base64,"+t.content),t.name,t.type):"name"in t&&("kind"in t&&t.kind==="file"?t.getFile().then(i=>{a.download(i,i.name,i.type)}):n(t.name)))}reset(){super.reset(),this._localValue=null,this.invalidFile=!1}_validateAll(){let e=this._stats,t=this.maxSize;return t>0&&t<e.size?(this.invalidFile=!0,!1):(this.invalidFile=!1,!0)}_validateSingleFile(e=this._fileupload.files[0],t){e instanceof File&&(t=e.name),t=t.substring(t.lastIndexOf("\\")+1);let n=this.maxSize;if(n>0&&n<e.size)return this.invalidFile=!0,!1;let i=this.pattern;return i&&!new RegExp(i,"i").test(t)?(this.invalidFile=!0,!1):(this.invalidFile=!1,!0)}upload(e,t,n){if(this._validateSingleFile(e,t))return this._upload(e,t,n)}async _upload(e,t,n){var i=this,s=i._fields;if(!e)return;!t&&e instanceof File&&(t=e.name),i.failed=!1,s.undone=!1,s.ongoing=0;let l=e,p=i.size=l.size;t=t.substring(t.lastIndexOf("\\")+1),i.percentage=0,i.complete=!1;var u={filename:t,length:p,action:"start",state:n,type:e.type};i.uploading=!0;try{var f=await i._fetch(u);if(f.ok){var g=await f.json();s.retryFrom=0,s.blob=l,s.uid=g.uid,i._manage()}else i.uploading=!1;return f}catch{i.uploading=!1}}async _blobToBase64(e){let t=await a.blobToDataURL(e);return t.substring(t.indexOf("base64,")+7)}async _doUpload(e,t){var n=this,i=n._fields;i.ongoing++;var l={chunk:await this._blobToBase64(e),uid:i.uid,position:t,action:"do"};try{let p=await n._fetch(l);if(p.ok){if(i.ongoing--,i.undone)return;let f=await p.json();f.percentage>this.percentage&&await n._tweenPercentage(Math.round(Math.max(1,f.percentage)),200),n.complete!=f.complete&&(n.complete=f.complete,n.complete===!0&&(n.uploading=!1,n.changeHandler(new Mu(f))))}else i.retryFrom=t,n.failed=!0,n.uploading=!1}catch{i.retryFrom=t,n.failed=!0,n.uploading=!1}}_manage(){let e=this._fields,t=this.size,n=e.blob,i=this.chunkSize||e.chunkSize;var s=e.retryFrom,l=s+i;e.enqueuer=setInterval(()=>{if(s<t&&!this.failed){let u=this.parallelism||e.parallelism;if(e.ongoing>=u)return;this._doUpload(n.slice(s,l),s),s=l,l=s+i}else{var p=this._fileupload;p.value="",window.clearInterval(e.enqueuer)}},100)}async _buildLocalValue(e,t=e.name,n=e){return this._localValue={name:t,size:n.size,type:e.type,lastModified:a.parseDate(e.lastModified).toISOString(),content:await this._blobToBase64(n)}}_canPick(e){return"showDirectoryPicker"in e&&(()=>{try{return e.self===e.top}catch{return!1}})()}_tryPickDirectory(){this._canPick(window)&&window.showDirectoryPicker({mode:"read"}).then(e=>{this.changeHandler(new ku(e))})}_tryPickFiles(e=this.selectMode==="multiple-picker",t=this.pattern){this._canPick(window)&&window.showOpenFilePicker({multiple:e}).then(n=>{this.changeHandler(new ku(n))})}_clickHandler(e){if(Q(e),!this.readonly)switch(this.selectMode){case"directory-picker":this._tryPickDirectory();break;case"file-picker":case"multiple-picker":this._tryPickFiles();break}}async _mimicCompute(){this.uploading=!0,a.isNullOrEmpty(this.value)?await a.idle(250):(this.percentage=0,await a.waitForAnimationEnd(this._tuner)),await this._tweener.run(0,100,500,0,Bt.Easings.sineInOut,(e,t)=>{this.percentage=t}),this.percentage=0,this.uploading=!1}onChange(e){return new Promise(async(t,n)=>{if(de.isInstanceOf(e,Mu)){let i=this.value=e.detail.filename;this.dispatchEvent(e),t(i)}else if(de.isInstanceOf(e,ku)){let i=e.detail,s,l,p;switch(this.selectMode){case"directory-picker":s=i,this._stats=await K_(s);break;case"multiple-picker":case"file-picker":p=i,p.length===1&&(i=p[0]),this._stats=await D0(p);break;default:this._stats={directories:0,files:0,size:0};break}t(this.value=this._localValue=i);let u=this._validateAll();this.dispatchEvent(new Mp({directory:s,file:l,files:p,valid:u}))}else{let i=this._fileupload;if(i.files.length===0)this._stats={directories:0,files:0,size:0},t(this.value=null);else{let s=i.files.length;if(this._stats={directories:0,files:s,size:Array.from(i.files).reduce((l,p,u)=>l+=p.size,0)},s>1){let l=Array.from(i.files);t(this.value=this._localValue=l);let p=this._validateAll();this.dispatchEvent(new Mp({files:l,valid:p}))}else{let l=i.files[0],p=l.name,u=l;!this._validateSingleFile(l)&&!a.isNullOrEmpty(this.url)?t(this.value=await this._buildLocalValue(l)):(/\.(jpe?g|png)$/i.test(p)&&this.maxImageWidth>0&&this.maxImageHeight>0&&(u=await a.Images.resize(u,this.maxImageWidth,this.maxImageHeight,{quality:.8})),await this._buildLocalValue(l,p,u),a.isNullOrEmpty(this.url)?(await this._mimicCompute(),t(this.value=this._localValue)):(this._upload(u,i.value),t(this.value))),this.dispatchEvent(new Mp({valid:!this.invalidFile,file:l}))}}}})}_fetch(e){return fetch(this.url,{method:"POST",credentials:this.fetchCredentials,headers:a.extend({Accept:"application/json","Content-Type":"application/json"},this.fetchHeaders||{}),body:JSON.stringify(e)})}async _undo(e){e.preventDefault(),e.stopPropagation();var t=this,n=t._fields,i=t._fileupload;clearInterval(n.enqueuer);var s={action:"undo",uid:n.uid};try{var l=await t._fetch(s);return l.ok&&(n.undone=!0,t.size=0,t._tweenPercentage(0,300)),l}catch{}finally{return i.value="",t.uploading=!1,l}}_tweenPercentage(e,t=500){let n=this.percentage;return this._tweener.run(n,e,t,0,Bt.Easings.sineInOut,(i,s)=>{this.percentage=s})}_retry(e){e.preventDefault(),e.stopPropagation(),this.failed=!1,this._manage()}_clear(e){e.preventDefault(),e.stopPropagation(),this.invalidFile=!1;let t=this.inputFields[0];t.value="",/safari/i.test(navigator.userAgent)||(t.type="",t.type="file"),this.changeHandler(null)}};c([h({emit:!1,converter:m.Json})],Xe.prototype,"fetchCredentials",2),c([h({emit:!1,converter:m.String})],Xe.prototype,"fetchHeaders",2),c([S("input[type=file]")],Xe.prototype,"_fileupload",2),c([S(`${d}-tuner`)],Xe.prototype,"_tuner",2),c([h({converter:m.String})],Xe.prototype,"undoCaption",2),c([h({converter:m.String})],Xe.prototype,"retryCaption",2),c([h({converter:m.String})],Xe.prototype,"clearCaption",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Xe.prototype,"pattern",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Xe.prototype,"url",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],Xe.prototype,"maxImageWidth",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],Xe.prototype,"parallelism",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],Xe.prototype,"chunkSize",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],Xe.prototype,"maxImageHeight",2),c([h({emit:!1,reflectBack:!0,converter:m.Number})],Xe.prototype,"maxSize",2),c([h({reflectBack:!0,converter:m.String})],Xe.prototype,"selectMode",2),c([h({converter:m.Boolean})],Xe.prototype,"uploading",2),c([h({converter:m.Number})],Xe.prototype,"size",2),c([h({converter:m.Number})],Xe.prototype,"percentage",2),c([h({converter:m.Boolean})],Xe.prototype,"complete",2),c([h({converter:m.Boolean})],Xe.prototype,"failed",2),c([h({converter:m.Boolean})],Xe.prototype,"invalidFile",2),Xe=c([C({tagName:d+"-upload",shadow:j.USE_SHADOW_ROOT,template:`<${d}-button on-click=":host._dispatchDownload($event)" class="${b}-upload ${b}-viewfinder flat" css-class="{{ {'upload-chosen': !$pacem.isNullOrEmpty(:host.value) && !:host.uploading, 'upload-error': ${A0}, 'upload-readonly': :host.readonly } }}">
|
|
728
728
|
|
|
729
729
|
<${d}-panel class="upload-button" hide="{{ (:host.uploading || :host.failed) && !$pacem.isNullOrEmpty(:host.url) }}">
|
|
730
730
|
<${d}-button tooltip="{{ :host.readonly ? :host.viewValue : 'upload' }}" class="button-circle pos-relative overflow-hidden"
|
|
@@ -754,7 +754,7 @@ css-class="{{ {'${b}-fetching': ::_fetcher.fetching, '${b}-dirty': this.dirty, '
|
|
|
754
754
|
|
|
755
755
|
<${d}-button class="button-circle button-flat clear-button" icon-glyph="clear" hide="{{ $pacem.isNullOrEmpty(:host.value) || :host.uploading }}" tooltip="{{ :host.clearCaption }}" on-click=":host._clear($event)"></${d}-button>
|
|
756
756
|
|
|
757
|
-
</${d}-button>`})],Xe);var Sp=class extends rt{constructor(){super()}toggleReadonlyView(r){}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=hidden]")],Sp.prototype,"_input",2),Sp=c([C({tagName:d+"-input-hidden",template:'<input type="hidden" />',shadow:j.USE_SHADOW_ROOT})],Sp);var
|
|
757
|
+
</${d}-button>`})],Xe);var Sp=class extends rt{constructor(){super()}toggleReadonlyView(r){}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=hidden]")],Sp.prototype,"_input",2),Sp=c([C({tagName:d+"-input-hidden",template:'<input type="hidden" />',shadow:j.USE_SHADOW_ROOT})],Sp);var J_=a.getUserMediaFunctions(),Sv=(t=>(t.Start="start",t.Taking="taking",t.Confirm="confirm",t))(Sv||{}),Pm=class extends ht{constructor(r){super("confirmsnapshot",{buffer:r})}},bt=class extends _e{constructor(){super(...arguments);this._resizeHandler=e=>{this._renderValue()};this.step="start";this._canUseWebcam=J_.length>0;this._countdown=0;this._webcamInitialized=!1;this._grabberChangeHandler=e=>{let t=this._grabber;t.files.length>0&&a.blobToDataURL(t.files[0]).then(n=>{a.loadImage(n).then(i=>{this._shutter(i)})})};this._snapshooterClickHandler=e=>{Q(e),this.step="taking"};this._pickerClickHandler=e=>{Q(e),this._grabber.click()};this._takerClickHandler=e=>{Q(e),this._countdown=0,this._shutter()};this._timerClickHandler=e=>{Q(e),this._countdown=3,this._shutter()};this._confirmerClickHandler=e=>{Q(e),this.changeHandler(new Pm(this._buffer))}}get inputFields(){return[]}toggleReadonlyView(e){}onChange(e){return new Promise((t,n)=>{de.isInstanceOf(e,Pm)?(t(this.value=e.detail.buffer),this.step="start"):t(this.value)})}acceptValue(e){this._renderValue(e)}getViewValue(e){return e}convertValueAttributeToProperty(e){return m.String.convert(e,this)}get _getUserMedia(){return this._canUseWebcam&&J_[0]}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"step":switch(n){case"start":this._buffer=null;let s=this._grabber;s.value="",/safari/i.test(navigator.userAgent)||(s.type="",s.type="file");break;case"taking":this._ensureWebcamRunning();break}break;case"_buffer":this._renderValue(n||this.value);break;case"width":case"height":this._syncSize();break}}viewActivatedCallback(){super.viewActivatedCallback(),this._syncSize(),this._picker.addEventListener("click",this._pickerClickHandler,!1),this._snapshooter.addEventListener("click",this._snapshooterClickHandler,!1),this._taker.addEventListener("click",this._takerClickHandler,!1),this._timer.addEventListener("click",this._timerClickHandler,!1),this._confirmer.addEventListener("click",this._confirmerClickHandler,!1),this._grabber.addEventListener("change",this._grabberChangeHandler,!1)}disconnectedCallback(){this.isReady&&(this._picker.removeEventListener("click",this._pickerClickHandler,!1),this._snapshooter.removeEventListener("click",this._snapshooterClickHandler,!1),this._taker.removeEventListener("click",this._takerClickHandler,!1),this._timer.removeEventListener("click",this._timerClickHandler,!1),this._confirmer.removeEventListener("click",this._confirmerClickHandler,!1),this._grabber.removeEventListener("change",this._grabberChangeHandler,!1)),super.disconnectedCallback()}_syncSize(){let e=this._stage,t=this._player;!a.isNull(e)&&!a.isNull(t)&&(e.style.width=t.style.width=this.width&&this.width+"px"||"",e.style.height=t.style.height=this.height&&this.height+"px"||"",this._renderValue(this._buffer||this.value))}_shutter(e){let t=this,n=this._player,i=this._stage;t._confirmer.disabled=!0,a.isNull(e)&&(e=t._player);var s,l;if(e instanceof HTMLVideoElement?(s=e.videoWidth,l=e.videoHeight):(s=e.naturalWidth,l=e.naturalHeight),t._countdown<=0){var p=document.createElement("canvas");p.width=this.width||i.clientWidth,p.height=this.height||i.clientHeight;var u=p.getContext("2d");a.cropImageOntoCanvas(e,u,s,l);let f=t._root;f.insertBefore(p,n),p.className="snapshot-brightout",setTimeout(function(){f.removeChild(p)},1e3),t._refreshBuffer(p.toDataURL()).then(g=>{t._setToBeConfirmed(g),t._confirmer.disabled=!1})}else setTimeout(()=>{t._countdown--,this._shutter()},1e3)}_renderValue(e=this.value){let t=this._stage;if(!a.isNull(t)){t.width=t.clientWidth,t.height=t.clientHeight;let n=t.getContext("2d");a.isNullOrEmpty(e)?n.clearRect(0,0,t.width,t.height):a.loadImage(e).then(i=>{a.cropImageOntoCanvas(i,n,i.width,i.height)})}}_setToBeConfirmed(e){this.step="confirm",this._buffer=e}_refreshBuffer(e){var t=this._stage;t.width=t.clientWidth,t.height=t.clientHeight;let n;return this.quality>0&&(n=Math.min(1,Math.max(0,this.quality))),a.cropImage(e,t.width,t.height,n)}_ensureWebcamRunning(){if(this._canUseWebcam&&!this._webcamInitialized){var e=this;e._webcamInitialized=!0,e._getUserMedia.apply(navigator,[{video:!0},function(t){var n=e._player;n.srcObject=t},function(t){e.log(ce.LogLevel.Error,(t||t.message).toString())}])}}};c([S("."+b+"-snapshot")],bt.prototype,"_root",2),c([S("canvas")],bt.prototype,"_stage",2),c([S("input[type=file]")],bt.prototype,"_grabber",2),c([S("video")],bt.prototype,"_player",2),c([S(d+"-button.button.snapshot-upload")],bt.prototype,"_picker",2),c([S(d+"-button.button.snapshot-camera")],bt.prototype,"_snapshooter",2),c([S(d+"-button.button.snapshot-take")],bt.prototype,"_taker",2),c([S(d+"-button.button.snapshot-timer3s")],bt.prototype,"_timer",2),c([S(d+"-button.button.snapshot-confirm")],bt.prototype,"_confirmer",2),c([h({converter:m.String})],bt.prototype,"step",2),c([h({emit:!1,converter:m.Number})],bt.prototype,"width",2),c([h({emit:!1,converter:m.Number})],bt.prototype,"height",2),c([h({emit:!1,converter:m.Number})],bt.prototype,"quality",2),c([h()],bt.prototype,"_countdown",2),c([h({emit:!1})],bt.prototype,"_buffer",2),bt=c([C({tagName:d+"-snapshot",shadow:j.USE_SHADOW_ROOT,template:`<${d}-panel class="${b}-snapshot"
|
|
758
758
|
css-class="{{ {
|
|
759
759
|
'snapshot-start': :host.step === 'start',
|
|
760
760
|
'snapshot-taking': :host.step === 'taking',
|
|
@@ -828,7 +828,7 @@ css-class="{{ {
|
|
|
828
828
|
</dl></${d}-panel>
|
|
829
829
|
|
|
830
830
|
</div>`})],Ft);var oo=class extends ao{toggleReadonlyView(r){this._span.hidden=!r,this._input.hidden=r}get inputFields(){return a.isNull(this._input)?[]:[this._input]}getViewValue(r){return this.value!=null?this._format(this.value):void 0}_format(r=this.value){let e=this.format;return a.isNullOrEmpty(e)?r.toString():new Intl.NumberFormat(a.lang(this),e).format(r)}getValue(r){let e=this.inputField.valueAsNumber||parseFloat(this.inputField.value);return isNaN(e)?void 0:e}viewActivatedCallback(){super.viewActivatedCallback();var r={capture:!1,passive:!1};this._input.addEventListener("wheel",this.emitHandler,r)}disconnectedCallback(){if(!a.isNull(this._input)){var r={capture:!1,passive:!1};this._input.removeEventListener("wheel",this.emitHandler,r)}super.disconnectedCallback()}};c([S("input[type=number]")],oo.prototype,"_input",2),c([S(`span.${b}-readonly`)],oo.prototype,"_span",2),c([h({emit:!1,converter:m.Json})],oo.prototype,"format",2),oo=c([C({tagName:d+"-input-number",template:`<input type="number" class="${b}-input ${b}-viewfinder" /><span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],oo);var lo=class extends rt{constructor(){super();this._togglerMousedownHandler=e=>{e.button==0&&(Q(e),this.toggleVisibility())}}get inputFields(){return a.isNull(this._input)?[]:[this._input]}viewActivatedCallback(){super.viewActivatedCallback();let e=this.id??"_"+a.uniqueCode(),t=this._input.id=e+"_ctrl";this._toggler.setAttribute("aria-controls",t),this._toggler.setAttribute("role","button"),this._syncToggler(),this._toggler.addEventListener("mousedown",this._togglerMousedownHandler,!1)}disconnectedCallback(){a.isNull(this._toggler)||this._toggler.removeEventListener("mousedown",this._togglerMousedownHandler,!1)}toggleVisibility(){let e=this._input.type;this._input.type=e==="password"?"text":"password",this._syncToggler()}_syncToggler(){let e=this._input.type==="password";this._toggler.innerText=e?"visibility_off":"visibility",this._toggler.setAttribute("aria-expanded",(!e).toString())}toggleReadonlyView(e){this._input.hidden=this._toggler.hidden=e,this._span.hidden=!e}getViewValue(e){return a.leftPad("",Math.floor(8+3*Math.random()),"\u2022")}};c([S("input[type=password]")],lo.prototype,"_input",2),c([S(`span.${b}-readonly`)],lo.prototype,"_span",2),c([S(`i.${b}-icon.${b}-clickable`)],lo.prototype,"_toggler",2),lo=c([C({tagName:d+"-input-password",template:`<input type="password" class="${b}-input ${b}-viewfinder" /><i class="${b}-icon ${b}-clickable"></i>
|
|
831
|
-
${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],lo);var Lp=class extends rt{constructor(){super()}get inputFields(){return a.isNull(this._input)?[]:[this._input]}toggleReadonlyView(r){}};c([S("input[type=search]")],Lp.prototype,"_input",2),Lp=c([C({tagName:d+"-input-search",template:'<input type="search" class="'+b+'-input" />',shadow:j.USE_SHADOW_ROOT})],Lp);var Il=class extends rt{constructor(){super()}toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=tel]")],Il.prototype,"_input",2),c([S(d+"-a")],Il.prototype,"_anchor",2),Il=c([C({tagName:d+"-input-tel",template:`<input type="tel" class="${b}-input" /><${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'tel:'+ :host.value }}"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Il);var $l=class extends rt{constructor(){super()}toggleReadonlyView(r){this._span.hidden=!r,this._input.hidden=r}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=text]")],$l.prototype,"_input",2),c([S("span."+b+"-readonly")],$l.prototype,"_span",2),$l=c([C({tagName:d+"-input-text",template:`<input type="text" class="${b}-input" />${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],$l);var Hl=class extends rt{constructor(){super()}toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=url]")],Hl.prototype,"_input",2),c([S(d+"-a")],Hl.prototype,"_anchor",2),Hl=c([C({tagName:d+"-input-url",template:`<input type="url" class="${b}-input" />${er}<${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ :host.value }}" target="_blank"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Hl);var
|
|
831
|
+
${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],lo);var Lp=class extends rt{constructor(){super()}get inputFields(){return a.isNull(this._input)?[]:[this._input]}toggleReadonlyView(r){}};c([S("input[type=search]")],Lp.prototype,"_input",2),Lp=c([C({tagName:d+"-input-search",template:'<input type="search" class="'+b+'-input" />',shadow:j.USE_SHADOW_ROOT})],Lp);var Il=class extends rt{constructor(){super()}toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=tel]")],Il.prototype,"_input",2),c([S(d+"-a")],Il.prototype,"_anchor",2),Il=c([C({tagName:d+"-input-tel",template:`<input type="tel" class="${b}-input" /><${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'tel:'+ :host.value }}"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Il);var $l=class extends rt{constructor(){super()}toggleReadonlyView(r){this._span.hidden=!r,this._input.hidden=r}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=text]")],$l.prototype,"_input",2),c([S("span."+b+"-readonly")],$l.prototype,"_span",2),$l=c([C({tagName:d+"-input-text",template:`<input type="text" class="${b}-input" />${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],$l);var Hl=class extends rt{constructor(){super()}toggleReadonlyView(r){let e=this._input,t=this._anchor;a.isNull(e)||(e.hidden=r),a.isNull(t)||(t.hidden=!r)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}};c([S("input[type=url]")],Hl.prototype,"_input",2),c([S(d+"-a")],Hl.prototype,"_anchor",2),Hl=c([C({tagName:d+"-input-url",template:`<input type="url" class="${b}-input" />${er}<${d}-a class="${b}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ :host.value }}" target="_blank"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-a>`,shadow:j.USE_SHADOW_ROOT})],Hl);var R0="",O0="",P0="https://nominatim.openstreetmap.org/reverse",It=class extends _e{convertValueAttributeToProperty(r){let e=/^\s*([+-]?\d+\.?\d+)[,\s]\s*([+-]?\d+\.?\d+)\s*$/.exec(r);if(e&&e.length===3)return{lat:parseFloat(e[1]),lng:parseFloat(e[2])};throw`Invalid coordinates format for "${r}"`}compareValuePropertyValues(r,e){return r&&typeof r.lat=="number"&&typeof r.lng=="number"&&e&&typeof e.lat=="number"&&typeof e.lng=="number"?r.lat===e.lat&&r.lng===e.lng:!1}getViewValue(r){return this._getViewValue(r)}_getViewValue(r,e=8){return r&&typeof r.lat=="number"&&typeof r.lng=="number"&&r.lat.toFixed(e)+","+r.lng.toFixed(e)||""}get inputFields(){return[this._latInput,this._lngInput]}toggleReadonlyView(r){this._inputContainer.hidden=r}acceptValue(r){let e=this._ensureValue(r);this._lat=e.lat,this._lng=e.lng}_ensureValue(r){return r&&typeof r.lat=="number"&&typeof r.lng=="number"?r:Qc.Maps.MapConsts.DEFAULT_COORDS}onChange(r){if(r&&r.type==="dragend"){var e=r;this._lat=e.detail.position.lat,this._lng=e.detail.position.lng}let t=this._lat,n=this._lng;return a.isNull(t)||a.isNull(n)?a.fromResult(this.value):a.fromResult(this.value={lat:t,lng:n})}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),r==="options"&&!n){let i=a.clone(t||{provider:"osm"});this._synchronizeOptions(i)}}viewActivatedCallback(){super.viewActivatedCallback(),this._synchronizeOptions()}_synchronizeOptions(r=this.options||{provider:"osm"}){let e=this._marker,t=this._map;switch(e.icon=r.icon,r&&r.provider){case"azure":this._azureAdapter.subscriptionKey=r.apiKey,t.adapter=this._azureAdapter;break;case"google":case"gmaps":this._googleAdapter.apiKey=r.apiKey,t.adapter=this._googleAdapter;break;default:a.isNullOrEmpty(r.attribution)||(this._leafletAdapter.attribution=r.attribution),a.isNullOrEmpty(r.tiles)||(this._leafletAdapter.tiles=r.tiles),t.adapter=this._leafletAdapter;break}delete r.provider,delete r.icon,delete r.apiKey,delete r.attribution,delete r.tiles;for(let n in r)n in t&&(t[n]=r[n])}};c([S(d+"-map-adapter-leaflet")],It.prototype,"_leafletAdapter",2),c([S(d+"-map-adapter-azure")],It.prototype,"_azureAdapter",2),c([S(d+"-map-adapter-google")],It.prototype,"_googleAdapter",2),c([S(d+"-map")],It.prototype,"_map",2),c([S(d+"-map-marker")],It.prototype,"_marker",2),c([S(d+"-input-number:nth-child(1)")],It.prototype,"_latInput",2),c([S(d+"-input-number:nth-child(2)")],It.prototype,"_lngInput",2),c([S(`.${b}-latlng-fields`)],It.prototype,"_inputContainer",2),c([S(d+"-fetch")],It.prototype,"_fetcher",2),c([h({converter:m.Json,emit:!1})],It.prototype,"options",2),c([h()],It.prototype,"_lat",2),c([h()],It.prototype,"_lng",2),It=c([C({tagName:d+"-latlng",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-latlng">
|
|
832
832
|
<div class="${b}-latlng-fields ${b}-viewfinder">
|
|
833
833
|
<${d}-input-number class="${b}-lat" value="{{ :host._lat, twoway }}" min="-90" max="90" step="{{ 'any' }}"></${d}-input-number>
|
|
834
834
|
<${d}-input-number class="${b}-lng" value="{{ :host._lng, twoway }}" min="-180" max="180" step="{{ 'any' }}"></${d}-input-number>
|
|
@@ -850,17 +850,17 @@ ${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-
|
|
|
850
850
|
<${d}-map adapter="{{ ::_adapter }}">
|
|
851
851
|
<${d}-map-marker position="{{ :host._ensureValue(:host.value) }}" on-dragend=":host.changeHandler($event)" draggable="{{ !:host.readonly }}"></${d}-map-marker>
|
|
852
852
|
</${d}-map>
|
|
853
|
-
<${d}-fetch disabled="{{ $pacem.isNull(:host.value) }}" parameters="{{ { format: 'json', lat: :host._lat, lon: :host._lng } }}" url="${
|
|
854
|
-
</div>`})],It);var
|
|
853
|
+
<${d}-fetch disabled="{{ $pacem.isNull(:host.value) }}" parameters="{{ { format: 'json', lat: :host._lat, lon: :host._lng } }}" url="${P0}"></${d}-fetch>
|
|
854
|
+
</div>`})],It);var Z_='change-policy="blur" readonly="{{ :host.readonly }}"';function Q_(o){return a.isNullOrEmpty(o&&o.name)}function ex(){return{name:"",value:""}}var Bl=class extends _e{constructor(){super(...arguments);this.inputFields=[];this._bag=[]}toggleReadonlyView(e){}onChange(e){return new Promise((t,n)=>{let i=this._bagToValue(this._bag);this.compareValuePropertyValues(i,this.value)?n():t(this.value=i)})}acceptValue(e){this._bag=this._valueToBag(e)}getViewValue(e){return""}compareValuePropertyValues(e,t){return a.Json.stringify(e)===a.Json.stringify(t)}convertValueAttributeToProperty(e){return m.Json.convert(e)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="dictionary"&&!i&&(this.value=this._bagToValue())}_bagToValue(e=this._bag){if(!this.dictionary){let n=[];for(let i of e||[])Q_(i)||n.find(s=>s.name===i.name&&s.value===i.value)||n.push(i);return n}let t={};for(let n of e||[])n.name in t||(t[n.name]=n.value);return t}_valueToBag(e=this.value){let t=[];if(!a.isNullOrEmpty(e)&&typeof e=="object")if(this.dictionary&&!a.isArray(e))for(let n in e)t.push({name:n,value:e[n]});else!this.dictionary&&a.isArray(e)&&Array.prototype.splice.apply(t,[0,0].concat(e.map(n=>a.clone(n))));return a.isNullOrEmpty(t)?[ex()]:t}_deleteAt(e){this._bag.splice(e.detail,1),this.changeHandler(e)}_addItem(e){let t=this._bag,n=this._bag[this._bag.length-1];(a.isEmpty(t)||!Q_(n))&&t.push(ex())}};c([h({emit:!1,converter:m.Boolean})],Bl.prototype,"dictionary",2),c([h({converter:m.Json})],Bl.prototype,"_bag",2),Bl=c([C({tagName:d+"-namevalue-list",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater datasource="{{ :host._bag }}" on-itemdelete=":host._deleteAt($event)">
|
|
855
855
|
<template>
|
|
856
856
|
<div class="${b}-fieldset ${b}-margin margin-bottom-1">
|
|
857
857
|
<div class="fieldset-auto">
|
|
858
858
|
<div class="${b}-fieldgroup">
|
|
859
|
-
<${d}-input-text ${
|
|
859
|
+
<${d}-input-text ${Z_} value="{{ ^item.name, twoway }}" on-change=":host.changeHandler($event)"></${d}-input-text>
|
|
860
860
|
<div class="fieldgroup-prepend"></div>
|
|
861
861
|
</div>
|
|
862
862
|
<div class="${b}-fieldgroup">
|
|
863
|
-
<${d}-input-text ${
|
|
863
|
+
<${d}-input-text ${Z_} value="{{ ^item.value, twoway }}" on-change=":host.changeHandler($event)"></${d}-input-text>
|
|
864
864
|
<div class="fieldgroup-append">
|
|
865
865
|
<${d}-button class="${b}-cell cols-2 flat delete" hide="{{ :host.readonly }}" command-name="delete" command-argument="{{ ^index }}"></${d}-button>
|
|
866
866
|
</div>
|
|
@@ -893,7 +893,7 @@ on-${ee}=":host._selectionChanged($event, ^index, ^item)"></${d}-radio></li>
|
|
|
893
893
|
</div>
|
|
894
894
|
<${d}-drag-drop lock-timeout="0"></${d}-drag-drop><${d}-resize watch-position="true" on-${R.ResizeEventName}=":host._setTrackSize($event)" target="{{ ::_track }}"></${d}-resize>
|
|
895
895
|
<${d}-shell-proxy><${d}-balloon class="text-center"><${d}-text text="{{ :host.viewValue }}"></${d}-text></${d}-balloon></${d}-shell-proxy>
|
|
896
|
-
`,shadow:j.USE_SHADOW_ROOT})],Tt);var Lu=class extends oe{constructor(r){super("suggestionselect",{selectedValue:r})}},
|
|
896
|
+
`,shadow:j.USE_SHADOW_ROOT})],Tt);var Lu=class extends oe{constructor(r){super("suggestionselect",{selectedValue:r})}},tx=100,rx=0,Nu,Np,Hi,Et=class extends vt{constructor(){super(...arguments);z(this,Nu);this._toggleBtnHandler=e=>{e.preventDefault(),this.disabled||this._balloon.toggle()};this._clearBtnHandler=e=>{e.preventDefault(),this.hint=this._input.value="",this.value=void 0,this._focus(null),this.changeHandler(new Lu(null))};this._balloonPopupHandler=e=>{a.addClass(this._btnArrow,"rotate-180")};this._balloonPopoutHandler=e=>{a.removeClass(this._btnArrow,"rotate-180")};this._inputHandler=e=>{switch(e.keyCode){case 9:case 13:break;default:this._focus(null),this.hint=this._input.value,this.changeHandler(new Lu(null));break}};this._keyupHandler=e=>{M(this,Np)&&(Q(e),H(this,Np,!1))};this._focusHandler=e=>{this.preventFocus&&(e.preventDefault(),this._balloon.visible?this.popout():this.popup());let t=this._input.value;this.viewValue!=t&&this._databind()};this._blurHandler=e=>{this._undo()};z(this,Np,!1);this._keydownHandler=e=>{var t=!1;if(a.isNull(M(this,Hi))){let l=this._findFirstAvailableListItem();if(!a.isNull(l))switch(e.keyCode){case 40:Q(e),this._focus(l);break;case 13:Q(e),t=!0,M(this,Nu).length===1?this._select(l):this._focus(l);break}}else{var n=M(this,Hi),i=n,s;let l=u=>!a.isNull(u)&&u.localName==="li"&&u.dataset.pacemDisabled==="true",p=u=>!a.isNull(u)&&u.localName==="li"&&u.dataset.pacemDisabled!=="true";switch(e.keyCode){case 38:Q(e);do if(i=i.previousElementSibling,p(i)){s=i;break}while(l(i));s??=n;break;case 40:Q(e);do if(i=i.nextElementSibling,p(i)){s=i;break}while(l(i));s??=n;break;case 27:Q(e),this._undo(),this.popout();break;case 9:case 13:Q(e),t=!0,this._select();break}this._focus(s),H(this,Np,t)}};this._selectHandler=e=>{Q(e),this._select(e.currentTarget)};z(this,Hi)}get inputFields(){return[this._input]}acceptValue(e){(this.allowNew||!a.isNullOrEmpty(this.datasource))&&(this._input.value=this.getViewValue(e)||(this._isTyping?this._input.value:""))}getViewValue(e){var t=super.getViewValue(e);return a.isNullOrEmpty(t)&&this.allowNew&&!a.isNullOrEmpty(e)&&(t=this.mapEntityToViewValue(e)),t}onChange(e){return new Promise((t,n)=>{if(e.type==="suggestionselect"){let i=e.detail.selectedValue;this.value=i,i&&this.popout(),t(i)}else t(this.value)})}viewActivatedCallback(){super.viewActivatedCallback(),this._setDropdownMode(),this._setupItemTemplate();var e=this._createBalloon();e.appendChild(this._repeater),this._checkBalloon(e),A.findAncestorShell(this).appendChild(e),this._balloon=e,this._input.addEventListener("mousedown",this._focusHandler,!1),this._input.addEventListener("keydown",this._keydownHandler,!1),this._input.addEventListener("keyup",this._keyupHandler,!1),this._input.addEventListener("focus",this._focusHandler,!1),this._input.addEventListener("blur",this._blurHandler,!1),this._input.addEventListener("input",this._inputHandler,!1),this._btnClear.addEventListener("mousedown",this._clearBtnHandler,!1),this._btnArrow.addEventListener("mousedown",this._toggleBtnHandler,!1),this._databind(),this._syncButtons()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),a.isNull(this._balloon))return;let s=this._isTyping;switch(e){case"adaptedDatasource":a.isNullOrEmpty(n)?this.popout():s?this.popup():this._input.value=this.getViewValue(this.value);break;case"hint":!s&&n!==this._input.value&&(this._input.value=n,H(this,Hi,null));break;case"readonly":this._setDropdownMode();case"disabled":case"value":this._checkBalloon();break;case"itemtemplate":i||this._setupItemTemplate();break;case"allowTyping":i||this._setDropdownMode();break}["adaptedDatasource","hint","value"].indexOf(e)>=0&&this._databind(),["allowTyping","value","hint"].indexOf(e)>=0&&this._syncButtons()}disconnectedCallback(){a.isNull(this._balloon)||(this._balloon.removeEventListener("popup",this._balloonPopupHandler,!1),this._balloon.removeEventListener("popout",this._balloonPopoutHandler,!1),this._balloon.remove()),a.isNull(this._input)||(this._input.removeEventListener("mousedown",this._focusHandler,!1),this._input.removeEventListener("focus",this._focusHandler,!1),this._input.removeEventListener("blur",this._blurHandler,!1),this._input.removeEventListener("keydown",this._keydownHandler,!1),this._input.removeEventListener("keyup",this._keyupHandler,!1),this._input.removeEventListener("input",this._inputHandler,!1)),a.isNull(this._btnClear)||this._btnClear.removeEventListener("mousedown",this._clearBtnHandler,!1),a.isNull(this._btnArrow)||this._btnArrow.addEventListener("mousedown",this._toggleBtnHandler,!1),super.disconnectedCallback()}_databind(){if(!a.isNull(this._repeater)){let e=H(this,Nu,this._filter(this.adaptedDatasource,this._input.value));this._repeater.datasource=e}}_syncButtons(){a.isNull(this._btnArrow)||(this._btnArrow.hide=this.allowTyping!==!1||!a.isNullOrEmpty(this._input.value||this.value)),a.isNull(this._btnClear)||(this._btnClear.hide=this.readonly||a.isNullOrEmpty(this._input.value||this.value))}get _isTyping(){return a.is(this._input,":focus")}_undo(){this._focus(null),this.hint=this._input.value=this.getViewValue(this.value)||""}_findFirstAvailableListItem(){var e;if(this._balloon.visible===!0&&!a.isNull(e=this._repeater.querySelector("ol > li")))for(;!a.isNull(e)&&e.dataset.pacemDisabled==="true"&&e.localName==="li";)e=e.nextElementSibling;return e}_setDropdownMode(e=this.allowTyping){this._input.readOnly=!(e??!0)}_setupItemTemplate(){if(this.itemtemplate instanceof HTMLTemplateElement){let e=this.itemtemplate.cloneNode(!0).content,t=document.createElement("template"),n=document.createElement("li");n.append(e),t.content.appendChild(n),this._tmplProxy.target=t}else this._tmplProxy.target=this._defaultTemplate}_focus(e){if(this.preventFocus)return;if(a.isNull(e)){H(this,Hi,null);return}let t=e.parentElement.children;for(let n=0;n<t.length;n++){let i=t.item(n);if(i===e){i.dataset.pacemFocused="true",H(this,Hi,i);let s=this._input,l=s.value=JSON.parse(i.dataset.pacemViewValue);s.setSelectionRange(l.length,l.length)}else delete i.dataset.pacemFocused}}_select(e=M(this,Hi)){let t=JSON.parse(e.dataset.pacemValue);e.dataset.pacemDisabled==="true"||this.changeHandler(new Lu(t))}_filter(e,t,n=this.value){let i=e||[];if(!a.isNullOrEmpty(t&&t.trim())){let l=t.toLowerCase().split(" "),p=i.filter(f=>{for(let g of l){if(f.viewValue?.toLowerCase().indexOf(g)>=0)return!0;let v=this.filterFields;if(!a.isNullOrEmpty(v)){let y=f.data;if(typeof y=="object"&&!a.isNullOrEmpty(y))for(let _ of v){let x=_.split("."),w=0,E=y;for(;!a.isNull(E)&&w<x.length;)E=E[x[w]],w++;if(!a.isNullOrEmpty(E)&&E.toString().toLowerCase().indexOf(g)>=0)return!0}}}return!1});i=this.allowNew&&a.isNullOrEmpty(this.valueProperty)&&a.isNullOrEmpty(this.textProperty)&&(a.isNullOrEmpty(p)||a.isNull(p.find(f=>f.viewValue===t)))?[{value:t,viewValue:t,data:t}].concat(p):p}let s=i;return this.allowTyping!==!1&&(s=i.slice(0,this.maxSuggestions||10)),this._isTyping&&this.popup(),this._balloon.style.opacity=a.isNullOrEmpty(s)?"0":"",this.log(ce.LogLevel.Log,`${s.length} dropdown suggestion(s), given hint '${t}' and ${(e||[]).length} datasource items`),s}_itemCreate(e){let t=e.detail.dom.find(l=>l instanceof HTMLLIElement),n=e.detail.item,i=e.detail.index,s=n.disabled===!0;t.tabIndex=s?-1:0,t.dataset.pacemValue=JSON.stringify(n.value),t.dataset.pacemViewValue=JSON.stringify(n.viewValue),t.dataset.pacemDisabled=s.toString(),t.addEventListener("mousedown",this._selectHandler,!1)}_itemRemove(e){e.detail.dom.find(n=>n instanceof HTMLLIElement).removeEventListener("mousedown",this._selectHandler,!1)}toggleReadonlyView(e){this.span.hidden=!e,this._input.hidden=e,e?this._btnClear.hide=this._btnArrow.hide=!0:this._syncButtons()}popup(e=tx){!a.isNullOrEmpty(this.adaptedDatasource)&&a.isVisible(this)&&this._balloon?.popup(e)}popout(e=rx){H(this,Hi,null),this._balloon?.popout(e)}_checkBalloon(e=this._balloon){if(!a.isNull(e)){let t=!a.isNullOrEmpty(this.value)&&!a.isNullOrEmpty(this._input.value);e.disabled=t||this.readonly||this.disabled||!1}}_createBalloon(){let e=document.createElement(d+"-balloon");return a.addClass(e,"suggest dropdown"),e.options={trackPosition:!0,trigger:ie.UI.BalloonTrigger.Focus,position:ie.UI.BalloonPosition.VerticalAuto,size:ie.UI.BalloonSizing.Match,align:ie.UI.BalloonAlignment.Start,behavior:ie.UI.BalloonBehavior.Menu,hoverDelay:tx,hoverTimeout:rx},e.addEventListener("popup",this._balloonPopupHandler,!1),e.addEventListener("popout",this._balloonPopoutHandler,!1),e.target=this._input,e}};Nu=new WeakMap,Np=new WeakMap,Hi=new WeakMap,c([S("input[type=text]")],Et.prototype,"_input",2),c([S(d+"-repeater")],Et.prototype,"_repeater",2),c([S(`span.${b}-readonly`)],Et.prototype,"span",2),c([S("template")],Et.prototype,"_defaultTemplate",2),c([S(d+"-template-proxy")],Et.prototype,"_tmplProxy",2),c([S(`${d}-button[toggle]`)],Et.prototype,"_btnArrow",2),c([S(`${d}-button[clear]`)],Et.prototype,"_btnClear",2),c([h({converter:m.String})],Et.prototype,"hint",2),c([h({emit:!1,converter:m.Number})],Et.prototype,"maxSuggestions",2),c([h({converter:m.Boolean})],Et.prototype,"allowTyping",2),c([h({emit:!1,converter:m.Boolean})],Et.prototype,"preventFocus",2),c([h({emit:!1,converter:m.Element})],Et.prototype,"itemtemplate",2),c([h({emit:!1,converter:m.StringArray})],Et.prototype,"filterFields",2),c([h({emit:!1,converter:m.Boolean})],Et.prototype,"allowNew",2),Et=c([C({tagName:d+"-suggest",shadow:j.USE_SHADOW_ROOT,template:`<div class="${b}-relative"><input type="text" class="${b}-input" />
|
|
897
897
|
<${d}-button clear tab-order="-1"
|
|
898
898
|
class="button-flat ${b}-anim anim-pop anim-sudden anim-quick pos-absolute absolute-right absolute-top display-block ${b}-margin margin-0"
|
|
899
899
|
icon-glyph="highlight_off"></${d}-button>
|
|
@@ -923,7 +923,7 @@ class="button-flat icon-rotate ${b}-anim anim-pop anim-sudden anim-quick pos-abs
|
|
|
923
923
|
</${d}-suggest>
|
|
924
924
|
</li>
|
|
925
925
|
</ul>
|
|
926
|
-
</${d}-repeater>`})],Un);var zs=class extends rt{constructor(){super(...arguments);this.rows=5;this.cols=50}get preventKeyboardSubmit(){return!0}toggleReadonlyView(e){let t=this._input,n=this._span;a.isNull(t)||(t.hidden=e),a.isNull(n)||(n.hidden=!e)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="rows"||e==="cols")&&this.inputField.setAttribute(e,n)}};c([h({emit:!1,converter:m.Number})],zs.prototype,"rows",2),c([h({emit:!1,converter:m.Number})],zs.prototype,"cols",2),c([S("textarea")],zs.prototype,"_input",2),c([S(`span.${b}-readonly`)],zs.prototype,"_span",2),zs=c([C({tagName:d+"-textarea",template:`<textarea class="${b}-input" pacem></textarea>${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],zs);var Gs=class extends rt{constructor(e=new ie.UI.MarkdownService){super();this._md=e;this.rows=5;this.cols=50;this._keydownHandler=e=>{if(e.keyCode===9){let n=this._input,i=n.value;var t=n.selectionStart;n.value=i.substr(0,t)+" "+i.substr(t),jl(e)}}}toggleReadonlyView(e){a.isNull(this._input)||(this._input.hidden=e)}get preventKeyboardSubmit(){return!0}get inputFields(){return a.isNull(this._input)?[]:[this._input]}getViewValue(e){return this._md.toHtml(e)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="rows"||e==="cols"?this.inputField.setAttribute(e,n):e=="viewValue"&&(this._markdown.innerHTML=n)}viewActivatedCallback(){super.viewActivatedCallback(),this._input.addEventListener("keydown",this._keydownHandler,!1)}disconnectedCallback(){this._input&&this._input.removeEventListener("keydown",this._keydownHandler,!1),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Number})],Gs.prototype,"rows",2),c([h({emit:!1,converter:m.Number})],Gs.prototype,"cols",2),c([S("textarea")],Gs.prototype,"_input",2),c([S(`div.${b}-readonly`)],Gs.prototype,"_markdown",2),Gs=c([C({tagName:d+"-textarea-markdown",template:`<textarea class="${b}-input" pacem></textarea>${er}<div class="${b}-readonly ${b}-markdown"></div>`,shadow:j.USE_SHADOW_ROOT})],Gs);var
|
|
926
|
+
</${d}-repeater>`})],Un);var zs=class extends rt{constructor(){super(...arguments);this.rows=5;this.cols=50}get preventKeyboardSubmit(){return!0}toggleReadonlyView(e){let t=this._input,n=this._span;a.isNull(t)||(t.hidden=e),a.isNull(n)||(n.hidden=!e)}get inputFields(){return a.isNull(this._input)?[]:[this._input]}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),(e==="rows"||e==="cols")&&this.inputField.setAttribute(e,n)}};c([h({emit:!1,converter:m.Number})],zs.prototype,"rows",2),c([h({emit:!1,converter:m.Number})],zs.prototype,"cols",2),c([S("textarea")],zs.prototype,"_input",2),c([S(`span.${b}-readonly`)],zs.prototype,"_span",2),zs=c([C({tagName:d+"-textarea",template:`<textarea class="${b}-input" pacem></textarea>${er}<span class="${b}-readonly"><${d}-text text="{{ :host.viewValue }}"></${d}-text></span>`,shadow:j.USE_SHADOW_ROOT})],zs);var Gs=class extends rt{constructor(e=new ie.UI.MarkdownService){super();this._md=e;this.rows=5;this.cols=50;this._keydownHandler=e=>{if(e.keyCode===9){let n=this._input,i=n.value;var t=n.selectionStart;n.value=i.substr(0,t)+" "+i.substr(t),jl(e)}}}toggleReadonlyView(e){a.isNull(this._input)||(this._input.hidden=e)}get preventKeyboardSubmit(){return!0}get inputFields(){return a.isNull(this._input)?[]:[this._input]}getViewValue(e){return this._md.toHtml(e)}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),e==="rows"||e==="cols"?this.inputField.setAttribute(e,n):e=="viewValue"&&(this._markdown.innerHTML=n)}viewActivatedCallback(){super.viewActivatedCallback(),this._input.addEventListener("keydown",this._keydownHandler,!1)}disconnectedCallback(){this._input&&this._input.removeEventListener("keydown",this._keydownHandler,!1),super.disconnectedCallback()}};c([h({emit:!1,converter:m.Number})],Gs.prototype,"rows",2),c([h({emit:!1,converter:m.Number})],Gs.prototype,"cols",2),c([S("textarea")],Gs.prototype,"_input",2),c([S(`div.${b}-readonly`)],Gs.prototype,"_markdown",2),Gs=c([C({tagName:d+"-textarea-markdown",template:`<textarea class="${b}-input" pacem></textarea>${er}<div class="${b}-readonly ${b}-markdown"></div>`,shadow:j.USE_SHADOW_ROOT})],Gs);var Ov={};Se(Ov,{DataCellUIEvent:()=>Pu,DataColumnRescaleEvent:()=>Op,DataColumnRescaleEventName:()=>Vm,DataColumnSortEvent:()=>Rp,DataColumnSortEventName:()=>Bm,DataGridBindEvent:()=>Um,DataRowSelectChangeEvent:()=>Ru,DataRowSelectChangeEventName:()=>cx,EditMode:()=>nx,PacemBaseCellElement:()=>Mn,PacemCarouselElement:()=>Fs,PacemContextMenuElement:()=>Bi,PacemContextMenuItemCommandElement:()=>Hr,PacemContextMenuItemElement:()=>Dp,PacemContextMenuItemSeparatorElement:()=>Tu,PacemDataCellElement:()=>Xs,PacemDataColumnElement:()=>$t,PacemDataGridElement:()=>gr,PacemEditElement:()=>Br,PacemGalleryElement:()=>ar,PacemHeadCellElement:()=>Ou,PacemModalFormElement:()=>lt,PacemRouterHashStateElement:()=>js,PacemRouterViewScrollElement:()=>ho,PacemSearchElement:()=>zn});var I0=ie.UI,Fs=class extends I0.PacemAdaptedIterativeElement{constructor(){super(...arguments);this.interval=4e3}};c([S(d+"-adapter")],Fs.prototype,"adapter",2),c([S(d+"-slideshow")],Fs.prototype,"slideshow",2),c([h({converter:m.Number})],Fs.prototype,"interval",2),c([h({converter:m.Boolean})],Fs.prototype,"pausable",2),Fs=c([C({tagName:d+"-carousel",shadow:j.USE_SHADOW_ROOT,template:`<${d}-repeater datasource="{{ :host.datasource }}">
|
|
927
927
|
<${d}-slideshow class="${b}-carousel" adapter="{{ ::adapter }}" index="{{ :host.index, twoway }}" on-load="this.focus()">
|
|
928
928
|
|
|
929
929
|
<template>
|
|
@@ -943,7 +943,7 @@ class="button-flat icon-rotate ${b}-anim anim-pop anim-sudden anim-quick pos-abs
|
|
|
943
943
|
</template>
|
|
944
944
|
</${d}-slideshow>
|
|
945
945
|
|
|
946
|
-
</${d}-repeater><${d}-adapter pausable="{{ :host.pausable }}" class="${b}-carousel-adapter" interval="{{ :host.interval }}"></${d}-adapter>`})],Fs);var Ul=ie.UI,Dp=class extends R.PacemItemElement{connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-context-menuitem")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.container;i instanceof Bi&&i.refresh()}},Hr=class extends Dp{createMenuItemElement(){let r=new Ul.PacemButtonElement;return r.commandArgument=this.commandArgument,r.commandName=this.commandName,r.textContent=this.caption,r.iconGlyph=this.iconGlyph,r.confirmationDialog=this.confirmationDialog,r.confirmationMessage=this.confirmationMessage,r.tooltip=this.tooltip,r.disabled=this.disabled,r.cssClass=this.buttonCssClass,r}};c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"commandName",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"caption",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"tooltip",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"iconGlyph",2),c([h({emit:!1,reflectBack:!0,converter:m.StringArray})],Hr.prototype,"buttonCssClass",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"confirmationMessage",2),c([h({emit:!1,reflectBack:!0,converter:m.Element})],Hr.prototype,"confirmationDialog",2),c([h({emit:!1,reflectBack:!0,converter:m.Json})],Hr.prototype,"commandArgument",2),Hr=c([C({tagName:d+"-context-menuitem-command"})],Hr);var Tu=class extends Dp{createMenuItemElement(){let r=document.createElement("hr");return r.style.pointerEvents="none",r}};Tu=c([C({tagName:d+"-context-menuitem-separator"})],Tu);var Ws,Ap,uo,Bi=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._dispatchCommand=e=>{Q(e),this._onCommand(new ql({commandName:e.detail.commandName,commandArgument:e.detail.commandArgument??this.commandArgument}))};z(this,Ws);z(this,Ap);z(this,uo);this._slotchangeHandler=e=>{this._resetLayout()};this._attributeChangeHandler=e=>this._refreshMenuItems;this._mouseupHandler=e=>{let t=this._ensureBalloon();a.isNull(t)||t.popout()}}validate(e){return e instanceof Dp}_ensureButton(){if(!a.isNull(M(this,Ws)))return M(this,Ws);let e=this._slot;if(a.isNull(e))return null;let t=this._lookForAButton();if(!a.isNull(t))return H(this,Ws,t);let n=new Ul.PacemButtonElement;n.setAttribute("slot","button"),n.className=`${b}-margin margin-0 button-flat`;let i=H(this,Ap,new Ul.PacemIconElement);return n.appendChild(i),this.appendChild(n),H(this,Ws,n)}_lookForAButton(){let e=this._slot;if(a.isNull(e))return null;let t=e.assignedElements({flatten:!0});return a.isNullOrEmpty(t)?null:t[0]}_ensureBalloon(){let e=M(this,uo);if(!a.isNull(e))return e;let t=A.findAncestorShell(this);return a.isNull(t)?null:(e=new Ul.PacemBalloonElement,e.options={trigger:Ul.BalloonTrigger.Click,position:Ul.BalloonPosition.HorizontalAuto,align:Ul.BalloonAlignment.Auto,autoAdjust:!0},e.addEventListener(Yt,this._dispatchCommand,!1),e.className=`${b}-contextmenu`,t.appendChild(e),H(this,uo,e))}register(e){let t=super.register(e);return t&&(e.addEventListener(Ku,this._attributeChangeHandler,!1),this._refreshMenuItems()),t}unregister(e){let t=super.unregister(e);return t&&(e.removeEventListener(Ku,this._attributeChangeHandler,!1),this._refreshMenuItems()),t}_onCommand(e){this.dispatchEvent(new CustomEvent(Yt,{detail:e.detail,cancelable:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent(e.detail.commandName.toLowerCase(),{detail:e.detail.commandArgument,cancelable:!0,bubbles:!0}))}_resetLayout(){let e=this._ensureButton(),t=this._ensureBalloon();!a.isNull(e)&&!a.isNull(t)&&(t.target=e),this._toggleBtn(),this._toggleIcon()}_toggleBtn(e=this.disabled){let t=M(this,Ws);!a.isNull(t)&&t instanceof R.PacemElement&&(t.disabled=e)}_toggleIcon(e=this.icon){let t=M(this,Ap);a.isNull(t)||(t.icon=e)}viewActivatedCallback(){super.viewActivatedCallback(),this._resetLayout(),this._slot.addEventListener("slotchange",this._slotchangeHandler,!1)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"icon":this._toggleIcon(n);break;case"disabled":this._toggleBtn(n);break}}disconnectedCallback(){this._disposeButton(),this._disposeSlot(),this._disposeBalloon(),super.disconnectedCallback()}refresh(){this._refreshMenuItems()}_disposeButton(){H(this,Ws,H(this,Ap,null))}_disposeSlot(){let e=this._slot;a.isNull(e)||e.removeEventListener("slotchange",this._slotchangeHandler,!1)}_disposeBalloon(){let e=M(this,uo);a.isNull(e)||(e.removeEventListener(Yt,this._dispatchCommand,!1),this._disposeBalloonChildren(0),e.remove(),H(this,uo,null))}_disposeBalloonChildren(e){let t=M(this,uo),n=t.children.length;for(let i=n-1;i>=e;i--){let s=t.children.item(i);s.removeEventListener("mouseup",this._mouseupHandler,!1),s.remove()}}_refreshMenuItems(){let e=this._ensureBalloon();if(a.isNull(e))return;let t=e.children.length,n=0;for(let i of this.items){if(i.hide)continue;let s=i.createMenuItemElement();if(s.addEventListener("mouseup",this._mouseupHandler,!1),n<t){let l=e.children.item(n);l.removeEventListener("mouseup",this._mouseupHandler,!1),l.replaceWith(s)}else e.appendChild(s);n++}this._disposeBalloonChildren(n)}};Ws=new WeakMap,Ap=new WeakMap,uo=new WeakMap,c([S("slot[name=button]")],Bi.prototype,"_slot",2),c([h({converter:m.Json})],Bi.prototype,"commandArgument",2),c([h({converter:m.String})],Bi.prototype,"icon",2),c([me(!0)],Bi.prototype,"_refreshMenuItems",1),Bi=c([C({tagName:d+"-context-menu",shadow:!0,template:'<slot name="button"></slot><slot></slot>'})],Bi);var Hm=ie.UI,Av=Tp.Scaffolding,rx=(n=>(n.Text="text",n.Html="html",n.Image="image",n.Markdown="markdown",n))(rx||{}),Br=class extends R.PacemElement{constructor(e=new Hm.MarkdownService){super();this._markdown=e;this._dialogPropertyChangedHandler=e=>{this._dialogPropertyChangedCallback(e)};this._broadcastFetchRequestEventName=e=>{this.dispatchEvent(new Av.ImageFetchRequestEvent(e.detail))};this._innerValueChangedHandler=e=>{e.detail.propertyName==="value"&&!a.isNull(this._dialog)&&(this._dialog.state=e.detail.currentValue)};this._editHandler=e=>{this.edit(e)}}_addButton(){if(a.isNull(this._button)){var e=document.createElement(d+"-button");return e.className=b+"-edit-button",e.addEventListener("click",this._editHandler,!1),this._target.appendChild(e),this._button=e}}_removeButton(){var e=this._button;a.isNull(e)||(e.removeEventListener("click",this._editHandler,!1),e.remove(),this._button=null)}_addDialog(){var e=document.createElement(d+"-dialog");return e.buttons=Hm.DialogButtons.OkCancel,e.addEventListener(ee,this._dialogPropertyChangedHandler,!1),e.appendChild(this._addTextarea()),e.appendChild(this._addContenteditable()),e.appendChild(this._addEditImage()),document.body.appendChild(e),this._dialog=e}_removeDialog(){this._removeTextarea(),this._removeContenteditable(),this._removeEditImage(),a.isNull(this._dialog)||(this._dialog.removeEventListener(ee,this._dialogPropertyChangedHandler,!1),this._dialog.remove())}_addTextarea(){var e=document.createElement(d+"-textarea");e.className=b+"-edit-text",e.addEventListener(ee,this._innerValueChangedHandler,!1);let t=this.type||"text";return e.hide=t!=="text"&&t!=="markdown",this._textarea=e}_removeTextarea(){a.isNull(this._textarea)||this._textarea.removeEventListener(ee,this._innerValueChangedHandler,!1)}_addContenteditable(){var e=document.createElement(d+"-contenteditable");e.className=b+"-edit-content",e.addEventListener(ee,this._innerValueChangedHandler,!1);let t=this.type||"text";return e.hide=t!=="html",this._contenteditable=e}_removeContenteditable(){a.isNull(this._contenteditable)||this._contenteditable.removeEventListener(ee,this._innerValueChangedHandler,!1)}_addEditImage(){var e=document.createElement(d+"-edit-image");e.disabled=!0,e.addEventListener(ee,this._innerValueChangedHandler,!1),e.addEventListener(Av.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1);let t=this.type||"text";return e.hide=t!=="image",e.uploadUrl=this.imageUploadUrl,e.allowSnapshot=this.allowSnapshot,e.maxWidth=this.maxImageWidth,e.maxHeight=this.maxImageHeight,this._editImage=e}_removeEditImage(){a.isNull(this._editImage)||(this._editImage.removeEventListener(ee,this._innerValueChangedHandler,!1),this._editImage.removeEventListener(Av.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1))}_update(e){var t=this._content;switch(this.type){case"html":t.innerHTML=e;break;case"markdown":t.localName===d+"-markdown"?t.value=e:t.innerHTML=this._markdown.toHtml(e);break;case"image":switch(t.localName){case"img":case d+"-img":t.src=e;break;default:t.style.backgroundImage=`url(${e})`;break}break;default:this._content.textContent=e;break}}_retrieve(){var e=this._content;switch(this.type){case"html":return e.innerHTML;case"image":switch(e.localName){case d+"-img":case"img":return e.src;default:let t=getComputedStyle(e).backgroundImage,n=/url\(["']?([^'"]+)["']?\)/.exec(t);return n&&n.length&&n[1]}case"markdown":return e.value||e.textContent;default:return e.textContent}}_setup(){this.disabled?(a.removeClass(this._target,b+"-editing"),this._removeButton()):(a.addClass(this._target,b+"-editing"),this._addButton())}_dialogPropertyChangedCallback(e){if(e.detail.propertyName==="state"){let t=e.detail.currentValue;a.isNull(this._textarea)||(this._textarea.value=t),a.isNull(this._contenteditable)||(this._contenteditable.value=t),a.isNull(this._editImage)||(this._editImage.value=t),this._update(e.detail.currentValue)}}get _target(){var e=this.target;return a.isNull(e)&&(e=this.firstElementChild),e}connectedCallback(){super.connectedCallback(),this._addDialog()}viewActivatedCallback(){super.viewActivatedCallback(),this._addButton(),this._setup()}disconnectedCallback(){this._removeButton(),this._removeDialog(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"imageUploadUrl":a.isNull(this._editImage)||(this._editImage.uploadUrl=n);break;case"allowSnapshot":a.isNull(this._editImage)||(this._editImage.allowSnapshot=n);break;case"imageSet":a.isNull(this._editImage)||(this._editImage.imageSet=n);break;case"disabled":this._setup();break;case"type":let s=n;a.isNull(this._textarea)||(this._textarea.hide=s!=="text"&&s!=="markdown"),a.isNull(this._contenteditable)||(this._contenteditable.hide=s!=="html"),a.isNull(this._editImage)||(this._editImage.hide=s!=="image");break;case"maxImageHeight":a.isNull(this._editImage)||(this._editImage.maxHeight=n);break;case"maxImageWidth":a.isNull(this._editImage)||(this._editImage.maxWidth=n);break}}edit(e){Q(e);var t=this._target;if(!a.isNull(t)){this._removeButton(),this._content=t;var n=this._state=this._retrieve();a.isNull(this._editImage)||(this._editImage.disabled=!1),this._dialog.open(n).then(i=>{switch(i.button){case Hm.DialogButton.Cancel:this._update(this._state);break;case Hm.DialogButton.Ok:this._update(i.state),this.dispatchEvent(new CustomEvent("commit",{detail:{value:i.state}}));break}this._content=null,a.isNull(this._editImage)||(this._editImage.disabled=!0),this._addButton()})}}};c([h({emit:!1,converter:m.String})],Br.prototype,"key",2),c([h({converter:m.String})],Br.prototype,"type",2),c([h({converter:m.Element})],Br.prototype,"target",2),c([h({emit:!1,converter:m.String})],Br.prototype,"imageUploadUrl",2),c([h({emit:!1})],Br.prototype,"imageSet",2),c([h({emit:!1,converter:m.Number})],Br.prototype,"maxImageWidth",2),c([h({emit:!1,converter:m.Number})],Br.prototype,"maxImageHeight",2),c([h({emit:!1,converter:m.Boolean})],Br.prototype,"allowSnapshot",2),Br=c([C({tagName:d+"-edit"})],Br);var nx=ie.UI;function ix(o=sx(),r="image"){return`<${d}-slide class="${b}-gallery-item"
|
|
946
|
+
</${d}-repeater><${d}-adapter pausable="{{ :host.pausable }}" class="${b}-carousel-adapter" interval="{{ :host.interval }}"></${d}-adapter>`})],Fs);var Ul=ie.UI,Dp=class extends R.PacemItemElement{connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-context-menuitem")}propertyChangedCallback(r,e,t,n){super.propertyChangedCallback(r,e,t,n);let i=this.container;i instanceof Bi&&i.refresh()}},Hr=class extends Dp{createMenuItemElement(){let r=new Ul.PacemButtonElement;return r.commandArgument=this.commandArgument,r.commandName=this.commandName,r.textContent=this.caption,r.iconGlyph=this.iconGlyph,r.confirmationDialog=this.confirmationDialog,r.confirmationMessage=this.confirmationMessage,r.tooltip=this.tooltip,r.disabled=this.disabled,r.cssClass=this.buttonCssClass,r}};c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"commandName",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"caption",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"tooltip",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"iconGlyph",2),c([h({emit:!1,reflectBack:!0,converter:m.StringArray})],Hr.prototype,"buttonCssClass",2),c([h({emit:!1,reflectBack:!0,converter:m.String})],Hr.prototype,"confirmationMessage",2),c([h({emit:!1,reflectBack:!0,converter:m.Element})],Hr.prototype,"confirmationDialog",2),c([h({emit:!1,reflectBack:!0,converter:m.Json})],Hr.prototype,"commandArgument",2),Hr=c([C({tagName:d+"-context-menuitem-command"})],Hr);var Tu=class extends Dp{createMenuItemElement(){let r=document.createElement("hr");return r.style.pointerEvents="none",r}};Tu=c([C({tagName:d+"-context-menuitem-separator"})],Tu);var Ws,Ap,uo,Bi=class extends R.PacemItemsContainerElement{constructor(){super(...arguments);this._dispatchCommand=e=>{Q(e),this._onCommand(new ql({commandName:e.detail.commandName,commandArgument:e.detail.commandArgument??this.commandArgument}))};z(this,Ws);z(this,Ap);z(this,uo);this._slotchangeHandler=e=>{this._resetLayout()};this._attributeChangeHandler=e=>this._refreshMenuItems;this._mouseupHandler=e=>{let t=this._ensureBalloon();a.isNull(t)||t.popout()}}validate(e){return e instanceof Dp}_ensureButton(){if(!a.isNull(M(this,Ws)))return M(this,Ws);let e=this._slot;if(a.isNull(e))return null;let t=this._lookForAButton();if(!a.isNull(t))return H(this,Ws,t);let n=new Ul.PacemButtonElement;n.setAttribute("slot","button"),n.className=`${b}-margin margin-0 button-flat`;let i=H(this,Ap,new Ul.PacemIconElement);return n.appendChild(i),this.appendChild(n),H(this,Ws,n)}_lookForAButton(){let e=this._slot;if(a.isNull(e))return null;let t=e.assignedElements({flatten:!0});return a.isNullOrEmpty(t)?null:t[0]}_ensureBalloon(){let e=M(this,uo);if(!a.isNull(e))return e;let t=A.findAncestorShell(this);return a.isNull(t)?null:(e=new Ul.PacemBalloonElement,e.options={trigger:Ul.BalloonTrigger.Click,position:Ul.BalloonPosition.HorizontalAuto,align:Ul.BalloonAlignment.Auto,autoAdjust:!0},e.addEventListener(Yt,this._dispatchCommand,!1),e.className=`${b}-contextmenu`,t.appendChild(e),H(this,uo,e))}register(e){let t=super.register(e);return t&&(e.addEventListener(Ku,this._attributeChangeHandler,!1),this._refreshMenuItems()),t}unregister(e){let t=super.unregister(e);return t&&(e.removeEventListener(Ku,this._attributeChangeHandler,!1),this._refreshMenuItems()),t}_onCommand(e){this.dispatchEvent(new CustomEvent(Yt,{detail:e.detail,cancelable:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent(e.detail.commandName.toLowerCase(),{detail:e.detail.commandArgument,cancelable:!0,bubbles:!0}))}_resetLayout(){let e=this._ensureButton(),t=this._ensureBalloon();!a.isNull(e)&&!a.isNull(t)&&(t.target=e),this._toggleBtn(),this._toggleIcon()}_toggleBtn(e=this.disabled){let t=M(this,Ws);!a.isNull(t)&&t instanceof R.PacemElement&&(t.disabled=e)}_toggleIcon(e=this.icon){let t=M(this,Ap);a.isNull(t)||(t.icon=e)}viewActivatedCallback(){super.viewActivatedCallback(),this._resetLayout(),this._slot.addEventListener("slotchange",this._slotchangeHandler,!1)}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"icon":this._toggleIcon(n);break;case"disabled":this._toggleBtn(n);break}}disconnectedCallback(){this._disposeButton(),this._disposeSlot(),this._disposeBalloon(),super.disconnectedCallback()}refresh(){this._refreshMenuItems()}_disposeButton(){H(this,Ws,H(this,Ap,null))}_disposeSlot(){let e=this._slot;a.isNull(e)||e.removeEventListener("slotchange",this._slotchangeHandler,!1)}_disposeBalloon(){let e=M(this,uo);a.isNull(e)||(e.removeEventListener(Yt,this._dispatchCommand,!1),this._disposeBalloonChildren(0),e.remove(),H(this,uo,null))}_disposeBalloonChildren(e){let t=M(this,uo),n=t.children.length;for(let i=n-1;i>=e;i--){let s=t.children.item(i);s.removeEventListener("mouseup",this._mouseupHandler,!1),s.remove()}}_refreshMenuItems(){let e=this._ensureBalloon();if(a.isNull(e))return;let t=e.children.length,n=0;for(let i of this.items){if(i.hide)continue;let s=i.createMenuItemElement();if(s.addEventListener("mouseup",this._mouseupHandler,!1),n<t){let l=e.children.item(n);l.removeEventListener("mouseup",this._mouseupHandler,!1),l.replaceWith(s)}else e.appendChild(s);n++}this._disposeBalloonChildren(n)}};Ws=new WeakMap,Ap=new WeakMap,uo=new WeakMap,c([S("slot[name=button]")],Bi.prototype,"_slot",2),c([h({converter:m.Json})],Bi.prototype,"commandArgument",2),c([h({converter:m.String})],Bi.prototype,"icon",2),c([me(!0)],Bi.prototype,"_refreshMenuItems",1),Bi=c([C({tagName:d+"-context-menu",shadow:!0,template:'<slot name="button"></slot><slot></slot>'})],Bi);var Hm=ie.UI,Av=Tp.Scaffolding,nx=(n=>(n.Text="text",n.Html="html",n.Image="image",n.Markdown="markdown",n))(nx||{}),Br=class extends R.PacemElement{constructor(e=new Hm.MarkdownService){super();this._markdown=e;this._dialogPropertyChangedHandler=e=>{this._dialogPropertyChangedCallback(e)};this._broadcastFetchRequestEventName=e=>{this.dispatchEvent(new Av.ImageFetchRequestEvent(e.detail))};this._innerValueChangedHandler=e=>{e.detail.propertyName==="value"&&!a.isNull(this._dialog)&&(this._dialog.state=e.detail.currentValue)};this._editHandler=e=>{this.edit(e)}}_addButton(){if(a.isNull(this._button)){var e=document.createElement(d+"-button");return e.className=b+"-edit-button",e.addEventListener("click",this._editHandler,!1),this._target.appendChild(e),this._button=e}}_removeButton(){var e=this._button;a.isNull(e)||(e.removeEventListener("click",this._editHandler,!1),e.remove(),this._button=null)}_addDialog(){var e=document.createElement(d+"-dialog");return e.buttons=Hm.DialogButtons.OkCancel,e.addEventListener(ee,this._dialogPropertyChangedHandler,!1),e.appendChild(this._addTextarea()),e.appendChild(this._addContenteditable()),e.appendChild(this._addEditImage()),document.body.appendChild(e),this._dialog=e}_removeDialog(){this._removeTextarea(),this._removeContenteditable(),this._removeEditImage(),a.isNull(this._dialog)||(this._dialog.removeEventListener(ee,this._dialogPropertyChangedHandler,!1),this._dialog.remove())}_addTextarea(){var e=document.createElement(d+"-textarea");e.className=b+"-edit-text",e.addEventListener(ee,this._innerValueChangedHandler,!1);let t=this.type||"text";return e.hide=t!=="text"&&t!=="markdown",this._textarea=e}_removeTextarea(){a.isNull(this._textarea)||this._textarea.removeEventListener(ee,this._innerValueChangedHandler,!1)}_addContenteditable(){var e=document.createElement(d+"-contenteditable");e.className=b+"-edit-content",e.addEventListener(ee,this._innerValueChangedHandler,!1);let t=this.type||"text";return e.hide=t!=="html",this._contenteditable=e}_removeContenteditable(){a.isNull(this._contenteditable)||this._contenteditable.removeEventListener(ee,this._innerValueChangedHandler,!1)}_addEditImage(){var e=document.createElement(d+"-edit-image");e.disabled=!0,e.addEventListener(ee,this._innerValueChangedHandler,!1),e.addEventListener(Av.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1);let t=this.type||"text";return e.hide=t!=="image",e.uploadUrl=this.imageUploadUrl,e.allowSnapshot=this.allowSnapshot,e.maxWidth=this.maxImageWidth,e.maxHeight=this.maxImageHeight,this._editImage=e}_removeEditImage(){a.isNull(this._editImage)||(this._editImage.removeEventListener(ee,this._innerValueChangedHandler,!1),this._editImage.removeEventListener(Av.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1))}_update(e){var t=this._content;switch(this.type){case"html":t.innerHTML=e;break;case"markdown":t.localName===d+"-markdown"?t.value=e:t.innerHTML=this._markdown.toHtml(e);break;case"image":switch(t.localName){case"img":case d+"-img":t.src=e;break;default:t.style.backgroundImage=`url(${e})`;break}break;default:this._content.textContent=e;break}}_retrieve(){var e=this._content;switch(this.type){case"html":return e.innerHTML;case"image":switch(e.localName){case d+"-img":case"img":return e.src;default:let t=getComputedStyle(e).backgroundImage,n=/url\(["']?([^'"]+)["']?\)/.exec(t);return n&&n.length&&n[1]}case"markdown":return e.value||e.textContent;default:return e.textContent}}_setup(){this.disabled?(a.removeClass(this._target,b+"-editing"),this._removeButton()):(a.addClass(this._target,b+"-editing"),this._addButton())}_dialogPropertyChangedCallback(e){if(e.detail.propertyName==="state"){let t=e.detail.currentValue;a.isNull(this._textarea)||(this._textarea.value=t),a.isNull(this._contenteditable)||(this._contenteditable.value=t),a.isNull(this._editImage)||(this._editImage.value=t),this._update(e.detail.currentValue)}}get _target(){var e=this.target;return a.isNull(e)&&(e=this.firstElementChild),e}connectedCallback(){super.connectedCallback(),this._addDialog()}viewActivatedCallback(){super.viewActivatedCallback(),this._addButton(),this._setup()}disconnectedCallback(){this._removeButton(),this._removeDialog(),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){switch(super.propertyChangedCallback(e,t,n,i),e){case"imageUploadUrl":a.isNull(this._editImage)||(this._editImage.uploadUrl=n);break;case"allowSnapshot":a.isNull(this._editImage)||(this._editImage.allowSnapshot=n);break;case"imageSet":a.isNull(this._editImage)||(this._editImage.imageSet=n);break;case"disabled":this._setup();break;case"type":let s=n;a.isNull(this._textarea)||(this._textarea.hide=s!=="text"&&s!=="markdown"),a.isNull(this._contenteditable)||(this._contenteditable.hide=s!=="html"),a.isNull(this._editImage)||(this._editImage.hide=s!=="image");break;case"maxImageHeight":a.isNull(this._editImage)||(this._editImage.maxHeight=n);break;case"maxImageWidth":a.isNull(this._editImage)||(this._editImage.maxWidth=n);break}}edit(e){Q(e);var t=this._target;if(!a.isNull(t)){this._removeButton(),this._content=t;var n=this._state=this._retrieve();a.isNull(this._editImage)||(this._editImage.disabled=!1),this._dialog.open(n).then(i=>{switch(i.button){case Hm.DialogButton.Cancel:this._update(this._state);break;case Hm.DialogButton.Ok:this._update(i.state),this.dispatchEvent(new CustomEvent("commit",{detail:{value:i.state}}));break}this._content=null,a.isNull(this._editImage)||(this._editImage.disabled=!0),this._addButton()})}}};c([h({emit:!1,converter:m.String})],Br.prototype,"key",2),c([h({converter:m.String})],Br.prototype,"type",2),c([h({converter:m.Element})],Br.prototype,"target",2),c([h({emit:!1,converter:m.String})],Br.prototype,"imageUploadUrl",2),c([h({emit:!1})],Br.prototype,"imageSet",2),c([h({emit:!1,converter:m.Number})],Br.prototype,"maxImageWidth",2),c([h({emit:!1,converter:m.Number})],Br.prototype,"maxImageHeight",2),c([h({emit:!1,converter:m.Boolean})],Br.prototype,"allowSnapshot",2),Br=c([C({tagName:d+"-edit"})],Br);var ix=ie.UI;function sx(o=ax(),r="image"){return`<${d}-slide class="${b}-gallery-item"
|
|
947
947
|
css-class="{{ { '${b}-gallery-previous': :host.isPrevious(^index, ::_slideshow.index), '${b}-gallery-next': :host.isNext(^index, ::_slideshow.index), '${b}-gallery-focus': ^index === ::_slideshow.index } }}"
|
|
948
948
|
>
|
|
949
949
|
<${d}-img src="{{ ^item.${r} }}" disabled="{{ !::_lightbox.show || !(:host.isCloseTo(^index, ::_slideshow.index) || ^index === ::_slideshow.index) }}"
|
|
@@ -951,9 +951,9 @@ css="{{ {'visibility': (:host._poppingUp ? 'hidden' : ''), 'transition': (:host.
|
|
|
951
951
|
|
|
952
952
|
${o}
|
|
953
953
|
|
|
954
|
-
</${d}-slide>`}function
|
|
954
|
+
</${d}-slide>`}function ax(o="caption"){return`<${d}-panel hide="{{ $pacem.isNullOrEmpty(^item.${o}) }}" class="${b}-gallery-caption gallery-caption-default">
|
|
955
955
|
<${d}-span class="paragraph" text="{{ ^item.${o} }}"></${d}-span>
|
|
956
|
-
</${d}-panel>`}var ar=class extends
|
|
956
|
+
</${d}-panel>`}var ar=class extends ix.PacemAdaptedIterativeElement{constructor(){super(...arguments);this._templateChangeHandler=e=>{let t=e.target;this._setupWithCaptionTemplate(t.target)}}viewActivatedCallback(){super.viewActivatedCallback(),this._setupWithCaptionTemplate(),this._databind()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"datasource":this._databind();break;case"captionTemplate":this._setupWithCaptionTemplate(n,t);break;case"imageProperty":this._setupWithCaptionTemplate(this.captionTemplate,this.captionTemplate);break;case"captionProperty":a.isNull(this.captionTemplate)&&this._setupDefaultTemplate();break}}disconnectedCallback(){this._disposeTemplate(),super.disconnectedCallback()}_disposeTemplate(e=this.captionTemplate){e instanceof R.PacemTemplateProxyElement&&e.removeEventListener("templatechange",this._templateChangeHandler)}_setupWithCaptionTemplate(e=this.captionTemplate,t){if(this._disposeTemplate(t),a.isNull(e)){this._setupDefaultTemplate();return}e instanceof R.PacemTemplateProxyElement&&(e.addEventListener("templatechange",this._templateChangeHandler,!1),e=e.target);let n=e.content.firstElementChild;a.addClass(n,b+"-gallery-caption");let i=document.createElement("template");i.innerHTML=sx(e.innerHTML,this.imageProperty),this._setupTemplate(i)}_setupTemplate(e){this._templateProxy.target=e}_setupDefaultTemplate(){let e=document.createElement("template");e.innerHTML=sx(ax(this.captionProperty),this.imageProperty),this._setupTemplate(e)}_databind(){let e=this._repeater;a.isNull(e)||(e.datasource=this.datasource)}get adapter(){return this._adapter}async _heroAnimate(e,t){if(!a.isNull(e)){let n=new ix.PacemImageElement,i=this._heroPlaceholderProxy.dom[0],s=300;n.src=t||e.src,n.adapt="contain";let l=a.offset(i),p=a.offset(e),u=n.style,f=getComputedStyle(i);u.border=f.border,u.width=i.clientWidth+"px",u.height=i.clientHeight+"px",u.position="absolute",u.zIndex=f.zIndex,u.top=l.top+"px",u.left=l.left+"px";let g=e.clientWidth/i.clientWidth,v=e.clientHeight/i.clientHeight,y=p.left-l.left+"px",_=p.top-l.top+"px";u.transformOrigin="0 0",u.transition=`transform cubic-bezier(0.445, 0.05, 0.55, 0.95) ${s}ms, opacity ${s}ms`,u.transform=`translate(${y}, ${_}) scale(${g}, ${v})`,document.body.appendChild(n),requestAnimationFrame(()=>{n.style.transform=""}),await a.waitForAnimationEnd(n,s),n.remove()}}open(e,t,n){this._poppingUp=!0,this._lightbox.show=!0,this._slideshow.index=e,this._heroAnimate(t,n).then(i=>{this._poppingUp=!1,this._slideshow.focus()})}};c([S(d+"-adapter")],ar.prototype,"_adapter",2),c([S(d+"-lightbox")],ar.prototype,"_lightbox",2),c([S(d+"-slideshow")],ar.prototype,"_slideshow",2),c([S(d+"-repeater")],ar.prototype,"_repeater",2),c([S(d+"-template-proxy")],ar.prototype,"_templateProxy",2),c([S(d+"-shell-proxy")],ar.prototype,"_heroPlaceholderProxy",2),c([h()],ar.prototype,"_poppingUp",2),c([h({emit:!1,converter:m.Element})],ar.prototype,"captionTemplate",2),c([h({emit:!1,converter:m.String})],ar.prototype,"captionProperty",2),c([h({emit:!1,converter:m.String})],ar.prototype,"imageProperty",2),ar=c([C({tagName:d+"-gallery",shadow:j.USE_SHADOW_ROOT,template:`<${d}-lightbox class="${b}-gallery">
|
|
957
957
|
<${d}-repeater>
|
|
958
958
|
<${d}-slideshow adapter="{{ ::_adapter }}" index="{{ :host.index, twoway }}" hide="{{ !::_lightbox.show }}">
|
|
959
959
|
<${d}-template-proxy></${d}-template-proxy>
|
|
@@ -987,14 +987,14 @@ ${o}
|
|
|
987
987
|
</${d}-fetch><${d}-input-search value="{{ :host.hint, twoway }}"></${d}-input-search>
|
|
988
988
|
<${d}-repeater datasource="{{ ::_fetch.result }}">
|
|
989
989
|
<${d}-content></${d}-content>
|
|
990
|
-
</${d}-repeater>`})],zn);var lx="datarowselectchange",Ru=class extends CustomEvent{constructor(r){super(lx,{detail:r,bubbles:!1,cancelable:!0})}},ax={},ox=[],Xs=class extends Mn{updateLayout(r=this.metadata){this._setup(r)}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-datacell")}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"_contentTooltip":this._updateTooltipJustInCase();break;case"gridState":case"rowindex":this._updateSelection();break}}_updateTooltipJustInCase(){(this.metadata.dataCell?.autoTooltip??!0)&&!a.isNullOrEmpty(this._contentTooltip)?this.setAttribute("tooltip",this._contentTooltip):this.removeAttribute("tooltip")}_inflateContent(r=this.dataitem,e=this.rowindex,t=this.metadata){this._contentTooltip="";let n=t.dataCell?.format,i=t.dataCell?.null??"";if(typeof n=="function"){let u=n(this,t,r,e);return a.isNullOrEmpty(u)?i:u}let l=A.resolvePath(t.prop,r)?.target?.value;if(a.isNullOrEmpty(l))return i;let p=a.lang(this);switch(t.dataType){case"boolean":return`<${d}-icon icon="${l?"check_circle_outline icon-fill":"radio_button_unchecked icon-outline"} icon-size icon-size-2"></${d}-icon>`;case"time":case"date":case"datetime":return this._contentTooltip=a.core.date(l,n,p);case"byte":case"int16":case"int32":case"int64":case"short":case"integer":case"int":case"long":case"double":case"decimal":case"float":case"single":case"number":return this._contentTooltip=a.core.number(l,n||"",p);case"currency":return n??="EUR",typeof n=="string"?this._contentTooltip=a.core.currency(l,n,p):this._contentTooltip=a.core.number(l,n,p);case"percent":case"percentage":return n??={style:"percent",maximumFractionDigits:2},typeof n=="string"?this._contentTooltip=a.core.currency(l,n,p):this._contentTooltip=a.core.number(l,n,p);default:return this._contentTooltip=l}}_inflateCssClass(r=this.dataitem,e=this.rowindex,t=this.metadata,n){if(a.isNull(r)||a.isNullOrEmpty(t))return ox;let i=t.dataCell&&t.dataCell.cssClass||ox,s=[];switch(typeof i=="function"?Array.prototype.push.apply(s,i(this,t,r,e)||[]):Array.prototype.push.apply(s,i),t.dataCell?.verticalAlign?.toLowerCase()){case"top":s.push("datacell-top");break;case"bottom":s.push("datacell-bottom");break;case"middle":s.push("datacell-middle");break}switch(t.dataCell?.horizontalAlign?.toLowerCase()){case"left":s.push("datacell-left");break;case"right":s.push("datacell-right");break;case"center":s.push("datacell-center");break}return n?.length&&(e===0&&s.push("datacell-firstrow"),e===n.length-1&&s.push("datacell-lastrow")),s}_inflateCss(r=this.dataitem,e=this.rowindex,t=this.metadata){if(a.isNull(r)||a.isNullOrEmpty(t))return ax;let n=t.dataCell&&t.dataCell.css||ax;return typeof n=="function"?n(this,t,r,e):n}_setup(r=this.metadata){this.setAttribute("css-class","{{ this._inflateCssClass(^item, ^index, this.metadata, :host.datasource) }}"),this.setAttribute("css","{{ Pacem.Utils.extend({ 'grid-row': ^index+2 }, this._inflateCss(^item, ^index, this.metadata, :host.datasource)) }}");let t=!!r.dataCell?.textEllipsis?["text-truncate"]:[];switch(r?.dataCell?.selectMode?.toLowerCase()){case"cell":case"row":t.push(b+"-inert"),t.push(b+"-unselect");break}this._content.cssClass=t,this._updateSelection()}_updateSelection(){(this.gridState?.selectedRows??[]).indexOf(this.rowindex)>=0?a.addClass(this,"datarow-selected datacell-filled datacell-primary"):a.removeClass(this,"datarow-selected datacell-filled datacell-primary")}};c([h({emit:!1,converter:m.Eval})],Xs.prototype,"dataitem",2),c([h({emit:!1,converter:m.Number})],Xs.prototype,"rowindex",2),c([h({emit:!1,converter:m.String,debounce:200})],Xs.prototype,"_contentTooltip",2),c([S(d+"-span")],Xs.prototype,"_content",2),Xs=c([C({tagName:d+"-datacell",shadow:!1,template:`<${d}-span content="{{ :host._inflateContent(^item, ^index, :host.metadata) }}"></${d}-span>`})],Xs);var zl=ie.UI,Bm="datacolumnsort",Rp=class extends CustomEvent{constructor(r){super(Bm,{detail:r,bubbles:!1,cancelable:!0})}},Vm="datacolumnrescale",Op=class extends CustomEvent{constructor(r){super(Vm,{detail:r,bubbles:!1,cancelable:!0})}},Ou=class extends Mn{constructor(e=new zl.MarkdownService){super();this._md=e;this._sortButtonClickHandler=e=>{let t=this.metadata,n=this.gridState,i=t.prop,s=n.sort?.column===i?n.sort.dir==="desc"?"asc":"desc":t.defaultSort||"asc";this.dispatchEvent(new Rp({column:i,dir:s}))};this._rescaleHandler=e=>{e.preventDefault();let t=e.detail,n=Math.max(this.metadata.minPixelWidth??24,t.currentPosition.x-this._columnBBox.x);this.dispatchEvent(new Op({width:n}))};this._rescaleStartHandler=e=>{this._columnBBox=a.offsetRect(this)};this._rescaleEndHandler=e=>{}}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-headcell")}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&e==="gridState"&&this._updateSortButtonIconGlyph()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureBalloon()}disconnectedCallback(){this._disposeBalloon(),this._disposeRescaler(),super.disconnectedCallback()}updateLayout(e=this.metadata){this._setup(e)}_setupSortButton(){let e=new zl.PacemButtonElement;return e.className=`button-flat headcell-sort ${b}-inert`,this.addEventListener("click",this._sortButtonClickHandler,!1),a.addClass(this,b+"-clickable"),e}_disposeSortButton(e=this._sortButton){a.isNull(e)||(a.removeClass(this,b+"-clickable"),this.removeEventListener("click",this._sortButtonClickHandler,!1),e.remove(),this._sortButton=null)}_updateSortButtonIconGlyph(e=this._sortButton,t=this.gridState,n=this.metadata){a.isNull(e)||a.isNullOrEmpty(n)||(e.iconGlyph=t?.sort?.column===n.prop?t.sort.dir==="desc"?"arrow_drop_down":"arrow_drop_up":"")}_ensureRescaler(){if(a.isNull(this._rescaler)){let e=this._rescaler=this._rescaler||new R.PacemRescaleElement;e.handles=[J.RescaleHandle.Right],e.addEventListener(J.RescaleEventType.Rescale,this._rescaleHandler,!1),e.addEventListener(J.RescaleEventType.Start,this._rescaleStartHandler,!1),e.addEventListener(J.RescaleEventType.End,this._rescaleEndHandler,!1),A.findAncestorShell(this).appendChild(e)}}_setupRescaleContainer(){this._ensureRescaler();let e=new R.PacemPanelElement;return e.className="headcell-rescale",e.behaviors=[this._rescaler],e}_disposeRescaleContainer(e=this._rescaleContainer){a.isNull(e)||(e.remove(),this._rescaleContainer=null)}_disposeRescaler(e=this._rescaler){a.isNull(e)||(e.removeEventListener(J.RescaleEventType.Rescale,this._rescaleHandler,!1),e.removeEventListener(J.RescaleEventType.Start,this._rescaleStartHandler,!1),e.removeEventListener(J.RescaleEventType.End,this._rescaleEndHandler,!1),e.remove(),this._rescaler=null)}_setup(e=this.metadata){this.setAttribute("css-class","{{ this.metadata && this.metadata.headCell && this.metadata.headCell.cssClass || [] }}"),this.setAttribute("css","{{ this.metadata && this.metadata.headCell && this.metadata.headCell.css }}");let n=!!e.headCell?.textEllipsis?["text-truncate"]:[];switch(e.headCell?.verticalAlign?.toLowerCase()){case"top":a.addClass(this,"headcell-top");break;case"bottom":a.addClass(this,"headcell-bottom");break;case"middle":a.addClass(this,"headcell-middle");break}switch(e.headCell?.horizontalAlign?.toLowerCase()){case"left":n.push("text-left");break;case"right":n.push("text-right");break;case"center":n.push("text-center");break}this.removeAttribute("content");let i=a.isNullOrEmpty(n)?"":` class="${n.join(" ")}"`,s=e.headCell?.name??e.prop;if(this.innerHTML=`<div${i}>${s}</div>`,e.isSortable){this._disposeSortButton();let l=this._sortButton=this._setupSortButton();this._updateSortButtonIconGlyph(l),this.appendChild(l)}if(e.isRescalable){this._disposeRescaleContainer();let l=this._rescaleContainer=this._setupRescaleContainer();this.appendChild(l)}e.isTogglable}_normalizeTooltip(){let e=this.metadata.headCell?.tooltip||!1;return typeof e=="object"?e:{type:e}}_ensureBalloon(){var e,t;let n=(t=this._normalizeTooltip()).type===!1||a.isNullOrEmpty(e=this.metadata.headCell?.description);if(a.isNull(this._balloon)&&!n){let l=new zl.PacemBalloonElement;l.options={behavior:zl.BalloonBehavior.Tooltip,trigger:t.trigger||zl.BalloonTrigger.Hover,position:t.position||zl.BalloonPosition.Top,hoverDelay:200,hoverTimeout:50,align:t.align||zl.BalloonAlignment.Auto},a.addClass(l,b+"-headcell-tooltip");var i=A.findAncestorShell(this);i.appendChild(this._balloon=l)}let s=this._balloon;if(!a.isNull(s)&&(s.target=this,!(s.disabled=n))){let l=e||"";switch(t.type){case"md":case"markdown":s.innerHTML=this._md.toHtml(l);break;case"html":s.innerHTML=l;break;default:s.innerText=l;break}}}_disposeBalloon(){a.isNull(this._balloon)||(this._balloon.remove(),this._balloon=null)}};Ou=c([C({tagName:d+"-headcell"})],Ou);var Dv="datacolumnchange",Rv="datacolumnstatechange",I0={Defaults:{selectCaption:"Details",editCaption:"Edit",editIcon:"edit",deleteCaption:"Delete",deleteIcon:"delete"}},Um=class extends CustomEvent{constructor(r){super("databind",{cancelable:!1,bubbles:!1,detail:r})}},Pu=class extends ht{constructor(r,e,t){super(r,e,{bubbles:!1,cancelable:!0},t)}},$t=class extends R.PacemItemElement{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"field":case"headcellCss":case"headcellCssClass":case"datacellCss":case"datacellCssClass":case"resizable":case"togglable":case"sortable":case"label":this.dispatchEvent(new Event(Dv));break;case"order":case"hide":this.dispatchEvent(new Event(Rv));break}}};c([h({emit:!1,converter:m.String})],$t.prototype,"field",2),c([h({emit:!1,converter:m.String})],$t.prototype,"label",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"resizable",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"togglable",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"sortable",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"order",2),c([h({emit:!1,converter:m.Json})],$t.prototype,"format",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"headcellCss",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"headcellCssClass",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"datacellCss",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"datacellCssClass",2),$t=c([C({tagName:d+"-datacolumn"})],$t);function $0(o){return`<${d}-headcell metadata="{{ :host._getColumnMetadata('${o.prop}') }}" state="{{ :host._columnState.${o.prop} }}" grid-state="{{ :host._gridState }}"
|
|
990
|
+
</${d}-repeater>`})],zn);var cx="datarowselectchange",Ru=class extends CustomEvent{constructor(r){super(cx,{detail:r,bubbles:!1,cancelable:!0})}},ox={},lx=[],Xs=class extends Mn{updateLayout(r=this.metadata){this._setup(r)}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-datacell")}propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"_contentTooltip":this._updateTooltipJustInCase();break;case"gridState":case"rowindex":this._updateSelection();break}}_updateTooltipJustInCase(){(this.metadata.dataCell?.autoTooltip??!0)&&!a.isNullOrEmpty(this._contentTooltip)?this.setAttribute("tooltip",this._contentTooltip):this.removeAttribute("tooltip")}_inflateContent(r=this.dataitem,e=this.rowindex,t=this.metadata){this._contentTooltip="";let n=t.dataCell?.format,i=t.dataCell?.null??"";if(typeof n=="function"){let u=n(this,t,r,e);return a.isNullOrEmpty(u)?i:u}let l=A.resolvePath(t.prop,r)?.target?.value;if(a.isNullOrEmpty(l))return i;let p=a.lang(this);switch(t.dataType){case"boolean":return`<${d}-icon icon="${l?"check_circle_outline icon-fill":"radio_button_unchecked icon-outline"} icon-size icon-size-2"></${d}-icon>`;case"time":case"date":case"datetime":return this._contentTooltip=a.core.date(l,n,p);case"byte":case"int16":case"int32":case"int64":case"short":case"integer":case"int":case"long":case"double":case"decimal":case"float":case"single":case"number":return this._contentTooltip=a.core.number(l,n||"",p);case"currency":return n??="EUR",typeof n=="string"?this._contentTooltip=a.core.currency(l,n,p):this._contentTooltip=a.core.number(l,n,p);case"percent":case"percentage":return n??={style:"percent",maximumFractionDigits:2},typeof n=="string"?this._contentTooltip=a.core.currency(l,n,p):this._contentTooltip=a.core.number(l,n,p);default:return this._contentTooltip=l}}_inflateCssClass(r=this.dataitem,e=this.rowindex,t=this.metadata,n){if(a.isNull(r)||a.isNullOrEmpty(t))return lx;let i=t.dataCell&&t.dataCell.cssClass||lx,s=[];switch(typeof i=="function"?Array.prototype.push.apply(s,i(this,t,r,e)||[]):Array.prototype.push.apply(s,i),t.dataCell?.verticalAlign?.toLowerCase()){case"top":s.push("datacell-top");break;case"bottom":s.push("datacell-bottom");break;case"middle":s.push("datacell-middle");break}switch(t.dataCell?.horizontalAlign?.toLowerCase()){case"left":s.push("datacell-left");break;case"right":s.push("datacell-right");break;case"center":s.push("datacell-center");break}return n?.length&&(e===0&&s.push("datacell-firstrow"),e===n.length-1&&s.push("datacell-lastrow")),s}_inflateCss(r=this.dataitem,e=this.rowindex,t=this.metadata){if(a.isNull(r)||a.isNullOrEmpty(t))return ox;let n=t.dataCell&&t.dataCell.css||ox;return typeof n=="function"?n(this,t,r,e):n}_setup(r=this.metadata){this.setAttribute("css-class","{{ this._inflateCssClass(^item, ^index, this.metadata, :host.datasource) }}"),this.setAttribute("css","{{ Pacem.Utils.extend({ 'grid-row': ^index+2 }, this._inflateCss(^item, ^index, this.metadata, :host.datasource)) }}");let t=!!r.dataCell?.textEllipsis?["text-truncate"]:[];switch(r?.dataCell?.selectMode?.toLowerCase()){case"cell":case"row":t.push(b+"-inert"),t.push(b+"-unselect");break}this._content.cssClass=t,this._updateSelection()}_updateSelection(){(this.gridState?.selectedRows??[]).indexOf(this.rowindex)>=0?a.addClass(this,"datarow-selected datacell-filled datacell-primary"):a.removeClass(this,"datarow-selected datacell-filled datacell-primary")}};c([h({emit:!1,converter:m.Eval})],Xs.prototype,"dataitem",2),c([h({emit:!1,converter:m.Number})],Xs.prototype,"rowindex",2),c([h({emit:!1,converter:m.String,debounce:200})],Xs.prototype,"_contentTooltip",2),c([S(d+"-span")],Xs.prototype,"_content",2),Xs=c([C({tagName:d+"-datacell",shadow:!1,template:`<${d}-span content="{{ :host._inflateContent(^item, ^index, :host.metadata) }}"></${d}-span>`})],Xs);var zl=ie.UI,Bm="datacolumnsort",Rp=class extends CustomEvent{constructor(r){super(Bm,{detail:r,bubbles:!1,cancelable:!0})}},Vm="datacolumnrescale",Op=class extends CustomEvent{constructor(r){super(Vm,{detail:r,bubbles:!1,cancelable:!0})}},Ou=class extends Mn{constructor(e=new zl.MarkdownService){super();this._md=e;this._sortButtonClickHandler=e=>{let t=this.metadata,n=this.gridState,i=t.prop,s=n.sort?.column===i?n.sort.dir==="desc"?"asc":"desc":t.defaultSort||"asc";this.dispatchEvent(new Rp({column:i,dir:s}))};this._rescaleHandler=e=>{e.preventDefault();let t=e.detail,n=Math.max(this.metadata.minPixelWidth??24,t.currentPosition.x-this._columnBBox.x);this.dispatchEvent(new Op({width:n}))};this._rescaleStartHandler=e=>{this._columnBBox=a.offsetRect(this)};this._rescaleEndHandler=e=>{}}connectedCallback(){super.connectedCallback(),a.addClass(this,b+"-headcell")}propertyChangedCallback(e,t,n,i){super.propertyChangedCallback(e,t,n,i),!i&&e==="gridState"&&this._updateSortButtonIconGlyph()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureBalloon()}disconnectedCallback(){this._disposeBalloon(),this._disposeRescaler(),super.disconnectedCallback()}updateLayout(e=this.metadata){this._setup(e)}_setupSortButton(){let e=new zl.PacemButtonElement;return e.className=`button-flat headcell-sort ${b}-inert`,this.addEventListener("click",this._sortButtonClickHandler,!1),a.addClass(this,b+"-clickable"),e}_disposeSortButton(e=this._sortButton){a.isNull(e)||(a.removeClass(this,b+"-clickable"),this.removeEventListener("click",this._sortButtonClickHandler,!1),e.remove(),this._sortButton=null)}_updateSortButtonIconGlyph(e=this._sortButton,t=this.gridState,n=this.metadata){a.isNull(e)||a.isNullOrEmpty(n)||(e.iconGlyph=t?.sort?.column===n.prop?t.sort.dir==="desc"?"arrow_drop_down":"arrow_drop_up":"")}_ensureRescaler(){if(a.isNull(this._rescaler)){let e=this._rescaler=this._rescaler||new R.PacemRescaleElement;e.handles=[J.RescaleHandle.Right],e.addEventListener(J.RescaleEventType.Rescale,this._rescaleHandler,!1),e.addEventListener(J.RescaleEventType.Start,this._rescaleStartHandler,!1),e.addEventListener(J.RescaleEventType.End,this._rescaleEndHandler,!1),A.findAncestorShell(this).appendChild(e)}}_setupRescaleContainer(){this._ensureRescaler();let e=new R.PacemPanelElement;return e.className="headcell-rescale",e.behaviors=[this._rescaler],e}_disposeRescaleContainer(e=this._rescaleContainer){a.isNull(e)||(e.remove(),this._rescaleContainer=null)}_disposeRescaler(e=this._rescaler){a.isNull(e)||(e.removeEventListener(J.RescaleEventType.Rescale,this._rescaleHandler,!1),e.removeEventListener(J.RescaleEventType.Start,this._rescaleStartHandler,!1),e.removeEventListener(J.RescaleEventType.End,this._rescaleEndHandler,!1),e.remove(),this._rescaler=null)}_setup(e=this.metadata){this.setAttribute("css-class","{{ this.metadata && this.metadata.headCell && this.metadata.headCell.cssClass || [] }}"),this.setAttribute("css","{{ this.metadata && this.metadata.headCell && this.metadata.headCell.css }}");let n=!!e.headCell?.textEllipsis?["text-truncate"]:[];switch(e.headCell?.verticalAlign?.toLowerCase()){case"top":a.addClass(this,"headcell-top");break;case"bottom":a.addClass(this,"headcell-bottom");break;case"middle":a.addClass(this,"headcell-middle");break}switch(e.headCell?.horizontalAlign?.toLowerCase()){case"left":n.push("text-left");break;case"right":n.push("text-right");break;case"center":n.push("text-center");break}this.removeAttribute("content");let i=a.isNullOrEmpty(n)?"":` class="${n.join(" ")}"`,s=e.headCell?.name??e.prop;if(this.innerHTML=`<div${i}>${s}</div>`,e.isSortable){this._disposeSortButton();let l=this._sortButton=this._setupSortButton();this._updateSortButtonIconGlyph(l),this.appendChild(l)}if(e.isRescalable){this._disposeRescaleContainer();let l=this._rescaleContainer=this._setupRescaleContainer();this.appendChild(l)}e.isTogglable}_normalizeTooltip(){let e=this.metadata.headCell?.tooltip||!1;return typeof e=="object"?e:{type:e}}_ensureBalloon(){var e,t;let n=(t=this._normalizeTooltip()).type===!1||a.isNullOrEmpty(e=this.metadata.headCell?.description);if(a.isNull(this._balloon)&&!n){let l=new zl.PacemBalloonElement;l.options={behavior:zl.BalloonBehavior.Tooltip,trigger:t.trigger||zl.BalloonTrigger.Hover,position:t.position||zl.BalloonPosition.Top,hoverDelay:200,hoverTimeout:50,align:t.align||zl.BalloonAlignment.Auto},a.addClass(l,b+"-headcell-tooltip");var i=A.findAncestorShell(this);i.appendChild(this._balloon=l)}let s=this._balloon;if(!a.isNull(s)&&(s.target=this,!(s.disabled=n))){let l=e||"";switch(t.type){case"md":case"markdown":s.innerHTML=this._md.toHtml(l);break;case"html":s.innerHTML=l;break;default:s.innerText=l;break}}}_disposeBalloon(){a.isNull(this._balloon)||(this._balloon.remove(),this._balloon=null)}};Ou=c([C({tagName:d+"-headcell"})],Ou);var Dv="datacolumnchange",Rv="datacolumnstatechange",$0={Defaults:{selectCaption:"Details",editCaption:"Edit",editIcon:"edit",deleteCaption:"Delete",deleteIcon:"delete"}},Um=class extends CustomEvent{constructor(r){super("databind",{cancelable:!1,bubbles:!1,detail:r})}},Pu=class extends ht{constructor(r,e,t){super(r,e,{bubbles:!1,cancelable:!0},t)}},$t=class extends R.PacemItemElement{propertyChangedCallback(r,e,t,n){if(super.propertyChangedCallback(r,e,t,n),!n)switch(r){case"field":case"headcellCss":case"headcellCssClass":case"datacellCss":case"datacellCssClass":case"resizable":case"togglable":case"sortable":case"label":this.dispatchEvent(new Event(Dv));break;case"order":case"hide":this.dispatchEvent(new Event(Rv));break}}};c([h({emit:!1,converter:m.String})],$t.prototype,"field",2),c([h({emit:!1,converter:m.String})],$t.prototype,"label",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"resizable",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"togglable",2),c([h({emit:!1,converter:m.Boolean})],$t.prototype,"sortable",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"order",2),c([h({emit:!1,converter:m.Json})],$t.prototype,"format",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"headcellCss",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"headcellCssClass",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"datacellCss",2),c([h({emit:!1,converter:m.Number})],$t.prototype,"datacellCssClass",2),$t=c([C({tagName:d+"-datacolumn"})],$t);function H0(o){return`<${d}-headcell metadata="{{ :host._getColumnMetadata('${o.prop}') }}" state="{{ :host._columnState.${o.prop} }}" grid-state="{{ :host._gridState }}"
|
|
991
991
|
on-${Bm}=":host._broadcastSortCommand($event)"
|
|
992
|
-
on-${Vm}=":host._broadcastRescaleCommand($event)"></${d}-headcell>`}function
|
|
993
|
-
dataitem="{{ ^item }}" rowindex="{{ ^index }}" ${r}></${d}-datacell>`}var gr=class extends R.PacemItemsContainerElement{constructor(e=a.uniqueCode()){super();this._key=e;this.state={};this._columnState={};this._gridState={sort:{},orderedColumns:[],selectedRows:[]};this._itemDataColumnRebuildHandler=e=>{this._adaptColumnMetadata(this.items||[])};this._itemDataColumnChangeHandler=e=>{this._adaptColumnMetadata(this.items||[])};this._memoizer={}}validate(e){return e instanceof $t}viewActivatedCallback(){super.viewActivatedCallback(),this.addEventListener(Yt,this._onCommand,!1),this._adaptColumnMetadata();let e=this._adaptedColumnMetadata||[];this._buildUpGrid(e)}disconnectedCallback(){this.removeEventListener(Yt,this._onCommand,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"items":case"metadata":this._adaptColumnMetadata();break;case"_adaptedColumnMetadata":this._buildUpGrid(n);break;case"datasource":let s={keepRowSelection:!1,datasource:n},l=new Um(s);this.dispatchEvent(l),s.keepRowSelection||this._setRowSelection();break;case"state":this._mergeState(n);break}}register(e){return super.register(e)?(e.addEventListener(Dv,this._itemDataColumnRebuildHandler,!1),e.addEventListener(Rv,this._itemDataColumnChangeHandler,!1),!0):!1}unregister(e){return super.unregister(e)?(e.removeEventListener(Dv,this._itemDataColumnRebuildHandler,!1),e.removeEventListener(Rv,this._itemDataColumnChangeHandler,!1),!0):!1}setRowSelection(...e){let t=Array.from(e);this._setRowSelection(t)}_setRowSelection(e){let t=(e||[]).map(i=>({item:this.datasource[i],index:i})),n=new Ru({selectedRows:t});if(this.dispatchEvent(n),!n.defaultPrevented){let i=n.detail.selectedRows;a.isArray(i)||(i=[]),this._doSetRowSelection(i.map(s=>s?.index??-1).filter(s=>s>=0))}}_doSetRowSelection(e){let t={selectedRows:e};this._mergeState(t)}_mergeState(e=this.state){e??={};let t={selectedRows:(e.selectedRows||[]).map(i=>typeof i=="number"?i:i.index)},n=this._gridState=a.extend({},this._gridState,e,t);this.state=a.extend(this.state??{},n)}_adaptColumnMetadata(e=this.items,t=this.metadata){let n=Array.prototype.concat.apply((e||[]).map(i=>({prop:i.field,headCell:{name:i.label,cssClass:i.headcellCssClass||[],css:i.headcellCss||{}},dataCell:{format:i.format,cssClass:i.datacellCssClass||[],css:i.datacellCss||{}},hide:i.hide,isRescalable:i.resizable,isSortable:i.sortable,isTogglable:i.togglable,order:i.order,width:1})),t||[]);this._memoizer={},this._adaptedColumnMetadata=n}_getColumnMetadata(e){return this._memoizer[e]=this._memoizer[e]||this._adaptedColumnMetadata.find(t=>t.prop===e)}_buildUpGrid(e){let t=this._tableContainer;if(a.isNull(t))return;if(a.isNullOrEmpty(e)){t.innerHTML="";return}let n=this.options=a.extend({}
|
|
992
|
+
on-${Vm}=":host._broadcastRescaleCommand($event)"></${d}-headcell>`}function B0(o,r){return`<${d}-datacell metadata="{{ :host._getColumnMetadata('${o.prop}') }}" state="{{ :host._columnState.${o.prop} }}" grid-state="{{ :host._gridState }}"
|
|
993
|
+
dataitem="{{ ^item }}" rowindex="{{ ^index }}" ${r}></${d}-datacell>`}var gr=class extends R.PacemItemsContainerElement{constructor(e=a.uniqueCode()){super();this._key=e;this.state={};this._columnState={};this._gridState={sort:{},orderedColumns:[],selectedRows:[]};this._itemDataColumnRebuildHandler=e=>{this._adaptColumnMetadata(this.items||[])};this._itemDataColumnChangeHandler=e=>{this._adaptColumnMetadata(this.items||[])};this._memoizer={}}validate(e){return e instanceof $t}viewActivatedCallback(){super.viewActivatedCallback(),this.addEventListener(Yt,this._onCommand,!1),this._adaptColumnMetadata();let e=this._adaptedColumnMetadata||[];this._buildUpGrid(e)}disconnectedCallback(){this.removeEventListener(Yt,this._onCommand,!1),super.disconnectedCallback()}propertyChangedCallback(e,t,n,i){if(super.propertyChangedCallback(e,t,n,i),!i)switch(e){case"items":case"metadata":this._adaptColumnMetadata();break;case"_adaptedColumnMetadata":this._buildUpGrid(n);break;case"datasource":let s={keepRowSelection:!1,datasource:n},l=new Um(s);this.dispatchEvent(l),s.keepRowSelection||this._setRowSelection();break;case"state":this._mergeState(n);break}}register(e){return super.register(e)?(e.addEventListener(Dv,this._itemDataColumnRebuildHandler,!1),e.addEventListener(Rv,this._itemDataColumnChangeHandler,!1),!0):!1}unregister(e){return super.unregister(e)?(e.removeEventListener(Dv,this._itemDataColumnRebuildHandler,!1),e.removeEventListener(Rv,this._itemDataColumnChangeHandler,!1),!0):!1}setRowSelection(...e){let t=Array.from(e);this._setRowSelection(t)}_setRowSelection(e){let t=(e||[]).map(i=>({item:this.datasource[i],index:i})),n=new Ru({selectedRows:t});if(this.dispatchEvent(n),!n.defaultPrevented){let i=n.detail.selectedRows;a.isArray(i)||(i=[]),this._doSetRowSelection(i.map(s=>s?.index??-1).filter(s=>s>=0))}}_doSetRowSelection(e){let t={selectedRows:e};this._mergeState(t)}_mergeState(e=this.state){e??={};let t={selectedRows:(e.selectedRows||[]).map(i=>typeof i=="number"?i:i.index)},n=this._gridState=a.extend({},this._gridState,e,t);this.state=a.extend(this.state??{},n)}_adaptColumnMetadata(e=this.items,t=this.metadata){let n=Array.prototype.concat.apply((e||[]).map(i=>({prop:i.field,headCell:{name:i.label,cssClass:i.headcellCssClass||[],css:i.headcellCss||{}},dataCell:{format:i.format,cssClass:i.datacellCssClass||[],css:i.datacellCss||{}},hide:i.hide,isRescalable:i.resizable,isSortable:i.sortable,isTogglable:i.togglable,order:i.order,width:1})),t||[]);this._memoizer={},this._adaptedColumnMetadata=n}_getColumnMetadata(e){return this._memoizer[e]=this._memoizer[e]||this._adaptedColumnMetadata.find(t=>t.prop===e)}_buildUpGrid(e){let t=this._tableContainer;if(a.isNull(t))return;if(a.isNullOrEmpty(e)){t.innerHTML="";return}let n=this.options=a.extend({},$0.Defaults,this.options||{}),i=n.allowDelete||n.allowEdit||n.allowSelect,s=n.allowMultiSelect&&i,l=s?"auto ":"",p=s?`<div class="${b}-headcell"></div>`:"",u=s?`<${d}-panel class="${b}-datacell" style="grid-column: 1;" css="{{ {'grid-row': ^index+2} }}"></${d}-panel>`:"",f=s?`<div class="${b}-footcell"></div>`:"",g=s?2:1,v=s?e.length+2:i?e.length+1:e.length;this._gridState.orderedColumns=e.sort((x,w)=>(x.order??0)-(w.order??0)).map(x=>x.prop);let y="";for(let x of R.PacemElement.emittedEventTypes)y+=` on-${x}=":host._broadcastUiEvent(^item, ^index, $event)"`;for(let x of e)this._columnState[x.prop]={hidden:x.hide},l+=this._getColumnSize(x).replaceAll(" ","")+" ",p+=H0(x),u+=B0(x,y),g++;u+=`<${d}-panel class="${b}-datarow" css-class="{{ {'datarow-alt': ^index % 2 === 1, 'datarow-first': ^index === 0, 'datarow-last': ^index === (:host.datasource.length - 1), 'datarow-selected': :host._gridState.selectedRows.indexOf(^index) >= 0 } }}" style="grid-column: 1 /span ${v};" css="{{ {'grid-row': ^index+2} }}"></${d}-panel>`;let _=`<${d}-repeater datasource="{{ :host.datasource }}">
|
|
994
994
|
<${d}-panel class="${b}-datatable" css="{{ {'grid-template-columns': :host._getColumnSizes(:host._columnState, '${l.trimEnd()}', :host._gridState) } }}">
|
|
995
995
|
${p}
|
|
996
996
|
<template>
|
|
997
997
|
${u}
|
|
998
998
|
</template>
|
|
999
999
|
${f}
|
|
1000
|
-
</${d}-panel>`;t.innerHTML=_}_getColumnSizes(e=this._columnState,t,n=this._gridState){if(a.isNullOrEmpty(e))return t;let i=t.split(" ");for(let s in e){let l=e[s],p=n.orderedColumns.indexOf(s);l.hidden?i[p]="auto":l.pixelWidth>0&&(i[p]=l.pixelWidth+"px")}return i.join(" ")}_getColumnSize(e){if(e.hide)return"auto";let t=e.minPixelWidth,n=e.maxPixelWidth;if(n>0&&t>0)return`minmax(${t}px, ${n}px)`;{let i=typeof e.width=="number"?e.width+"fr":"auto";return t>0?`minmax(${t}px, ${i})`:n>0?`minmax(${i}, ${n}px)`:i}}_onCommand(e){this.dispatchEvent(new R.ItemCommandEvent(e)),this.dispatchEvent(new R.CustomItemCommandEvent(e))}_broadcastUiEvent(e,t,n){let i=n.type.toLowerCase(),s="datacell"+i,l={dataitem:e,rowindex:t,datacell:n.srcElement},p=n instanceof MouseEvent||n instanceof TouchEvent||n instanceof KeyboardEvent?new Pu(s,l,n):new Pu(s,l);if(this.dispatchEvent(p),i==="click"&&!p.defaultPrevented)switch(p.detail.datacell.metadata?.dataCell?.selectMode?.toLowerCase()){case"cell":break;case"row":this._broadcastSelectCommand(p.detail.rowindex);break}}_broadcastSortCommand(e){let t=e.detail,n=new Rp(t);if(this.dispatchEvent(n),!n.defaultPrevented){let i={column:""};typeof n.detail.column=="string"&&(i.column=n.detail.column),typeof n.detail.dir=="string"&&(i.dir=n.detail.dir==="desc"?"desc":"asc"),this._gridState=a.extend({},this._gridState,{sort:i})}}_broadcastRescaleCommand(e){let t=e.detail,n=new Op(t);if(this.dispatchEvent(n),!n.defaultPrevented){let i=t.width;typeof n.detail.width=="number"&&n.detail.width>0&&(i=n.detail.width);let s=e.srcElement.metadata,l={};l[s.prop]={pixelWidth:i},this._columnState=a.extend({},this._columnState,l)}}_broadcastSelectCommand(e){let t=(this._gridState.selectedRows||[]).slice(0),n=t.indexOf(e),i=!0;if(n>=0)t.splice(n,1);else{let s=this.options;if(s.allowMultiSelect)t.push(e);else if(s.allowSelect)t=[e];else{i=!1;let l=`Cannot select the row at index ${e} since datagrid options do not allow any row selection.`;a.isNull(this.logger)?console.warn(l):this.log(ce.LogLevel.Warn,l)}}i&&this._setRowSelection(t)}};c([h({emit:!1,converter:m.Json})],gr.prototype,"metadata",2),c([h({emit:!1,converter:m.Json})],gr.prototype,"options",2),c([h({emit:!1,converter:m.Json})],gr.prototype,"state",2),c([h({emit:!0,converter:m.Json})],gr.prototype,"datasource",2),c([S("."+b+"-datagrid")],gr.prototype,"_tableContainer",2),c([h()],gr.prototype,"_adaptedColumnMetadata",2),c([h()],gr.prototype,"_columnState",2),c([h()],gr.prototype,"_gridState",2),c([me()],gr.prototype,"_adaptColumnMetadata",1),gr=c([C({tagName:d+"-datagrid",shadow:!1,template:`<div class="${b}-datagrid"></div><${d}-content></${d}-content>`})],gr);export{Wn as Angle,Bt as Animations,Pp as Arrays,Yu as AttributeChangeEvent,Ku as AttributeChangeEventName,nh as Behaviors,mo as Blobs,Be as Colors,ql as CommandEvent,Yt as CommandEventName,Gu as Compile,
|
|
1000
|
+
</${d}-panel>`;t.innerHTML=_}_getColumnSizes(e=this._columnState,t,n=this._gridState){if(a.isNullOrEmpty(e))return t;let i=t.split(" ");for(let s in e){let l=e[s],p=n.orderedColumns.indexOf(s);l.hidden?i[p]="auto":l.pixelWidth>0&&(i[p]=l.pixelWidth+"px")}return i.join(" ")}_getColumnSize(e){if(e.hide)return"auto";let t=e.minPixelWidth,n=e.maxPixelWidth;if(n>0&&t>0)return`minmax(${t}px, ${n}px)`;{let i=typeof e.width=="number"?e.width+"fr":"auto";return t>0?`minmax(${t}px, ${i})`:n>0?`minmax(${i}, ${n}px)`:i}}_onCommand(e){this.dispatchEvent(new R.ItemCommandEvent(e)),this.dispatchEvent(new R.CustomItemCommandEvent(e))}_broadcastUiEvent(e,t,n){let i=n.type.toLowerCase(),s="datacell"+i,l={dataitem:e,rowindex:t,datacell:n.srcElement},p=n instanceof MouseEvent||n instanceof TouchEvent||n instanceof KeyboardEvent?new Pu(s,l,n):new Pu(s,l);if(this.dispatchEvent(p),i==="click"&&!p.defaultPrevented)switch(p.detail.datacell.metadata?.dataCell?.selectMode?.toLowerCase()){case"cell":break;case"row":this._broadcastSelectCommand(p.detail.rowindex);break}}_broadcastSortCommand(e){let t=e.detail,n=new Rp(t);if(this.dispatchEvent(n),!n.defaultPrevented){let i={column:""};typeof n.detail.column=="string"&&(i.column=n.detail.column),typeof n.detail.dir=="string"&&(i.dir=n.detail.dir==="desc"?"desc":"asc"),this._gridState=a.extend({},this._gridState,{sort:i})}}_broadcastRescaleCommand(e){let t=e.detail,n=new Op(t);if(this.dispatchEvent(n),!n.defaultPrevented){let i=t.width;typeof n.detail.width=="number"&&n.detail.width>0&&(i=n.detail.width);let s=e.srcElement.metadata,l={};l[s.prop]={pixelWidth:i},this._columnState=a.extend({},this._columnState,l)}}_broadcastSelectCommand(e){let t=(this._gridState.selectedRows||[]).slice(0),n=t.indexOf(e),i=!0;if(n>=0)t.splice(n,1);else{let s=this.options;if(s.allowMultiSelect)t.push(e);else if(s.allowSelect)t=[e];else{i=!1;let l=`Cannot select the row at index ${e} since datagrid options do not allow any row selection.`;a.isNull(this.logger)?console.warn(l):this.log(ce.LogLevel.Warn,l)}}i&&this._setRowSelection(t)}};c([h({emit:!1,converter:m.Json})],gr.prototype,"metadata",2),c([h({emit:!1,converter:m.Json})],gr.prototype,"options",2),c([h({emit:!1,converter:m.Json})],gr.prototype,"state",2),c([h({emit:!0,converter:m.Json})],gr.prototype,"datasource",2),c([S("."+b+"-datagrid")],gr.prototype,"_tableContainer",2),c([h()],gr.prototype,"_adaptedColumnMetadata",2),c([h()],gr.prototype,"_columnState",2),c([h()],gr.prototype,"_gridState",2),c([me()],gr.prototype,"_adaptColumnMetadata",1),gr=c([C({tagName:d+"-datagrid",shadow:!1,template:`<div class="${b}-datagrid"></div><${d}-content></${d}-content>`})],gr);export{Wn as Angle,Bt as Animations,Pp as Arrays,Yu as AttributeChangeEvent,Ku as AttributeChangeEventName,nh as Behaviors,mo as Blobs,Be as Colors,ql as CommandEvent,Yt as CommandEventName,Gu as Compile,px as Components,ub as Concurrent,Ju as CurrentIndexChangeEvent,C as CustomElement,A as CustomElementUtils,de as CustomEventUtils,oe as CustomTypedEvent,ht as CustomUIEvent,br as Dates,me as Debounce,Wl as DeepCloner,zv as DeepMerger,bo as DefaultComparer,j as Defaults,_t as DeferPromise,Db as Drawing,Ub as Drawing3D,fS as EMPTY_MATCHER,ib as EventKeyModifier,ta as Expression,we as Geometry,Fl as HistoryService,Yl as INSTANCE_BINDINGS_VAR,ea as INSTANCE_HOST_VAR,Bp as INSTANCE_SCOPE_VAR,fo as Imaging,Hp as Json,Jv as JsonFunctionConversion,Qs as Keys,ce as Logging,es as Maps,Bb as Mathematics,ke as Matrix2D,pt as Net,be as NullChecker,go as Numbers,d as P,b as PCSS,K as PacemEventTarget,Wb as Plus,se as Point,ue as PropertyChangeEvent,ee as PropertyChangeEventName,m as PropertyConverters,Ze as Rect,hb as Regex,ra as Repeater,Gi as RepeaterItem,Xu as RouterNavigateEvent,iC as RouterNavigateEventName,qu as RouterNavigatingEvent,nC as RouterNavigatingEventName,Fb as Scaffolding,Zs as Size,eh as Storage,gn as Strings,Xl as TemplateElement,Wp as Throttle,Te as Transformer,Zk as Type,J as UI,a as Utils,S as ViewChild,Wu as WATCH_PROPS_VAR,h as Watch,Q as avoidHandler,Bu as detect,yr as parseAsNumericalArray,jl as preventDefaultHandler,Re as stopPropagationHandler};
|