UNPKG

tinymce

Version:

Web based JavaScript HTML WYSIWYG editor control.

1 lines 438 kB
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>!!o(e,t.prototype)||e.constructor?.name===t.name,o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,(e,t)=>t.isPrototypeOf(e))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,(t,o)=>e(t)===o))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},v=e=>()=>e(),x=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=y(!1),E=y(!0);class A{tag;value;static singletonNone=new A(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:A.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return g(e)?A.some(e):A.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const D=Array.prototype.slice,M=Array.prototype.indexOf,B=Array.prototype.push,F=(e,t)=>M.call(e,t),I=(e,t)=>F(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},N=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},z=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=D.call(e,n,n+t);o.push(s)}return o},L=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}return n},V=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},H=(e,t)=>{const o=[],n=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},P=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,(e,n)=>{o=t(o,e,n)}),o),W=(e,t,o)=>(V(e,(e,n)=>{o=t(o,e,n)}),o),$=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),G=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},j=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);B.apply(t,e[o])}return t},q=(e,t)=>j(L(e,t)),X=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},Y=e=>{const t=D.call(e,0);return t.reverse(),t},K=(e,t)=>P(e,e=>!I(t,e)),J=(e,t)=>{const o={};for(let n=0,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],Z=(e,t)=>{const o=D.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>D.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},re=Object.keys,ae=Object.hasOwnProperty,ie=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},le=(e,t)=>ce(e,(e,o)=>({k:o,v:t(e,o)})),ce=(e,t)=>{const o={};return ie(e,(e,n)=>{const s=t(e,n);o[s.k]=s.v}),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,(e,s)=>{(t(e,s)?o:n)(e,s)})},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,(e,n)=>{o.push(t(e,n))}),o},pe=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return A.some(r)}return A.none()},he=e=>ge(e,w),fe=(e,t)=>be(e,t)?A.from(e[t]):A.none(),be=(e,t)=>ae.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],xe=e=>{if(!l(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return V(e,(n,s)=>{const r=re(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,o)},match:e=>{const n=re(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!X(t,e=>I(n,e)))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}}),o},ye=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},we=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(e=>{s()||(t=A.some(e),V(o,r),o=[])}),{get:n,map:e=>we(t=>{n(o=>{t(e(o))})}),isReady:s}},Se={nu:we,pure:e=>we(t=>{t(e)})},Ce=e=>{setTimeout(()=>{throw e},0)},ke=e=>{const t=t=>{e().then(t,Ce)};return{map:t=>ke(()=>e().then(t)),bind:t=>ke(()=>e().then(e=>t(e).toPromise())),anonBind:t=>ke(()=>e().then(()=>t.toPromise())),toLazy:()=>Se.nu(t),toCached:()=>{let t=null;return ke(()=>(null===t&&(t=e()),t))},toPromise:e,get:t}},Oe=e=>ke(()=>new Promise(e)),_e=e=>ke(()=>Promise.resolve(e)),Te=e=>{const t=t=>t(e),o=y(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>Ae.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>A.some(e)};return s},Ee=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>Ae.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},Ae={value:Te,error:Ee,fromOption:(e,t)=>e.fold(()=>Ee(t),Te)},De=e=>({...e,toCached:()=>De(e.toCached()),bindFuture:t=>De(e.bind(e=>e.fold(e=>_e(Ae.error(e)),e=>t(e)))),bindResult:t=>De(e.map(e=>e.bind(t))),mapResult:t=>De(e.map(e=>e.map(t))),mapError:t=>De(e.map(e=>e.mapError(t))),foldResult:(t,o)=>e.map(e=>e.fold(t,o)),withTimeout:(t,o)=>De(Oe(n=>{let s=!1;const r=setTimeout(()=>{s=!0,n(Ae.error(o()))},t);e.get(e=>{s||(clearTimeout(r),n(e))})}))}),Me=e=>De(Oe(e)),Be="undefined"!=typeof window?window:Function("return this;")(),Fe=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},Ie=(e,t,o)=>Math.min(Math.max(e,t),o);let Re=0;const Ne=e=>{const t=(new Date).getTime(),o=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return Re++,e+"_"+o+Re+String(t)},ze=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n<t.length;n++){const s=t[n];for(const t in s)be(s,t)&&(o[t]=e(o[t],s[t]))}return o},Le=ze((e,t)=>i(e)&&i(t)?Le(e,t):t),Ve=ze((e,t)=>t),He=(e,t,o=S)=>e.exists(e=>o(e,t)),Pe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},Ue=(e,t,o)=>e.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),We=(e,t)=>null!=e?A.some(t(e)):A.none(),$e=(e,t)=>e?A.some(t):A.none(),Ge=(e,t)=>((e,t)=>{let o=null!=t?t:Be;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t);xe([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const je=e=>{const t=ye(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},qe=()=>je(e=>e.unbind()),Xe=()=>{const e=je(b);return{...e,on:t=>e.get().each(t)}},Ye=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ke=(e,t)=>Qe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Je=(e,t,o=0,n)=>{const s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Qe=(e,t)=>Ye(e,t,0),Ze=(e,t)=>Ye(e,t,e.length-t.length),et=(ft=/^\s+|\s+$/g,e=>e.replace(ft,"")),tt=e=>e.length>0,ot=e=>!tt(e),nt=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,s)},t)}}},st=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},rt=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},at=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return rt(o.childNodes[0])},it=(e,t)=>{const o=(t||document).createElement(e);return rt(o)},lt=(e,t)=>{const o=(t||document).createTextNode(e);return rt(o)},ct=rt,dt=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold(e=>{s.setStartBefore(e.dom)},(e,t)=>{s.setStart(e.dom,t)},e=>{s.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},ut=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},mt=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),gt=xe([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),pt=(e,t,o)=>t(ct(o.startContainer),o.startOffset,ct(o.endContainer),o.endOffset),ht=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:y(e),rtl:A.none}),relative:(t,o)=>({ltr:st(()=>dt(e,t,o)),rtl:st(()=>A.some(dt(e,o,t)))}),exact:(t,o,n,s)=>({ltr:st(()=>ut(e,t,o,n,s)),rtl:st(()=>A.some(ut(e,n,s,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>gt.rtl(ct(e.endContainer),e.endOffset,ct(e.startContainer),e.startOffset)).getOrThunk(()=>pt(0,gt.ltr,o)):pt(0,gt.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});var ft;gt.ltr,gt.rtl;const bt=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},vt=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,xt=(e,t)=>{const o=void 0===t?document:t.dom;return vt(o)?A.none():A.from(o.querySelector(e)).map(ct)},yt=(e,t)=>e.dom===t.dom,wt=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},St=()=>Ct(0,0),Ct=(e,t)=>({major:e,minor:t}),kt={nu:Ct,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?St():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return Ct(n(1),n(2))})(e,o)},unknown:St},Ot=(e,t)=>{const o=String(t).toLowerCase();return $(e,e=>e.search(o))},_t=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Tt=e=>t=>Je(t,e),Et=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Je(e,"edge/")&&Je(e,"chrome")&&Je(e,"safari")&&Je(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,_t],search:e=>Je(e,"chrome")&&!Je(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Je(e,"msie")||Je(e,"trident")},{name:"Opera",versionRegexes:[_t,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Tt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Tt("firefox")},{name:"Safari",versionRegexes:[_t,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Je(e,"safari")||Je(e,"mobile/"))&&Je(e,"applewebkit")}],At=[{name:"Windows",search:Tt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Je(e,"iphone")||Je(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Tt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Tt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Tt("linux"),versionRegexes:[]},{name:"Solaris",search:Tt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Tt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Tt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Dt={browsers:y(Et),oses:y(At)},Mt="Edge",Bt="Chromium",Ft="Opera",It="Firefox",Rt="Safari",Nt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(Mt),isChromium:n(Bt),isIE:n("IE"),isOpera:n(Ft),isFirefox:n(It),isSafari:n(Rt)}},zt=()=>Nt({current:void 0,version:kt.unknown()}),Lt=Nt,Vt=(y(Mt),y(Bt),y("IE"),y(Ft),y(It),y(Rt),"Windows"),Ht="Android",Pt="Linux",Ut="macOS",Wt="Solaris",$t="FreeBSD",Gt="ChromeOS",jt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Vt),isiOS:n("iOS"),isAndroid:n(Ht),isMacOS:n(Ut),isLinux:n(Pt),isSolaris:n(Wt),isFreeBSD:n($t),isChromeOS:n(Gt)}},qt=()=>jt({current:void 0,version:kt.unknown()}),Xt=jt,Yt=(y(Vt),y("iOS"),y(Ht),y(Pt),y(Ut),y(Wt),y($t),y(Gt),e=>window.matchMedia(e).matches);let Kt=st(()=>((e,t,o)=>{const n=Dt.browsers(),s=Dt.oses(),r=t.bind(e=>((e,t)=>se(t.brands,t=>{const o=t.brand.toLowerCase();return $(e,e=>o===e.brand?.toLowerCase()).map(e=>({current:e.name,version:kt.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>Ot(e,t).map(e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(zt,Lt),a=((e,t)=>Ot(e,t).map(e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(s,e).fold(qt,Xt),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:y(s),isiPhone:y(r),isTablet:y(l),isPhone:y(c),isTouch:y(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:y(d),isDesktop:y(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(window.navigator.userAgent,A.from(window.navigator.userAgentData),Yt));const Jt=()=>Kt(),Qt=Object.getPrototypeOf,Zt=e=>{const t=Ge("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>Ge(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Qt(e).constructor.name))},eo=e=>e.dom.nodeName.toLowerCase(),to=e=>t=>(e=>e.dom.nodeType)(t)===e,oo=e=>no(e)&&Zt(e.dom),no=to(1),so=to(3),ro=to(9),ao=to(11),io=e=>t=>no(t)&&eo(t)===e,lo=e=>ct(e.dom.ownerDocument),co=e=>ro(e)?e:lo(e),uo=e=>ct(co(e).dom.documentElement),mo=e=>ct(co(e).dom.defaultView),go=e=>A.from(e.dom.parentNode).map(ct),po=e=>A.from(e.dom.parentElement).map(ct),ho=e=>A.from(e.dom.offsetParent).map(ct),fo=e=>A.from(e.dom.previousSibling).map(ct),bo=e=>A.from(e.dom.nextSibling).map(ct),vo=e=>L(e.dom.childNodes,ct),xo=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(ct)},yo=e=>xo(e,0),wo=(e,t)=>({element:e,offset:t}),So=(e,t)=>{const o=vo(e);return o.length>0&&t<o.length?wo(o[t],0):wo(e,t)},Co=e=>ao(e)&&g(e.dom.host),ko=e=>ct(e.dom.getRootNode()),Oo=e=>Co(e)?e:ct(co(e).dom.body),_o=e=>{const t=ko(e);return Co(t)?A.some(t):A.none()},To=e=>ct(e.dom.host),Eo=e=>{const t=ct((e=>{if(g(e.target)){const t=ct(e.target);if(no(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=x(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},Ao=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(Eo(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:C(Do,e,t,r,s)}},Do=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Mo=E,Bo=(e,t,o)=>((e,t,o,n)=>Ao(e,t,o,n,!1))(e,t,Mo,o),Fo=(e,t,o)=>((e,t,o,n)=>Ao(e,t,o,n,!0))(e,t,Mo,o),Io=Eo,Ro=()=>ct(document),No=(e,t=!1)=>e.dom.focus({preventScroll:t}),zo=e=>e.dom.blur(),Lo=e=>{const t=ko(e).dom;return e.dom===t.activeElement},Vo=(e=Ro())=>A.from(e.dom.activeElement).map(ct),Ho=e=>Vo(ko(e)).filter(t=>e.dom.contains(t.dom)),Po=(e,t)=>{go(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},Uo=(e,t)=>{bo(e).fold(()=>{go(e).each(e=>{$o(e,t)})},e=>{Po(e,t)})},Wo=(e,t)=>{yo(e).fold(()=>{$o(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},$o=(e,t)=>{e.dom.appendChild(t.dom)},Go=(e,t)=>{V(t,t=>{$o(e,t)})},jo=(e,t,o)=>{if(!(r(o)||d(o)||h(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},qo=(e,t,o)=>{jo(e.dom,t,o)},Xo=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{jo(o,t,e)})},Yo=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Ko=(e,t)=>A.from(Yo(e,t)),Jo=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Qo=(e,t)=>{e.dom.removeAttribute(t)},Zo=e=>{e.dom.textContent="",V(vo(e),e=>{en(e)})},en=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},tn=(e,t)=>ct(e.dom.cloneNode(t)),on=e=>e.dom.innerHTML,nn=(e,t)=>{const o=lo(e).dom,n=ct(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,vo(ct(o))})(t,o);Go(n,s),Zo(e),$o(e,n)},sn=e=>new Promise((t,o)=>{const n=()=>{r(),t(e)},s=[Bo(e,"load",n),Bo(e,"error",()=>{r(),o("Unable to load data from image: "+e.dom.src)})],r=()=>V(s,e=>e.unbind());e.dom.complete&&n()}),rn=e=>void 0!==e.style&&p(e.style.getPropertyValue),an=e=>{const t=so(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return _o(ct(t)).fold(()=>o.body.contains(t),(n=an,s=To,e=>n(s(e))));var n,s},ln=()=>cn(ct(document)),cn=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ct(t)},dn=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);rn(e)&&e.style.setProperty(t,o)},un=(e,t)=>{rn(e)&&e.style.removeProperty(t)},mn=(e,t,o)=>{const n=e.dom;dn(n,t,o)},gn=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{dn(o,t,e)})},pn=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{e.fold(()=>{un(o,t)},e=>{dn(o,t,e)})})},hn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||an(e)?n:fn(o,t)},fn=(e,t)=>rn(e)?e.style.getPropertyValue(t):"",bn=(e,t)=>{const o=e.dom,n=fn(o,t);return A.from(n).filter(e=>e.length>0)},vn=e=>{const t={},o=e.dom;if(rn(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},xn=(e,t,o)=>{const n=it(e);return mn(n,t,o),bn(n,t).isSome()},yn=(e,t)=>{const o=e.dom;un(o,t),He(Ko(e,"style").map(et),"")&&Qo(e,"style")},wn=e=>e.dom.offsetWidth,Sn=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=hn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>W(t,(t,o)=>{const n=hn(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s},0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;rn(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},Cn=Sn("height",e=>{const t=e.dom;return an(e)?t.getBoundingClientRect().height:t.offsetHeight}),kn=e=>Cn.get(e),On=e=>Cn.getOuter(e),_n=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Tn=Sn("width",e=>{const t=e.dom;return an(e)?t.getBoundingClientRect().width:t.offsetWidth}),En=e=>Tn.get(e),An=e=>Tn.getOuter(e),Dn=(e,t)=>({left:e,top:t,translate:(o,n)=>Dn(e+o,t+n)}),Mn=Dn,Bn=(e,t)=>void 0!==e?e:void 0!==t?t:0,Fn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return Mn(o.offsetLeft,o.offsetTop);const r=Bn(n?.pageYOffset,s.scrollTop),a=Bn(n?.pageXOffset,s.scrollLeft),i=Bn(s.clientTop,o.clientTop),l=Bn(s.clientLeft,o.clientLeft);return In(e).translate(a-l,r-i)},In=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Mn(o.offsetLeft,o.offsetTop):an(e)?(e=>{const t=e.getBoundingClientRect();return Mn(t.left,t.top)})(t):Mn(0,0)},Rn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Mn(o,n)},Nn=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},zn=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(so),Ln=(e,t)=>o=>"rtl"===Vn(o)?t:e,Vn=e=>"rtl"===hn(e,"direction")?"rtl":"ltr",Hn=(e,t)=>{const o=Yo(e,t);return void 0===o||""===o?[]:o.split(" ")};var Pn=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const Un=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=ct(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},Wn=(e,t,o)=>Pn((e,t)=>t(e),Un,e,t,o),$n=(e,t)=>$(e.dom.childNodes,e=>t(ct(e))).map(ct),Gn=(e,t,o)=>Un(e,e=>bt(e,t),o),jn=(e,t)=>(e=>{const o=e.dom;return o.parentNode?$n(ct(o.parentNode),o=>!yt(e,o)&&bt(o,t)):A.none()})(e),qn=(e,t)=>$n(e,e=>bt(e,t)),Xn=(e,t)=>xt(t,e),Yn=(e,t,o)=>Pn((e,t)=>bt(e,t),Gn,e,t,o),Kn=(e,t)=>{e.dom.checked=t},Jn=e=>e.dom.checked,Qn=e=>void 0!==e.dom.classList,Zn=e=>Hn(e,"class"),es=(e,t)=>((e,t,o)=>{const n=Hn(e,t).concat([o]);return qo(e,t,n.join(" ")),!0})(e,"class",t),ts=(e,t)=>((e,t,o)=>{const n=P(Hn(e,t),e=>e!==o);return n.length>0?qo(e,t,n.join(" ")):Qo(e,t),!1})(e,"class",t),os=(e,t)=>{Qn(e)?e.dom.classList.add(t):es(e,t)},ns=e=>{0===(Qn(e)?e.dom.classList:Zn(e)).length&&Qo(e,"class")},ss=(e,t)=>{Qn(e)?e.dom.classList.remove(t):ts(e,t),ns(e)},rs=(e,t)=>Qn(e)&&e.dom.classList.contains(t),as=(e,t)=>{V(t,t=>{os(e,t)})},is=(e,t)=>{V(t,t=>{ss(e,t)})},ls=e=>Qn(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e<t.length;e++){const n=t.item(e);null!==n&&(o[e]=n)}return o})(e):Zn(e),cs=e=>e.dom.value,ds=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},us=(e,t,o)=>P(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=ct(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),ms=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return vt(o)?[]:L(o.querySelectorAll(e),ct)})(t,e),gs=(e,t,o)=>Wn(e,t,o).isSome(),ps=(e,t,o)=>Yn(e,t,o).isSome(),hs=e=>p(e)?e:T,fs=(e,t,o)=>{let n=e.dom;const s=hs(o);for(;n.parentNode;){n=n.parentNode;const e=ct(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},bs=(e,t,o)=>{const n=t(e),s=hs(o);return n.orThunk(()=>s(e)?A.none():fs(e,t,s))},vs=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),xs=xe([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),ys=(xs.before,xs.on,xs.after,e=>e.fold(w,w,w)),ws=xe([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Ss={domRange:ws.domRange,relative:ws.relative,exact:ws.exact,exactFromRange:e=>ws.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>ct(e.startContainer),relative:(e,t)=>ys(e),exact:(e,t,o,n)=>e}))(e);return mo(t)},range:vs},Cs=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(vs(ct(t.startContainer),t.startOffset,ct(o.endContainer),o.endOffset))}return A.none()},ks=e=>{if(null===e.anchorNode||null===e.focusNode)return Cs(e);{const t=ct(e.anchorNode),o=ct(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=lo(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=yt(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(vs(t,e.anchorOffset,o,e.focusOffset)):Cs(e)}},Os=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(mt):A.none()})(ht(e,t)),_s={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Ts=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Es=(e,t)=>A.from(Ts.exec(e)).bind(e=>{const o=Number(e[1]),n=e[2];return((e,t)=>R(t,t=>R(_s[t],t=>e===t)))(n,t)?A.some({value:o,unit:n}):A.none()}),As=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Ds=e=>{const t=void 0===e?window:e,o=t.document,n=Rn(ct(o));return(e=>{const t=void 0===e?window:e;return Jt().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return As(n.left,n.top,o,s)},e=>As(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},Ms=(e,t)=>e.view(t).fold(y([]),t=>{const o=e.owner(t),n=Ms(e,o);return[t].concat(n)});var Bs=Object.freeze({__proto__:null,view:e=>(e.dom===document?A.none():A.from(e.dom.defaultView?.frameElement)).map(ct),owner:e=>lo(e)});const Fs=e=>{const t=Ro(),o=Rn(t),n=((e,t)=>{const o=t.owner(e),n=Ms(t,o);return A.some(n)})(e,Bs);return n.fold(C(Fn,e),t=>{const n=In(e),s=U(t,(e,t)=>{const o=In(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Mn(s.left+n.left+o.left,s.top+n.top+o.top)})},Is=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Rs=e=>{const t=Fn(e),o=An(e),n=On(e);return Is(t.left,t.top,o,n)},Ns=e=>{const t=Fs(e),o=An(e),n=On(e);return Is(t.left,t.top,o,n)},zs=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Is(o,n,s-o,r-n)},Ls=()=>Ds(window),Vs=(e,t)=>yt(e.element,t.event.target),Hs=e=>(He(bn(e,"position"),"fixed")?A.none():ho(e)).orThunk(()=>{const t=it("span");return go(e).bind(e=>{$o(e,t);const o=ho(t);return en(t),o})}),Ps=e=>Hs(e).map(Fn).getOrThunk(()=>Mn(0,0)),Us=(e,t)=>{const o=A.from(Yo(e,"id")).getOrThunk(()=>{const e=Ne("aria");return qo(t,"id",e),e});qo(e,"aria-describedby",o)};var Ws;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Ws||(Ws={}));const $s=(e,t,o)=>e.stype===Ws.Error?t(e.serror):o(e.svalue),Gs=e=>({stype:Ws.Value,svalue:e}),js=e=>({stype:Ws.Error,serror:e}),qs=Gs,Xs=js,Ys=$s,Ks=e=>a(e)&&re(e).length>100?" removed due to size":JSON.stringify(e,null,2),Js=(e,t)=>Xs([{path:e,getErrorInfo:t}]),Qs=e=>({extract:(t,o)=>((e,t)=>e.stype===Ws.Error?t(e.serror):e)(e(o),e=>((e,t)=>Js(e,y(t)))(t,e)),toString:y("val")}),Zs=Qs(qs),er=y(Zs),tr=(e,t)=>Qs(o=>{const n=typeof o;return e(o)?qs(o):Xs(`Expected type: ${t} but got: ${n}`)}),or=tr(h,"number"),nr=tr(r,"string"),sr=tr(d,"boolean"),rr=tr(p,"function"),ar=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every(t=>ar(e[t]));default:return!1}},ir=Qs(e=>ar(e)?qs(e):Xs("Expected value to be acceptable for sending via postMessage")),lr=e=>({tag:"defaultedThunk",process:e}),cr=e=>lr(y(e)),dr=e=>({tag:"mergeWithThunk",process:e}),ur=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),mr=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},gr=e=>{const t=(e=>{const t=[],o=[];return V(e,e=>{$s(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,x(Xs,j)(o)):qs(t.values);var o},pr=(e,t,o,n)=>n(fe(e,t).getOrThunk(()=>o(e))),hr=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold(()=>qs(A.none()),e=>((e,t)=>e.stype===Ws.Value?{stype:Ws.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold(()=>((e,t,o)=>Js(e,()=>'Could not find valid *required* value for "'+t+'" in '+Ks(o)))(e,o,t),n))(t,o,n,r);case"defaultedThunk":return pr(o,n,e.process,r);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map(t=>!0===t?o(e):t)))(o,n,e.process,a);case"mergeWithThunk":return pr(o,n,y({}),t=>{const n=Le(e.process(o),t);return r(n)})}},fr=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),br=e=>re(me(e,g)),vr=e=>{const t=xr(e),o=U(e,(e,t)=>mr(t,t=>Le(e,{[t]:!0}),y(e)),{});return{extract:(e,n)=>{const s=d(n)?[]:br(n),r=P(s,e=>!ve(o,e));return 0===r.length?t.extract(e,n):((e,t)=>Js(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"))(e,r)},toString:t.toString}},xr=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)mr(r,(o,r,a,i)=>{const l=hr(a,e,t,o,i);Ys(l,e=>{s.push(...e)},e=>{n[r]=e})},(e,o)=>{n[e]=o(t)});return s.length>0?Xs(s):qs(n)})(t,o,e),toString:()=>{const t=L(e,e=>mr(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),yr=e=>({extract:(t,o)=>{const n=L(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return gr(n)},toString:()=>"array("+e.toString()+")"}),wr=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===Ws.Value)return{stype:Ws.Value,svalue:o(e.svalue)};s.push(e)}return gr(s)},toString:()=>"oneOf("+L(e,e=>e.toString()).join(", ")+")"}},Sr=(e,t)=>({extract:(o,n)=>{const s=re(n),r=((t,o)=>yr(Qs(e)).extract(t,o))(o,s);return((e,t)=>e.stype===Ws.Value?t(e.svalue):e)(r,e=>{const s=L(e,e=>ur(e,e,{tag:"required",process:{}},t));return xr(s).extract(o,n)})},toString:()=>"setOf("+t.toString()+")"}),Cr=x(yr,xr),kr=(e,t)=>({extract:(o,n)=>fe(n,e).fold(()=>((e,t)=>Js(e,()=>'Choice schema did not contain choice key: "'+t+'"'))(o,e),e=>((e,t,o,n)=>fe(o,n).fold(()=>((e,t,o)=>Js(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+Ks(t)))(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t)))(o,n,t,e)),toString:()=>"chooseOn("+e+"). Possible values: "+re(t)}),Or=e=>Qs(t=>e(t).fold(Xs,qs)),_r=(e,t)=>Sr(t=>e(t).fold(js,Gs),t),Tr=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===Ws.Error?{stype:Ws.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),$s(n,Ae.error,Ae.value);var n},Er=e=>e.fold(e=>{throw new Error(Dr(e))},w),Ar=(e,t,o)=>Er(Tr(e,t,o)),Dr=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:y("... (only showing first ten failures)")}]):e;return L(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})(e.errors).join("\n")+"\n\nInput object: "+Ks(e.input),Mr=(e,t)=>kr(e,le(t,xr)),Br=(e,t)=>((e,t)=>{const o=st(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),Fr=ur,Ir=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Rr=e=>Or(t=>I(e,t)?Ae.value(t):Ae.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),Nr=e=>Fr(e,e,{tag:"required",process:{}},er()),zr=(e,t)=>Fr(e,e,{tag:"required",process:{}},t),Lr=e=>zr(e,or),Vr=e=>zr(e,nr),Hr=(e,t)=>Fr(e,e,{tag:"required",process:{}},Rr(t)),Pr=e=>zr(e,rr),Ur=(e,t)=>Fr(e,e,{tag:"required",process:{}},xr(t)),Wr=(e,t)=>Fr(e,e,{tag:"required",process:{}},Cr(t)),$r=(e,t)=>Fr(e,e,{tag:"required",process:{}},yr(t)),Gr=e=>Fr(e,e,{tag:"option",process:{}},er()),jr=(e,t)=>Fr(e,e,{tag:"option",process:{}},t),qr=e=>jr(e,or),Xr=e=>jr(e,nr),Yr=(e,t)=>jr(e,Rr(t)),Kr=e=>jr(e,rr),Jr=(e,t)=>jr(e,yr(t)),Qr=(e,t)=>jr(e,xr(t)),Zr=(e,t)=>Fr(e,e,cr(t),er()),ea=(e,t,o)=>Fr(e,e,cr(t),o),ta=(e,t)=>ea(e,t,or),oa=(e,t)=>ea(e,t,nr),na=(e,t,o)=>ea(e,t,Rr(o)),sa=(e,t)=>ea(e,t,sr),ra=(e,t)=>ea(e,t,rr),aa=(e,t,o)=>ea(e,t,yr(o)),ia=(e,t,o)=>ea(e,t,xr(o)),la=(e,t)=>((e,t)=>({[e]:t}))(e,t),ca=e=>(e=>{const t={};return V(e,e=>{t[e.key]=e.value}),t})(e),da=y,ua=da("touchstart"),ma=da("touchmove"),ga=da("touchend"),pa=da("touchcancel"),ha=da("mousedown"),fa=da("mousemove"),ba=da("mouseout"),va=da("mouseup"),xa=da("mouseover"),ya=da("focusin"),wa=da("focusout"),Sa=da("keydown"),Ca=da("keyup"),ka=da("input"),Oa=da("change"),_a=da("click"),Ta=da("transitioncancel"),Ea=da("transitionend"),Aa=da("transitionstart"),Da=da("selectstart"),Ma=e=>y("alloy."+e),Ba={tap:Ma("tap")},Fa=Ma("focus"),Ia=Ma("blur.post"),Ra=Ma("paste.post"),Na=Ma("receive"),za=Ma("execute"),La=Ma("focus.item"),Va=Ba.tap,Ha=Ma("longpress"),Pa=Ma("sandbox.close"),Ua=Ma("typeahead.cancel"),Wa=Ma("system.init"),$a=Ma("system.touchmove"),Ga=Ma("system.touchend"),ja=Ma("system.scroll"),qa=Ma("system.resize"),Xa=Ma("system.attached"),Ya=Ma("system.detached"),Ka=Ma("system.dismissRequested"),Ja=Ma("system.repositionRequested"),Qa=Ma("focusmanager.shifted"),Za=Ma("slotcontainer.visibility"),ei=Ma("system.external.element.scroll"),ti=Ma("change.tab"),oi=Ma("dismiss.tab"),ni=Ma("highlight"),si=Ma("dehighlight"),ri=e=>(e=>{if(Co(e))return"#shadow-root";{const t=(e=>tn(e,!1))(e);return(e=>{const t=it("div"),o=ct(e.dom.cloneNode(!0));return $o(t,o),on(t)})(t)}})(e);var ai;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(ai||(ai={}));const ii=ye({}),li=["alloy/data/Fields","alloy/debugging/Debugging"],ci=(e,t,o)=>((e,t,o)=>{switch(fe(ii.get(),e).orThunk(()=>{const t=re(ii.get());return se(t,t=>e.indexOf(t)>-1?A.some(ii.get()[t]):A.none())}).getOr(ai.NORMAL)){case ai.NORMAL:return o(di());case ai.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();I(["mousemove","mouseover","mouseout",Wa()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:L(o,e=>I(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ri(e.target)+")":e.outcome)})}}})(e,t),s=o(n);return n.write(),s}case ai.STOP:return!0}})(e,t,o),di=y({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),ui=y([Nr("menu"),Nr("selectedMenu")]),mi=y([Nr("item"),Nr("selectedItem")]);y(xr(mi().concat(ui())));const gi=y(xr(mi())),pi=Ur("initSize",[Nr("numColumns"),Nr("numRows")]),hi=()=>Ur("markers",[Nr("backgroundMenu")].concat(ui()).concat(mi())),fi=e=>Ur("markers",L(e,Nr)),bi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");$(t,e=>e.indexOf("alloy")>0&&!R(li,t=>e.indexOf(t)>-1)).getOr("unknown")}})(),Fr(t,t,o,Or(e=>Ae.value((...t)=>e.apply(void 0,t))))),vi=e=>bi(0,e,cr(b)),xi=e=>bi(0,e,cr(A.none)),yi=e=>bi(0,e,{tag:"required",process:{}}),wi=e=>bi(0,e,{tag:"required",process:{}}),Si=(e,t)=>Ir(e,y(t)),Ci=e=>Ir(e,w),ki=y(pi),Oi=e=>L(e,e=>Ze(e,"/*")?e.substring(0,e.length-2):e),_i=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Oi(r)}),e},Ti=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)}}},Ei=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])};var Ai;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(Ai||(Ai={}));const Di="placeholder",Mi=xe([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Bi=e=>be(e,"uiType"),Fi=(e,t,o,n)=>((e,t,o,n)=>Bi(o)&&o.uiType===Di?((e,t,o,n)=>e.exists(e=>e!==o.owner)?Mi.single(!0,y(o)):fe(n,o.name).fold(()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+re(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))},e=>e.replace()))(e,0,o,n):Mi.single(!1,y(o)))(e,0,o,n).fold((s,r)=>{const a=Bi(o)?r(t,o.config,o.validated):r(t),i=fe(a,"components").getOr([]),l=q(i,o=>Fi(e,t,o,n));return[{...a,components:l}]},(e,n)=>{if(Bi(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)}),Ii=Mi.single,Ri=Mi.multiple,Ni=y(Di),zi=xe([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Li=Zr("factory",{sketch:w}),Vi=Zr("schema",[]),Hi=Nr("name"),Pi=Fr("pname","pname",lr(e=>"<alloy."+Ne(e.name)+">"),er()),Ui=Ir("schema",()=>[Gr("preprocess")]),Wi=Zr("defaults",y({})),$i=Zr("overrides",y({})),Gi=xr([Li,Vi,Hi,Pi,Wi,$i]),ji=xr([Li,Vi,Hi,Wi,$i]),qi=xr([Li,Vi,Hi,Pi,Wi,$i]),Xi=xr([Li,Ui,Hi,Nr("unit"),Pi,Wi,$i]),Yi=e=>e.fold(A.some,A.none,A.some,A.some),Ki=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Ji=(e,t)=>o=>{const n=Ar("Converting part type",t,o);return e(n)},Qi=Ji(zi.required,Gi),Zi=Ji(zi.external,ji),el=Ji(zi.optional,qi),tl=Ji(zi.group,Xi),ol=y("entirety");var nl=Object.freeze({__proto__:null,required:Qi,external:Zi,optional:el,group:tl,asNamedPart:Yi,name:Ki,asCommon:e=>e.fold(w,w,w,w),original:ol});const sl=(e,t,o,n)=>Le(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),rl=(e,t)=>{const o={};return V(t,t=>{Yi(t).each(t=>{const n=al(e,t.pname);o[t.name]=o=>{const s=Ar("Part: "+t.name+" in "+e,xr(t.schema),o);return{...n,config:o,validated:s}}})}),o},al=(e,t)=>({uiType:Ni(),owner:e,name:t}),il=(e,t,o)=>({uiType:Ni(),owner:e,name:t,config:o,validated:{}}),ll=e=>q(e,e=>e.fold(A.none,A.some,A.none,A.none).map(e=>Ur(e.name,e.schema.concat([Ci(ol())]))).toArray()),cl=e=>L(e,Ki),dl=(e,t,o)=>((e,t,o)=>{const n={},s={};return V(o,e=>{e.fold(e=>{n[e.pname]=Ii(!0,(t,o,n)=>e.factory.sketch(sl(t,e,o,n)))},e=>{const o=t.parts[e.name];s[e.name]=y(e.factory.sketch(sl(t,e,o[ol()]),o))},e=>{n[e.pname]=Ii(!1,(t,o,n)=>e.factory.sketch(sl(t,e,o,n)))},e=>{n[e.pname]=Ri(!0,(t,o,n)=>{const s=t[e.name];return L(s,o=>e.factory.sketch(Le(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:y(n),externals:y(s)}})(0,t,o),ul=(e,t,o)=>((e,t,o,n)=>{const s=le(n,(e,t)=>((e,t)=>{let o=!1;return{name:y(e),required:()=>t.fold((e,t)=>e,(e,t)=>e),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e)),r=((e,t,o,n)=>q(o,o=>Fi(e,t,o,n)))(e,t,o,s);return ie(s,o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),r})(A.some(e),t,t.components,o),ml=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},gl=(e,t,o)=>ml(e,t,o).getOrDie("Could not find part: "+o),pl=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,e=>{n[e]=y(r.getByUid(s[e]))}),n},hl=(e,t)=>{const o=e.getSystem();return le(t.partUids,(e,t)=>y(o.getByUid(e)))},fl=e=>re(e.partUids),bl=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,e=>{n[e]=y(r.getByUid(s[e]).getOrDie())}),n},vl=(e,t)=>{const o=cl(t);return ca(L(o,t=>({key:t,value:e+"-"+t})))},xl=e=>Fr("partUids","partUids",dr(t=>vl(t.uid,e)),er());var yl=Object.freeze({__proto__:null,generate:rl,generateOne:il,schemas:ll,names:cl,substitutes:dl,components:ul,defaultUids:vl,defaultUidsSchema:xl,getAllParts:hl,getAllPartNames:fl,getPart:ml,getPartOrDie:gl,getParts:pl,getPartsOrDie:bl});const wl=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Sl=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=K(wl,o);return{offset:Mn(e,t),classesOn:q(o,a),classesOff:q(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},Cl=()=>Sl(0,0,{}),kl=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),Ol=xe([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),_l=Ol.southeast,Tl=Ol.southwest,El=Ol.northeast,Al=Ol.northwest,Dl=Ol.south,Ml=Ol.north,Bl=Ol.east,Fl=Ol.west,Il=(e,t)=>J(["left","right","top","bottom"],o=>fe(t,o).map(t=>((e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}})(e,t))),Rl="layout",Nl=e=>e.x,zl=(e,t)=>e.x+e.width/2-t.width/2,Ll=(e,t)=>e.x+e.width-t.width,Vl=(e,t)=>e.y-t.height,Hl=e=>e.y+e.height,Pl=(e,t)=>e.y+e.height/2-t.height/2,Ul=(e,t,o)=>kl(Nl(e),Hl(e),o.southeast(),_l(),"southeast",Il(e,{left:1,top:3}),Rl),Wl=(e,t,o)=>kl(Ll(e,t),Hl(e),o.southwest(),Tl(),"southwest",Il(e,{right:0,top:3}),Rl),$l=(e,t,o)=>kl(Nl(e),Vl(e,t),o.northeast(),El(),"northeast",Il(e,{left:1,bottom:2}),Rl),Gl=(e,t,o)=>kl(Ll(e,t),Vl(e,t),o.northwest(),Al(),"northwest",Il(e,{right:0,bottom:2}),Rl),jl=(e,t,o)=>kl(zl(e,t),Vl(e,t),o.north(),Ml(),"north",Il(e,{bottom:2}),Rl),ql=(e,t,o)=>kl(zl(e,t),Hl(e),o.south(),Dl(),"south",Il(e,{top:3}),Rl),Xl=(e,t,o)=>kl((e=>e.x+e.width)(e),Pl(e,t),o.east(),Bl(),"east",Il(e,{left:0}),Rl),Yl=(e,t,o)=>kl(((e,t)=>e.x-t.width)(e,t),Pl(e,t),o.west(),Fl(),"west",Il(e,{right:1}),Rl),Kl=()=>[Ul,Wl,$l,Gl,ql,jl,Xl,Yl],Jl=()=>[Wl,Ul,Gl,$l,ql,jl,Xl,Yl],Ql=()=>[$l,Gl,Ul,Wl,jl,ql],Zl=()=>[Gl,$l,Wl,Ul,jl,ql],ec=()=>[Ul,Wl,$l,Gl,ql,jl],tc=()=>[Wl,Ul,Gl,$l,ql,jl],oc="data-alloy-placement",nc=e=>Ko(e,oc),sc="layout-inset",rc=e=>e.x,ac=(e,t)=>e.x+e.width/2-t.width/2,ic=(e,t)=>e.x+e.width-t.width,lc=e=>e.y,cc=(e,t)=>e.y+e.height-t.height,dc=(e,t)=>e.y+e.height/2-t.height/2,uc=(e,t,o)=>kl(ic(e,t),cc(e,t),o.insetSouthwest(),Al(),"southwest",Il(e,{right:0,bottom:3}),sc),mc=(e,t,o)=>kl(rc(e),cc(e,t),o.insetSoutheast(),El(),"southeast",Il(e,{left:1,bottom:3}),sc),gc=(e,t,o)=>kl(ic(e,t),lc(e),o.insetNorthwest(),Tl(),"northwest",Il(e,{right:0,top:2}),sc),pc=(e,t,o)=>kl(rc(e),lc(e),o.insetNortheast(),_l(),"northeast",Il(e,{left:1,top:2}),sc),hc=(e,t,o)=>kl(ac(e,t),lc(e),o.insetNorth(),Dl(),"north",Il(e,{top:2}),sc),fc=(e,t,o)=>kl(ac(e,t),cc(e,t),o.insetSouth(),Ml(),"south",Il(e,{bottom:3}),sc),bc=(e,t,o)=>kl(ic(e,t),dc(e,t),o.insetEast(),Fl(),"east",Il(e,{right:0}),sc),vc=(e,t,o)=>kl(rc(e),dc(e,t),o.insetWest(),Bl(),"west",Il(e,{left:1}),sc),xc=e=>{switch(e){case"north":return hc;case"northeast":return pc;case"northwest":return gc;case"south":return fc;case"southeast":return mc;case"southwest":return uc;case"east":return bc;case"west":return vc}},yc=(e,t,o,n,s)=>nc(n).map(xc).getOr(hc)(e,t,o,n,s),wc=e=>{switch(e){case"north":return fc;case"northeast":return mc;case"northwest":return uc;case"south":return hc;case"southeast":return pc;case"southwest":return gc;case"east":return vc;case"west":return bc}},Sc=(e,t,o,n,s)=>nc(n).map(wc).getOr(hc)(e,t,o,n,s),Cc=(e,t)=>{((e,t)=>{const o=Cn.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);mn(e,"max-height",o+"px")})(e,Math.floor(t))},kc=y((e,t)=>{Cc(e,t),gn(e,{"overflow-x":"hidden","overflow-y":"auto"})}),Oc=y((e,t)=>{Cc(e,t)}),_c=y((e,t)=>{((e,t)=>{const o=Tn.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);mn(e,"max-width",o+"px")})(e,Math.floor(t))});var Tc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Tc||(Tc={}));const Ec="data-alloy-vertical-dir",Ac=e=>gs(e,e=>no(e)&&Yo(e,"data-alloy-vertical-dir")===Tc.BottomToTop);var Dc;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Dc||(Dc={}));const Mc={init:()=>Bc({readState:y("No State required")})},Bc=e=>e,Fc={can:E,abort:T,run:b},Ic=e=>{if(!ve(e,"can")&&!ve(e,"abort")&&!ve(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Fc,...e}},Rc=(e,t)=>{Vc(e,e.element,t,{})},Nc=(e,t,o)=>{Vc(e,e.element,t,o)},zc=e=>{Rc(e,za())},Lc=(e,t,o)=>{Vc(e,t,o,{})},Vc=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Hc=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Pc=e=>ca(e),Uc=(e,t)=>({key:e,value:Ic({abort:t})}),Wc=e=>({key:e,value:Ic({run:(e,t)=>{t.event.prevent()}})}),$c=(e,t)=>({key:e,value:Ic({run:t})}),Gc=(e,t,o)=>({key:e,value:Ic({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),jc=e=>t=>({key:e,value:Ic({run:(e,o)=>{Vs(e,o)&&t(e,o)}})}),qc=(e,t,o)=>((e,t)=>$c(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Hc(t,t.element,e,n)})}))(e,t.partUids[o]),Xc=(e,t)=>$c(e,(e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk(()=>bs(n.target,t=>e.getSystem().getByDom(t).toOptional(),T).getOr(e));t(e,s,o)}),Yc=e=>$c(e,(e,t)=>{t.cut()}),Kc=e=>$c(e,(e,t)=>{t.stop()}),Jc=(e,t)=>jc(e)(t),Qc=jc(Xa()),Zc=jc(Ya()),ed=jc(Wa()),td=(e=>t=>$c(e,t))(za()),od=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),nd=(e,t,o)=>ed((n,s)=>{o(n,e,t)}),sd=e=>({key:e,value:void 0}),rd=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():A.none(),l=le(s,(e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Oi(a.slice(0,1).concat(a.slice(3)))}),e})((n,...s)=>{const r=[n].concat(s);return n.config({name:y(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})},o,t))(o,e,t)),c={...le(r,(e,t)=>_i(e,t)),...l,revoke:C(sd,o),config:t=>{const n=Ar(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:st(()=>Ar(o+"-config",e,t)),initialConfig:t,state:a}}},schema:y(t),exhibit:(e,t)=>Ue(i(e),fe(n,"exhibit"),(e,o)=>o(t,e.config,e.state)).getOrThunk(()=>od({})),name:y(o),handlers:e=>i(e).map(e=>fe(n,"events").getOr(()=>({}))(e.config,e.state)).getOr({})};return c},ad=e=>ca(e),id=vr([Nr("fields"),Nr("name"),Zr("active",{}),Zr("apis",{}),Zr("state",Mc),Zr("extra",{})]),ld=e=>{const t=Ar("Creating behaviour: "+e.name,id,e);return((e,t,o,n,s,r)=>{const a=vr(e),i=Qr(t,[(l=e,jr("config",vr(l)))]);var l;return rd(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},cd=vr([Nr("branchKey"),Nr("branches"),Nr("name"),Zr("active",{}),Zr("apis",{}),Zr("state",Mc),Zr("extra",{})]),dd=e=>{const t=Ar("Creating behaviour: "+e.name,cd,e);return((e,t,o,n,s,r)=>{const a=e,i=Qr(t,[jr("config",e)]);return rd(a,i,t,o,n,s,r)})(Mr(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},ud=y(void 0),md=(e,t)=>{const o=((e,t)=>{const o=Pc(t);return ld({fields:[Nr("enabled")],name:e,active:{events:y(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:y({}),initialConfig:{},state:Mc}}},gd=(e,t)=>{t.ignore||(No(e.element),t.onFocus(e))};var pd=Object.freeze({__proto__:null,focus:gd,blur:(e,t)=>{t.ignore||zo(e.element)},isFocused:e=>Lo(e.element)}),hd=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return od(o)},events:e=>Pc([$c(Fa(),(t,o)=>{gd(t,e),o.stop()})].concat(e.stopMousedown?[$c(ha(),(e,t)=>{t.event.prevent()})]:[]))}),fd=[vi("onFocus"),Zr("stopMousedown",!1),Zr("ignore",!1)];const bd=ld({fields:fd,name:"focusing",active:hd,apis:pd}),vd=[8],xd=[9],yd=[13],wd=[27],Sd=[32],Cd=[37],kd=[38],Od=[39],_d=[40],Td=y("tooltipping.close.all"),Ed=y("dismiss.popups"),Ad=y("reposition.popups"),Dd=y("mouse.released"),Md=(e,t,o)=>{const n=Y(e.slice(0,t)),s=Y(e.slice(t+1));return $(n.concat(s),o)},Bd=(e,t,o)=>{const n=Y(e.slice(0,t));return $(n,o)},Fd=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return $(s.concat(n),o)},Id=(e,t,o)=>{const n=e.slice(t+1);return $(n,o)},Rd=e=>t=>{const o=t.raw;return I(e,o.which)},Nd=e=>t=>X(e,e=>e(t)),zd=e=>!0===e.raw.shiftKey,Ld=e=>!0===e.raw.ctrlKey,Vd=k(zd),Hd=(e,t)=>({matches:e,classification:t}),Pd=(e,t,o,n)=>{const s=ms(e.element,"."+t.highlightClass);V(s,o=>{R(n,e=>yt(e.element,o))||(ss(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Rc(o,si())}))})},Ud=(e,t,o,n)=>{Pd(e,t,0,[n]),Wd(e,t,o,n)||(os(n.element,t.highlightClass),t.onHighlight(e,n),Rc(n,ni()))},Wd=(e,t,o,n)=>rs(n.element,t.highlightClass),$d=(e,t,o)=>Xn(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),Gd=(e,t,o)=>{const n=ms(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind(t=>e.getSystem().getByDom(t).toOptional())},jd=(e,t,o,n)=>{const s=ms(e.element,"."+t.itemClass);return G(s,e=>rs(e,t.highlightClass)).bind(t=>{const o=Fe(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()})},qd=(e,t,o)=>{con