UNPKG

@tripetto/runner-autoscroll

Version:

Autoscroll UI for running Tripetto forms and surveys.

153 lines (133 loc) 392 kB
/*! Tripetto Autoscroll Runner 9.0.2 - Copyright (C) 2025 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 a,Debounce as s,L10n as l,Runner as c,isBoolean as u,getString as d,findFirst as p,isFilledString as h,each as v,scheduleFrame as g,Enumerator as f,markdownifyTo as b,isString as m,MarkdownFeatures as y,castToString as $,isNumberFinite as w,castToNumber as k,castToBoolean as x,tripetto as C,condition as S,validator as O,ConditionBlock as z,Str as P,isVariable as B,NodeBlock as V,assert as F,cancelUITimeout as R,scheduleUITimeout as j,verify as D,scheduleAction as T,isFunction as A,scheduleUIInterval as q,cancelUIInterval as M,extendImmutable as I,noop as E,markdownifyToString as L,markdownifyToURL as U,compare as N,cancelFrame as W,scheduleAnimation as _,arraySize as H,Slots as K,HeadlessBlock as Y,castToFloat as X,getAny as J,isObject as Z,unmountNamespace as G,isDefined as Q,filter as ee,map as te,reduce as re,eachReverse as oe,AES as ne,isArray as ie,isPromise as ae,fingerprint as se}from"@tripetto/runner";import{jsx as le,Fragment as ce,jsxs as ue}from"react/jsx-runtime";import{useRef as de,useState as pe,useEffect as he,createElement as ve,StrictMode as ge}from"react";import{styled as fe,createGlobalStyle as be,css as me,StyleSheetManager as ye,keyframes as $e}from"styled-components";export{css,keyframes,styled}from"styled-components";import*as we from"react-dom";import{createPortal as ke}from"react-dom";import{createRoot as xe}from"react-dom/client";function Ce(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 Se(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 a=r.then;if("function"==typeof a)return void a.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 a=0;a<o.length;a++)i(a,o[a])}))}function Oe(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}function ze(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=[],a=0;a<n.length;a++)try{t.resolve(n[a]).then(r).catch((function(e){i.push(e),i.length===n.length&&o(new Oe(i,"All promises were rejected"))}))}catch(e){o(e)}}))}Oe.prototype=Error.prototype;var Pe=setTimeout;function Be(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=[],qe(e,this)}function Re(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 De(t.promise,e)}je(t.promise,o)}else(1===e._state?je:De)(t.promise,e._value)}))):e._deferreds.push(t)}function je(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 Te(e);if("function"==typeof r)return void qe((o=r,n=t,function(){o.apply(n,arguments)}),e)}e._state=1,e._value=t,Te(e)}catch(t){De(e,t)}var o,n}function De(e,t){e._state=2,e._value=t,Te(e)}function Te(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++)Re(e,e._deferreds[t]);e._deferreds=null}function Ae(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function qe(e,t){var r=!1;try{e((function(e){r||(r=!0,je(t,e))}),(function(e){r||(r=!0,De(t,e))}))}catch(e){if(r)return;r=!0,De(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 Re(this,new Ae(e,t,r)),r},Fe.prototype.finally=Ce,Fe.all=function(e){return new Fe((function(t,r){if(!Be(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,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,(function(t){i(e,t)}),r)}o[e]=a,0==--n&&t(o)}catch(e){r(e)}}for(var a=0;a<o.length;a++)i(a,o[a])}))},Fe.any=ze,Fe.allSettled=Se,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(!Be(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){Pe(e,0)},Fe._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var Me=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 Me.Promise?Me.Promise=Fe:(Me.Promise.prototype.finally||(Me.Promise.prototype.finally=Ce),Me.Promise.allSettled||(Me.Promise.allSettled=Se),Me.Promise.any||(Me.Promise.any=ze));var Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ee(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,a="__URLSearchParams__",s=!r||((t=new r).append("s"," &"),"s=+%26"===t.toString()),l=h.prototype,c=!(!e.Symbol||!e.Symbol.iterator);if(!(r&&o&&n&&s&&i)){l.append=function(e,t){m(this[a],e,t)},l.delete=function(e){delete this[a][e]},l.get=function(e){var t=this[a];return this.has(e)?t[e][0]:null},l.getAll=function(e){var t=this[a];return this.has(e)?t[e].slice(0):[]},l.has=function(e){return $(this[a],e)},l.set=function(e,t){this[a][e]=[""+t]},l.toString=function(){var e,t,r,o,n=this[a],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||!s||!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],a=o[i];for(r=0;r<a.length;r++)this.append(i,a[r])}}),"keys"in p||(p.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),f(e)}),"values"in p||(p.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)}),"entries"in p||(p.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),f(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[a]=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 g(e){return e.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,(function(e){return decodeURIComponent(e)}))}function f(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("&"),a=0;a<i.length;a++){var s=i[a],l=s.indexOf("=");-1<l?m(t,g(s.slice(0,l)),g(s.slice(l+1))):s&&m(t,g(s),"")}}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!==Ie?Ie:"undefined"!=typeof window?window:Ie);const Le="@tripetto/runner-autoscroll@9.0.2";function Ue(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function Ne(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(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(a,s)}l((o=o.apply(e,t||[])).next())}))}e(Le),"function"==typeof SuppressedError&&SuppressedError;const We=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 _e=0;function He(e){return i(e,(e=>e.isPreActive||e.isBeforeActive||e.isActive||e.isAfterActive||e.isPostActive))}function Ke(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 Ye(e,i,s,l,c){const u="node"===s&&l||void 0,d="prologue"===s&&l||void 0,p="epilogue"===s&&l||void 0,h=("finishing"===s||"pausing"===s)&&l||void 0,v=_e++,g={id:"_"+t.CSHA2_256(u?u.key+("live"===e.viewRef.current&&e.storylineRef.current&&e.storylineRef.current.instance.id):`${s}-${e.sequence.length}`),key:u&&u.key||"_"+t.CSHA2_256(`${s}-${e.sequence.length}`),type:s,node:u,prologue:d,epilogue:p,cancel:h,index:e.sequence.length,state:i,changeState:o=>{r(g,"state","prologue"===g.type&&"preview"!==e.viewRef.current&&"active"===o?"history":o),"history"===g.state&&"live"===e.viewRef.current&&u&&r(g,"key","_"+t.CSHA2_256(`history-${v}`)),u&&"upcoming"===g.state&&r(g,"timeStamp",void 0)},get isHealthy(){const t=o(e.sequence,g.index);return t&&t.id===g.id||!1},get isHistory(){return"history"===g.state},get isPast(){return"past"===g.state},get isPreActive(){return"pre-active"===g.state},get isBeforeActive(){return"before-active"===g.state},get isActive(){return"active"===g.state},get isAfterActive(){return"after-active"===g.state},get isPostActive(){return"post-active"===g.state},get isUpcoming(){return"upcoming"===g.state},get isFirst(){return 0===g.index},get isLast(){return g.index===e.sequence.length-1},get isPaused(){if(g.index+1<e.sequence.length){const t=e.sequence[g.index+1];if("pausing"===t.type||"paused"===t.type||"error"===t.type&&"paused"===t.error)return!0}return!1},get allowActivate(){return!(!g.isHealthy||g.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=He(e.sequence);t&&t.cancel&&t.cancel()}if(u&&(!e.storylineRef.current||e.storylineRef.current.isFinishing||e.storylineRef.current.isPausing))return!1;if(We(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=He(e),i=(n||{index:-1}).index;if(i!==t){const s=-1===i?0:a.min(t,i),l=-1===i?e.length-1:a.max(t,i);let c;for(let o=s;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,g.index,"preview"===e.viewRef.current,c)){const r=()=>{g.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(g)||0;t?(e.promiseRef.current={resolve:()=>"before-active"===g.state&&r(),reject:()=>g.changeState("upcoming"),handle:setTimeout((()=>g.continue()),t)},g.changeState("before-active"),e.update()):r()}else r()};if("node"===g.type&&e.reset(),t&&"preview"!==e.viewRef.current&&e.rules.preActiveDuration){const t=e.rules.preActiveDuration(g)||0;t>0?(e.promiseRef.current={resolve:()=>"pre-active"===g.state&&o(),reject:()=>g.changeState("upcoming"),handle:setTimeout((()=>g.continue()),t)},g.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,g.index,c))&&(e.update(),!0),get allowNext(){return!g.isHistory&&e.storylineRef.current&&!e.storylineRef.current.isEvaluating&&!e.storylineRef.current.isFinishing&&!e.storylineRef.current.isPausing&&(!g.node||g.node.isPassed)&&g.isHealthy&&("preview"===e.viewRef.current||g.index+1<e.sequence.length||e.storylineRef.current.isFinishable||!1)||!1},next:()=>{if(!g.isHealthy)return!1;if("preview"!==e.viewRef.current){const t=()=>{g.node&&g.node.block&&g.node.block.lock()},r=()=>(g.node&&g.node.block&&g.node.block.unlock(),!0);if(e.rules.afterActiveDuration&&g.isActive){const o=e.rules.afterActiveDuration(g)||0;if(o>0)return e.promiseRef.current={resolve:()=>"after-active"===g.state&&g.next(),reject:()=>r()&&g.changeState("node"!==g.type?"history":"past"),handle:setTimeout((()=>g.continue()),o)},t(),g.changeState("after-active"),e.update(),!0}if(e.rules.postActiveDuration&&(g.isActive||g.isAfterActive)){const o=e.rules.postActiveDuration(g)||0;if(o>0)return e.promiseRef.current={resolve:()=>"post-active"===g.state&&g.next(),reject:()=>r()&&g.changeState("node"!==g.type?"history":"past"),handle:setTimeout((()=>g.continue()),o)},t(),g.changeState("post-active"),e.update(),!0}r()}else if(g.deactivate())return!0;return!(g.node&&!g.node.isPassed||g.isHistory)&&(g.index+1<e.sequence.length?e.sequence[g.index+1].activate(!0):"node"!==g.type?(g.changeState("history"),!1):(g.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"===g.type&&!e.storylineRef.current.isPausing||"pausing"===g.type&&g.pausingRecipe)||!Ke(e.sequence,g.index,e.rules.canInteract))},undo:()=>{if(e.storylineRef.current&&!e.storylineRef.current.isEvaluating){if("pausing"===g.type&&g.pausingRecipe)return g.pausingRecipe.cancel(),!0;const t=Ke(e.sequence,g.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"===g.type&&e.rules.canSkip&&e.rules.canSkip(g)||!1},skip:()=>!(!g.isHealthy||!g.allowSkip)&&(g.node&&g.node.block&&g.node.block.clear(),g.next()),wait:()=>We(e.promiseRef).cancel(),continue:()=>We(e.promiseRef).resolve(),get repeat(){if("epilogue"===g.type&&g.epilogue&&("test"===e.viewRef.current||"live"===e.viewRef.current&&g.epilogue.repeatable)){for(let t=g.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"===g.type&&e.runnerRef.current&&!e.runnerRef.current.isRunning&&!e.runnerRef.current.isFinishing&&!e.runnerRef.current.isPausing&&g.isLast)return()=>e.runnerRef.current&&e.runnerRef.current.start()},changeToError:(t,o,i)=>{r(g,"type","error"),r(g,"error",t),r(g,"retry",o),r(g,"cancel",i),r(g,"timeStamp",n.now),g.activate(!0)||e.update()},changeToEpilogue:t=>{r(g,"type","epilogue"),r(g,"epilogue",t),r(g,"timeStamp",n.now),g.activate(!0)||e.update()},changeToPausing:t=>{r(g,"type","pausing"),r(g,"retry",void 0),r(g,"cancel",t),r(g,"timeStamp",void 0),g.activate(!0)||e.update()},changeToPaused:()=>{r(g,"type","paused"),r(g,"retry",void 0),r(g,"cancel",void 0),r(g,"timeStamp",n.now),g.activate(!0)||e.update()},pausingRecipe:void 0,setPausingRecipe:t=>{if("email"===t.recipe)if("pausing"===g.type){const o=()=>{r(g,"pausingRecipe",void 0),r(g,"cancel",void 0),e.update()};r(g,"pausingRecipe",{recipe:t.recipe,complete:e=>{o(),t.complete(e)},cancel:()=>{o(),t.cancel()}}),e.update()}}};return e.sequence.push(g),c&&"active"===i&&c("stage",g.node),g}const Xe=new f;function Je(e,t,r=!0,o,n){return b(e,t,{lineBreaks:r,features:o,reduce:(e,o,i)=>{const a=m(o)?[o]:o;switch(e){case"bold":return ve("b",void 0,...a);case"italic":return ve("i",void 0,...a);case"bold+italic":return ve("b",void 0,ve("i",void 0,...a));case"underline":return ve("u",void 0,...a);case"strikethrough":return ve("s",void 0,...a);case"break":return ve("br");case"hyperlink":return ve("a",{href:$(i),target:"_blank",rel:"noopener"},...a);case"mention":const e=i&&i||void 0;if(e&&e.content.length>0){const o=[];return v(e.content,(i=>{const a=i.value;a&&(o.length>0&&i.separator&&o.push(ve("span",void 0,i.separator)),"string"===i.type?o.push(r&&a&&-1!==a.indexOf("\n")?Je(a.replace(/[@\\]/g,"\\$&"),t,!0,y.None):ve(a?"span":"u",void 0,a||"   ")):n&&-1!==n.indexOf("@"+e.id)||o.push(Je(a,t,r,"text"===i.type?y.None:y.Formatting|y.Hyperlinks,(n||"")+"@"+e.id)))})),o.length>0?ve("span",void 0,...o):ve("u",void 0,"   ")}return ve("u",void 0,"   ")}return ve("span",{key:Xe.n},...a)}})}var Ze={exports:{}},Ge={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]},Qe={exports:{}},et=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))},tt=Array.prototype.concat,rt=Array.prototype.slice,ot=Qe.exports=function(e){for(var t=[],r=0,o=e.length;r<o;r++){var n=e[r];et(n)?t=tt.call(t,rt.call(n)):t.push(n)}return t};ot.wrap=function(e){return function(){return e(ot(arguments))}};var nt=Qe.exports,it=Ge,at=nt,st=Object.hasOwnProperty,lt=Object.create(null);for(var ct in it)st.call(it,ct)&&(lt[it[ct]]=ct);var ut=Ze.exports={to:{},get:{}};function dt(e,t,r){return Math.min(Math.max(t,e),r)}function pt(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}ut.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=ut.get.hsl(e),r="hsl";break;case"hwb":t=ut.get.hwb(e),r="hwb";break;default:t=ut.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},ut.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(it,t[1])?((n=it[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]=dt(n[r],0,255);return n[3]=dt(n[3],0,1),n},ut.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,dt(parseFloat(t[2]),0,100),dt(parseFloat(t[3]),0,100),dt(isNaN(r)?1:r,0,1)]}return null},ut.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,dt(parseFloat(t[2]),0,100),dt(parseFloat(t[3]),0,100),dt(isNaN(r)?1:r,0,1)]}return null},ut.to.hex=function(){var e=at(arguments);return"#"+pt(e[0])+pt(e[1])+pt(e[2])+(e[3]<1?pt(Math.round(255*e[3])):"")},ut.to.rgb=function(){var e=at(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]+")"},ut.to.rgb.percent=function(){var e=at(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]+")"},ut.to.hsl=function(){var e=at(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},ut.to.hwb=function(){var e=at(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},ut.to.keyword=function(e){return lt[e.slice(0,3)]};var ht=Ze.exports,vt={exports:{}},gt=Ge,ft={};for(var bt in gt)gt.hasOwnProperty(bt)&&(ft[gt[bt]]=bt);var mt=vt.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 yt in mt)if(mt.hasOwnProperty(yt)){if(!("channels"in mt[yt]))throw new Error("missing channels property: "+yt);if(!("labels"in mt[yt]))throw new Error("missing channel labels property: "+yt);if(mt[yt].labels.length!==mt[yt].channels)throw new Error("channel and label counts mismatch: "+yt);var $t=mt[yt].channels,wt=mt[yt].labels;delete mt[yt].channels,delete mt[yt].labels,Object.defineProperty(mt[yt],"channels",{value:$t}),Object.defineProperty(mt[yt],"labels",{value:wt})}function kt(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)}mt.rgb.hsl=function(e){var t,r,o=e[0]/255,n=e[1]/255,i=e[2]/255,a=Math.min(o,n,i),s=Math.max(o,n,i),l=s-a;return s===a?t=0:o===s?t=(n-i)/l:n===s?t=2+(i-o)/l:i===s&&(t=4+(o-n)/l),(t=Math.min(60*t,360))<0&&(t+=360),r=(a+s)/2,[t,100*(s===a?0:r<=.5?l/(s+a):l/(2-s-a)),100*r]},mt.rgb.hsv=function(e){var t,r,o,n,i,a=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(a,s,l),u=c-Math.min(a,s,l),d=function(e){return(c-e)/6/u+.5};return 0===u?n=i=0:(i=u/c,t=d(a),r=d(s),o=d(l),a===c?n=o-r:s===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]},mt.rgb.hwb=function(e){var t=e[0],r=e[1],o=e[2];return[mt.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)))]},mt.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]},mt.rgb.keyword=function(e){var t=ft[e];if(t)return t;var r,o=1/0;for(var n in gt)if(gt.hasOwnProperty(n)){var i=kt(e,gt[n]);i<o&&(o=i,r=n)}return r},mt.keyword.rgb=function(e){return gt[e]},mt.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)]},mt.rgb.lab=function(e){var t=mt.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))]},mt.hsl.rgb=function(e){var t,r,o,n,i,a=e[0]/360,s=e[1]/100,l=e[2]/100;if(0===s)return[i=255*l,i,i];t=2*l-(r=l<.5?l*(1+s):l+s-l*s),n=[0,0,0];for(var c=0;c<3;c++)(o=a+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},mt.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)]},mt.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),a=255*o*(1-r),s=255*o*(1-r*i),l=255*o*(1-r*(1-i));switch(o*=255,n){case 0:return[o,l,a];case 1:return[s,o,a];case 2:return[a,o,l];case 3:return[a,s,o];case 4:return[l,a,o];case 5:return[o,a,s]}},mt.hsv.hsl=function(e){var t,r,o,n=e[0],i=e[1]/100,a=e[2]/100,s=Math.max(a,.01);return o=(2-i)*a,r=i*s,[n,100*(r=(r/=(t=(2-i)*s)<=1?t:2-t)||0),100*(o/=2)]},mt.hwb.rgb=function(e){var t,r,o,n,i,a,s,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,a=n,s=c;break;case 1:i=n,a=r,s=c;break;case 2:i=c,a=r,s=n;break;case 3:i=c,a=n,s=r;break;case 4:i=n,a=c,s=r;break;case 5:i=r,a=c,s=n}return[255*i,255*a,255*s]},mt.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))]},mt.xyz.rgb=function(e){var t,r,o,n=e[0]/100,i=e[1]/100,a=e[2]/100;return r=-.9689*n+1.8758*i+.0415*a,o=.0557*n+-.204*i+1.057*a,t=(t=3.2406*n+-1.5372*i+-.4986*a)>.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))]},mt.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))]},mt.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),a=Math.pow(t,3),s=Math.pow(o,3);return r=i>.008856?i:(r-16/116)/7.787,t=a>.008856?a:(t-16/116)/7.787,o=s>.008856?s:(o-16/116)/7.787,[t*=95.047,r*=100,o*=108.883]},mt.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]},mt.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)]},mt.rgb.ansi16=function(e){var t=e[0],r=e[1],o=e[2],n=1 in arguments?arguments[1]:mt.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},mt.hsv.ansi16=function(e){return mt.rgb.ansi16(mt.hsv.rgb(e),e[2])},mt.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)},mt.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]},mt.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]},mt.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},mt.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]},mt.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),a=Math.min(Math.min(r,o),n),s=i-a;return t=s<=0?0:i===r?(o-n)/s%6:i===o?2+(n-r)/s:4+(r-o)/s+4,t/=6,[360*(t%=1),100*s,100*(s<1?a/(1-s):0)]},mt.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]},mt.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]},mt.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],a=t%1*6,s=a%1,l=1-s;switch(Math.floor(a)){case 0:i[0]=1,i[1]=s,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]=s;break;case 3:i[0]=0,i[1]=l,i[2]=1;break;case 4:i[0]=s,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)]},mt.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]},mt.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]},mt.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)]},mt.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]},mt.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},mt.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},mt.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},mt.gray.hsl=mt.gray.hsv=function(e){return[0,0,e[0]]},mt.gray.hwb=function(e){return[0,100,e[0]]},mt.gray.cmyk=function(e){return[0,0,0,e[0]]},mt.gray.lab=function(e){return[e[0],0,0]},mt.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},mt.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};var xt=vt.exports,Ct=xt;function St(e){var t=function(){for(var e={},t=Object.keys(Ct),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(Ct[o]),i=n.length,a=0;a<i;a++){var s=n[a],l=t[s];-1===l.distance&&(l.distance=t[o].distance+1,l.parent=o,r.unshift(s))}return t}function Ot(e,t){return function(r){return t(e(r))}}function zt(e,t){for(var r=[t[e].parent,e],o=Ct[t[e].parent][e],n=t[e].parent;t[n].parent;)r.unshift(t[n].parent),o=Ot(Ct[t[n].parent][n],o),n=t[n].parent;return o.conversion=r,o}var Pt=xt,Bt=function(e){for(var t=St(e),r={},o=Object.keys(t),n=o.length,i=0;i<n;i++){var a=o[i];null!==t[a].parent&&(r[a]=zt(a,t))}return r},Vt={};Object.keys(Pt).forEach((function(e){Vt[e]={},Object.defineProperty(Vt[e],"channels",{value:Pt[e].channels}),Object.defineProperty(Vt[e],"labels",{value:Pt[e].labels});var t=Bt(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=ht,Rt=Vt,jt=[].slice,Dt=["keyword","gray","hex"],Tt={};Object.keys(Rt).forEach((function(e){Tt[jt.call(Rt[e].labels).sort().join("")]=e}));var At={};function qt(e,t){if(!(this instanceof qt))return new qt(e,t);if(t&&t in Dt&&(t=null),t&&!(t in Rt))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 qt)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=Rt[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=Rt[this.model].channels;var i=jt.call(e,0,o);this.color=Et(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 a=Object.keys(e);"alpha"in e&&(a.splice(a.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var s=a.sort().join("");if(!(s in Tt))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Tt[s];var l=Rt[this.model].labels,c=[];for(r=0;r<l.length;r++)c.push(e[l[r]]);this.color=Et(c)}if(At[this.model])for(o=Rt[this.model].channels,r=0;r<o;r++){var u=At[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 Mt(e,t,r){return(e=Array.isArray(e)?e:[e]).forEach((function(e){(At[e]||(At[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 It(e){return function(t){return Math.max(0,Math.min(e,t))}}function Et(e,t){for(var r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}qt.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=Rt[this.model].channels,r=Rt[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 qt(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 qt(this.color.concat(Math.max(0,Math.min(1,e))),this.model):this.valpha},red:Mt("rgb",0,It(255)),green:Mt("rgb",1,It(255)),blue:Mt("rgb",2,It(255)),hue:Mt(["hsl","hsv","hsl","hwb","hcg"],0,(function(e){return(e%360+360)%360})),saturationl:Mt("hsl",1,It(100)),lightness:Mt("hsl",2,It(100)),saturationv:Mt("hsv",1,It(100)),value:Mt("hsv",2,It(100)),chroma:Mt("hcg",1,It(100)),gray:Mt("hcg",2,It(100)),white:Mt("hwb",1,It(100)),wblack:Mt("hwb",2,It(100)),cyan:Mt("cmyk",0,It(100)),magenta:Mt("cmyk",1,It(100)),yellow:Mt("cmyk",2,It(100)),black:Mt("cmyk",3,It(100)),x:Mt("xyz",0,It(100)),y:Mt("xyz",1,It(100)),z:Mt("xyz",2,It(100)),l:Mt("lab",0,It(100)),a:Mt("lab",1),b:Mt("lab",2),keyword:function(e){return arguments.length?new qt(e):Rt[this.model].keyword(this.color)},hex:function(e){return arguments.length?new qt(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 qt.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,a=r.alpha()-o.alpha(),s=((i*a==-1?i:(i+a)/(1+i*a))+1)/2,l=1-s;return qt.rgb(s*r.red()+l*o.red(),s*r.green()+l*o.green(),s*r.blue()+l*o.blue(),r.alpha()*n+o.alpha()*(1-n))}},Object.keys(Rt).forEach((function(e){if(-1===Dt.indexOf(e)){var t=Rt[e].channels;qt.prototype[e]=function(){if(this.model===e)return new qt(this);if(arguments.length)return new qt(arguments,e);var r,o="number"==typeof arguments[t]?t:this.valpha;return new qt((r=Rt[this.model][e].raw(this.color),Array.isArray(r)?r:[r]).concat(o),e)},qt[e]=function(r){return"number"==typeof r&&(r=Et(jt.call(arguments),t)),new qt(r,e)}}}));var Lt=Ee(qt);const Ut=e=>{if(e&&"transparent"!==(e=e.toLowerCase()))try{return Lt(e)}catch(t){try{return Lt("#"+e)}catch(e){return Lt("rgba(255,255,255,0)")}}return Lt("rgba(255,255,255,0)")},Nt=(e,t)=>{let r=Ut(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=Ut(t)),e)};t(e)}return r.rgb().string()},Wt=fe.span` color: ${e=>Nt(e.$errorColor)}; position: relative; left: 0.1em; top: 0.18em; text-transform: uppercase; font-size: 1.4em; line-height: 0.5em; &:after { content: "*"; } `,_t=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>`),Ht=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&&Nt(e.$baseColor)||"transparent"}; border: ${e=>`${e.$outlineSize}px solid ${Nt(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=>Nt(e.$textColor||e.$baseColor,(t=>t.makeBlackOrWhite(!e.$textColor&&"fill"===e.$mode)))}; text-align: left; border-radius: ${e=>w(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=>Nt(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&&Nt(e.$baseColor,(t=>t.manipulate((e=>e.darken(.05)),"fill"===e.$mode)))||void 0}; border-color: ${e=>"fill"===e.$hover&&Nt(e.$baseColor,(t=>t.manipulate((e=>e.darken(.1)),"fill"===e.$mode)))||void 0}; color: ${e=>"outline"===e.$mode&&"fill"===e.$hover&&Nt(e.$baseColor,(e=>e.makeBlackOrWhite()))||void 0}; box-shadow: 0 0 0 0.2rem ${e=>Nt(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.2)))))}; svg { path { fill: ${e=>"outline"===e.$mode&&"fill"===e.$hover&&Nt(e.$baseColor,(e=>e.makeBlackOrWhite()))||void 0}; } } } &:focus { box-shadow: 0 0 0 0.2rem ${e=>Nt(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.5)))))}; } &:active { box-shadow: 0 0 0 0.2rem ${e=>Nt(e.$baseColor,(e=>e.manipulate((e=>e.alpha(.5)))))}; background-color: ${e=>"fill"===e.$hover&&Nt(e.$baseColor,(e=>e.manipulate((e=>e.darken(.15)))))}; } } `,Kt=e=>{const t=e.label?e.iconPosition||"left":"solo",r=e.disabled||!e.onClick&&!e.hyperlink;return ue(Ht,{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.onC