UNPKG

framework7

Version:

Full featured mobile HTML framework for building iOS & Android apps

13 lines (12 loc) 765 kB
/** * Framework7 8.3.4 * Full featured mobile HTML framework for building iOS & Android apps * https://framework7.io/ * * Copyright 2014-2024 Vladimir Kharlampidi * * Released under the MIT License * * Released on: September 18, 2024 */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Framework7=t()}(this,(function(){"use strict";function e(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function t(a,r){void 0===a&&(a={}),void 0===r&&(r={}),Object.keys(r).forEach((s=>{void 0===a[s]?a[s]=r[s]:e(r[s])&&e(a[s])&&Object.keys(r[s]).length>0&&t(a[s],r[s])}))}const a={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function r(){const e="undefined"!=typeof document?document:{};return t(e,a),e}const s={document:a,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function o(){const e="undefined"!=typeof window?window:{};return t(e,s),e}class n extends Array{constructor(e){"number"==typeof e?super(e):(super(...e||[]),function(e){const t=e.__proto__;Object.defineProperty(e,"__proto__",{get:()=>t,set(e){t.__proto__=e}})}(this))}}function i(e){void 0===e&&(e=[]);const t=[];return e.forEach((e=>{Array.isArray(e)?t.push(...i(e)):t.push(e)})),t}function l(e,t){return Array.prototype.filter.call(e,t)}function c(e,t){const a=o(),s=r();let i=[];if(!t&&e instanceof n)return e;if(!e)return new n(i);if("string"==typeof e){const a=e.trim();if(a.indexOf("<")>=0&&a.indexOf(">")>=0){let e="div";0===a.indexOf("<li")&&(e="ul"),0===a.indexOf("<tr")&&(e="tbody"),0!==a.indexOf("<td")&&0!==a.indexOf("<th")||(e="tr"),0===a.indexOf("<tbody")&&(e="table"),0===a.indexOf("<option")&&(e="select");const t=s.createElement(e);t.innerHTML=a;for(let e=0;e<t.childNodes.length;e+=1)i.push(t.childNodes[e])}else i=function(e,t){if("string"!=typeof e)return[e];const a=[],r=t.querySelectorAll(e);for(let e=0;e<r.length;e+=1)a.push(r[e]);return a}(e.trim(),t||s)}else if(e.nodeType||e===a||e===s)i.push(e);else if(Array.isArray(e)){if(e instanceof n)return e;i=e}return new n(function(e){const t=[];for(let a=0;a<e.length;a+=1)-1===t.indexOf(e[a])&&t.push(e[a]);return t}(i))}c.fn=n.prototype;const p="resize scroll".split(" ");function d(e){return function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];if(void 0===a[0]){for(let t=0;t<this.length;t+=1)p.indexOf(e)<0&&(e in this[t]?this[t][e]():c(this[t]).trigger(e));return this}return this.on(e,...a)}}const u=d("click"),h=d("blur"),m=d("focus"),f=d("focusin"),g=d("focusout"),v=d("keyup"),b=d("keydown"),w=d("keypress"),y=d("submit"),C=d("change"),E=d("mousedown"),k=d("mousemove"),$=d("mouseup"),x=d("mouseenter"),T=d("mouseleave"),S=d("mouseout"),P=d("mouseover"),M=d("touchstart"),O=d("touchend"),I=d("touchmove"),B=d("resize"),L=d("scroll");var D=Object.freeze({__proto__:null,$:c,add:function(){const e=this;let t,a;for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];for(t=0;t<s.length;t+=1){const r=c(s[t]);for(a=0;a<r.length;a+=1)e.push(r[a])}return e},addClass:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];const r=i(t.map((e=>e.split(" "))));return this.forEach((e=>{e.classList.add(...r)})),this},animate:function(e,t){const a=o(),r=this,s={props:Object.assign({},e),params:Object.assign({duration:300,easing:"swing"},t),elements:r,animating:!1,que:[],easingProgress:(e,t)=>"swing"===e?.5-Math.cos(t*Math.PI)/2:"function"==typeof e?e(t):t,stop(){s.frameId&&a.cancelAnimationFrame(s.frameId),s.animating=!1,s.elements.each((e=>{delete e.dom7AnimateInstance})),s.que=[]},done(e){if(s.animating=!1,s.elements.each((e=>{delete e.dom7AnimateInstance})),e&&e(r),s.que.length>0){const e=s.que.shift();s.animate(e[0],e[1])}},animate(e,t){if(s.animating)return s.que.push([e,t]),s;const o=[];s.elements.each(((t,r)=>{let n,i,l,c,p;t.dom7AnimateInstance||(s.elements[r].dom7AnimateInstance=s),o[r]={container:t},Object.keys(e).forEach((s=>{n=a.getComputedStyle(t,null).getPropertyValue(s).replace(",","."),i=parseFloat(n),l=n.replace(i,""),c=parseFloat(e[s]),p=e[s]+l,o[r][s]={initialFullValue:n,initialValue:i,unit:l,finalValue:c,finalFullValue:p,currentValue:i}}))}));let n,i,l=null,c=0,p=0,d=!1;return s.animating=!0,s.frameId=a.requestAnimationFrame((function u(){let h,m;n=(new Date).getTime(),d||(d=!0,t.begin&&t.begin(r)),null===l&&(l=n),t.progress&&t.progress(r,Math.max(Math.min((n-l)/t.duration,1),0),l+t.duration-n<0?0:l+t.duration-n,l),o.forEach((a=>{const r=a;i||r.done||Object.keys(e).forEach((a=>{if(i||r.done)return;h=Math.max(Math.min((n-l)/t.duration,1),0),m=s.easingProgress(t.easing,h);const{initialValue:d,finalValue:u,unit:f}=r[a];r[a].currentValue=d+m*(u-d);const g=r[a].currentValue;(u>d&&g>=u||u<d&&g<=u)&&(r.container.style[a]=u+f,p+=1,p===Object.keys(e).length&&(r.done=!0,c+=1),c===o.length&&(i=!0)),i?s.done(t.complete):r.container.style[a]=g+f}))})),i||(s.frameId=a.requestAnimationFrame(u))})),s}};if(0===s.elements.length)return r;let n;for(let e=0;e<s.elements.length;e+=1)s.elements[e].dom7AnimateInstance?n=s.elements[e].dom7AnimateInstance:s.elements[e].dom7AnimateInstance=s;return n||(n=s),"stop"===e?n.stop():n.animate(s.props,s.params),r},animationEnd:function(e){const t=this;return e&&t.on("animationend",(function a(r){r.target===this&&(e.call(this,r),t.off("animationend",a))})),this},append:function(){let e;const t=r();for(let a=0;a<arguments.length;a+=1){e=a<0||arguments.length<=a?void 0:arguments[a];for(let a=0;a<this.length;a+=1)if("string"==typeof e){const r=t.createElement("div");for(r.innerHTML=e;r.firstChild;)this[a].appendChild(r.firstChild)}else if(e instanceof n)for(let t=0;t<e.length;t+=1)this[a].appendChild(e[t]);else this[a].appendChild(e)}return this},appendTo:function(e){return c(e).append(this),this},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(let a=0;a<this.length;a+=1)if(2===arguments.length)this[a].setAttribute(e,t);else for(const t in e)this[a][t]=e[t],this[a].setAttribute(t,e[t]);return this},blur:h,change:C,children:function(e){const t=[];for(let a=0;a<this.length;a+=1){const r=this[a].children;for(let a=0;a<r.length;a+=1)e&&!c(r[a]).is(e)||t.push(r[a])}return c(t)},click:u,closest:function(e){let t=this;return void 0===e?c([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},css:function(e,t){const a=o();let r;if(1===arguments.length){if("string"!=typeof e){for(r=0;r<this.length;r+=1)for(const t in e)this[r].style[t]=e[t];return this}if(this[0])return a.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(r=0;r<this.length;r+=1)this[r].style[e]=t;return this}return this},data:function(e,t){let a;if(void 0===t){if(a=this[0],!a)return;if(a.dom7ElementDataStorage&&e in a.dom7ElementDataStorage)return a.dom7ElementDataStorage[e];const t=a.getAttribute(`data-${e}`);return t||void 0}for(let r=0;r<this.length;r+=1)a=this[r],a.dom7ElementDataStorage||(a.dom7ElementDataStorage={}),a.dom7ElementDataStorage[e]=t;return this},dataset:function(){const e=this[0];if(!e)return;const t={};if(e.dataset)for(const a in e.dataset)t[a]=e.dataset[a];else for(let r=0;r<e.attributes.length;r+=1){const s=e.attributes[r];s.name.indexOf("data-")>=0&&(t[(a=s.name.split("data-")[1],a.toLowerCase().replace(/-(.)/g,((e,t)=>t.toUpperCase())))]=s.value)}var a;for(const e in t)"false"===t[e]?t[e]=!1:"true"===t[e]?t[e]=!0:parseFloat(t[e])===1*t[e]&&(t[e]*=1);return t},default:c,detach:function(){return this.remove()},each:function(e){return e?(this.forEach(((t,a)=>{e.apply(t,[t,a])})),this):this},empty:function(){for(let e=0;e<this.length;e+=1){const t=this[e];if(1===t.nodeType){for(let e=0;e<t.childNodes.length;e+=1)t.childNodes[e].parentNode&&t.childNodes[e].parentNode.removeChild(t.childNodes[e]);t.textContent=""}}return this},eq:function(e){if(void 0===e)return this;const t=this.length;if(e>t-1)return c([]);if(e<0){const a=t+e;return c(a<0?[]:[this[a]])}return c([this[e]])},filter:function(e){return c(l(this,e))},find:function(e){const t=[];for(let a=0;a<this.length;a+=1){const r=this[a].querySelectorAll(e);for(let e=0;e<r.length;e+=1)t.push(r[e])}return c(t)},focus:m,focusin:f,focusout:g,hasClass:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];const r=i(t.map((e=>e.split(" "))));return l(this,(e=>r.filter((t=>e.classList.contains(t))).length>0)).length>0},height:function(){const e=o();return this[0]===e?e.innerHeight:this.length>0?parseFloat(this.css("height")):null},hide:function(){for(let e=0;e<this.length;e+=1)this[e].style.display="none";return this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:null;for(let t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},index:function(){let e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},insertAfter:function(e){const t=c(e);for(let e=0;e<this.length;e+=1)if(1===t.length)t[0].parentNode.insertBefore(this[e],t[0].nextSibling);else if(t.length>1)for(let a=0;a<t.length;a+=1)t[a].parentNode.insertBefore(this[e].cloneNode(!0),t[a].nextSibling)},insertBefore:function(e){const t=c(e);for(let e=0;e<this.length;e+=1)if(1===t.length)t[0].parentNode.insertBefore(this[e],t[0]);else if(t.length>1)for(let a=0;a<t.length;a+=1)t[a].parentNode.insertBefore(this[e].cloneNode(!0),t[a])},is:function(e){const t=o(),a=r(),s=this[0];let i,l;if(!s||void 0===e)return!1;if("string"==typeof e){if(s.matches)return s.matches(e);if(s.webkitMatchesSelector)return s.webkitMatchesSelector(e);if(s.msMatchesSelector)return s.msMatchesSelector(e);for(i=c(e),l=0;l<i.length;l+=1)if(i[l]===s)return!0;return!1}if(e===a)return s===a;if(e===t)return s===t;if(e.nodeType||e instanceof n){for(i=e.nodeType?[e]:e,l=0;l<i.length;l+=1)if(i[l]===s)return!0;return!1}return!1},keydown:b,keypress:w,keyup:v,mousedown:E,mouseenter:x,mouseleave:T,mousemove:k,mouseout:S,mouseover:P,mouseup:$,next:function(e){return this.length>0?e?this[0].nextElementSibling&&c(this[0].nextElementSibling).is(e)?c([this[0].nextElementSibling]):c([]):this[0].nextElementSibling?c([this[0].nextElementSibling]):c([]):c([])},nextAll:function(e){const t=[];let a=this[0];if(!a)return c([]);for(;a.nextElementSibling;){const r=a.nextElementSibling;e?c(r).is(e)&&t.push(r):t.push(r),a=r}return c(t)},off:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];let[r,s,o,n]=t;"function"==typeof t[1]&&([r,o,n]=t,s=void 0),n||(n=!1);const i=r.split(" ");for(let e=0;e<i.length;e+=1){const t=i[e];for(let e=0;e<this.length;e+=1){const a=this[e];let r;if(!s&&a.dom7Listeners?r=a.dom7Listeners[t]:s&&a.dom7LiveListeners&&(r=a.dom7LiveListeners[t]),r&&r.length)for(let e=r.length-1;e>=0;e-=1){const s=r[e];o&&s.listener===o||o&&s.listener&&s.listener.dom7proxy&&s.listener.dom7proxy===o?(a.removeEventListener(t,s.proxyListener,n),r.splice(e,1)):o||(a.removeEventListener(t,s.proxyListener,n),r.splice(e,1))}}}return this},offset:function(){if(this.length>0){const e=o(),t=r(),a=this[0],s=a.getBoundingClientRect(),n=t.body,i=a.clientTop||n.clientTop||0,l=a.clientLeft||n.clientLeft||0,c=a===e?e.scrollY:a.scrollTop,p=a===e?e.scrollX:a.scrollLeft;return{top:s.top+c-i,left:s.left+p-l}}return null},on:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];let[r,s,o,n]=t;function i(e){const t=e.target;if(!t)return;const a=e.target.dom7EventData||[];if(a.indexOf(e)<0&&a.unshift(e),c(t).is(s))o.apply(t,a);else{const e=c(t).parents();for(let t=0;t<e.length;t+=1)c(e[t]).is(s)&&o.apply(e[t],a)}}function l(e){const t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),o.apply(this,t)}"function"==typeof t[1]&&([r,o,n]=t,s=void 0),n||(n=!1);const p=r.split(" ");let d;for(let e=0;e<this.length;e+=1){const t=this[e];if(s)for(d=0;d<p.length;d+=1){const e=p[d];t.dom7LiveListeners||(t.dom7LiveListeners={}),t.dom7LiveListeners[e]||(t.dom7LiveListeners[e]=[]),t.dom7LiveListeners[e].push({listener:o,proxyListener:i}),t.addEventListener(e,i,n)}else for(d=0;d<p.length;d+=1){const e=p[d];t.dom7Listeners||(t.dom7Listeners={}),t.dom7Listeners[e]||(t.dom7Listeners[e]=[]),t.dom7Listeners[e].push({listener:o,proxyListener:l}),t.addEventListener(e,l,n)}}return this},once:function(){const e=this;for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];let[s,o,n,i]=a;function l(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];n.apply(this,a),e.off(s,o,l,i),l.dom7proxy&&delete l.dom7proxy}return"function"==typeof a[1]&&([s,n,i]=a,o=void 0),l.dom7proxy=n,e.on(s,o,l,i)},outerHeight:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},outerWidth:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},parent:function(e){const t=[];for(let a=0;a<this.length;a+=1)null!==this[a].parentNode&&(e?c(this[a].parentNode).is(e)&&t.push(this[a].parentNode):t.push(this[a].parentNode));return c(t)},parents:function(e){const t=[];for(let a=0;a<this.length;a+=1){let r=this[a].parentNode;for(;r;)e?c(r).is(e)&&t.push(r):t.push(r),r=r.parentNode}return c(t)},prepend:function(e){const t=r();let a,s;for(a=0;a<this.length;a+=1)if("string"==typeof e){const r=t.createElement("div");for(r.innerHTML=e,s=r.childNodes.length-1;s>=0;s-=1)this[a].insertBefore(r.childNodes[s],this[a].childNodes[0])}else if(e instanceof n)for(s=0;s<e.length;s+=1)this[a].insertBefore(e[s],this[a].childNodes[0]);else this[a].insertBefore(e,this[a].childNodes[0]);return this},prependTo:function(e){return c(e).prepend(this),this},prev:function(e){if(this.length>0){const t=this[0];return e?t.previousElementSibling&&c(t.previousElementSibling).is(e)?c([t.previousElementSibling]):c([]):t.previousElementSibling?c([t.previousElementSibling]):c([])}return c([])},prevAll:function(e){const t=[];let a=this[0];if(!a)return c([]);for(;a.previousElementSibling;){const r=a.previousElementSibling;e?c(r).is(e)&&t.push(r):t.push(r),a=r}return c(t)},prop:function(e,t){if(1!==arguments.length||"string"!=typeof e){for(let a=0;a<this.length;a+=1)if(2===arguments.length)this[a][e]=t;else for(const t in e)this[a][t]=e[t];return this}return this[0]?this[0][e]:this},remove:function(){for(let e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},removeAttr:function(e){for(let t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},removeClass:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];const r=i(t.map((e=>e.split(" "))));return this.forEach((e=>{e.classList.remove(...r)})),this},removeData:function(e){for(let t=0;t<this.length;t+=1){const a=this[t];a.dom7ElementDataStorage&&a.dom7ElementDataStorage[e]&&(a.dom7ElementDataStorage[e]=null,delete a.dom7ElementDataStorage[e])}},resize:B,scroll:L,scrollLeft:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];let[r,s,o,n]=t;3===t.length&&"function"==typeof o&&([r,s,n,o]=t);const i=this;return void 0===r?i.length>0?i[0].scrollLeft:null:i.scrollTo(r,void 0,s,o,n)},scrollTo:function(){const e=o();for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];let[s,n,i,l,c]=a;return 4===a.length&&"function"==typeof l&&(c=l,[s,n,i,c,l]=a),void 0===l&&(l="swing"),this.each((function(){const t=this;let a,r,o,p,d,u,h,m,f=n>0||0===n,g=s>0||0===s;if(void 0===l&&(l="swing"),f&&(a=t.scrollTop,i||(t.scrollTop=n)),g&&(r=t.scrollLeft,i||(t.scrollLeft=s)),!i)return;f&&(o=t.scrollHeight-t.offsetHeight,d=Math.max(Math.min(n,o),0)),g&&(p=t.scrollWidth-t.offsetWidth,u=Math.max(Math.min(s,p),0));let v=null;f&&d===a&&(f=!1),g&&u===r&&(g=!1),e.requestAnimationFrame((function s(o){void 0===o&&(o=(new Date).getTime()),null===v&&(v=o);const n=Math.max(Math.min((o-v)/i,1),0),p="linear"===l?n:.5-Math.cos(n*Math.PI)/2;let b;f&&(h=a+p*(d-a)),g&&(m=r+p*(u-r)),f&&d>a&&h>=d&&(t.scrollTop=d,b=!0),f&&d<a&&h<=d&&(t.scrollTop=d,b=!0),g&&u>r&&m>=u&&(t.scrollLeft=u,b=!0),g&&u<r&&m<=u&&(t.scrollLeft=u,b=!0),b?c&&c():(f&&(t.scrollTop=h),g&&(t.scrollLeft=m),e.requestAnimationFrame(s))}))}))},scrollTop:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];let[r,s,o,n]=t;3===t.length&&"function"==typeof o&&([r,s,n,o]=t);const i=this;return void 0===r?i.length>0?i[0].scrollTop:null:i.scrollTo(void 0,r,s,o,n)},show:function(){const e=o();for(let t=0;t<this.length;t+=1){const a=this[t];"none"===a.style.display&&(a.style.display=""),"none"===e.getComputedStyle(a,null).getPropertyValue("display")&&(a.style.display="block")}return this},siblings:function(e){return this.nextAll(e).add(this.prevAll(e))},stop:function(){const e=this;for(let t=0;t<e.length;t+=1)e[t].dom7AnimateInstance&&e[t].dom7AnimateInstance.stop()},styles:function(){const e=o();return this[0]?e.getComputedStyle(this[0],null):{}},submit:y,text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(let t=0;t<this.length;t+=1)this[t].textContent=e;return this},toggleClass:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];const r=i(t.map((e=>e.split(" "))));this.forEach((e=>{r.forEach((t=>{e.classList.toggle(t)}))}))},touchend:O,touchmove:I,touchstart:M,transform:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transform=e;return this},transition:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transitionDuration="string"!=typeof e?`${e}ms`:e;return this},transitionEnd:function(e){const t=this;return e&&t.on("transitionend",(function a(r){r.target===this&&(e.call(this,r),t.off("transitionend",a))})),this},transitionStart:function(e){const t=this;return e&&t.on("transitionstart",(function a(r){r.target===this&&(e.call(this,r),t.off("transitionstart",a))})),this},trigger:function(){const e=o();for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];const s=a[0].split(" "),n=a[1];for(let t=0;t<s.length;t+=1){const r=s[t];for(let t=0;t<this.length;t+=1){const s=this[t];if(e.CustomEvent){const t=new e.CustomEvent(r,{detail:n,bubbles:!0,cancelable:!0});s.dom7EventData=a.filter(((e,t)=>t>0)),s.dispatchEvent(t),s.dom7EventData=[],delete s.dom7EventData}}}return this},val:function(e){if(void 0===e){const e=this[0];if(!e)return;if(e.multiple&&"select"===e.nodeName.toLowerCase()){const t=[];for(let a=0;a<e.selectedOptions.length;a+=1)t.push(e.selectedOptions[a].value);return t}return e.value}for(let t=0;t<this.length;t+=1){const a=this[t];if(Array.isArray(e)&&a.multiple&&"select"===a.nodeName.toLowerCase())for(let t=0;t<a.options.length;t+=1)a.options[t].selected=e.indexOf(a.options[t].value)>=0;else a.value=e}return this},value:function(e){return this.val(e)},width:function(){const e=o();return this[0]===e?e.innerWidth:this.length>0?parseFloat(this.css("width")):null}});Object.keys(D).forEach((e=>{"$"!==e&&(c.fn[e]=D[e])}));var A=c;function R(e){return e<0?-1:0===e?0:1}function H(e,t,a){return(1-a)*e+a*t}function z(e,t,a){return a<e?e:a>t?t:a}function N(e){return(e%=360)<0&&(e+=360),e}function V(e,t){return[e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2]]}const F=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],_=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],q=[95.047,100,108.883];function j(e,t,a){return(255<<24|(255&e)<<16|(255&t)<<8|255&a)>>>0}function Y(e){return j(Z(e[0]),Z(e[1]),Z(e[2]))}function W(e){return e>>16&255}function X(e){return e>>8&255}function U(e){return 255&e}function G(e){return 116*ee(function(e){return V([J(W(e)),J(X(e)),J(U(e))],F)}(e)[1]/100)-16}function K(e){return 100*function(e){const t=e*e*e;return t>216/24389?t:(116*e-16)/903.2962962962963}((e+16)/116)}function Q(e){return 116*ee(e/100)-16}function J(e){const t=e/255;return t<=.040449936?t/12.92*100:100*Math.pow((t+.055)/1.055,2.4)}function Z(e){const t=e/100;let a=0;return a=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,r=0,s=255,(o=Math.round(255*a))<r?r:o>s?s:o;var r,s,o}function ee(e){return e>216/24389?Math.pow(e,1/3):(903.2962962962963*e+16)/116}class te{static make(e,t,a,r,s){void 0===e&&(e=q),void 0===t&&(t=200/Math.PI*K(50)/100),void 0===a&&(a=50),void 0===r&&(r=2),void 0===s&&(s=!1);const o=e,n=.401288*o[0]+.650173*o[1]+-.051461*o[2],i=-.250268*o[0]+1.204414*o[1]+.045854*o[2],l=-.002079*o[0]+.048952*o[1]+.953127*o[2],c=.8+r/10,p=c>=.9?H(.59,.69,10*(c-.9)):H(.525,.59,10*(c-.8));let d=s?1:c*(1-1/3.6*Math.exp((-t-42)/92));d=d>1?1:d<0?0:d;const u=c,h=[d*(100/n)+1-d,d*(100/i)+1-d,d*(100/l)+1-d],m=1/(5*t+1),f=m*m*m*m,g=1-f,v=f*t+.1*g*g*Math.cbrt(5*t),b=K(a)/e[1],w=1.48+Math.sqrt(b),y=.725/Math.pow(b,.2),C=y,E=[Math.pow(v*h[0]*n/100,.42),Math.pow(v*h[1]*i/100,.42),Math.pow(v*h[2]*l/100,.42)],k=[400*E[0]/(E[0]+27.13),400*E[1]/(E[1]+27.13),400*E[2]/(E[2]+27.13)];return new te(b,(2*k[0]+k[1]+.05*k[2])*y,y,C,p,u,h,v,Math.pow(v,.25),w)}constructor(e,t,a,r,s,o,n,i,l,c){this.n=e,this.aw=t,this.nbb=a,this.ncb=r,this.c=s,this.nc=o,this.rgbD=n,this.fl=i,this.fLRoot=l,this.z=c}}te.DEFAULT=te.make();class ae{constructor(e,t,a,r,s,o,n,i,l){this.hue=e,this.chroma=t,this.j=a,this.q=r,this.m=s,this.s=o,this.jstar=n,this.astar=i,this.bstar=l}distance(e){const t=this.jstar-e.jstar,a=this.astar-e.astar,r=this.bstar-e.bstar,s=Math.sqrt(t*t+a*a+r*r);return 1.41*Math.pow(s,.63)}static fromInt(e){return ae.fromIntInViewingConditions(e,te.DEFAULT)}static fromIntInViewingConditions(e,t){const a=(65280&e)>>8,r=255&e,s=J((16711680&e)>>16),o=J(a),n=J(r),i=.41233895*s+.35762064*o+.18051042*n,l=.2126*s+.7152*o+.0722*n,c=.01932141*s+.11916382*o+.95034478*n,p=.401288*i+.650173*l-.051461*c,d=-.250268*i+1.204414*l+.045854*c,u=-.002079*i+.048952*l+.953127*c,h=t.rgbD[0]*p,m=t.rgbD[1]*d,f=t.rgbD[2]*u,g=Math.pow(t.fl*Math.abs(h)/100,.42),v=Math.pow(t.fl*Math.abs(m)/100,.42),b=Math.pow(t.fl*Math.abs(f)/100,.42),w=400*R(h)*g/(g+27.13),y=400*R(m)*v/(v+27.13),C=400*R(f)*b/(b+27.13),E=(11*w+-12*y+C)/11,k=(w+y-2*C)/9,$=(20*w+20*y+21*C)/20,x=(40*w+20*y+C)/20,T=180*Math.atan2(k,E)/Math.PI,S=T<0?T+360:T>=360?T-360:T,P=S*Math.PI/180,M=x*t.nbb,O=100*Math.pow(M/t.aw,t.c*t.z),I=4/t.c*Math.sqrt(O/100)*(t.aw+4)*t.fLRoot,B=S<20.14?S+360:S,L=5e4/13*(.25*(Math.cos(B*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(E*E+k*k)/($+.305),D=Math.pow(L,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),A=D*Math.sqrt(O/100),H=A*t.fLRoot,z=50*Math.sqrt(D*t.c/(t.aw+4)),N=(1+100*.007)*O/(1+.007*O),V=1/.0228*Math.log(1+.0228*H),F=V*Math.cos(P),_=V*Math.sin(P);return new ae(S,A,O,I,H,z,N,F,_)}static fromJch(e,t,a){return ae.fromJchInViewingConditions(e,t,a,te.DEFAULT)}static fromJchInViewingConditions(e,t,a,r){const s=4/r.c*Math.sqrt(e/100)*(r.aw+4)*r.fLRoot,o=t*r.fLRoot,n=t/Math.sqrt(e/100),i=50*Math.sqrt(n*r.c/(r.aw+4)),l=a*Math.PI/180,c=(1+100*.007)*e/(1+.007*e),p=1/.0228*Math.log(1+.0228*o),d=p*Math.cos(l),u=p*Math.sin(l);return new ae(a,t,e,s,o,i,c,d,u)}static fromUcs(e,t,a){return ae.fromUcsInViewingConditions(e,t,a,te.DEFAULT)}static fromUcsInViewingConditions(e,t,a,r){const s=t,o=a,n=Math.sqrt(s*s+o*o),i=(Math.exp(.0228*n)-1)/.0228/r.fLRoot;let l=Math.atan2(o,s)*(180/Math.PI);l<0&&(l+=360);const c=e/(1-.007*(e-100));return ae.fromJchInViewingConditions(c,i,l,r)}toInt(){return this.viewed(te.DEFAULT)}viewed(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),r=this.hue*Math.PI/180,s=.25*(Math.cos(r+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),n=s*(5e4/13)*e.nc*e.ncb,i=o/e.nbb,l=Math.sin(r),c=Math.cos(r),p=23*(i+.305)*a/(23*n+11*a*c+108*a*l),d=p*c,u=p*l,h=(460*i+451*d+288*u)/1403,m=(460*i-891*d-261*u)/1403,f=(460*i-220*d-6300*u)/1403,g=Math.max(0,27.13*Math.abs(h)/(400-Math.abs(h))),v=R(h)*(100/e.fl)*Math.pow(g,1/.42),b=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),w=R(m)*(100/e.fl)*Math.pow(b,1/.42),y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=R(f)*(100/e.fl)*Math.pow(y,1/.42),E=v/e.rgbD[0],k=w/e.rgbD[1],$=C/e.rgbD[2];return function(e,t,a){const r=_,s=r[0][0]*e+r[0][1]*t+r[0][2]*a,o=r[1][0]*e+r[1][1]*t+r[1][2]*a,n=r[2][0]*e+r[2][1]*t+r[2][2]*a;return j(Z(s),Z(o),Z(n))}(1.86206786*E-1.01125463*k+.14918677*$,.38752654*E+.62144744*k-.00897398*$,-.0158415*E-.03412294*k+1.04996444*$)}static fromXyzInViewingConditions(e,t,a,r){const s=.401288*e+.650173*t-.051461*a,o=-.250268*e+1.204414*t+.045854*a,n=-.002079*e+.048952*t+.953127*a,i=r.rgbD[0]*s,l=r.rgbD[1]*o,c=r.rgbD[2]*n,p=Math.pow(r.fl*Math.abs(i)/100,.42),d=Math.pow(r.fl*Math.abs(l)/100,.42),u=Math.pow(r.fl*Math.abs(c)/100,.42),h=400*R(i)*p/(p+27.13),m=400*R(l)*d/(d+27.13),f=400*R(c)*u/(u+27.13),g=(11*h+-12*m+f)/11,v=(h+m-2*f)/9,b=(20*h+20*m+21*f)/20,w=(40*h+20*m+f)/20,y=180*Math.atan2(v,g)/Math.PI,C=y<0?y+360:y>=360?y-360:y,E=C*Math.PI/180,k=w*r.nbb,$=100*Math.pow(k/r.aw,r.c*r.z),x=4/r.c*Math.sqrt($/100)*(r.aw+4)*r.fLRoot,T=C<20.14?C+360:C,S=5e4/13*(1/4*(Math.cos(T*Math.PI/180+2)+3.8))*r.nc*r.ncb*Math.sqrt(g*g+v*v)/(b+.305),P=Math.pow(S,.9)*Math.pow(1.64-Math.pow(.29,r.n),.73),M=P*Math.sqrt($/100),O=M*r.fLRoot,I=50*Math.sqrt(P*r.c/(r.aw+4)),B=(1+100*.007)*$/(1+.007*$),L=Math.log(1+.0228*O)/.0228,D=L*Math.cos(E),A=L*Math.sin(E);return new ae(C,M,$,x,O,I,B,D,A)}xyzInViewingConditions(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),a=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),r=this.hue*Math.PI/180,s=.25*(Math.cos(r+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),n=s*(5e4/13)*e.nc*e.ncb,i=o/e.nbb,l=Math.sin(r),c=Math.cos(r),p=23*(i+.305)*a/(23*n+11*a*c+108*a*l),d=p*c,u=p*l,h=(460*i+451*d+288*u)/1403,m=(460*i-891*d-261*u)/1403,f=(460*i-220*d-6300*u)/1403,g=Math.max(0,27.13*Math.abs(h)/(400-Math.abs(h))),v=R(h)*(100/e.fl)*Math.pow(g,1/.42),b=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),w=R(m)*(100/e.fl)*Math.pow(b,1/.42),y=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=R(f)*(100/e.fl)*Math.pow(y,1/.42),E=v/e.rgbD[0],k=w/e.rgbD[1],$=C/e.rgbD[2];return[1.86206786*E-1.01125463*k+.14918677*$,.38752654*E+.62144744*k-.00897398*$,-.0158415*E-.03412294*k+1.04996444*$]}}class re{static sanitizeRadians(e){return(e+8*Math.PI)%(2*Math.PI)}static trueDelinearized(e){const t=e/100;let a=0;return a=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*a}static chromaticAdaptation(e){const t=Math.pow(Math.abs(e),.42);return 400*R(e)*t/(t+27.13)}static hueOf(e){const t=V(e,re.SCALED_DISCOUNT_FROM_LINRGB),a=re.chromaticAdaptation(t[0]),r=re.chromaticAdaptation(t[1]),s=re.chromaticAdaptation(t[2]),o=(11*a+-12*r+s)/11,n=(a+r-2*s)/9;return Math.atan2(n,o)}static areInCyclicOrder(e,t,a){return re.sanitizeRadians(t-e)<re.sanitizeRadians(a-e)}static intercept(e,t,a){return(t-e)/(a-e)}static lerpPoint(e,t,a){return[e[0]+(a[0]-e[0])*t,e[1]+(a[1]-e[1])*t,e[2]+(a[2]-e[2])*t]}static setCoordinate(e,t,a,r){const s=re.intercept(e[r],t,a[r]);return re.lerpPoint(e,s,a)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const a=re.Y_FROM_LINRGB[0],r=re.Y_FROM_LINRGB[1],s=re.Y_FROM_LINRGB[2],o=t%4<=1?0:100,n=t%2==0?0:100;if(t<4){const t=o,i=n,l=(e-t*r-i*s)/a;return re.isBounded(l)?[l,t,i]:[-1,-1,-1]}if(t<8){const t=o,i=n,l=(e-i*a-t*s)/r;return re.isBounded(l)?[i,l,t]:[-1,-1,-1]}{const t=o,i=n,l=(e-t*a-i*r)/s;return re.isBounded(l)?[t,i,l]:[-1,-1,-1]}}static bisectToSegment(e,t){let a=[-1,-1,-1],r=a,s=0,o=0,n=!1,i=!0;for(let l=0;l<12;l++){const c=re.nthVertex(e,l);if(c[0]<0)continue;const p=re.hueOf(c);n?(i||re.areInCyclicOrder(s,p,o))&&(i=!1,re.areInCyclicOrder(s,t,p)?(r=c,o=p):(a=c,s=p)):(a=c,r=c,s=p,o=p,n=!0)}return[a,r]}static midpoint(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,t){const a=re.bisectToSegment(e,t);let r=a[0],s=re.hueOf(r),o=a[1];for(let e=0;e<3;e++)if(r[e]!==o[e]){let a=-1,n=255;r[e]<o[e]?(a=re.criticalPlaneBelow(re.trueDelinearized(r[e])),n=re.criticalPlaneAbove(re.trueDelinearized(o[e]))):(a=re.criticalPlaneAbove(re.trueDelinearized(r[e])),n=re.criticalPlaneBelow(re.trueDelinearized(o[e])));for(let i=0;i<8&&!(Math.abs(n-a)<=1);i++){const i=Math.floor((a+n)/2),l=re.CRITICAL_PLANES[i],c=re.setCoordinate(r,l,o,e),p=re.hueOf(c);re.areInCyclicOrder(s,t,p)?(o=c,n=i):(r=c,s=p,a=i)}}return re.midpoint(r,o)}static inverseChromaticAdaptation(e){const t=Math.abs(e),a=Math.max(0,27.13*t/(400-t));return R(e)*Math.pow(a,1/.42)}static findResultByJ(e,t,a){let r=11*Math.sqrt(a);const s=te.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,s.n),.73),n=.25*(Math.cos(e+2)+3.8)*(5e4/13)*s.nc*s.ncb,i=Math.sin(e),l=Math.cos(e);for(let e=0;e<5;e++){const c=r/100,p=0===t||0===r?0:t/Math.sqrt(c),d=Math.pow(p*o,1/.9),u=s.aw*Math.pow(c,1/s.c/s.z)/s.nbb,h=23*(u+.305)*d/(23*n+11*d*l+108*d*i),m=h*l,f=h*i,g=(460*u+451*m+288*f)/1403,v=(460*u-891*m-261*f)/1403,b=(460*u-220*m-6300*f)/1403,w=V([re.inverseChromaticAdaptation(g),re.inverseChromaticAdaptation(v),re.inverseChromaticAdaptation(b)],re.LINRGB_FROM_SCALED_DISCOUNT);if(w[0]<0||w[1]<0||w[2]<0)return 0;const y=re.Y_FROM_LINRGB[0],C=re.Y_FROM_LINRGB[1],E=re.Y_FROM_LINRGB[2],k=y*w[0]+C*w[1]+E*w[2];if(k<=0)return 0;if(4===e||Math.abs(k-a)<.002)return w[0]>100.01||w[1]>100.01||w[2]>100.01?0:Y(w);r-=(k-a)*r/(2*k)}return 0}static solveToInt(e,t,a){if(t<1e-4||a<1e-4||a>99.9999)return function(e){const t=Z(K(e));return j(t,t,t)}(a);const r=(e=N(e))/180*Math.PI,s=K(a),o=re.findResultByJ(r,t,s);return 0!==o?o:Y(re.bisectToLimit(s,r))}static solveToCam(e,t,a){return ae.fromInt(re.solveToInt(e,t,a))}}re.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],re.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],re.Y_FROM_LINRGB=[.2126,.7152,.0722],re.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];class se{static from(e,t,a){return new se(re.solveToInt(e,t,a))}static fromInt(e){return new se(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(re.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(re.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(re.solveToInt(this.internalHue,this.internalChroma,e))}constructor(e){this.argb=e;const t=ae.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=G(e),this.argb=e}setInternalState(e){const t=ae.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=G(e),this.argb=e}inViewingConditions(e){const t=ae.fromInt(this.toInt()).xyzInViewingConditions(e),a=ae.fromXyzInViewingConditions(t[0],t[1],t[2],te.make());return se.from(a.hue,a.chroma,Q(t[1]))}}class oe{static harmonize(e,t){const a=se.fromInt(e),r=se.fromInt(t),s=(l=a.hue,c=r.hue,180-Math.abs(Math.abs(l-c)-180)),o=Math.min(.5*s,15),n=N(a.hue+o*(i=a.hue,N(r.hue-i)<=180?1:-1));var i,l,c;return se.from(n,a.chroma,a.tone).toInt()}static hctHue(e,t,a){const r=oe.cam16Ucs(e,t,a),s=ae.fromInt(r),o=ae.fromInt(e);return se.from(s.hue,o.chroma,G(e)).toInt()}static cam16Ucs(e,t,a){const r=ae.fromInt(e),s=ae.fromInt(t),o=r.jstar,n=r.astar,i=r.bstar,l=o+(s.jstar-o)*a,c=n+(s.astar-n)*a,p=i+(s.bstar-i)*a;return ae.fromUcs(l,c,p).toInt()}}class ne{static ratioOfTones(e,t){return e=z(0,100,e),t=z(0,100,t),ne.ratioOfYs(K(e),K(t))}static ratioOfYs(e,t){const a=e>t?e:t;return(a+5)/((a===t?e:t)+5)}static lighter(e,t){if(e<0||e>100)return-1;const a=K(e),r=t*(a+5)-5,s=ne.ratioOfYs(r,a),o=Math.abs(s-t);if(s<t&&o>.04)return-1;const n=Q(r)+.4;return n<0||n>100?-1:n}static darker(e,t){if(e<0||e>100)return-1;const a=K(e),r=(a+5)/t-5,s=ne.ratioOfYs(a,r),o=Math.abs(s-t);if(s<t&&o>.04)return-1;const n=Q(r)-.4;return n<0||n>100?-1:n}static lighterUnsafe(e,t){const a=ne.lighter(e,t);return a<0?100:a}static darkerUnsafe(e,t){const a=ne.darker(e,t);return a<0?0:a}}class ie{static isDisliked(e){const t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,a=Math.round(e.chroma)>16,r=Math.round(e.tone)<65;return t&&a&&r}static fixIfDisliked(e){return ie.isDisliked(e)?se.from(e.hue,e.chroma,70):e}}class le{static fromPalette(e){return new le(e.name??"",e.palette,e.tone,e.isBackground??!1,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}constructor(e,t,a,r,s,o,n,i){if(this.name=e,this.palette=t,this.tone=a,this.isBackground=r,this.background=s,this.secondBackground=o,this.contrastCurve=n,this.toneDeltaPair=i,this.hctCache=new Map,!s&&o)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!s&&n)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(s&&!n)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(e){return this.getHct(e).toInt()}getHct(e){const t=this.hctCache.get(e);if(null!=t)return t;const a=this.getTone(e),r=this.palette(e).getHct(a);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,r),r}getTone(e){const t=e.contrastLevel<0;if(this.toneDeltaPair){const a=this.toneDeltaPair(e),r=a.roleA,s=a.roleB,o=a.delta,n=a.polarity,i=a.stayTogether,l=this.background(e).getTone(e),c="nearer"===n||"lighter"===n&&!e.isDark||"darker"===n&&e.isDark,p=c?r:s,d=c?s:r,u=this.name===p.name,h=e.isDark?1:-1,m=p.contrastCurve.getContrast(e.contrastLevel),f=d.contrastCurve.getContrast(e.contrastLevel),g=p.tone(e);let v=ne.ratioOfTones(l,g)>=m?g:le.foregroundTone(l,m);const b=d.tone(e);let w=ne.ratioOfTones(l,b)>=f?b:le.foregroundTone(l,f);return t&&(v=le.foregroundTone(l,m),w=le.foregroundTone(l,f)),(w-v)*h>=o||(w=z(0,100,v+o*h),(w-v)*h>=o||(v=z(0,100,w-o*h))),50<=v&&v<60?h>0?(v=60,w=Math.max(w,v+o*h)):(v=49,w=Math.min(w,v+o*h)):50<=w&&w<60&&(i?h>0?(v=60,w=Math.max(w,v+o*h)):(v=49,w=Math.min(w,v+o*h)):w=h>0?60:49),u?v:w}{let a=this.tone(e);if(null==this.background)return a;const r=this.background(e).getTone(e),s=this.contrastCurve.getContrast(e.contrastLevel);if(ne.ratioOfTones(r,a)>=s||(a=le.foregroundTone(r,s)),t&&(a=le.foregroundTone(r,s)),this.isBackground&&50<=a&&a<60&&(a=ne.ratioOfTones(49,r)>=s?49:60),this.secondBackground){const[t,r]=[this.background,this.secondBackground],[o,n]=[t(e).getTone(e),r(e).getTone(e)],[i,l]=[Math.max(o,n),Math.min(o,n)];if(ne.ratioOfTones(i,a)>=s&&ne.ratioOfTones(l,a)>=s)return a;const c=ne.lighter(i,s),p=ne.darker(l,s),d=[];return-1!==c&&d.push(c),-1!==p&&d.push(p),le.tonePrefersLightForeground(o)||le.tonePrefersLightForeground(n)?c<0?100:c:1===d.length?d[0]:p<0?0:p}return a}}static foregroundTone(e,t){const a=ne.lighterUnsafe(e,t),r=ne.darkerUnsafe(e,t),s=ne.ratioOfTones(a,e),o=ne.ratioOfTones(r,e);if(le.tonePrefersLightForeground(e)){const e=Math.abs(s-o)<.1&&s<t&&o<t;return s>=t||s>=o||e?a:r}return o>=t||o>=s?r:a}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return le.tonePrefersLightForeground(e)&&!le.toneAllowsLightForeground(e)?49:e}}var ce;!function(e){e[e.MONOCHROME=0]="MONOCHROME",e[e.NEUTRAL=1]="NEUTRAL",e[e.TONAL_SPOT=2]="TONAL_SPOT",e[e.VIBRANT=3]="VIBRANT",e[e.EXPRESSIVE=4]="EXPRESSIVE",e[e.FIDELITY=5]="FIDELITY",e[e.CONTENT=6]="CONTENT",e[e.RAINBOW=7]="RAINBOW",e[e.FRUIT_SALAD=8]="FRUIT_SALAD"}(ce||(ce={}));class pe{constructor(e,t,a,r){this.low=e,this.normal=t,this.medium=a,this.high=r}getContrast(e){return e<=-1?this.low:e<0?H(this.low,this.normal,(e- -1)/1):e<.5?H(this.normal,this.medium,(e-0)/.5):e<1?H(this.medium,this.high,(e-.5)/.5):this.high}}class de{constructor(e,t,a,r,s){this.roleA=e,this.roleB=t,this.delta=a,this.polarity=r,this.stayTogether=s}}function ue(e){return e.variant===ce.FIDELITY||e.variant===ce.CONTENT}function he(e){return e.variant===ce.MONOCHROME}function me(e,t){const a=e.inViewingConditions(function(e){return te.make(void 0,void 0,e.isDark?30:80,void 0,void 0)}(t));return le.tonePrefersLightForeground(e.tone)&&!le.toneAllowsLightForeground(a.tone)?le.enableLightForeground(e.tone):le.enableLightForeground(a.tone)}class fe{static highestSurface(e){return e.isDark?fe.surfaceBright:fe.surfaceDim}}fe.contentAccentToneDelta=15,fe.primaryPaletteKeyColor=le.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone}),fe.secondaryPaletteKeyColor=le.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone}),fe.tertiaryPaletteKeyColor=le.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone}),fe.neutralPaletteKeyColor=le.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone}),fe.neutralVariantPaletteKeyColor=le.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone}),fe.background=le.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0}),fe.onBackground=le.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>fe.background,contrastCurve:new pe(3,3,4.5,7)}),fe.surface=le.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0}),fe.surfaceDim=le.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:87,isBackground:!0}),fe.surfaceBright=le.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?24:98,isBackground:!0}),fe.surfaceContainerLowest=le.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?4:100,isBackground:!0}),fe.surfaceContainerLow=le.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?10:96,isBackground:!0}),fe.surfaceContainer=le.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?12:94,isBackground:!0}),fe.surfaceContainerHigh=le.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?17:92,isBackground:!0}),fe.surfaceContainerHighest=le.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?22:90,isBackground:!0}),fe.onSurface=le.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>fe.highestSurface(e),contrastCurve:new pe(4.5,7,11,21)}),fe.surfaceVariant=le.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0}),fe.onSurfaceVariant=le.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>fe.highestSurface(e),contrastCurve:new pe(3,4.5,7,11)}),fe.inverseSurface=le.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20}),fe.inverseOnSurface=le.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>fe.inverseSurface,contrastCurve:new pe(4.5,7,11,21)}),fe.outline=le.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>fe.highestSurface(e),contrastCurve:new pe(1.5,3,4.5,7)}),fe.outlineVariant=le.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>fe.highestSurface(e),contrastCurve:new pe(1,1,3,7)}),fe.shadow=le.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0}),fe.scrim=le.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0}),fe.surfaceTint=le.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0}),fe.primary=le.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>he(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(3,4.5,7,11),toneDeltaPair:e=>new de(fe.primaryContainer,fe.primary,15,"nearer",!1)}),fe.onPrimary=le.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>he(e)?e.isDark?10:90:e.isDark?20:100,background:e=>fe.primary,contrastCurve:new pe(4.5,7,11,21)}),fe.primaryContainer=le.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>ue(e)?me(e.sourceColorHct,e):he(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(1,1,3,7),toneDeltaPair:e=>new de(fe.primaryContainer,fe.primary,15,"nearer",!1)}),fe.onPrimaryContainer=le.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>ue(e)?le.foregroundTone(fe.primaryContainer.tone(e),4.5):he(e)?e.isDark?0:100:e.isDark?90:10,background:e=>fe.primaryContainer,contrastCurve:new pe(4.5,7,11,21)}),fe.inversePrimary=le.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>fe.inverseSurface,contrastCurve:new pe(3,4.5,7,11)}),fe.secondary=le.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(3,4.5,7,11),toneDeltaPair:e=>new de(fe.secondaryContainer,fe.secondary,15,"nearer",!1)}),fe.onSecondary=le.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>he(e)?e.isDark?10:100:e.isDark?20:100,background:e=>fe.secondary,contrastCurve:new pe(4.5,7,11,21)}),fe.secondaryContainer=le.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;if(he(e))return e.isDark?30:85;if(!ue(e))return t;let a=function(e,t,a,r){let s=a,o=se.from(e,t,a);if(o.chroma<t){let a=o.chroma;for(;o.chroma<t;){s+=r?-1:1;const n=se.from(e,t,s);if(a>n.chroma)break;if(Math.abs(n.chroma-t)<.4)break;Math.abs(n.chroma-t)<Math.abs(o.chroma-t)&&(o=n),a=Math.max(a,n.chroma)}}return s}(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark);return a=me(e.secondaryPalette.getHct(a),e),a},isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(1,1,3,7),toneDeltaPair:e=>new de(fe.secondaryContainer,fe.secondary,15,"nearer",!1)}),fe.onSecondaryContainer=le.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>ue(e)?le.foregroundTone(fe.secondaryContainer.tone(e),4.5):e.isDark?90:10,background:e=>fe.secondaryContainer,contrastCurve:new pe(4.5,7,11,21)}),fe.tertiary=le.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>he(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(3,4.5,7,11),toneDeltaPair:e=>new de(fe.tertiaryContainer,fe.tertiary,15,"nearer",!1)}),fe.onTertiary=le.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>he(e)?e.isDark?10:90:e.isDark?20:100,background:e=>fe.tertiary,contrastCurve:new pe(4.5,7,11,21)}),fe.tertiaryContainer=le.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(he(e))return e.isDark?60:49;if(!ue(e))return e.isDark?30:90;const t=me(e.tertiaryPalette.getHct(e.sourceColorHct.tone),e),a=e.tertiaryPalette.getHct(t);return ie.fixIfDisliked(a).tone},isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(1,1,3,7),toneDeltaPair:e=>new de(fe.tertiaryContainer,fe.tertiary,15,"nearer",!1)}),fe.onTertiaryContainer=le.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>he(e)?e.isDark?0:100:ue(e)?le.foregroundTone(fe.tertiaryContainer.tone(e),4.5):e.isDark?90:10,background:e=>fe.tertiaryContainer,contrastCurve:new pe(4.5,7,11,21)}),fe.error=le.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>fe.highestSurface(e),contrastCurve:new pe(3,4.5,7,11),toneDeltaPair:e=>new de(fe.errorContainer,fe.error,15,"nearer",!1)}),fe.onError=le.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>fe.error,contrastCurve:new pe(4.5,7,11,21)}),fe.er