UNPKG

@tripetto/runner-autoscroll

Version:

Autoscroll UI for running Tripetto forms and surveys.

153 lines (133 loc) 375 kB
/*! Tripetto Autoscroll Runner 8.2.3 - Copyright (C) 2023 Tripetto B.V. - All Rights Reserved */ "use client"; import{mountNamespace as e,SHA2 as t,set as r,arrayItem as o,DateTime as n,findLast as i,Num as s,Debounce as a,L10n as l,Runner as c,isBoolean as u,findFirst as d,isFilledString as p,each as h,scheduleFrame as v,Enumerator as f,markdownifyTo as g,isString as b,MarkdownFeatures as m,castToString as y,isNumberFinite as $,castToNumber as w,castToBoolean as k,tripetto as x,condition as C,validator as S,ConditionBlock as O,Str as z,isVariable as P,NodeBlock as V,assert as F,cancelUITimeout as B,scheduleUITimeout as R,verify as j,scheduleAction as D,isFunction as T,scheduleUIInterval as A,cancelUIInterval as q,extendImmutable as M,noop as I,markdownifyToString as E,markdownifyToURL as L,compare as U,cancelFrame as N,scheduleAnimation as W,arraySize as _,Slots as H,HeadlessBlock as K,castToFloat as Y,getAny as X,isObject as J,unmountNamespace as Z,isDefined as G,filter as Q,map as ee,reduce as te,eachReverse as re,AES as oe,isArray as ne,isPromise as ie,fingerprint as se}from"@tripetto/runner";import{jsx as ae,Fragment as le,jsxs as ce}from"react/jsx-runtime";import{useRef as ue,useState as de,useEffect as pe,createElement as he,StrictMode as ve}from"react";import{styled as fe,createGlobalStyle as ge,css as be,StyleSheetManager as me,keyframes as ye}from"styled-components";export{css,keyframes,styled}from"styled-components";import*as $e from"react-dom";import{createPortal as we}from"react-dom";import{createRoot as ke}from"react-dom/client";function xe(e){var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){return t.reject(r)}))}))}function Ce(e){return new this((function(t,r){if(!e||void 0===e.length)return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var o=Array.prototype.slice.call(e);if(0===o.length)return t([]);var n=o.length;function i(e,r){if(r&&("object"==typeof r||"function"==typeof r)){var s=r.then;if("function"==typeof s)return void s.call(r,(function(t){i(e,t)}),(function(r){o[e]={status:"rejected",reason:r},0==--n&&t(o)}))}o[e]={status:"fulfilled",value:r},0==--n&&t(o)}for(var s=0;s<o.length;s++)i(s,o[s])}))}function Se(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}function Oe(e){var t=this;return new t((function(r,o){if(!e||void 0===e.length)return o(new TypeError("Promise.any accepts an array"));var n=Array.prototype.slice.call(e);if(0===n.length)return o();for(var i=[],s=0;s<n.length;s++)try{t.resolve(n[s]).then(r).catch((function(e){i.push(e),i.length===n.length&&o(new Se(i,"All promises were rejected"))}))}catch(e){o(e)}}))}Se.prototype=Error.prototype;var ze=setTimeout;function Pe(e){return Boolean(e&&void 0!==e.length)}function Ve(){}function Fe(e){if(!(this instanceof Fe))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Ae(e,this)}function Be(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,Fe._immediateFn((function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){var o;try{o=r(e._value)}catch(e){return void je(t.promise,e)}Re(t.promise,o)}else(1===e._state?Re:je)(t.promise,e._value)}))):e._deferreds.push(t)}function Re(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof Fe)return e._state=3,e._value=t,void De(e);if("function"==typeof r)return void Ae((o=r,n=t,function(){o.apply(n,arguments)}),e)}e._state=1,e._value=t,De(e)}catch(t){je(e,t)}var o,n}function je(e,t){e._state=2,e._value=t,De(e)}function De(e){2===e._state&&0===e._deferreds.length&&Fe._immediateFn((function(){e._handled||Fe._unhandledRejectionFn(e._value)}));for(var t=0,r=e._deferreds.length;t<r;t++)Be(e,e._deferreds[t]);e._deferreds=null}function Te(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function Ae(e,t){var r=!1;try{e((function(e){r||(r=!0,Re(t,e))}),(function(e){r||(r=!0,je(t,e))}))}catch(e){if(r)return;r=!0,je(t,e)}}Fe.prototype.catch=function(e){return this.then(null,e)},Fe.prototype.then=function(e,t){var r=new this.constructor(Ve);return Be(this,new Te(e,t,r)),r},Fe.prototype.finally=xe,Fe.all=function(e){return new Fe((function(t,r){if(!Pe(e))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(e);if(0===o.length)return t([]);var n=o.length;function i(e,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,(function(t){i(e,t)}),r)}o[e]=s,0==--n&&t(o)}catch(e){r(e)}}for(var s=0;s<o.length;s++)i(s,o[s])}))},Fe.any=Oe,Fe.allSettled=Ce,Fe.resolve=function(e){return e&&"object"==typeof e&&e.constructor===Fe?e:new Fe((function(t){t(e)}))},Fe.reject=function(e){return new Fe((function(t,r){r(e)}))},Fe.race=function(e){return new Fe((function(t,r){if(!Pe(e))return r(new TypeError("Promise.race accepts an array"));for(var o=0,n=e.length;o<n;o++)Fe.resolve(e[o]).then(t,r)}))},Fe._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){ze(e,0)},Fe._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var qe=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"function"!=typeof qe.Promise?qe.Promise=Fe:(qe.Promise.prototype.finally||(qe.Promise.prototype.finally=xe),qe.Promise.allSettled||(qe.Promise.allSettled=Ce),qe.Promise.any||(qe.Promise.any=Oe));var Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(e){var t,r=function(){try{if(e.URLSearchParams&&"bar"===new e.URLSearchParams("foo=bar").get("foo"))return e.URLSearchParams}catch(e){}return null}(),o=r&&"a=1"===new r({a:1}).toString(),n=r&&"+"===new r("s=%2B").get("s"),i=r&&"size"in r.prototype,s="__URLSearchParams__",a=!r||((t=new r).append("s"," &"),"s=+%26"===t.toString()),l=h.prototype,c=!(!e.Symbol||!e.Symbol.iterator);if(!(r&&o&&n&&a&&i)){l.append=function(e,t){m(this[s],e,t)},l.delete=function(e){delete this[s][e]},l.get=function(e){var t=this[s];return this.has(e)?t[e][0]:null},l.getAll=function(e){var t=this[s];return this.has(e)?t[e].slice(0):[]},l.has=function(e){return $(this[s],e)},l.set=function(e,t){this[s][e]=[""+t]},l.toString=function(){var e,t,r,o,n=this[s],i=[];for(t in n)for(r=v(t),e=0,o=n[t];e<o.length;e++)i.push(r+"="+v(o[e]));return i.join("&")};var u,d=e.Proxy&&r&&(!n||!a||!o||!i);d?(u=new Proxy(r,{construct:function(e,t){return new e(new h(t[0]).toString())}})).toString=Function.prototype.toString.bind(h):u=h,Object.defineProperty(e,"URLSearchParams",{value:u});var p=e.URLSearchParams.prototype;p.polyfill=!0,!d&&e.Symbol&&(p[e.Symbol.toStringTag]="URLSearchParams"),"forEach"in p||(p.forEach=function(e,t){var r=b(this.toString());Object.getOwnPropertyNames(r).forEach((function(o){r[o].forEach((function(r){e.call(t,r,o,this)}),this)}),this)}),"sort"in p||(p.sort=function(){var e,t,r,o=b(this.toString()),n=[];for(e in o)n.push(e);for(n.sort(),t=0;t<n.length;t++)this.delete(n[t]);for(t=0;t<n.length;t++){var i=n[t],s=o[i];for(r=0;r<s.length;r++)this.append(i,s[r])}}),"keys"in p||(p.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),g(e)}),"values"in p||(p.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),g(e)}),"entries"in p||(p.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),g(e)}),c&&(p[e.Symbol.iterator]=p[e.Symbol.iterator]||p.entries),"size"in p||Object.defineProperty(p,"size",{get:function(){var e=b(this.toString());if(p===this)throw new TypeError("Illegal invocation at URLSearchParams.invokeGetter");return Object.keys(e).reduce((function(t,r){return t+e[r].length}),0)}})}function h(e){((e=e||"")instanceof URLSearchParams||e instanceof h)&&(e=e.toString()),this[s]=b(e)}function v(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,(function(e){return t[e]}))}function f(e){return e.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,(function(e){return decodeURIComponent(e)}))}function g(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return c&&(r[e.Symbol.iterator]=function(){return r}),r}function b(e){var t={};if("object"==typeof e)if(y(e))for(var r=0;r<e.length;r++){var o=e[r];if(!y(o)||2!==o.length)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");m(t,o[0],o[1])}else for(var n in e)e.hasOwnProperty(n)&&m(t,n,e[n]);else{0===e.indexOf("?")&&(e=e.slice(1));for(var i=e.split("&"),s=0;s<i.length;s++){var a=i[s],l=a.indexOf("=");-1<l?m(t,f(a.slice(0,l)),f(a.slice(l+1))):a&&m(t,f(a),"")}}return t}function m(e,t,r){var o="string"==typeof r?r:null!=r&&"function"==typeof r.toString?r.toString():JSON.stringify(r);$(e,t)?e[t].push(o):e[t]=[o]}function y(e){return!!e&&"[object Array]"===Object.prototype.toString.call(e)}function $(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(void 0!==Me?Me:"undefined"!=typeof window?window:Me);const Ee="@tripetto/runner-autoscroll@8.2.3";function Le(e,t,r,o){var n,i=arguments.length,s=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(i<3?n(s):i>3?n(t,r,s):n(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function Ue(e,t,r,o){return new(r||(r=Promise))((function(n,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((o=o.apply(e,t||[])).next())}))}e(Ee),"function"==typeof SuppressedError&&SuppressedError;const Ne=e=>{const t=e.current,r=()=>{t&&0!==t.handle&&(clearTimeout(t.handle),t.handle=0)};return{resolve:()=>{e.current=void 0,t&&(r(),t.resolve())},reject:()=>{e.current=void 0,t&&(r(),t.reject())},cancel:r}};let We=0;function _e(e){return i(e,(e=>e.isPreActive||e.isBeforeActive||e.isActive||e.isAfterActive||e.isPostActive))}function He(e,t,r){const n=o(e,t);if(n&&n.isHealthy){let t=n.index;for(;--t>=0;){const o=e[t];if(o.isHistory)break;if(!r||r(o))return o}}}function Ke(e,i,a,l,c){const u="node"===a&&l||void 0,d="prologue"===a&&l||void 0,p="epilogue"===a&&l||void 0,h=("finishing"===a||"pausing"===a)&&l||void 0,v=We++,f={id:"_"+t.CSHA2_256(u?u.key+("live"===e.viewRef.current&&e.storylineRef.current&&e.storylineRef.current.instance.id):`${a}-${e.sequence.length}`),key:u&&u.key||"_"+t.CSHA2_256(`${a}-${e.sequence.length}`),type:a,node:u,prologue:d,epilogue:p,cancel:h,index:e.sequence.length,state:i,changeState:o=>{r(f,"state","prologue"===f.type&&"preview"!==e.viewRef.current&&"active"===o?"history":o),"history"===f.state&&"live"===e.viewRef.current&&u&&r(f,"key","_"+t.CSHA2_256(`history-${v}`)),u&&"upcoming"===f.state&&r(f,"timeStamp",void 0)},get isHealthy(){const t=o(e.sequence,f.index);return t&&t.id===f.id||!1},get isHistory(){return"history"===f.state},get isPast(){return"past"===f.state},get isPreActive(){return"pre-active"===f.state},get isBeforeActive(){return"before-active"===f.state},get isActive(){return"active"===f.state},get isAfterActive(){return"after-active"===f.state},get isPostActive(){return"post-active"===f.state},get isUpcoming(){return"upcoming"===f.state},get isFirst(){return 0===f.index},get isLast(){return f.index===e.sequence.length-1},get isPaused(){if(f.index+1<e.sequence.length){const t=e.sequence[f.index+1];if("pausing"===t.type||"paused"===t.type||"error"===t.type&&"paused"===t.error)return!0}return!1},get allowActivate(){return!(!f.isHealthy||f.isHistory||!u||!e.storylineRef.current||e.storylineRef.current.isFinishing||e.storylineRef.current.isPausing)},activate:(t=!1)=>{if(u&&e.storylineRef.current&&e.storylineRef.current.isPausing){const t=_e(e.sequence);t&&t.cancel&&t.cancel()}if(u&&(!e.storylineRef.current||e.storylineRef.current.isFinishing||e.storylineRef.current.isPausing))return!1;if(Ne(e.promiseRef).reject(),function(e,t,r,o){if(0===e.length||t<0||t>=e.length||!e[t].isHealthy||!r&&e[t].isHistory&&"prologue"!==e[t].type)return!1;const n=_e(e),i=(n||{index:-1}).index;if(i!==t){const a=-1===i?0:s.min(t,i),l=-1===i?e.length-1:s.max(t,i);let c;for(let o=a;o<=l;o++){const n=e[o];if((!n.isHistory||"prologue"===n.type)&&(n.changeState(o===t?"active":o<t?"node"!==n.type?"history":"past":"upcoming"),c||o!==t||(c=n),!r&&o>t&&"node"!==n.type&&"epilogue"!==n.type)){e.splice(o,e.length-o);break}}o&&(n&&!n.isActive&&o("unstage",n.node),c&&o("stage",c.node))}return!0}(e.sequence,f.index,"preview"===e.viewRef.current,c)){const r=()=>{f.changeState("active"),e.update(),e.rules.onInteraction&&e.rules.onInteraction()},o=()=>{if(t&&"preview"!==e.viewRef.current&&e.rules.beforeActiveDuration){const t=e.rules.beforeActiveDuration(f)||0;t?(e.promiseRef.current={resolve:()=>"before-active"===f.state&&r(),reject:()=>f.changeState("upcoming"),handle:setTimeout((()=>f.continue()),t)},f.changeState("before-active"),e.update()):r()}else r()};if("node"===f.type&&e.reset(),t&&"preview"!==e.viewRef.current&&e.rules.preActiveDuration){const t=e.rules.preActiveDuration(f)||0;t>0?(e.promiseRef.current={resolve:()=>"pre-active"===f.state&&o(),reject:()=>f.changeState("upcoming"),handle:setTimeout((()=>f.continue()),t)},f.changeState("pre-active"),e.update()):o()}else o();return e.rules.onInteraction&&e.rules.onInteraction(),!0}return!1},deactivate:()=>!("preview"!==e.viewRef.current||!function(e,t,r){if(t<0||t>=e.length||!e[t].isHealthy||!e[t].isActive)return!1;if(r){const o=e[t];(null==o?void 0:o.isActive)&&r("unstage",o.node)}for(;t<e.length;){const r=e[t];r.isHistory||r.isAfterActive||r.isPostActive||r.changeState("node"!==r.type?"history":"past"),t++}return!0}(e.sequence,f.index,c))&&(e.update(),!0),get allowNext(){return!f.isHistory&&e.storylineRef.current&&!e.storylineRef.current.isEvaluating&&!e.storylineRef.current.isFinishing&&!e.storylineRef.current.isPausing&&(!f.node||f.node.isPassed)&&f.isHealthy&&("preview"===e.viewRef.current||f.index+1<e.sequence.length||e.storylineRef.current.isFinishable||!1)||!1},next:()=>{if(!f.isHealthy)return!1;if("preview"!==e.viewRef.current){const t=()=>{f.node&&f.node.block&&f.node.block.lock()},r=()=>(f.node&&f.node.block&&f.node.block.unlock(),!0);if(e.rules.afterActiveDuration&&f.isActive){const o=e.rules.afterActiveDuration(f)||0;if(o>0)return e.promiseRef.current={resolve:()=>"after-active"===f.state&&f.next(),reject:()=>r()&&f.changeState("node"!==f.type?"history":"past"),handle:setTimeout((()=>f.continue()),o)},t(),f.changeState("after-active"),e.update(),!0}if(e.rules.postActiveDuration&&(f.isActive||f.isAfterActive)){const o=e.rules.postActiveDuration(f)||0;if(o>0)return e.promiseRef.current={resolve:()=>"post-active"===f.state&&f.next(),reject:()=>r()&&f.changeState("node"!==f.type?"history":"past"),handle:setTimeout((()=>f.continue()),o)},t(),f.changeState("post-active"),e.update(),!0}r()}else if(f.deactivate())return!0;return!(f.node&&!f.node.isPassed||f.isHistory)&&(f.index+1<e.sequence.length?e.sequence[f.index+1].activate(!0):"node"!==f.type?(f.changeState("history"),!1):(f.changeState("past"),e.storylineRef.current&&e.storylineRef.current.stepForward()||!1))},get allowUndo(){return!(!e.storylineRef.current||e.storylineRef.current.isFinishing||e.storylineRef.current.isEvaluating||!("node"===f.type&&!e.storylineRef.current.isPausing||"pausing"===f.type&&f.pausingRecipe)||!He(e.sequence,f.index,e.rules.canInteract))},undo:()=>{if(e.storylineRef.current&&!e.storylineRef.current.isEvaluating){if("pausing"===f.type&&f.pausingRecipe)return f.pausingRecipe.cancel(),!0;const t=He(e.sequence,f.index,e.rules.canInteract);return t&&t.activate(!1)||!1}return!1},get allowSkip(){return e.storylineRef.current&&!e.storylineRef.current.isFinishing&&!e.storylineRef.current.isPausing&&!e.storylineRef.current.isEvaluating&&"node"===f.type&&e.rules.canSkip&&e.rules.canSkip(f)||!1},skip:()=>!(!f.isHealthy||!f.allowSkip)&&(f.node&&f.node.block&&f.node.block.clear(),f.next()),wait:()=>Ne(e.promiseRef).cancel(),continue:()=>Ne(e.promiseRef).resolve(),get repeat(){if("epilogue"===f.type&&f.epilogue&&("test"===e.viewRef.current||"live"===e.viewRef.current&&f.epilogue.repeatable)){for(let t=f.index+1;t<e.sequence.length;t++)if("epilogue"!==e.sequence[t].type)return;return()=>{"test"===e.viewRef.current?e.restart():e.runnerRef.current&&!e.runnerRef.current.isRunning&&e.runnerRef.current.start()}}},get kickOff(){if("preview"!==e.viewRef.current&&"prologue"===f.type&&e.runnerRef.current&&!e.runnerRef.current.isRunning&&!e.runnerRef.current.isFinishing&&!e.runnerRef.current.isPausing&&f.isLast)return()=>e.runnerRef.current&&e.runnerRef.current.start()},changeToError:(t,o,i)=>{r(f,"type","error"),r(f,"error",t),r(f,"retry",o),r(f,"cancel",i),r(f,"timeStamp",n.now),f.activate(!0)||e.update()},changeToEpilogue:t=>{r(f,"type","epilogue"),r(f,"epilogue",t),r(f,"timeStamp",n.now),f.activate(!0)||e.update()},changeToPausing:t=>{r(f,"type","pausing"),r(f,"retry",void 0),r(f,"cancel",t),r(f,"timeStamp",void 0),f.activate(!0)||e.update()},changeToPaused:()=>{r(f,"type","paused"),r(f,"retry",void 0),r(f,"cancel",void 0),r(f,"timeStamp",n.now),f.activate(!0)||e.update()},pausingRecipe:void 0,setPausingRecipe:t=>{if("email"===t.recipe)if("pausing"===f.type){const o=()=>{r(f,"pausingRecipe",void 0),r(f,"cancel",void 0),e.update()};r(f,"pausingRecipe",{recipe:t.recipe,complete:e=>{o(),t.complete(e)},cancel:()=>{o(),t.cancel()}}),e.update()}}};return e.sequence.push(f),c&&"active"===i&&c("stage",f.node),f}const Ye=new f;function Xe(e,t,r=!0,o,n){return g(e,t,{lineBreaks:r,features:o,reduce:(e,o,i)=>{const s=b(o)?[o]:o;switch(e){case"bold":return he("b",void 0,...s);case"italic":return he("i",void 0,...s);case"bold+italic":return he("b",void 0,he("i",void 0,...s));case"underline":return he("u",void 0,...s);case"strikethrough":return he("s",void 0,...s);case"break":return he("br");case"hyperlink":return he("a",{href:y(i),target:"_blank",rel:"noopener"},...s);case"mention":const e=i&&i||void 0;if(e&&e.content.length>0){const o=[];return h(e.content,(i=>{const s=i.value;s&&(o.length>0&&i.separator&&o.push(he("span",void 0,i.separator)),"string"===i.type?o.push(r&&s&&-1!==s.indexOf("\n")?Xe(s.replace(/[@\\]/g,"\\$&"),t,!0,m.None):he(s?"span":"u",void 0,s||"   ")):n&&-1!==n.indexOf("@"+e.id)||o.push(Xe(s,t,r,"text"===i.type?m.None:m.Formatting|m.Hyperlinks,(n||"")+"@"+e.id)))})),o.length>0?he("span",void 0,...o):he("u",void 0,"   ")}return he("u",void 0,"   ")}return he("span",{key:Ye.n},...s)}})}var Je={exports:{}},Ze={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ge={exports:{}},Qe=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))},et=Array.prototype.concat,tt=Array.prototype.slice,rt=Ge.exports=function(e){for(var t=[],r=0,o=e.length;r<o;r++){var n=e[r];Qe(n)?t=et.call(t,tt.call(n)):t.push(n)}return t};rt.wrap=function(e){return function(){return e(rt(arguments))}};var ot=Ge.exports,nt=Ze,it=ot,st=Object.hasOwnProperty,at=Object.create(null);for(var lt in nt)st.call(nt,lt)&&(at[nt[lt]]=lt);var ct=Je.exports={to:{},get:{}};function ut(e,t,r){return Math.min(Math.max(t,e),r)}function dt(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}ct.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=ct.get.hsl(e),r="hsl";break;case"hwb":t=ct.get.hwb(e),r="hwb";break;default:t=ct.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},ct.get.rgb=function(e){if(!e)return null;var t,r,o,n=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=t[2],t=t[1],r=0;r<3;r++){var i=2*r;n[r]=parseInt(t.slice(i,i+2),16)}o&&(n[3]=parseInt(o,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(o=(t=t[1])[3],r=0;r<3;r++)n[r]=parseInt(t[r]+t[r],16);o&&(n[3]=parseInt(o+o,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)n[r]=parseInt(t[r+1],0);t[4]&&(t[5]?n[3]=.01*parseFloat(t[4]):n[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:st.call(nt,t[1])?((n=nt[t[1]])[3]=1,n):null:null;for(r=0;r<3;r++)n[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?n[3]=.01*parseFloat(t[4]):n[3]=parseFloat(t[4]))}for(r=0;r<3;r++)n[r]=ut(n[r],0,255);return n[3]=ut(n[3],0,1),n},ct.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,ut(parseFloat(t[2]),0,100),ut(parseFloat(t[3]),0,100),ut(isNaN(r)?1:r,0,1)]}return null},ct.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,ut(parseFloat(t[2]),0,100),ut(parseFloat(t[3]),0,100),ut(isNaN(r)?1:r,0,1)]}return null},ct.to.hex=function(){var e=it(arguments);return"#"+dt(e[0])+dt(e[1])+dt(e[2])+(e[3]<1?dt(Math.round(255*e[3])):"")},ct.to.rgb=function(){var e=it(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},ct.to.rgb.percent=function(){var e=it(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),o=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+o+"%)":"rgba("+t+"%, "+r+"%, "+o+"%, "+e[3]+")"},ct.to.hsl=function(){var e=it(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},ct.to.hwb=function(){var e=it(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},ct.to.keyword=function(e){return at[e.slice(0,3)]};var pt=Je.exports,ht={exports:{}},vt=Ze,ft={};for(var gt in vt)vt.hasOwnProperty(gt)&&(ft[vt[gt]]=gt);var bt=ht.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var mt in bt)if(bt.hasOwnProperty(mt)){if(!("channels"in bt[mt]))throw new Error("missing channels property: "+mt);if(!("labels"in bt[mt]))throw new Error("missing channel labels property: "+mt);if(bt[mt].labels.length!==bt[mt].channels)throw new Error("channel and label counts mismatch: "+mt);var yt=bt[mt].channels,$t=bt[mt].labels;delete bt[mt].channels,delete bt[mt].labels,Object.defineProperty(bt[mt],"channels",{value:yt}),Object.defineProperty(bt[mt],"labels",{value:$t})}function wt(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)}bt.rgb.hsl=function(e){var t,r,o=e[0]/255,n=e[1]/255,i=e[2]/255,s=Math.min(o,n,i),a=Math.max(o,n,i),l=a-s;return a===s?t=0:o===a?t=(n-i)/l:n===a?t=2+(i-o)/l:i===a&&(t=4+(o-n)/l),(t=Math.min(60*t,360))<0&&(t+=360),r=(s+a)/2,[t,100*(a===s?0:r<=.5?l/(a+s):l/(2-a-s)),100*r]},bt.rgb.hsv=function(e){var t,r,o,n,i,s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(e){return(c-e)/6/u+.5};return 0===u?n=i=0:(i=u/c,t=d(s),r=d(a),o=d(l),s===c?n=o-r:a===c?n=1/3+t-o:l===c&&(n=2/3+r-t),n<0?n+=1:n>1&&(n-=1)),[360*n,100*i,100*c]},bt.rgb.hwb=function(e){var t=e[0],r=e[1],o=e[2];return[bt.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,o))),100*(o=1-1/255*Math.max(t,Math.max(r,o)))]},bt.rgb.cmyk=function(e){var t,r=e[0]/255,o=e[1]/255,n=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-o,1-n)))/(1-t)||0),100*((1-o-t)/(1-t)||0),100*((1-n-t)/(1-t)||0),100*t]},bt.rgb.keyword=function(e){var t=ft[e];if(t)return t;var r,o=1/0;for(var n in vt)if(vt.hasOwnProperty(n)){var i=wt(e,vt[n]);i<o&&(o=i,r=n)}return r},bt.keyword.rgb=function(e){return vt[e]},bt.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,o=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(o=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92)),100*(.2126*t+.7152*r+.0722*o),100*(.0193*t+.1192*r+.9505*o)]},bt.rgb.lab=function(e){var t=bt.rgb.xyz(e),r=t[0],o=t[1],n=t[2];return o/=100,n/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116)-16,500*(r-o),200*(o-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},bt.hsl.rgb=function(e){var t,r,o,n,i,s=e[0]/360,a=e[1]/100,l=e[2]/100;if(0===a)return[i=255*l,i,i];t=2*l-(r=l<.5?l*(1+a):l+a-l*a),n=[0,0,0];for(var c=0;c<3;c++)(o=s+1/3*-(c-1))<0&&o++,o>1&&o--,i=6*o<1?t+6*(r-t)*o:2*o<1?r:3*o<2?t+(r-t)*(2/3-o)*6:t,n[c]=255*i;return n},bt.hsl.hsv=function(e){var t=e[0],r=e[1]/100,o=e[2]/100,n=r,i=Math.max(o,.01);return r*=(o*=2)<=1?o:2-o,n*=i<=1?i:2-i,[t,100*(0===o?2*n/(i+n):2*r/(o+r)),100*((o+r)/2)]},bt.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,o=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),s=255*o*(1-r),a=255*o*(1-r*i),l=255*o*(1-r*(1-i));switch(o*=255,n){case 0:return[o,l,s];case 1:return[a,o,s];case 2:return[s,o,l];case 3:return[s,a,o];case 4:return[l,s,o];case 5:return[o,s,a]}},bt.hsv.hsl=function(e){var t,r,o,n=e[0],i=e[1]/100,s=e[2]/100,a=Math.max(s,.01);return o=(2-i)*s,r=i*a,[n,100*(r=(r/=(t=(2-i)*a)<=1?t:2-t)||0),100*(o/=2)]},bt.hwb.rgb=function(e){var t,r,o,n,i,s,a,l=e[0]/360,c=e[1]/100,u=e[2]/100,d=c+u;switch(d>1&&(c/=d,u/=d),o=6*l-(t=Math.floor(6*l)),0!=(1&t)&&(o=1-o),n=c+o*((r=1-u)-c),t){default:case 6:case 0:i=r,s=n,a=c;break;case 1:i=n,s=r,a=c;break;case 2:i=c,s=r,a=n;break;case 3:i=c,s=n,a=r;break;case 4:i=n,s=c,a=r;break;case 5:i=r,s=c,a=n}return[255*i,255*s,255*a]},bt.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,o=e[2]/100,n=e[3]/100;return[255*(1-Math.min(1,t*(1-n)+n)),255*(1-Math.min(1,r*(1-n)+n)),255*(1-Math.min(1,o*(1-n)+n))]},bt.xyz.rgb=function(e){var t,r,o,n=e[0]/100,i=e[1]/100,s=e[2]/100;return r=-.9689*n+1.8758*i+.0415*s,o=.0557*n+-.204*i+1.057*s,t=(t=3.2406*n+-1.5372*i+-.4986*s)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:12.92*o,[255*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(o=Math.min(Math.max(0,o),1))]},bt.xyz.lab=function(e){var t=e[0],r=e[1],o=e[2];return r/=100,o/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},bt.lab.xyz=function(e){var t,r,o,n=e[0];t=e[1]/500+(r=(n+16)/116),o=r-e[2]/200;var i=Math.pow(r,3),s=Math.pow(t,3),a=Math.pow(o,3);return r=i>.008856?i:(r-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,o=a>.008856?a:(o-16/116)/7.787,[t*=95.047,r*=100,o*=108.883]},bt.lab.lch=function(e){var t,r=e[0],o=e[1],n=e[2];return(t=360*Math.atan2(n,o)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(o*o+n*n),t]},bt.lch.lab=function(e){var t,r=e[0],o=e[1];return t=e[2]/360*2*Math.PI,[r,o*Math.cos(t),o*Math.sin(t)]},bt.rgb.ansi16=function(e){var t=e[0],r=e[1],o=e[2],n=1 in arguments?arguments[1]:bt.rgb.hsv(e)[2];if(0===(n=Math.round(n/50)))return 30;var i=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===n&&(i+=60),i},bt.hsv.ansi16=function(e){return bt.rgb.ansi16(bt.hsv.rgb(e),e[2])},bt.rgb.ansi256=function(e){var t=e[0],r=e[1],o=e[2];return t===r&&r===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},bt.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},bt.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},bt.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},bt.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var o=parseInt(r,16);return[o>>16&255,o>>8&255,255&o]},bt.rgb.hcg=function(e){var t,r=e[0]/255,o=e[1]/255,n=e[2]/255,i=Math.max(Math.max(r,o),n),s=Math.min(Math.min(r,o),n),a=i-s;return t=a<=0?0:i===r?(o-n)/a%6:i===o?2+(n-r)/a:4+(r-o)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?s/(1-a):0)]},bt.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,o=1,n=0;return(o=r<.5?2*t*r:2*t*(1-r))<1&&(n=(r-.5*o)/(1-o)),[e[0],100*o,100*n]},bt.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,o=t*r,n=0;return o<1&&(n=(r-o)/(1-o)),[e[0],100*o,100*n]},bt.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,o=e[2]/100;if(0===r)return[255*o,255*o,255*o];var n,i=[0,0,0],s=t%1*6,a=s%1,l=1-a;switch(Math.floor(s)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=l,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=l,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=l}return n=(1-r)*o,[255*(r*i[0]+n),255*(r*i[1]+n),255*(r*i[2]+n)]},bt.hcg.hsv=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t),o=0;return r>0&&(o=t/r),[e[0],100*o,100*r]},bt.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,o=0;return r>0&&r<.5?o=t/(2*r):r>=.5&&r<1&&(o=t/(2*(1-r))),[e[0],100*o,100*r]},bt.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},bt.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,o=r-t,n=0;return o<1&&(n=(r-o)/(1-o)),[e[0],100*o,100*n]},bt.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},bt.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},bt.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},bt.gray.hsl=bt.gray.hsv=function(e){return[0,0,e[0]]},bt.gray.hwb=function(e){return[0,100,e[0]]},bt.gray.cmyk=function(e){return[0,0,0,e[0]]},bt.gray.lab=function(e){return[e[0],0,0]},bt.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},bt.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};var kt=ht.exports,xt=kt;function Ct(e){var t=function(){for(var e={},t=Object.keys(xt),r=t.length,o=0;o<r;o++)e[t[o]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;)for(var o=r.pop(),n=Object.keys(xt[o]),i=n.length,s=0;s<i;s++){var a=n[s],l=t[a];-1===l.distance&&(l.distance=t[o].distance+1,l.parent=o,r.unshift(a))}return t}function St(e,t){return function(r){return t(e(r))}}function Ot(e,t){for(var r=[t[e].parent,e],o=xt[t[e].parent][e],n=t[e].parent;t[n].parent;)r.unshift(t[n].parent),o=St(xt[t[n].parent][n],o),n=t[n].parent;return o.conversion=r,o}var zt=kt,Pt=function(e){for(var t=Ct(e),r={},o=Object.keys(t),n=o.length,i=0;i<n;i++){var s=o[i];null!==t[s].parent&&(r[s]=Ot(s,t))}return r},Vt={};Object.keys(zt).forEach((function(e){Vt[e]={},Object.defineProperty(Vt[e],"channels",{value:zt[e].channels}),Object.defineProperty(Vt[e],"labels",{value:zt[e].labels});var t=Pt(e);Object.keys(t).forEach((function(r){var o=t[r];Vt[e][r]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);if("object"==typeof r)for(var o=r.length,n=0;n<o;n++)r[n]=Math.round(r[n]);return r};return"conversion"in e&&(t.conversion=e.conversion),t}(o),Vt[e][r].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(o)}))}));var Ft=pt,Bt=Vt,Rt=[].slice,jt=["keyword","gray","hex"],Dt={};Object.keys(Bt).forEach((function(e){Dt[Rt.call(Bt[e].labels).sort().join("")]=e}));var Tt={};function At(e,t){if(!(this instanceof At))return new At(e,t);if(t&&t in jt&&(t=null),t&&!(t in Bt))throw new Error("Unknown model: "+t);var r,o;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof At)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var n=Ft.get(e);if(null===n)throw new Error("Unable to parse color from string: "+e);this.model=n.model,o=Bt[this.model].channels,this.color=n.value.slice(0,o),this.valpha="number"==typeof n.value[o]?n.value[o]:1}else if(e.length){this.model=t||"rgb",o=Bt[this.model].channels;var i=Rt.call(e,0,o);this.color=It(i,o),this.valpha="number"==typeof e[o]?e[o]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var s=Object.keys(e);"alpha"in e&&(s.splice(s.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var a=s.sort().join("");if(!(a in Dt))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Dt[a];var l=Bt[this.model].labels,c=[];for(r=0;r<l.length;r++)c.push(e[l[r]]);this.color=It(c)}if(Tt[this.model])for(o=Bt[this.model].channels,r=0;r<o;r++){var u=Tt[this.model][r];u&&(this.color[r]=u(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function qt(e,t,r){return(e=Array.isArray(e)?e:[e]).forEach((function(e){(Tt[e]||(Tt[e]=[]))[t]=r})),e=e[0],function(o){var n;return arguments.length?(r&&(o=r(o)),(n=this[e]()).color[t]=o,n):(n=this[e]().color[t],r&&(n=r(n)),n)}}function Mt(e){return function(t){return Math.max(0,Math.min(e,t))}}function It(e,t){for(var r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}At.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(e){var t=this.model in Ft.to?this:this.rgb(),r=1===(t=t.round("number"==typeof e?e:1)).valpha?t.color:t.color.concat(this.valpha);return Ft.to[t.model](r)},percentString:function(e){var t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:t.color.concat(this.valpha);return Ft.to.rgb.percent(r)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var e={},t=Bt[this.model].channels,r=Bt[this.model].labels,o=0;o<t;o++)e[r[o]]=this.color[o];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray:function(){var e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject:function(){var e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round:function(e){return e=Math.max(e||0,0),new At(this.color.map(function(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}(e)).concat(this.valpha),this.model)},alpha:function(e){return arguments.length?new At(this.color.concat(Math.max(0,Math.min(1,e))),this.model):this.valpha},red:qt("rgb",0,Mt(255)),green:qt("rgb",1,Mt(255)),blue:qt("rgb",2,Mt(255)),hue:qt(["hsl","hsv","hsl","hwb","hcg"],0,(function(e){return(e%360+360)%360})),saturationl:qt("hsl",1,Mt(100)),lightness:qt("hsl",2,Mt(100)),saturationv:qt("hsv",1,Mt(100)),value:qt("hsv",2,Mt(100)),chroma:qt("hcg",1,Mt(100)),gray:qt("hcg",2,Mt(100)),white:qt("hwb",1,Mt(100)),wblack:qt("hwb",2,Mt(100)),cyan:qt("cmyk",0,Mt(100)),magenta:qt("cmyk",1,Mt(100)),yellow:qt("cmyk",2,Mt(100)),black:qt("cmyk",3,Mt(100)),x:qt("xyz",0,Mt(100)),y:qt("xyz",1,Mt(100)),z:qt("xyz",2,Mt(100)),l:qt("lab",0,Mt(100)),a:qt("lab",1),b:qt("lab",2),keyword:function(e){return arguments.length?new At(e):Bt[this.model].keyword(this.color)},hex:function(e){return arguments.length?new At(e):Ft.to.hex(this.rgb().round().color)},rgbNumber:function(){var e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity:function(){for(var e=this.rgb().color,t=[],r=0;r<e.length;r++){var o=e[r]/255;t[r]=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast:function(e){var t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return At.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),r=t.color[0];return r=(r=(r+e)%360)<0?360+r:r,t.color[0]=r,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var r=e.rgb(),o=this.rgb(),n=void 0===t?.5:t,i=2*n-1,s=r.alpha()-o.alpha(),a=((i*s==-1?i:(i+s)/(1+i*s))+1)/2,l=1-a;return At.rgb(a*r.red()+l*o.red(),a*r.green()+l*o.green(),a*r.blue()+l*o.blue(),r.alpha()*n+o.alpha()*(1-n))}},Object.keys(Bt).forEach((function(e){if(-1===jt.indexOf(e)){var t=Bt[e].channels;At.prototype[e]=function(){if(this.model===e)return new At(this);if(arguments.length)return new At(arguments,e);var r,o="number"==typeof arguments[t]?t:this.valpha;return new At((r=Bt[this.model][e].raw(this.color),Array.isArray(r)?r:[r]).concat(o),e)},At[e]=function(r){return"number"==typeof r&&(r=It(Rt.call(arguments),t)),new At(r,e)}}}));var Et=Ie(At);const Lt=e=>{if(e&&"transparent"!==(e=e.toLowerCase()))try{return Et(e)}catch(t){try{return Et("#"+e)}catch(e){return Et("rgba(255,255,255,0)")}}return Et("rgba(255,255,255,0)")},Ut=(e,t)=>{let r=Lt(e);if(t){const e={manipulate:(t,o=!0)=>(o&&(r=t(r)),e),makeBlackOrWhite:(t=!0)=>{if(t){const e=(.299*r.red()+.587*r.green()+.114*r.blue())/255;r=r.red(e>.55?0:255).green(e>.55?0:255).blue(e>.55?0:255).alpha(1)}return e},makeUnclear:t=>(t&&0===r.alpha()&&(r=Lt(t)),e)};t(e)}return r.rgb().string()},Nt=fe.span` color: ${e=>Ut(e.$errorColor)}; position: relative; left: 0.1em; top: 0.18em; text-transform: uppercase; font-size: 1.4em; line-height: 0.5em; &:after { content: "*"; } `,Wt=e=>btoa(`<?xml version="1.0" encoding="utf-8"?>\n <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20">\n <path d="M16.218 3.782c-1.794-1.794-4.18-2.782-6.718-2.782s-4.923 0.988-6.718 2.782-2.782 4.18-2.782 6.717 0.988 4.923 2.782 6.718 4.18 2.782 6.718 2.782 4.923-0.988 6.718-2.782 2.782-4.18 2.782-6.718-0.988-4.923-2.782-6.717zM9.5 19c-4.687 0-8.5-3.813-8.5-8.5s3.813-8.5 8.5-8.5c4.687 0 8.5 3.813 8.5 8.5s-3.813 8.5-8.5 8.5z" fill="${e}"></path>\n <path d="M9.5 18c-0 0 0 0 0 0-0.276 0-0.5-0.224-0.5-0.5v-1c0-0.276 0.224-0.5 0.5-0.5v0c0.276 0 0.5 0.224 0.5 0.5v1c0 0.276-0.224 0.5-0.5 0.5z" fill="${e}"></path>\n <path d="M9.5 15c-0.276 0-0.5-0.224-0.5-0.5v-10c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v10c0 0.276-0.224 0.5-0.5 0.5z" fill="${e}"></path>\n </svg>`),_t=fe.button` appearance: none; font-size: 1em; line-height: 1.5em; outline: none; user-select: none; box-sizing: border-box; background-color: ${e=>"fill"===e.$mode&&Ut(e.$baseColor)||"transparent"}; border: ${e=>`${e.$outlineSize}px solid ${Ut(e.$baseColor,(t=>t.manipulate((e=>e.darken(.1)),"fill"===e.$mode)))}`}; border-left: ${e=>"middle"===e.$group||"end"===e.$group?"none":void 0}; color: ${e=>Ut(e.$textColor||e.$baseColor,(t=>t.makeBlackOrWhite(!e.$textColor&&"fill"===e.$mode)))}; text-align: left; border-radius: ${e=>$(e.$roundness)?`${e.$roundness}px`:"0.5em"}; border-top-left-radius: ${e=>e.$group&&"start"!==e.$group?"0":void 0}; border-bottom-left-radius: ${e=>e.$group&&"start"!==e.$group?"0":void 0}; border-top-right-radius: ${e=>e.$group&&"end"!==e.$group?"0":void 0}; border-bottom-right-radius: ${e=>e.$group&&"end"!==e.$group?"0":void 0}; width: ${e=>e.$isImage&&`calc(${"small"===e.$size?75:"large"===e.$size?300:150}px + 1.5em)`}; overflow: ${e=>e.$isImage?"hidden":void 0}; padding: ${e=>.375*e.$scale+"em 0.75em"}; padding-top: ${e=>e.$isImage?"0.75em":void 0}; padding-bottom: ${e=>e.$isImage&&!e.$hasLabel?"0.75em":void 0}; margin: 0; opacity: ${e=>"outline"===e.$mode?.2:.4}; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, opacity 0.15s ease-in-out; @media (max-device-width: 500px) { width: ${e=>e.$isImage&&`calc(${"small"===e.$size?75:"large"===e.$size?280:120}px + 1.5em)`}; } @media (max-width: 500px) { width: ${e=>e.$isImage&&`calc(${"small"===e.$size?75:"large"===e.$size?240:120}px + 1.5em)`}; } > div { display: flex; width: ${e=>("small"===e.$size?75:"large"===e.$size?300:150)+"px"}; height: ${e=>("small"===e.$size?75:"large"===e.$size?300:150)+"px"}; min-width: 100%; background-repeat: no-repeat; background-size: cover; background-position: center center; justify-content: center; align-items: center; overflow: hidden; white-space: nowrap; > span { font-size: ${e=>("small"===e.$size?40:"large"===e.$size?160:80)+"px"}; } @media (max-device-width: 500px) { width: ${e=>("small"===e.$size?75:"large"===e.$size?240:120)+"px"}; height: ${e=>("small"===e.$size?75:"large"===e.$size?240:120)+"px"}; > span { font-size: ${e=>("small"===e.$size?40:"large"===e.$size?136:68)+"px"}; } } @media (max-width: 500px) { width: ${e=>("small"===e.$size?75:"large"===e.$size?240:120)+"px"}; height: ${e=>("small"===e.$size?75:"large"===e.$size?240:120)+"px"}; > span { font-size: ${e=>("small"===e.$size?40:"large"===e.$size?136:68)+"px"}; } } } > span { display: block; > span { display: table-cell; > small { display: block; font-size: 0.8em; opacity: 0.8; } > svg { width: 1em; height: 1em; position: relative; top: ${e=>"solo"!==e.$iconPosition&&"-2px"}; margin-left: ${e=>"right"===e.$iconPosition&&"0.5em"}; margin-right: ${e=>"left"===e.$iconPosition&&"0.5em"}; overflow: hidden; vertical-align: middle; path { fill: ${e=>Ut(e.$textColor||e.$baseColor,(t=>t.makeBlackOrWhite(!e.$textColor&&"fill"===e.$mode)))}; transition: fill 0.15s ease-in-out; } } } } > div + span { display: flex; justify-content: center; margin-top: ${e=>.375*e.$scale+"em"}; text-align: center; } &:not(:disabled) { cursor: pointer; opacity: 1; &:hover { background-color: ${e=>"fill"===e.$hover&&Ut(e.$baseColor,(t=>t.manipulate((e=>e.darken(.05)),"fill"===e.$mode)))||void 0}; border-color: ${e=>"fill"===e.$hover&&Ut(e.$baseColor,(t=>t.manipulate((e=>e.darken(.1)),"fill"===e.$mode)))||void 0}; color: ${e=>"outline"===e.$mode&&"fill"===e.$hover&&Ut(e.$baseColor,(e=>e.makeBlackOrWhite()))||void 0}; box-shadow: 0 0 0 0.2rem ${e=>Ut(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.2)))))}; svg { path { fill: ${e=>"outline"===e.$mode&&"fill"===e.$hover&&Ut(e.$baseColor,(e=>e.makeBlackOrWhite()))||void 0}; } } } &:focus { box-shadow: 0 0 0 0.2rem ${e=>Ut(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.5)))))}; } &:active { box-shadow: 0 0 0 0.2rem ${e=>Ut(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.5)))))}; background-color: ${e=>"fill"===e.$hover&&Ut(e.$baseColor,(e=>e.manipulate((e=>e.darken(.15)))))}; } } `,Ht=e=>{const t=e.label?e.iconPosition||"left":"solo",r=e.disabled||!e.onClick&&!e.hyperlink;return ce(_t,{ref:e.onAutoFocus,type:"button",disabled:r,tabIndex:e.tabIndex,"aria-describedby":e.ariaDescribedBy,onFocus:e.onFocus,onBlur:e.onBlur,onKeyDown:t=>e.onTab&&"Tab"===t.key&&!t.shiftKey?(t.preventDefault(),void e.onTab()):e.onCancel&&"Tab"===t.key&&t.shiftKey?(t.preventDefault(),void e.onCancel()):void(e.onKeyDown&&e.onKeyDown(t)),onClick:t=>{t.stopPropagation(),e.hyperlink?window.open(e.hyperlink.url,`_${e.hyperlink.target||"self"}`,"noopener"):e.onClick&&e.onClick()},$baseCol